blob: 6e6a41d4dc62d8740b0c3e633c4c0468c8f519a2 [file] [log] [blame]
From d5221e296c5e9c398bb8b83c7e47d14576afea71 Mon Sep 17 00:00:00 2001
From: Shayne Chen <shayne.chen@mediatek.com>
Date: Mon, 11 Dec 2023 17:02:05 +0800
Subject: [PATCH 64/69] mtk: hostapd: extend ap_get_sta() to find the correct
sta
There're still some mld address tranlation issues that need to be dealt
with on driver side (e.g. RX eapol frames). So add the code that find
station also with link address and across hapds at the moment.
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
---
src/ap/ieee802_11.c | 1 +
src/ap/sta_info.c | 16 ++++++++++++++++
src/ap/sta_info.h | 1 +
3 files changed, 18 insertions(+)
diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
index f1c5c5a82..a4f1e20b7 100644
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -3119,6 +3119,7 @@ static void handle_auth(struct hostapd_data *hapd,
mgmt->sa, ETH_ALEN);
os_memcpy(sta->mld_info.links[link_id].local_addr,
hapd->own_addr, ETH_ALEN);
+ os_memcpy(sta->setup_link_addr, mgmt->sa, ETH_ALEN);
}
}
#endif /* CONFIG_IEEE80211BE */
diff --git a/src/ap/sta_info.c b/src/ap/sta_info.c
index ebb23d1f1..fa81b34ac 100644
--- a/src/ap/sta_info.c
+++ b/src/ap/sta_info.c
@@ -73,6 +73,22 @@ struct sta_info * ap_get_sta(struct hostapd_data *hapd, const u8 *sta)
s = hapd->sta_hash[STA_HASH(sta)];
while (s != NULL && os_memcmp(s->addr, sta, 6) != 0)
s = s->hnext;
+
+ if (hapd->conf->mld_ap && !s) {
+ u8 link_id;
+
+ for (link_id = 0; link_id < MAX_NUM_MLD_LINKS; link_id++) {
+ struct hostapd_data *h = hostapd_mld_get_link_bss(hapd, link_id);
+
+ if (!h)
+ continue;
+
+ for (s = h->sta_list; s; s = s->next)
+ if (!os_memcmp(s->setup_link_addr, sta, 6))
+ return s;
+ }
+ }
+
return s;
}
diff --git a/src/ap/sta_info.h b/src/ap/sta_info.h
index d18dd2fcd..10ab4114f 100644
--- a/src/ap/sta_info.h
+++ b/src/ap/sta_info.h
@@ -102,6 +102,7 @@ struct sta_info {
struct sta_info *next; /* next entry in sta list */
struct sta_info *hnext; /* next entry in hash table list */
u8 addr[6];
+ u8 setup_link_addr[6];
be32 ipaddr;
struct dl_list ip6addr; /* list head for struct ip6addr */
u16 aid; /* STA's unique AID (1 .. 2007) or 0 if not yet assigned */
--
2.39.2