diff mbox series

[6/8] WNM: Handle BTM request with "Link Removal Imminent"

Message ID 20231213140412.326465-6-andrei.otcheretianski@intel.com
State Accepted
Headers show
Series [1/8] AP: WNM: Use correct address when configured as AP MLD | expand

Commit Message

Andrei Otcheretianski Dec. 13, 2023, 2:04 p.m. UTC
From: Ilan Peer <ilan.peer@intel.com>

Based on Draft P802.11be_D3.0, when a station is non-AP MLD with more
then one link and "Link Removal Imminent" is set, the "Disassociation
Imminent" and "BSS Termination Included" can be ignored, as the station
will not be disassociated.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
---
 src/common/ieee802_11_defs.h | 11 ++++++-----
 wpa_supplicant/wnm_sta.c     | 14 ++++++++++++++
 2 files changed, 20 insertions(+), 5 deletions(-)

Comments

Jouni Malinen Dec. 16, 2023, 6:54 p.m. UTC | #1
On Wed, Dec 13, 2023 at 04:04:10PM +0200, Andrei Otcheretianski wrote:
> Based on Draft P802.11be_D3.0, when a station is non-AP MLD with more
> then one link and "Link Removal Imminent" is set, the "Disassociation
> Imminent" and "BSS Termination Included" can be ignored, as the station
> will not be disassociated.

That is not what the standard says.. Those two bits are not being
"ignored". In particular, there is a specific meaning for BSS
Termination Included value 0 which is clearly not supposed to be
ignored..

> diff --git a/wpa_supplicant/wnm_sta.c b/wpa_supplicant/wnm_sta.c
> +	/*
> +	 * Based on Draft P802.11be_D3.0, when a station is non-AP MLD with more
> +	 * then one link and "link removal imminent" is set, the below flags can
> +	 * be ignored, as the station will not be disassociated.
> +	 */
> +	if ((wpa_s->valid_links & (wpa_s->valid_links - 1)) != 0 &&
> +	    wpa_s->wnm_mode & WNM_BSS_TM_REQ_LINK_REMOVAL_IMMINENT &&
> +	    (wpa_s->wnm_mode & WNM_BSS_TM_REQ_DISASSOC_IMMINENT ||
> +	     wpa_s->wnm_mode & WNM_BSS_TM_REQ_BSS_TERMINATION_INCLUDED)) {
> +		wpa_printf(MSG_INFO,
> +			   "WNM: BTM request for single MLO link. ignore");
> +		return;
> +	}

So those conditions are incorrect since the link removal case applies
only if BSS Termination Included is set to 1. Furthermore, I did not
find any justification from the standard to ignore the BTM request
itself, i.e., this request still needs a response.

I fixed these and the test in the following patch to match the
functionality.

In addition, patch 8/8 broke functionality since it did not make sure
wpa_s->wnm_mode is cleared for new associations/disassociations and the
old value was incorrectly used for cases where there had been no
disassociation imminent indication.

I applied all eight patches with cleanup and fixes.
diff mbox series

Patch

diff --git a/src/common/ieee802_11_defs.h b/src/common/ieee802_11_defs.h
index cd33f6a8f5..2d865e639c 100644
--- a/src/common/ieee802_11_defs.h
+++ b/src/common/ieee802_11_defs.h
@@ -1880,11 +1880,12 @@  enum wnm_action {
 };
 
 /* IEEE 802.11v - BSS Transition Management Request - Request Mode */
-#define WNM_BSS_TM_REQ_PREF_CAND_LIST_INCLUDED BIT(0)
-#define WNM_BSS_TM_REQ_ABRIDGED BIT(1)
-#define WNM_BSS_TM_REQ_DISASSOC_IMMINENT BIT(2)
-#define WNM_BSS_TM_REQ_BSS_TERMINATION_INCLUDED BIT(3)
-#define WNM_BSS_TM_REQ_ESS_DISASSOC_IMMINENT BIT(4)
+#define WNM_BSS_TM_REQ_PREF_CAND_LIST_INCLUDED   BIT(0)
+#define WNM_BSS_TM_REQ_ABRIDGED                  BIT(1)
+#define WNM_BSS_TM_REQ_DISASSOC_IMMINENT         BIT(2)
+#define WNM_BSS_TM_REQ_BSS_TERMINATION_INCLUDED  BIT(3)
+#define WNM_BSS_TM_REQ_ESS_DISASSOC_IMMINENT     BIT(4)
+#define WNM_BSS_TM_REQ_LINK_REMOVAL_IMMINENT     BIT(5)
 
 /* IEEE Std 802.11-2012 - Table 8-253 */
 enum bss_trans_mgmt_status_code {
diff --git a/wpa_supplicant/wnm_sta.c b/wpa_supplicant/wnm_sta.c
index 493821b37f..bcbd8c04c9 100644
--- a/wpa_supplicant/wnm_sta.c
+++ b/wpa_supplicant/wnm_sta.c
@@ -1479,6 +1479,20 @@  static void ieee802_11_rx_bss_trans_mgmt_req(struct wpa_supplicant *wpa_s,
 	}
 #endif /* CONFIG_MBO && CONFIG_TESTING_OPTIONS */
 
+	/*
+	 * Based on Draft P802.11be_D3.0, when a station is non-AP MLD with more
+	 * then one link and "link removal imminent" is set, the below flags can
+	 * be ignored, as the station will not be disassociated.
+	 */
+	if ((wpa_s->valid_links & (wpa_s->valid_links - 1)) != 0 &&
+	    wpa_s->wnm_mode & WNM_BSS_TM_REQ_LINK_REMOVAL_IMMINENT &&
+	    (wpa_s->wnm_mode & WNM_BSS_TM_REQ_DISASSOC_IMMINENT ||
+	     wpa_s->wnm_mode & WNM_BSS_TM_REQ_BSS_TERMINATION_INCLUDED)) {
+		wpa_printf(MSG_INFO,
+			   "WNM: BTM request for single MLO link. ignore");
+		return;
+	}
+
 	pos += 5;
 
 	if (wpa_s->wnm_mode & WNM_BSS_TM_REQ_BSS_TERMINATION_INCLUDED) {