[PATCH v2 38/44] AP: Specify the link ID for set_key() callback

Andrei Otcheretianski andrei.otcheretianski at intel.com
Mon May 22 12:34:06 PDT 2023


From: Ilan Peer <ilan.peer at intel.com>

If the AP is part of a MLD AP specify the link ID in the
set key parameters.

Signed-off-by: Ilan Peer <ilan.peer at intel.com>
Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski at intel.com>
---
 src/ap/ap_drv_ops.c |  5 +++++
 src/ap/wpa_auth.c   | 24 ++++++------------------
 2 files changed, 11 insertions(+), 18 deletions(-)

diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c
index cf4ff3ddd8..399ca7abc6 100644
--- a/src/ap/ap_drv_ops.c
+++ b/src/ap/ap_drv_ops.c
@@ -758,6 +758,11 @@ int hostapd_drv_set_key(const char *ifname, struct hostapd_data *hapd,
 	params.key_flag = key_flag;
 	params.link_id = -1;
 
+#ifdef CONFIG_IEEE80211BE
+	if (hapd->conf->mld_ap && !(key_flag & KEY_FLAG_PAIRWISE))
+		params.link_id = hapd->mld_link_id;
+#endif /* CONFIG_IEEE80211BE */
+
 	return hapd->driver->set_key(hapd->drv_priv, &params);
 }
 
diff --git a/src/ap/wpa_auth.c b/src/ap/wpa_auth.c
index 2ad5cf8a72..0003be1e4c 100644
--- a/src/ap/wpa_auth.c
+++ b/src/ap/wpa_auth.c
@@ -36,20 +36,6 @@
 #include "sta_info.h"
 
 
-static const u8 *wpa_auth_get_aa(struct wpa_state_machine *sm)
-{
-	return (sm && sm->mld_assoc_link_id >= 0) ?
-		sm->own_mld_addr : sm->wpa_auth->addr;
-}
-
-
-static const u8 *wpa_auth_get_spa(struct wpa_state_machine *sm)
-{
-	return sm->mld_assoc_link_id >= 0 ?
-		sm->peer_mld_addr : sm->addr;
-}
-
-
 #define STATE_MACHINE_DATA struct wpa_state_machine
 #define STATE_MACHINE_DEBUG_PREFIX "WPA"
 #define STATE_MACHINE_ADDR wpa_auth_get_spa(sm)
@@ -98,15 +84,17 @@ static const int dot11RSNAConfigPMKReauthThreshold = 70;
 static const int dot11RSNAConfigSATimeout = 60;
 
 
-static const u8 * wpa_auth_get_aa(const struct wpa_state_machine *sm)
+static const u8 * wpa_auth_get_aa(struct wpa_state_machine *sm)
 {
-	return sm->wpa_auth->addr;
+	return (sm && sm->mld_assoc_link_id >= 0) ?
+		sm->own_mld_addr : sm->wpa_auth->addr;
 }
 
 
-static const u8 * wpa_auth_get_spa(const struct wpa_state_machine *sm)
+static const u8 * wpa_auth_get_spa(struct wpa_state_machine *sm)
 {
-	return sm->addr;
+	return sm->mld_assoc_link_id >= 0 ?
+		sm->peer_mld_addr : sm->addr;
 }
 
 
-- 
2.38.1




More information about the Hostap mailing list