developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1 | From 4be7c245a946016c41a69c7469e00d22aaa32a46 Mon Sep 17 00:00:00 2001 |
| 2 | From: Aditya Kumar Singh <quic_adisi@quicinc.com> |
| 3 | Date: Thu, 28 Mar 2024 23:46:36 +0530 |
| 4 | Subject: [PATCH 006/104] hostapd: MLO: reset auth state machine's ML info |
| 5 | |
| 6 | Currently auth state machine ML info is set only when the it is created |
| 7 | newly. However, if the association is tried again, the state machine will |
| 8 | exist already and hence the ML info will not be refreshed. This leads to |
| 9 | an issue where if in the subsequent association request, the MLD info is |
| 10 | different than old info then validation of it will fail. |
| 11 | |
| 12 | Fix this issue by refreshing the auth state machine's ML info every time |
| 13 | association request is handled. |
| 14 | |
| 15 | Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com> |
| 16 | --- |
| 17 | src/ap/ieee802_11.c | 32 ++++++++++++++++++-------------- |
| 18 | src/ap/wpa_auth.c | 1 + |
| 19 | 2 files changed, 19 insertions(+), 14 deletions(-) |
| 20 | |
| 21 | diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c |
| 22 | index b20300bab..98398ccdd 100644 |
| 23 | --- a/src/ap/ieee802_11.c |
| 24 | +++ b/src/ap/ieee802_11.c |
| 25 | @@ -4032,15 +4032,15 @@ static int __check_assoc_ies(struct hostapd_data *hapd, struct sta_info *sta, |
| 26 | |
| 27 | if (hapd->conf->wpa && wpa_ie) { |
| 28 | enum wpa_validate_result res; |
| 29 | +#ifdef CONFIG_IEEE80211BE |
| 30 | + struct mld_info *info = &sta->mld_info; |
| 31 | + bool init = false; |
| 32 | +#endif /* CONFIG_IEEE80211BE */ |
| 33 | |
| 34 | wpa_ie -= 2; |
| 35 | wpa_ie_len += 2; |
| 36 | |
| 37 | if (!sta->wpa_sm) { |
| 38 | -#ifdef CONFIG_IEEE80211BE |
| 39 | - struct mld_info *info = &sta->mld_info; |
| 40 | -#endif /* CONFIG_IEEE80211BE */ |
| 41 | - |
| 42 | sta->wpa_sm = wpa_auth_sta_init(hapd->wpa_auth, |
| 43 | sta->addr, |
| 44 | p2p_dev_addr); |
| 45 | @@ -4050,19 +4050,23 @@ static int __check_assoc_ies(struct hostapd_data *hapd, struct sta_info *sta, |
| 46 | "Failed to initialize RSN state machine"); |
| 47 | return WLAN_STATUS_UNSPECIFIED_FAILURE; |
| 48 | } |
| 49 | - |
| 50 | #ifdef CONFIG_IEEE80211BE |
| 51 | - if (ap_sta_is_mld(hapd, sta)) { |
| 52 | - wpa_printf(MSG_DEBUG, |
| 53 | - "MLD: Set ML info in RSN Authenticator"); |
| 54 | - wpa_auth_set_ml_info(sta->wpa_sm, |
| 55 | - hapd->mld->mld_addr, |
| 56 | - sta->mld_assoc_link_id, |
| 57 | - info); |
| 58 | - } |
| 59 | -#endif /* CONFIG_IEEE80211BE */ |
| 60 | + init = true; |
| 61 | } |
| 62 | |
| 63 | + if (ap_sta_is_mld(hapd, sta)) { |
| 64 | + wpa_printf(MSG_DEBUG, |
| 65 | + "MLD: %s ML info in RSN Authenticator", |
| 66 | + init ? "Set" : "Reset"); |
| 67 | + wpa_auth_set_ml_info(sta->wpa_sm, |
| 68 | + hapd->mld->mld_addr, |
| 69 | + sta->mld_assoc_link_id, |
| 70 | + info); |
| 71 | + } |
| 72 | +#else |
| 73 | + } |
| 74 | +#endif /* CONFIG_IEEE80211BE */ |
| 75 | + |
| 76 | wpa_auth_set_auth_alg(sta->wpa_sm, sta->auth_alg); |
| 77 | res = wpa_validate_wpa_ie(hapd->wpa_auth, sta->wpa_sm, |
| 78 | hapd->iface->freq, |
| 79 | diff --git a/src/ap/wpa_auth.c b/src/ap/wpa_auth.c |
| 80 | index 01a10b23c..0d15c4209 100644 |
| 81 | --- a/src/ap/wpa_auth.c |
| 82 | +++ b/src/ap/wpa_auth.c |
| 83 | @@ -6820,6 +6820,7 @@ void wpa_auth_set_ml_info(struct wpa_state_machine *sm, const u8 *mld_addr, |
| 84 | return; |
| 85 | |
| 86 | os_memset(sm->mld_links, 0, sizeof(sm->mld_links)); |
| 87 | + sm->n_mld_affiliated_links = 0; |
| 88 | |
| 89 | wpa_auth_logger(sm->wpa_auth, wpa_auth_get_spa(sm), LOGGER_DEBUG, |
| 90 | "MLD: Initialization"); |
| 91 | -- |
| 92 | 2.39.2 |
| 93 | |