<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">From c1cd6e04d06ec59de9f9977d90ba58210ef5a83b Mon Sep 17 00:00:00 2001
From: Andrei Otcheretianski &lt;andrei.otcheretianski@intel.com&gt;
Date: Mon, 22 May 2023 22:33:58 +0300
Subject: [PATCH 30/54] AP: Forward link specific events

Process management and EAPOL frames on the correct link.

Signed-off-by: Andrei Otcheretianski &lt;andrei.otcheretianski@intel.com&gt;
---
 src/ap/drv_callbacks.c | 35 +++++++++++++++++++++++++++++++----
 1 file changed, 31 insertions(+), 4 deletions(-)

diff --git a/src/ap/drv_callbacks.c b/src/ap/drv_callbacks.c
index 0281264a6..028fc6b53 100644
--- a/src/ap/drv_callbacks.c
+++ b/src/ap/drv_callbacks.c
@@ -1417,6 +1417,21 @@ static void hostapd_action_rx(struct hostapd_data *hapd,
 
 
 #ifdef NEED_AP_MLME
+static struct hostapd_data *switch_link_hapd(struct hostapd_data *hapd, int link_id)
+{
+#ifdef CONFIG_IEEE80211BE
+	if (hapd-&gt;conf-&gt;mld_ap &amp;&amp; link_id &gt;= 0) {
+		struct hostapd_data *link_bss;
+
+		link_bss = hostapd_mld_get_link_bss(hapd, (u8)link_id);
+		if (link_bss)
+			return link_bss;
+	}
+#endif /* CONFIG_IEEE80211BE */
+
+	return hapd;
+}
+
 
 #define HAPD_BROADCAST ((struct hostapd_data *) -1)
 
@@ -1454,13 +1469,17 @@ static void hostapd_rx_from_unknown_sta(struct hostapd_data *hapd,
 
 static int hostapd_mgmt_rx(struct hostapd_data *hapd, struct rx_mgmt *rx_mgmt)
 {
-	struct hostapd_iface *iface = hapd-&gt;iface;
+	struct hostapd_iface *iface;
 	const struct ieee80211_hdr *hdr;
 	const u8 *bssid;
 	struct hostapd_frame_info fi;
 	int ret;
 	bool is_mld = false;
 
+	hapd = switch_link_hapd(hapd, rx_mgmt-&gt;link_id);
+
+	iface = hapd-&gt;iface;
+
 #ifdef CONFIG_TESTING_OPTIONS
 	if (hapd-&gt;ext_mgmt_frame_handling) {
 		size_t hex_len = 2 * rx_mgmt-&gt;frame_len + 1;
@@ -1600,12 +1619,19 @@ static int hostapd_event_new_sta(struct hostapd_data *hapd, const u8 *addr)
 
 static void hostapd_event_eapol_rx(struct hostapd_data *hapd, const u8 *src,
 				   const u8 *data, size_t data_len,
-				   enum frame_encryption encrypted)
+				   enum frame_encryption encrypted,
+				   int link_id)
 {
-	struct hostapd_iface *iface = hapd-&gt;iface;
+	struct hostapd_iface *iface;
 	struct sta_info *sta;
 	size_t j;
 
+#ifdef CONFIG_IEEE80211BE
+	hapd = switch_link_hapd(hapd, link_id);
+#endif /* CONFIG_IEEE80211BE */
+
+	iface = hapd-&gt;iface;
+
 	for (j = 0; j &lt; iface-&gt;num_bss; j++) {
 		sta = ap_get_sta(iface-&gt;bss[j], src);
 		if (sta &amp;&amp; sta-&gt;flags &amp; WLAN_STA_ASSOC) {
@@ -2007,7 +2033,8 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
 		hostapd_event_eapol_rx(hapd, data-&gt;eapol_rx.src,
 				       data-&gt;eapol_rx.data,
 				       data-&gt;eapol_rx.data_len,
-				       data-&gt;eapol_rx.encrypted);
+				       data-&gt;eapol_rx.encrypted,
+				       data-&gt;eapol_rx.link_id);
 		break;
 	case EVENT_ASSOC:
 		if (!data)
-- 
2.39.2

</pre></body></html>