]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
AP: Provide the link ID for an MLD setting when setting VLAN
authorIlan Peer <ilan.peer@intel.com>
Mon, 22 May 2023 19:33:55 +0000 (22:33 +0300)
committerJouni Malinen <j@w1.fi>
Mon, 12 Jun 2023 13:31:00 +0000 (16:31 +0300)
This is a required modification to the driver interface and driver
nl80211.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
src/ap/ap_drv_ops.h
src/ap/sta_info.c
src/drivers/driver.h
src/drivers/driver_nl80211.c

index 073715178328f07cadbe26fec38871c94646c758..25d9ee75e47588011a9a571f67d6230a3c70093e 100644 (file)
@@ -173,12 +173,13 @@ static inline int hostapd_drv_set_countermeasures(struct hostapd_data *hapd,
 
 static inline int hostapd_drv_set_sta_vlan(const char *ifname,
                                           struct hostapd_data *hapd,
-                                          const u8 *addr, int vlan_id)
+                                          const u8 *addr, int vlan_id,
+                                          int link_id)
 {
        if (hapd->driver == NULL || hapd->driver->set_sta_vlan == NULL)
                return 0;
        return hapd->driver->set_sta_vlan(hapd->drv_priv, addr, ifname,
-                                         vlan_id);
+                                         vlan_id, link_id);
 }
 
 static inline int hostapd_drv_get_inact_sec(struct hostapd_data *hapd,
index cf527e63984203664a520af22c7ddf922da873c5..1d9becea3165dc20cecfba8021abcff763005c4a 100644 (file)
@@ -1086,6 +1086,12 @@ int ap_sta_bind_vlan(struct hostapd_data *hapd, struct sta_info *sta)
        struct hostapd_vlan *vlan = NULL;
        int ret;
        int old_vlanid = sta->vlan_id_bound;
+       int mld_link_id = -1;
+
+#ifdef CONFIG_IEEE80211BE
+       if (hapd->conf->mld_ap)
+               mld_link_id = hapd->mld_link_id;
+#endif /* CONFIG_IEEE80211BE */
 
        if ((sta->flags & WLAN_STA_WDS) && sta->vlan_id == 0) {
                wpa_printf(MSG_DEBUG,
@@ -1143,7 +1149,8 @@ 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);
+       ret = hostapd_drv_set_sta_vlan(iface, hapd, sta->addr, sta->vlan_id,
+                                      mld_link_id);
        if (ret < 0) {
                hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
                               HOSTAPD_LEVEL_DEBUG, "could not bind the STA "
index 52b14fe80b76ebf51463730ec9788e62da1fb20f..b3043da33373d158d89940e24e1f76bee7761149 100644 (file)
@@ -3785,6 +3785,7 @@ struct wpa_driver_ops {
         * @ifname: Interface (main or virtual BSS or VLAN)
         * @addr: MAC address of the associated station
         * @vlan_id: VLAN ID
+        * @link_id: The link ID or -1 for non-MLO
         * Returns: 0 on success, -1 on failure
         *
         * This function is used to bind a station to a specific virtual
@@ -3794,7 +3795,7 @@ struct wpa_driver_ops {
         * domains to be used with a single BSS.
         */
        int (*set_sta_vlan)(void *priv, const u8 *addr, const char *ifname,
-                           int vlan_id);
+                           int vlan_id, int link_id);
 
        /**
         * commit - Optional commit changes handler (AP only)
index 2222fb5ddd023987092658acc21cdac57d98753f..e157fb3f3a2b155ffb48191958fe407f1b35dc96 100644 (file)
@@ -8025,7 +8025,7 @@ fail:
 
 
 static int i802_set_sta_vlan(struct i802_bss *bss, const u8 *addr,
-                            const char *ifname, int vlan_id)
+                            const char *ifname, int vlan_id, int link_id)
 {
        struct wpa_driver_nl80211_data *drv = bss->drv;
        struct nl_msg *msg;
@@ -8039,6 +8039,8 @@ static int i802_set_sta_vlan(struct i802_bss *bss, const u8 *addr,
            nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, addr) ||
            (vlan_id && (drv->capa.flags & WPA_DRIVER_FLAGS_VLAN_OFFLOAD) &&
             nla_put_u16(msg, NL80211_ATTR_VLAN_ID, vlan_id)) ||
+           (link_id != NL80211_DRV_LINK_ID_NA &&
+            nla_put_u8(msg, NL80211_ATTR_MLO_LINK_ID, link_id)) ||
            nla_put_u32(msg, NL80211_ATTR_STA_VLAN, if_nametoindex(ifname))) {
                nlmsg_free(msg);
                return -ENOBUFS;
@@ -8297,7 +8299,8 @@ 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);
                }
-               return i802_set_sta_vlan(priv, addr, name, 0);
+               return i802_set_sta_vlan(priv, addr, name, 0,
+                                        NL80211_DRV_LINK_ID_NA);
        } else {
                if (bridge_ifname &&
                    linux_br_del_if(drv->global->ioctl_sock, bridge_ifname,
@@ -8306,7 +8309,8 @@ static int i802_set_wds_sta(void *priv, const u8 *addr, int aid, int val,
                                   "nl80211: Failed to remove interface %s from bridge %s: %s",
                                   name, bridge_ifname, strerror(errno));
 
-               i802_set_sta_vlan(priv, addr, bss->ifname, 0);
+               i802_set_sta_vlan(priv, addr, bss->ifname, 0,
+                                 NL80211_DRV_LINK_ID_NA);
                nl80211_remove_iface(drv, if_nametoindex(name));
                os_memset(&event, 0, sizeof(event));
                event.wds_sta_interface.sta_addr = addr;
@@ -10477,10 +10481,11 @@ static int driver_nl80211_sta_remove(void *priv, const u8 *addr)
 
 
 static int driver_nl80211_set_sta_vlan(void *priv, const u8 *addr,
-                                      const char *ifname, int vlan_id)
+                                      const char *ifname, int vlan_id,
+                                      int link_id)
 {
        struct i802_bss *bss = priv;
-       return i802_set_sta_vlan(bss, addr, ifname, vlan_id);
+       return i802_set_sta_vlan(bss, addr, ifname, vlan_id, link_id);
 }