]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
wext: Suppress kernel generated disassoc event
authorBenjamin Berg <benjamin.berg@intel.com>
Tue, 5 Aug 2025 15:13:14 +0000 (17:13 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 6 Oct 2025 17:07:28 +0000 (20:07 +0300)
wpa_supplicant already generates the event internally when
disassociating. In the case of a new association, such an event may also
be generated by the kernel for the previous connection and needs to be
ignored.

Without this fix the next commit that optimizes the scanning behavior on
connection failures would trigger an unexpected failure in the
wext_pmska_cache hwsim test.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
src/drivers/driver_wext.c
src/drivers/driver_wext.h

index 189408d7168c13d42f280136aeed163881c01611..d884e75923cd2a9b3fb674838dac49032909fb07 100644 (file)
@@ -461,13 +461,18 @@ static void wpa_driver_wext_event_wireless(struct wpa_driver_wext_data *drv,
                                drv->assoc_req_ies = NULL;
                                os_free(drv->assoc_resp_ies);
                                drv->assoc_resp_ies = NULL;
-                               wpa_supplicant_event(drv->ctx, EVENT_DISASSOC,
-                                                    NULL);
 
+                               if (!drv->ignore_next_disconnect) {
+                                       wpa_supplicant_event(drv->ctx,
+                                                            EVENT_DISASSOC,
+                                                            NULL);
+                                       drv->ignore_next_disconnect = false;
+                               }
                        } else {
                                wpa_driver_wext_event_assoc_ies(drv);
                                wpa_supplicant_event(drv->ctx, EVENT_ASSOC,
                                                     NULL);
+                               drv->ignore_next_disconnect = false;
                        }
                        break;
                case IWEVMICHAELMICFAILURE:
@@ -1891,6 +1896,9 @@ static void wpa_driver_wext_disconnect(struct wpa_driver_wext_data *drv)
                                   "SSID to disconnect");
                }
        }
+
+       /* wpa_supplicant generates a disconnect event internally already */
+       drv->ignore_next_disconnect = true;
 }
 
 
@@ -2124,6 +2132,9 @@ int wpa_driver_wext_associate(void *priv,
            wpa_driver_wext_set_ssid(drv, params->ssid, params->ssid_len) < 0)
                ret = -1;
 
+       /* Ignore spurious disconnect event if we are reassociating */
+       drv->ignore_next_disconnect = true;
+
        return ret;
 }
 
index 6214cdf42a6887628ae4ed7ad303e3b9ef7c7456..1c6144770f3ff0d94c701754cc8ffc64b8ae2a9a 100644 (file)
@@ -44,6 +44,8 @@ struct wpa_driver_wext_data {
        int cfg80211; /* whether driver is using cfg80211 */
 
        u8 max_level;
+
+       bool ignore_next_disconnect;
 };
 
 int wpa_driver_wext_get_bssid(void *priv, u8 *bssid);