]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
nl80211: Add AP_VLAN interface to bridge after interface is up
authorRadha Krishna Simha Jiguru <quic_rjiguru@quicinc.com>
Wed, 17 Jul 2024 16:57:39 +0000 (22:27 +0530)
committerJouni Malinen <j@w1.fi>
Mon, 12 Aug 2024 09:40:03 +0000 (12:40 +0300)
In the current hostapd flow, AP_VLAN net device is added to a bridge
before the interface is brought up.

Interface up event is used in mac80211 layer for setting device context
in the driver. Vendor specific datapath offload configurations for net
device might also be set up in interface up event context. Adding
AP_VLAN interface to a bridge before the UP event could cause
inconsistent state for datapath offload context setup in a vendor
driver.

Change the sequence to add AP_VLAN interface to a bridge after the
interface is set up. This makes the interface up and bridge add sequence
for AP_VLAN to be consistent with that of a regular AP interface.

Signed-off-by: Radha Krishna Simha Jiguru <quic_rjiguru@quicinc.com>
src/drivers/driver_nl80211.c

index b8b747d8bea333da69f1ba75582ab99d9e4a5742..ea2d739d7890266679729410e605dc02db99506f 100644 (file)
@@ -8488,6 +8488,7 @@ static int i802_set_wds_sta(void *priv, const u8 *addr, int aid, int val,
        struct wpa_driver_nl80211_data *drv = bss->drv;
        char name[IFNAMSIZ + 1];
        union wpa_event_data event;
+       bool add_br = false;
        int ret;
 
        ret = os_snprintf(name, sizeof(name), "%s.sta%d", bss->ifname, aid);
@@ -8509,10 +8510,9 @@ static int i802_set_wds_sta(void *priv, const u8 *addr, int aid, int val,
                                                 bss->addr, 1, NULL, NULL, 0) <
                            0)
                                return -1;
-                       if (bridge_ifname &&
-                           linux_br_add_if(drv->global->ioctl_sock,
-                                           bridge_ifname, name) < 0)
-                               return -1;
+
+                       if (bridge_ifname)
+                               add_br = true;
 
                        os_memset(&event, 0, sizeof(event));
                        event.wds_sta_interface.sta_addr = addr;
@@ -8526,6 +8526,12 @@ static int i802_set_wds_sta(void *priv, const u8 *addr, int aid, int val,
                        wpa_printf(MSG_ERROR, "nl80211: Failed to set WDS STA "
                                   "interface %s up", name);
                }
+
+               if (add_br &&
+                   linux_br_add_if(drv->global->ioctl_sock,
+                                   bridge_ifname, name) < 0)
+                       return -1;
+
                return i802_set_sta_vlan(priv, addr, name, 0,
                                         NL80211_DRV_LINK_ID_NA);
        } else {