[PATCH v5 14/22] VLAN: add tagged vlan to vlan data structure

Michael Braun michael-dev
Tue Nov 19 11:47:50 PST 2013


Signed-hostap: Michael Braun <michael-dev at fami-braun.de>
---
 hostapd/Makefile             |    1 
 hostapd/config_file.c        |    6 +-
 src/ap/ap_config.h           |    1 
 src/ap/ieee802_11.c          |    8 +-
 src/ap/ieee802_11_auth.c     |    3 +
 src/ap/ieee802_1x.c          |    6 +-
 src/ap/sta_info.c            |   19 +++---
 src/ap/vlan_init.c           |   13 ++--
 src/ap/wpa_auth.c            |   19 +++---
 src/ap/wpa_auth_ie.c         |    4 +
 src/common/vlan.c            |  139 ++++++++++++++++++++++++++++++++++++++++--
 src/common/vlan.h            |   19 +++++-
 src/drivers/driver_nl80211.c |    8 +-
 src/drivers/driver_test.c    |    4 +
 14 files changed, 195 insertions(+), 55 deletions(-)

diff --git a/hostapd/Makefile b/hostapd/Makefile
index 6f888d4..29c576f 100644
--- a/hostapd/Makefile
+++ b/hostapd/Makefile
@@ -94,6 +94,7 @@ OBJS += ../src/utils/ip_addr.o
 
 OBJS += ../src/common/ieee802_11_common.o
 OBJS += ../src/common/wpa_common.o
+OBJS += ../src/common/vlan.o
 
 OBJS += ../src/eapol_auth/eapol_auth_sm.o
 
diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index bff58d0..7926931 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -58,7 +58,7 @@ static int hostapd_config_read_vlan_file(struct hostapd_bss_config *bss,
 			continue;
 
 		if (buf[0] == '*') {
-			vlan_alloc(&vlan_id, VLAN_ID_WILDCARD);
+			vlan_alloc(&vlan_id, VLAN_ID_WILDCARD, 0, NULL);
 			pos = buf + 1;
 		} else {
 			int untagged_vlan_id = strtol(buf, &pos, 10);
@@ -69,7 +69,7 @@ static int hostapd_config_read_vlan_file(struct hostapd_bss_config *bss,
 				fclose(f);
 				return -1;
 			}
-			vlan_alloc(&vlan_id, untagged_vlan_id);
+			vlan_alloc(&vlan_id, untagged_vlan_id, 0, NULL);
 		}
 
 		while (*pos == ' ' || *pos == '\t')
@@ -164,7 +164,7 @@ static int hostapd_config_read_maclist(const char *fname,
 		while (*pos == ' ' || *pos == '\t')
 			pos++;
 		if (*pos != '\0')
-			vlan_alloc(&vlan_id, atoi(pos));
+			vlan_alloc(&vlan_id, atoi(pos), 0, NULL);
 
 		newacl = os_realloc_array(*acl, *num + 1, sizeof(**acl));
 		if (newacl == NULL) {
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
index e67a8e4..eaad286 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -17,7 +17,6 @@
 #include "wps/wps.h"
 
 #define MAX_STA_COUNT 2007
-#define MAX_VLAN_ID 4094
 
 typedef u8 macaddr[ETH_ALEN];
 
diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
index 9e946e5..e1c86dc 100644
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -653,15 +653,15 @@ static void handle_auth(struct hostapd_data *hapd,
 		if (!hostapd_vlan_id_valid(hapd->conf->vlan, vlan_id)) {
 			hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_RADIUS,
 				       HOSTAPD_LEVEL_INFO, "Invalid VLAN ID "
-				       "%d received from RADIUS server",
-				       vlan_untagged(&vlan_id));
+				       "%s received from RADIUS server",
+				       vlan2str(&vlan_id));
 			resp = WLAN_STATUS_UNSPECIFIED_FAILURE;
 			goto fail;
 		}
 		vlan_alloc_copy(&sta->vlan_id, &vlan_id);
 		hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_RADIUS,
-			       HOSTAPD_LEVEL_INFO, "VLAN ID %d",
-			       vlan_untagged(&sta->vlan_id));
+			       HOSTAPD_LEVEL_INFO, "VLAN ID %s",
+			       vlan2str(&sta->vlan_id));
 	}
 	vlan_free(&vlan_id);
 
diff --git a/src/ap/ieee802_11_auth.c b/src/ap/ieee802_11_auth.c
index cc76680..ea44a45 100644
--- a/src/ap/ieee802_11_auth.c
+++ b/src/ap/ieee802_11_auth.c
@@ -542,7 +542,8 @@ hostapd_acl_recv_radius(struct radius_msg *msg, struct radius_msg *req,
 			cache->acct_interim_interval = 0;
 		}
 
-		vlan_alloc(&cache->vlan_id, radius_msg_get_vlanid(msg));
+		vlan_alloc(&cache->vlan_id, radius_msg_get_vlanid(msg), 0,
+		           NULL);
 
 		decode_tunnel_passwords(hapd, shared_secret, shared_secret_len,
 					msg, req, cache);
diff --git a/src/ap/ieee802_1x.c b/src/ap/ieee802_1x.c
index fe1f3b2..572f30a 100644
--- a/src/ap/ieee802_1x.c
+++ b/src/ap/ieee802_1x.c
@@ -1334,7 +1334,8 @@ ieee802_1x_receive_auth(struct radius_msg *msg, struct radius_msg *req,
 #ifndef CONFIG_NO_VLAN
 		else {
 			vlan_alloc_copy(&old_vlanid, &sta->vlan_id);
-			vlan_alloc(&sta->vlan_id, radius_msg_get_vlanid(msg));
+			vlan_alloc(&sta->vlan_id, radius_msg_get_vlanid(msg),
+			           0, NULL);
 		}
 		if (vlan_notempty(&sta->vlan_id) &&
 		    vlan_untagged(&sta->vlan_id) > 0 &&
@@ -1342,8 +1343,7 @@ ieee802_1x_receive_auth(struct radius_msg *msg, struct radius_msg *req,
 			hostapd_logger(hapd, sta->addr,
 				       HOSTAPD_MODULE_RADIUS,
 				       HOSTAPD_LEVEL_INFO,
-				       "VLAN ID %d",
-				       vlan_untagged(&sta->vlan_id));
+				       "VLAN ID %s", vlan2str(&sta->vlan_id));
 		} else if (sta->ssid->dynamic_vlan == DYNAMIC_VLAN_REQUIRED) {
 			sta->eapol_sm->authFail = TRUE;
 			hostapd_logger(hapd, sta->addr,
diff --git a/src/ap/sta_info.c b/src/ap/sta_info.c
index 58aafb2..0d93abd 100644
--- a/src/ap/sta_info.c
+++ b/src/ap/sta_info.c
@@ -748,8 +748,8 @@ int ap_sta_bind_vlan(struct hostapd_data *hapd, struct sta_info *sta,
 	    vlan_untagged(&sta->vlan_id) >= 0 && vlan == NULL) {
 		hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
 			       HOSTAPD_LEVEL_DEBUG, "could not find VLAN for "
-			       "binding station to (vlan_id=%d)",
-			       vlan_untagged(&sta->vlan_id));
+			       "binding station to (vlan_id=%s)",
+			       vlan2str(&sta->vlan_id));
 		return -1;
 	} else if (vlan_notempty(&sta->vlan_id) &&
 	           vlan_untagged(&sta->vlan_id) >= 0 &&
@@ -759,8 +759,8 @@ int ap_sta_bind_vlan(struct hostapd_data *hapd, struct sta_info *sta,
 			hostapd_logger(hapd, sta->addr,
 				       HOSTAPD_MODULE_IEEE80211,
 				       HOSTAPD_LEVEL_DEBUG, "could not add "
-				       "dynamic VLAN interface for vlan_id=%d",
-				       vlan_untagged(&sta->vlan_id));
+				       "dynamic VLAN interface for vlan_id=%s",
+				       vlan2str(&sta->vlan_id));
 			return -1;
 		}
 
@@ -770,8 +770,8 @@ int ap_sta_bind_vlan(struct hostapd_data *hapd, struct sta_info *sta,
 				       HOSTAPD_MODULE_IEEE80211,
 				       HOSTAPD_LEVEL_DEBUG, "could not "
 				       "configure encryption for dynamic VLAN "
-				       "interface for vlan_id=%d",
-				       vlan_untagged(&sta->vlan_id));
+				       "interface for vlan_id=%s",
+				       vlan2str(&sta->vlan_id));
 		}
 
 		hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
@@ -798,8 +798,8 @@ int ap_sta_bind_vlan(struct hostapd_data *hapd, struct sta_info *sta,
 				       HOSTAPD_MODULE_IEEE80211,
 				       HOSTAPD_LEVEL_DEBUG, "could not "
 				       "configure encryption for VLAN "
-				       "interface for vlan_id=%d",
-				       vlan_untagged(&sta->vlan_id));
+				       "interface for vlan_id=%s",
+				       vlan2str(&sta->vlan_id));
 		}
 	}
 
@@ -814,8 +814,7 @@ int ap_sta_bind_vlan(struct hostapd_data *hapd, struct sta_info *sta,
 	if (ret < 0) {
 		hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
 			       HOSTAPD_LEVEL_DEBUG, "could not bind the STA "
-			       "entry to vlan_id=%d",
-			       vlan_untagged(&sta->vlan_id));
+			       "entry to vlan_id=%s", vlan2str(&sta->vlan_id));
 	}
 	return ret;
 #else /* CONFIG_NO_VLAN */
diff --git a/src/ap/vlan_init.c b/src/ap/vlan_init.c
index 2fd1c50..163e573 100644
--- a/src/ap/vlan_init.c
+++ b/src/ap/vlan_init.c
@@ -1012,7 +1012,7 @@ int vlan_init(struct hostapd_data *hapd)
 			return -1;
 		}
 
-		vlan_alloc(&vlan->vlan_id, VLAN_ID_WILDCARD);
+		vlan_alloc(&vlan->vlan_id, VLAN_ID_WILDCARD, 0, NULL);
 		os_snprintf(vlan->ifname, sizeof(vlan->ifname), "%s.#",
 			    hapd->conf->iface);
 		vlan->next = hapd->conf->vlan;
@@ -1049,8 +1049,8 @@ struct hostapd_vlan * vlan_add_dynamic(struct hostapd_data *hapd,
 	    vlan_untagged(&vlan->vlan_id) != VLAN_ID_WILDCARD)
 		return NULL;
 
-	wpa_printf(MSG_DEBUG, "VLAN: %s(vlan_id=%d ifname=%s)",
-		   __func__, vlan_untagged(&vlan_id), vlan->ifname);
+	wpa_printf(MSG_DEBUG, "VLAN: %s(vlan_id=%s ifname=%s)",
+		   __func__, vlan2str(&vlan_id), vlan->ifname);
 	ifname = os_strdup(vlan->ifname);
 	if (ifname == NULL)
 		return NULL;
@@ -1095,12 +1095,11 @@ int vlan_remove_dynamic(struct hostapd_data *hapd,
 {
 	struct hostapd_vlan *vlan;
 
-	if (vlan_untagged(&vlan_id) <= 0 ||
-	    vlan_untagged(&vlan_id) > MAX_VLAN_ID)
+	if (vlan_untagged(&vlan_id) == VLAN_ID_WILDCARD)
 		return 1;
 
-	wpa_printf(MSG_DEBUG, "VLAN: %s(vlan_id=%d)", __func__,
-	           vlan_untagged(&vlan_id));
+	wpa_printf(MSG_DEBUG, "VLAN: %s(vlan_id=%s)", __func__,
+	           vlan2str(&vlan_id));
 
 	vlan = hapd->conf->vlan;
 	while (vlan) {
diff --git a/src/ap/wpa_auth.c b/src/ap/wpa_auth.c
index da23a0a..c550419 100644
--- a/src/ap/wpa_auth.c
+++ b/src/ap/wpa_auth.c
@@ -2415,7 +2415,7 @@ static void wpa_group_gtk_init(struct wpa_authenticator *wpa_auth,
 			       struct wpa_group *group)
 {
 	wpa_printf(MSG_DEBUG, "WPA: group state machine entering state "
-		   "GTK_INIT (VLAN-ID %d)", vlan_untagged(&group->vlan_id));
+		   "GTK_INIT (VLAN-ID %s)", vlan2str(&group->vlan_id));
 	group->changed = FALSE; /* GInit is not cleared here; avoid loop */
 	group->wpa_group_state = WPA_GROUP_GTK_INIT;
 
@@ -2552,7 +2552,7 @@ static void wpa_group_setkeys(struct wpa_authenticator *wpa_auth,
 	int tmp;
 
 	wpa_printf(MSG_DEBUG, "WPA: group state machine entering state "
-		   "SETKEYS (VLAN-ID %d)", vlan_untagged(&group->vlan_id));
+		   "SETKEYS (VLAN-ID %s)", vlan2str(&group->vlan_id));
 	group->changed = TRUE;
 	group->wpa_group_state = WPA_GROUP_SETKEYS;
 	group->GTKReKey = FALSE;
@@ -2609,7 +2609,7 @@ static int wpa_group_setkeysdone(struct wpa_authenticator *wpa_auth,
 				 struct wpa_group *group)
 {
 	wpa_printf(MSG_DEBUG, "WPA: group state machine entering state "
-		   "SETKEYSDONE (VLAN-ID %d)", vlan_untagged(&group->vlan_id));
+		   "SETKEYSDONE (VLAN-ID %s)", vlan2str(&group->vlan_id));
 	group->changed = TRUE;
 	group->wpa_group_state = WPA_GROUP_SETKEYSDONE;
 
@@ -2999,13 +2999,14 @@ wpa_group_free(struct wpa_authenticator *wpa_auth, struct wpa_group *group)
 {
 	struct wpa_group *prev = wpa_auth->group;
 
-	wpa_printf(MSG_DEBUG, "WPA: Remove group state machine for VLAN-ID %d",
-		   vlan_untagged(&group->vlan_id));
+	wpa_printf(MSG_DEBUG, "WPA: Remove group state machine for VLAN-ID %s",
+	                       vlan2str(&group->vlan_id));
 
 	while (prev) {
 		if (prev->next == group) {
 			/* This never frees the special first group as needed */
 			prev->next = group->next;
+			vlan_free(&group->vlan_id);
 			os_free(group);
 			break;
 		}
@@ -3055,8 +3056,8 @@ wpa_auth_add_group(struct wpa_authenticator *wpa_auth,
 	if (wpa_auth == NULL || wpa_auth->group == NULL)
 		return NULL;
 
-	wpa_printf(MSG_DEBUG, "WPA: Add group state machine for VLAN-ID %d",
-		   vlan_untagged(&vlan_id));
+	wpa_printf(MSG_DEBUG, "WPA: Add group state machine for VLAN-ID %s",
+		   vlan2str(&vlan_id));
 	group = wpa_group_init(wpa_auth, vlan_id, 0);
 	if (group == NULL)
 		return NULL;
@@ -3093,8 +3094,8 @@ int wpa_auth_sta_set_vlan(struct wpa_state_machine *sm,
 		return 0;
 
 	wpa_printf(MSG_DEBUG, "WPA: Moving STA " MACSTR " to use group state "
-		   "machine for VLAN ID %d", MAC2STR(sm->addr),
-		   vlan_untagged(&vlan_id));
+		   "machine for VLAN ID %s", MAC2STR(sm->addr),
+		   vlan2str(&vlan_id));
 
 	wpa_group_get(sm->wpa_auth, group);
 	oldgroup = sm->group;
diff --git a/src/ap/wpa_auth_ie.c b/src/ap/wpa_auth_ie.c
index b0aa98a..d103881 100644
--- a/src/ap/wpa_auth_ie.c
+++ b/src/ap/wpa_auth_ie.c
@@ -607,9 +607,9 @@ int wpa_validate_wpa_ie(struct wpa_authenticator *wpa_auth,
 	if (sm->pmksa) {
 		wpa_auth_vlogger(wpa_auth, sm->addr, LOGGER_DEBUG,
 				 "PMKID found from PMKSA cache "
-				 "eap_type=%d vlan_id=%d",
+				 "eap_type=%d vlan_id=%s",
 				 sm->pmksa->eap_type_authsrv,
-				 vlan_untagged(&sm->pmksa->vlan_id));
+				 vlan2str(&sm->pmksa->vlan_id));
 		os_memcpy(wpa_auth->dot11RSNAPMKIDUsed, pmkid, PMKID_LEN);
 	}
 
diff --git a/src/common/vlan.c b/src/common/vlan.c
index 4317a0d..cfc71f7 100644
--- a/src/common/vlan.c
+++ b/src/common/vlan.c
@@ -6,32 +6,118 @@
  * See README for more details.
  */
 
+#include "includes.h"
+#include "common.h"
 #include "vlan.h"
 
-void vlan_alloc(struct vlan_description *dst, const int untagged)
+#ifdef DEBUG_VLAN_FREE
+#include <signal.h>
+#endif /* DEBUG_VLAN_FREE */
+
+void vlan_free(struct vlan_description *dst)
+{
+#ifdef DEBUG_VLAN_FREE
+	/* check that the struct vlan_description instance
+          was not moved around ! */
+	if (dst->self != NULL && dst->self != dst)
+		raise(SIGILL);
+	dst->self = NULL;
+	/* end */
+#endif /* DEBUG_VLAN_FREE */
+	dst->untagged = 0;
+#ifdef CONFIG_VLAN_TAGGED
+	if (dst->num_tagged == 0)
+		return;
+	dst->references--;
+	if (dst->references == 0) {
+		os_free(dst->tagged);
+		os_free(dst->references);
+	}
+	dst->tagged = NULL;
+	dst->num_tagged = 0;
+	dst->references = NULL;
+#endif /* CONFIG_VLAN_TAGGED */
+}
+
+int cmp_int(const void *a, const void *b)
+{
+	const int *ia = (const int *) a;
+	const int *ib = (const int *) b;
+	return (*ia > *ib) - (*ia < *ib);
+}
+
+void vlan_alloc(struct vlan_description *dst, const int untagged,
+                const unsigned int num_tagged, const int* tagged)
 {
+        int i, offset=0;
+
+	vlan_free(dst);
+
 	dst->untagged = untagged;
+#ifdef DEBUG_VLAN_FREE
+	dst->self = dst;
+#endif /* DEBUG_VLAN_FREE */
+#ifdef CONFIG_VLAN_TAGGED
+	dst->num_tagged = num_tagged;
+	if (dst->num_tagged == 0)
+		return;
+	dst->references = os_zalloc(sizeof(dst->references));
+	dst->tagged = os_zalloc(sizeof(*dst->tagged) * num_tagged);
+	if (!dst->tagged || !dst->references) {
+		dst->num_tagged = 0;
+		return;
+	}
+	os_memcpy(dst->tagged, tagged, sizeof(*dst->tagged) * num_tagged);
+	(*dst->references)++;
+
+        qsort(dst->tagged, dst->num_tagged, sizeof(int), cmp_int);
+        for (i=1; i < dst->num_tagged; i++) {
+                if (dst->tagged[i-1-offset] == dst->tagged[i])
+                        offset++;
+                else if (dst->tagged[i] <= 0 || dst->tagged[i] > MAX_VLAN_ID)
+                        offset++;
+                else if (offset > 0)
+                        dst->tagged[i-offset] = dst->tagged[i];
+        }
+        dst->num_tagged -= offset;
+#endif /* CONFIG_VLAN_TAGGED */
 }
 
 void vlan_alloc_copy(struct vlan_description *dst,
                      const struct vlan_description *src)
 {
+	vlan_free(dst);
 	dst->untagged = src->untagged;
-}
-
-void vlan_free(struct vlan_description *dst)
-{
-	dst->untagged = 0;
+#ifdef DEBUG_VLAN_FREE
+	dst->self = dst;
+#endif /* DEBUG_VLAN_FREE */
+#ifdef CONFIG_VLAN_TAGGED
+	dst->num_tagged = src->num_tagged;
+	if (dst->num_tagged == 0)
+		return;
+	dst->references = src->references;
+	dst->tagged = src->tagged;
+	(*dst->references)++;
+#endif /* CONFIG_VLAN_TAGGED */
 }
 
 int vlan_cmp(const struct vlan_description *a,
              const struct vlan_description *b)
 {
+	int i;
 	if (!a && !b)
 		return 1;
 	if (!a || !b)
 		return 0;
-	return (a->untagged == b->untagged);
+	if (a->untagged != b->untagged)
+		return 0;
+#ifdef CONFIG_VLAN_TAGGED
+	if (a->num_tagged != b->num_tagged)
+		return 0;
+	for (i=0; i < a->num_tagged; i++)
+		if (a->tagged[i] != b->tagged[i]) return 0;
+#endif /* CONFIG_VLAN_TAGGED */
+	return 1;
 }
 
 int vlan_untagged(const struct vlan_description *a)
@@ -41,10 +127,49 @@ int vlan_untagged(const struct vlan_description *a)
 	return a->untagged;
 }
 
+int vlan_tagged(const struct vlan_description *a, int **tagged)
+{
+	if (tagged)
+		*tagged = NULL;
+	if (!a)
+		return 0;
+#ifdef CONFIG_VLAN_TAGGED
+	if (tagged)
+		*tagged = a->tagged;
+	return a->num_tagged;
+#else /* CONFIG_VLAN_TAGGED */
+	return 0;
+#endif /* CONFIG_VLAN_TAGGED */
+}
+
 int vlan_notempty(const struct vlan_description *a)
 {
 	if (!a)
 		return 0;
+#ifdef CONFIG_VLAN_TAGGED
+	return a->untagged || a->num_tagged;
+#else /* CONFIG_VLAN_TAGGED */
 	return a->untagged;
+#endif /* CONFIG_VLAN_TAGGED */
+}
+
+char* vlan2str(const struct vlan_description *a)
+{
+	if (!a)
+		return "";
+#ifdef CONFIG_VLAN_TAGGED
+	static char buf[6 * 4096];
+	int i;
+	char *pos = buf;
+	pos += os_snprintf(pos, sizeof(buf) + buf - pos, "u%d", a->untagged);
+	for (i=0; i < a->num_tagged; i++) {
+		pos += os_snprintf(pos, sizeof(buf) + buf - pos, "t%d",
+		                a->tagged[i]);
+	}
+#else /* CONFIG_VLAN_TAGGED */
+	static char buf[5];
+	snprintf(buf, sizeof(buf), "%d", *a);
+#endif /* CONFIG_VLAN_TAGGED */
+	return buf;
 }
 
diff --git a/src/common/vlan.h b/src/common/vlan.h
index a340ce2..d33f7a1 100644
--- a/src/common/vlan.h
+++ b/src/common/vlan.h
@@ -9,18 +9,33 @@
 #ifndef HOSTAPD_VLAN_H
 #define HOSTAPD_VLAN_H
 
+#define MAX_VLAN_ID 4094
+
 #define VLAN_NULL (struct vlan_description) {0}
+
 struct vlan_description {
 	int untagged;
+#ifdef CONFIG_VLAN_TAGGED
+	unsigned int num_tagged;
+	int* tagged;
+	unsigned int* references;
+#endif /* CONFIG_VLAN_TAGGED */
+#ifdef DEBUG_VLAN_FREE
+	/* enforce that copies cannot be freed by error */
+	struct vlan_description *self;
+#endif /* DEBUG_VLAN_FREE */
 };
 
-void vlan_alloc(struct vlan_description *dst, const int untagged);
+void vlan_alloc(struct vlan_description *dst, const int untagged,
+                const unsigned int num_tagged, const int* tagged);
 void vlan_alloc_copy(struct vlan_description *dst,
                      const struct vlan_description *src);
 void vlan_free(struct vlan_description *dst);
 int vlan_cmp(const struct vlan_description *a,
              const struct vlan_description *b);
 int vlan_untagged(const struct vlan_description *a);
+int vlan_tagged(const struct vlan_description *a, int **tagged);
 int vlan_notempty(const struct vlan_description *a);
+char* vlan2str(const struct vlan_description *a);
 
-#endif
+#endif /* HOSTAPD_VLAN_H */
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index cbb0a51..e7b052a 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -8889,10 +8889,10 @@ static int i802_set_sta_vlan(struct i802_bss *bss, const u8 *addr,
 		return -ENOMEM;
 
 	wpa_printf(MSG_DEBUG, "nl80211: %s[%d]: set_sta_vlan(" MACSTR
-		   ", ifname=%s[%d], vlan_id=%d)",
+		   ", ifname=%s[%d], vlan_id=%s)",
 		   bss->ifname, if_nametoindex(bss->ifname),
 		   MAC2STR(addr), ifname, if_nametoindex(ifname),
-                  vlan_untagged(&vlan_id));
+		   vlan2str(&vlan_id));
 	nl80211_cmd(drv, msg, 0, NL80211_CMD_SET_STATION);
 
 	NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX,
@@ -8905,8 +8905,8 @@ static int i802_set_sta_vlan(struct i802_bss *bss, const u8 *addr,
 	msg = NULL;
 	if (ret < 0) {
 		wpa_printf(MSG_ERROR, "nl80211: NL80211_ATTR_STA_VLAN (addr="
-			   MACSTR " ifname=%s vlan_id=%d) failed: %d (%s)",
-			   MAC2STR(addr), ifname, vlan_untagged(&vlan_id), ret,
+			   MACSTR " ifname=%s vlan_id=%s) failed: %d (%s)",
+			   MAC2STR(addr), ifname, vlan2str(&vlan_id), ret,
 			   strerror(-ret));
 	}
  nla_put_failure:
diff --git a/src/drivers/driver_test.c b/src/drivers/driver_test.c
index fcf4e63..8f0359e 100644
--- a/src/drivers/driver_test.c
+++ b/src/drivers/driver_test.c
@@ -1130,8 +1130,8 @@ static int test_driver_set_sta_vlan(void *priv, const u8 *addr,
 				    const char *ifname,
                                    struct vlan_description vlan_id)
 {
-	wpa_printf(MSG_DEBUG, "%s(addr=" MACSTR " ifname=%s vlan_id=%d)",
-		   __func__, MAC2STR(addr), ifname, vlan_untagged(&vlan_id));
+	wpa_printf(MSG_DEBUG, "%s(addr=" MACSTR " ifname=%s vlan_id=%s)",
+		   __func__, MAC2STR(addr), ifname, vlan2str(&vlan_id));
 	return 0;
 }
 




More information about the Hostap mailing list