[PATCH 8/8] WNM: Skip current connection BSS when disassociate imminent is set

Andrei Otcheretianski andrei.otcheretianski at intel.com
Wed Dec 13 06:04:12 PST 2023


During scan results matching for connection skip BSS entires for the
current connection if disassociation imminent is set.

Signed-off-by: Ilan Peer <ilan.peer at intel.com>
Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski at intel.com>
---
 wpa_supplicant/events.c  |  8 ++++++++
 wpa_supplicant/wnm_sta.c | 37 +++++++++++++++++++++++++++++++++++++
 wpa_supplicant/wnm_sta.h |  2 +-
 3 files changed, 46 insertions(+), 1 deletion(-)

diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index 4644f54888..600d27d5b3 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -1689,6 +1689,14 @@ struct wpa_ssid * wpa_scan_res_match(struct wpa_supplicant *wpa_s,
 		return NULL;
 	}
 
+#ifdef CONFIG_WNM
+	if (wnm_is_bss_excluded(wpa_s, bss)) {
+		if (debug_print)
+			wpa_dbg(wpa_s, MSG_DEBUG, "   skip - BSSID excluded");
+		return NULL;
+	}
+#endif /* CONFIG_WNM */
+
 	for (ssid = group; ssid; ssid = only_first_ssid ? NULL : ssid->pnext) {
 		if (wpa_scan_res_ok(wpa_s, ssid, match_ssid, match_ssid_len,
 				    bss, bssid_ignore_count, debug_print))
diff --git a/wpa_supplicant/wnm_sta.c b/wpa_supplicant/wnm_sta.c
index bcbd8c04c9..6a2c874475 100644
--- a/wpa_supplicant/wnm_sta.c
+++ b/wpa_supplicant/wnm_sta.c
@@ -2058,3 +2058,40 @@ void wnm_clear_coloc_intf_reporting(struct wpa_supplicant *wpa_s)
 	wpa_s->coloc_intf_auto_report = 0;
 #endif /* CONFIG_WNM */
 }
+
+int wnm_is_bss_excluded(struct wpa_supplicant *wpa_s, struct wpa_bss *bss)
+{
+	/*
+	 * In case disassociation imminent is set, do no try to use a BSS to
+	 * which we are connected.
+	 */
+	if (wpa_s->wnm_mode & WNM_BSS_TM_REQ_DISASSOC_IMMINENT) {
+		unsigned int i;
+
+		if (wpa_s->current_bss &&
+		    !os_memcmp(wpa_s->current_bss->bssid,
+			       bss->bssid,
+			       ETH_ALEN)) {
+			wpa_dbg(wpa_s, MSG_DEBUG,
+				"WNM: disassociation imminent: current BSS");
+			return 1;
+		}
+
+		if (!wpa_s->valid_links)
+			return 0;
+
+		for (i = 0; i < MAX_NUM_MLD_LINKS; i++) {
+			if (!(wpa_s->valid_links & BIT(i)))
+				continue;
+
+			if (!os_memcmp(wpa_s->links[i].bssid,
+				       bss->bssid, ETH_ALEN)) {
+				wpa_dbg(wpa_s, MSG_DEBUG,
+					"WNM: MLD: disassociation imminent");
+				return 1;
+			}
+		}
+	}
+
+	return 0;
+}
diff --git a/wpa_supplicant/wnm_sta.h b/wpa_supplicant/wnm_sta.h
index e4957e48aa..6f2408e9eb 100644
--- a/wpa_supplicant/wnm_sta.h
+++ b/wpa_supplicant/wnm_sta.h
@@ -70,7 +70,7 @@ int wnm_send_coloc_intf_report(struct wpa_supplicant *wpa_s, u8 dialog_token,
 			       const struct wpabuf *elems);
 void wnm_set_coloc_intf_elems(struct wpa_supplicant *wpa_s,
 			      struct wpabuf *elems);
-
+int wnm_is_bss_excluded(struct wpa_supplicant *wpa_s, struct wpa_bss *bss);
 
 #ifdef CONFIG_WNM
 
-- 
2.38.1




More information about the Hostap mailing list