developer | 617abbd | 2024-04-23 14:50:01 +0800 | [diff] [blame^] | 1 | From fb3820ff9fff1b15c13d4a799fbef8932fda7a1b Mon Sep 17 00:00:00 2001 |
| 2 | From: Shayne Chen <shayne.chen@mediatek.com> |
| 3 | Date: Mon, 11 Dec 2023 17:02:05 +0800 |
| 4 | Subject: [PATCH 083/104] mtk: hostapd: extend ap_get_sta() to find the correct |
| 5 | sta |
| 6 | |
| 7 | There're still some mld address tranlation issues that need to be dealt |
| 8 | with on driver side (e.g. RX eapol frames). So add the code that find |
| 9 | station also with link address and across hapds at the moment. |
| 10 | |
| 11 | Signed-off-by: Shayne Chen <shayne.chen@mediatek.com> |
| 12 | --- |
| 13 | src/ap/ieee802_11.c | 1 + |
| 14 | src/ap/sta_info.c | 16 ++++++++++++++++ |
| 15 | src/ap/sta_info.h | 1 + |
| 16 | 3 files changed, 18 insertions(+) |
| 17 | |
| 18 | diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c |
| 19 | index ce3874901..0f357d786 100644 |
| 20 | --- a/src/ap/ieee802_11.c |
| 21 | +++ b/src/ap/ieee802_11.c |
| 22 | @@ -3116,6 +3116,7 @@ static void handle_auth(struct hostapd_data *hapd, |
| 23 | mgmt->sa, ETH_ALEN); |
| 24 | os_memcpy(sta->mld_info.links[link_id].local_addr, |
| 25 | hapd->own_addr, ETH_ALEN); |
| 26 | + os_memcpy(sta->setup_link_addr, mgmt->sa, ETH_ALEN); |
| 27 | } |
| 28 | } |
| 29 | #endif /* CONFIG_IEEE80211BE */ |
| 30 | diff --git a/src/ap/sta_info.c b/src/ap/sta_info.c |
| 31 | index ee6e20538..e9fa0ed6e 100644 |
| 32 | --- a/src/ap/sta_info.c |
| 33 | +++ b/src/ap/sta_info.c |
| 34 | @@ -73,6 +73,22 @@ struct sta_info * ap_get_sta(struct hostapd_data *hapd, const u8 *sta) |
| 35 | s = hapd->sta_hash[STA_HASH(sta)]; |
| 36 | while (s != NULL && os_memcmp(s->addr, sta, 6) != 0) |
| 37 | s = s->hnext; |
| 38 | + |
| 39 | + if (hapd->conf->mld_ap && !s) { |
| 40 | + u8 link_id; |
| 41 | + |
| 42 | + for (link_id = 0; link_id < MAX_NUM_MLD_LINKS; link_id++) { |
| 43 | + struct hostapd_data *h = hostapd_mld_get_link_bss(hapd, link_id); |
| 44 | + |
| 45 | + if (!h) |
| 46 | + continue; |
| 47 | + |
| 48 | + for (s = h->sta_list; s; s = s->next) |
| 49 | + if (!os_memcmp(s->setup_link_addr, sta, 6)) |
| 50 | + return s; |
| 51 | + } |
| 52 | + } |
| 53 | + |
| 54 | return s; |
| 55 | } |
| 56 | |
| 57 | diff --git a/src/ap/sta_info.h b/src/ap/sta_info.h |
| 58 | index 38b80903d..cd89db6c8 100644 |
| 59 | --- a/src/ap/sta_info.h |
| 60 | +++ b/src/ap/sta_info.h |
| 61 | @@ -102,6 +102,7 @@ struct sta_info { |
| 62 | struct sta_info *next; /* next entry in sta list */ |
| 63 | struct sta_info *hnext; /* next entry in hash table list */ |
| 64 | u8 addr[6]; |
| 65 | + u8 setup_link_addr[6]; |
| 66 | be32 ipaddr; |
| 67 | struct dl_list ip6addr; /* list head for struct ip6addr */ |
| 68 | u16 aid; /* STA's unique AID (1 .. 2007) or 0 if not yet assigned */ |
| 69 | -- |
| 70 | 2.39.2 |
| 71 | |