]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
WNM: Skip current connection BSS when disassociate imminent is set
authorAndrei Otcheretianski <andrei.otcheretianski@intel.com>
Wed, 13 Dec 2023 14:04:12 +0000 (16:04 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 16 Dec 2023 18:40:23 +0000 (20:40 +0200)
During scan results matching for connection skip BSS entries for the
current connection if disassociation imminent is set.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
wpa_supplicant/events.c
wpa_supplicant/wnm_sta.c
wpa_supplicant/wnm_sta.h
wpa_supplicant/wpa_supplicant.c

index dd988e7b37bd094e4866b8a1e9da32709b0e1a32..7bea6498691bbdb3148ba1049997fade96d27049 100644 (file)
@@ -386,6 +386,9 @@ void wpa_supplicant_mark_disassoc(struct wpa_supplicant *wpa_s)
        wpas_rrm_reset(wpa_s);
 #endif /* CONFIG_NO_RRM */
        wpa_s->wnmsleep_used = 0;
+#ifdef CONFIG_WNM
+       wpa_s->wnm_mode = 0;
+#endif /* CONFIG_WNM */
        wnm_clear_coloc_intf_reporting(wpa_s);
        wpa_s->disable_mbo_oce = 0;
 
@@ -1689,6 +1692,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))
index fa9ab0e3ee34387b902924fc15e1d21ed50a1c4b..d121c1bb9da6663c13f2b0d0e9f8f956736ba5c0 100644 (file)
@@ -2068,3 +2068,41 @@ void wnm_clear_coloc_intf_reporting(struct wpa_supplicant *wpa_s)
        wpa_s->coloc_intf_dialog_token = 0;
        wpa_s->coloc_intf_auto_report = 0;
 }
+
+
+bool wnm_is_bss_excluded(struct wpa_supplicant *wpa_s, struct wpa_bss *bss)
+{
+       unsigned int i;
+
+       if (!(wpa_s->wnm_mode & WNM_BSS_TM_REQ_DISASSOC_IMMINENT))
+               return false;
+
+       /*
+        * In case disassociation imminent is set, do no try to use a BSS to
+        * which we are connected.
+        */
+
+       if (wpa_s->current_bss &&
+           os_memcmp(wpa_s->current_bss->bssid, bss->bssid, ETH_ALEN) == 0) {
+               wpa_dbg(wpa_s, MSG_DEBUG,
+                       "WNM: Disassociation imminent: current BSS");
+               return true;
+       }
+
+       if (!wpa_s->valid_links)
+               return false;
+
+       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) == 0) {
+                       wpa_dbg(wpa_s, MSG_DEBUG,
+                               "WNM: MLD: Disassociation imminent: current link");
+                       return true;
+               }
+       }
+
+       return false;
+}
index e4957e48aa202b857121b4292da1df7d1ddab52b..2a473db4e8e6ed29bf04274d2c4dec35f22b4ee6 100644 (file)
@@ -70,6 +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);
+bool wnm_is_bss_excluded(struct wpa_supplicant *wpa_s, struct wpa_bss *bss);
 
 
 #ifdef CONFIG_WNM
index 732a2e1324ca0aeb962a5e2cd49121544cae6d8b..134ba39c530211c50b1220fe0b63a7becccb3cbc 100644 (file)
@@ -2495,6 +2495,9 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
 #ifndef CONFIG_NO_WMM_AC
        wmm_ac_clear_saved_tspecs(wpa_s);
 #endif /* CONFIG_NO_WMM_AC */
+#ifdef CONFIG_WNM
+       wpa_s->wnm_mode = 0;
+#endif /* CONFIG_WNM */
        wpa_s->reassoc_same_bss = 0;
        wpa_s->reassoc_same_ess = 0;
 #ifdef CONFIG_TESTING_OPTIONS