]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Support VLAN offload with SAE password based selection
authorShiva Sankar Gajula <quic_sgajula@quicinc.com>
Wed, 29 Nov 2023 09:27:42 +0000 (14:57 +0530)
committerJouni Malinen <j@w1.fi>
Thu, 21 Dec 2023 18:12:18 +0000 (20:12 +0200)
Allow VLAN selection based on SAE password entries when VLAN offloading
is used.

Signed-off-by: Shiva Sankar Gajula <quic_sgajula@quicinc.com>
src/ap/ieee802_11.c

index dd5acd9c2f4878a823c7524bc8c950715c68b13a..597a5df3c41bbef56a6d39dc8bf804c7d8093665 100644 (file)
@@ -907,23 +907,27 @@ void sae_accept_sta(struct hostapd_data *hapd, struct sta_info *sta)
                           " to VLAN ID %d",
                           MAC2STR(sta->addr), sta->sae->tmp->vlan_id);
 
-               os_memset(&vlan_desc, 0, sizeof(vlan_desc));
-               vlan_desc.notempty = 1;
-               vlan_desc.untagged = sta->sae->tmp->vlan_id;
-               if (!hostapd_vlan_valid(hapd->conf->vlan, &vlan_desc)) {
-                       wpa_printf(MSG_INFO,
-                                  "Invalid VLAN ID %d in sae_password",
-                                  sta->sae->tmp->vlan_id);
-                       return;
-               }
+               if (!(hapd->iface->drv_flags & WPA_DRIVER_FLAGS_VLAN_OFFLOAD)) {
+                       os_memset(&vlan_desc, 0, sizeof(vlan_desc));
+                       vlan_desc.notempty = 1;
+                       vlan_desc.untagged = sta->sae->tmp->vlan_id;
+                       if (!hostapd_vlan_valid(hapd->conf->vlan, &vlan_desc)) {
+                               wpa_printf(MSG_INFO,
+                                          "Invalid VLAN ID %d in sae_password",
+                                          sta->sae->tmp->vlan_id);
+                               return;
+                       }
 
-               if (ap_sta_set_vlan(hapd, sta, &vlan_desc) < 0 ||
-                   ap_sta_bind_vlan(hapd, sta) < 0) {
-                       wpa_printf(MSG_INFO,
-                                  "Failed to assign VLAN ID %d from sae_password to "
-                                  MACSTR, sta->sae->tmp->vlan_id,
-                                  MAC2STR(sta->addr));
-                       return;
+                       if (ap_sta_set_vlan(hapd, sta, &vlan_desc) < 0 ||
+                           ap_sta_bind_vlan(hapd, sta) < 0) {
+                               wpa_printf(MSG_INFO,
+                                          "Failed to assign VLAN ID %d from sae_password to "
+                                          MACSTR, sta->sae->tmp->vlan_id,
+                                          MAC2STR(sta->addr));
+                               return;
+                       }
+               } else {
+                       sta->vlan_id = sta->sae->tmp->vlan_id;
                }
        }
 #endif /* CONFIG_NO_VLAN */