blob: b3144cb7457a9e914f443a79396e0928a0287db9 [file] [log] [blame]
From fb3820ff9fff1b15c13d4a799fbef8932fda7a1b 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 083/104] 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 ce3874901..0f357d786 100644
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -3116,6 +3116,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 ee6e20538..e9fa0ed6e 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 38b80903d..cd89db6c8 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