]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
AP MLD: Check if non-AP STA in reconfig add-request already exists
authorPooventhiran G <quic_pooventh@quicinc.com>
Mon, 16 Jun 2025 11:19:00 +0000 (16:49 +0530)
committerJouni Malinen <j@w1.fi>
Wed, 18 Jun 2025 09:18:57 +0000 (12:18 +0300)
As per IEEE P802.11be/D7.0, the non-AP STA requested in ML Setup link
reconfiguration for "add" operation should not have the (link) MAC address
associated to any non-AP STA which is either affiliated or not to a
non-AP MLD on the corresponding AP link affiliated with the AP MLD.

Enforce this condition and reject the operation otherwise.

Reviewed-by: Rohan Dutta <quic_drohan@quicinc.com>
Signed-off-by: Pooventhiran G <quic_pooventh@quicinc.com>
src/ap/ieee802_11_eht.c

index e7f0b4c034bec8471a6156aea482f7c64a66de2d..1c7e74ed413838947480d62ddee549e8ca3f2a90 100644 (file)
@@ -2033,6 +2033,39 @@ send_resp:
 }
 
 
+static int
+hostapd_ml_check_sta_entry_by_link_addr_iter(struct hostapd_data *hapd,
+                                            struct sta_info *sta, void *ctx)
+{
+       const u8 *link_addr = ctx;
+       struct mld_link_info li;
+
+       if (!link_addr)
+               return 0;
+
+       if (sta->mld_info.mld_sta) {
+               li = sta->mld_info.links[hapd->mld_link_id];
+               if (!li.valid || !ether_addr_equal(li.peer_addr, link_addr))
+                       return 0;
+
+               wpa_printf(MSG_DEBUG, "MLD: STA with address " MACSTR
+                          " exists for AP (link_id=%u) as a non-AP STA affiliated with non-AP MLD "
+                          MACSTR, MAC2STR(link_addr),
+                          hapd->mld_link_id, MAC2STR(sta->addr));
+               return 1;
+       }
+
+       if (ether_addr_equal(sta->addr, link_addr)) {
+               wpa_printf(MSG_DEBUG, "MLD: STA with address " MACSTR
+                          " exists for AP (link_id=%u) as a legacy STA",
+                          MAC2STR(link_addr), hapd->mld_link_id);
+               return 1;
+       }
+
+       return 0;
+}
+
+
 /* Returns:
  * 0 = successful parsing
  * 1 = per-STA profile (subelement) skipped or rejected
@@ -2219,6 +2252,15 @@ hostapd_parse_link_reconf_req_sta_profile(struct hostapd_data *hapd,
                goto add_to_list;
        }
 
+       /* Check if link address is already used by any connected legacy
+        * non-AP STA or non-AP STA affiliated with a non-AP MLD.
+        */
+       if (ap_for_each_sta(lhapd, hostapd_ml_check_sta_entry_by_link_addr_iter,
+                           sta_addr)) {
+               ret = 1; /* Reject this per-STA profile */
+               goto add_to_list;
+       }
+
        status = WLAN_STATUS_SUCCESS; /* IE validations done later */
        ret = 0;