[PATCH v2 27/33] STA: avoid driver warning when configuring not connected STAs for WPA

Michael Braun michael-dev at fami-braun.de
Sat Sep 24 13:54:08 PDT 2016


At least mac80211 drivers refuse to set VLAN for a station not yet
associated and therefore print errors to console that can be ignored.
In order to avoid confusion from these errors, do not try to configure
station vlan to driver if station is not associated.

It does not fix any real bugs.

Signed-off-by: Michael Braun <michael-dev at fami-braun.de>
---
 src/ap/sta_info.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/ap/sta_info.c b/src/ap/sta_info.c
index b508afb..20f4021 100644
--- a/src/ap/sta_info.c
+++ b/src/ap/sta_info.c
@@ -1007,11 +1007,21 @@ skip_counting:
 	if (wpa_auth_sta_set_vlan(sta->wpa_sm, sta->vlan_id) < 0)
 		wpa_printf(MSG_INFO, "Failed to update VLAN-ID for WPA");
 
-	ret = hostapd_drv_set_sta_vlan(iface, hapd, sta->addr, sta->vlan_id);
-	if (ret < 0) {
+	if (sta->flags & (WLAN_STA_AUTH | WLAN_STA_ASSOC)) {
+		ret = hostapd_drv_set_sta_vlan(iface, hapd, sta->addr,
+					       sta->vlan_id);
+		if (ret < 0)
+			hostapd_logger(hapd, sta->addr,
+				       HOSTAPD_MODULE_IEEE80211,
+				       HOSTAPD_LEVEL_WARNING, "could not bind "
+				       "the STA entry to vlan_id=%d",
+				       sta->vlan_id);
+	} else {
+		ret = -1;
 		hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
-			       HOSTAPD_LEVEL_DEBUG, "could not bind the STA "
-			       "entry to vlan_id=%d", sta->vlan_id);
+			       HOSTAPD_LEVEL_INFO, "station not authenticated, "
+			       "so skip setting vlan to vlan_id=%d",
+			       sta->vlan_id);
 	}
 
 	/* During 1x reauth, if the vlan id changes, then remove the old id. */
-- 
2.1.4




More information about the Hostap mailing list