[PATCH v2 1/4] wext: suppress kernel generated disassoc event
Benjamin Berg
benjamin at sipsolutions.net
Tue Aug 5 08:13:14 PDT 2025
From: Benjamin Berg <benjamin.berg at intel.com>
The 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 patch that optimizes the scanning behaviour on
connection failures would trigger an unexpected failure in the
wext_pmska_cache hwsim test.
Signed-off-by: Benjamin Berg <benjamin.berg at intel.com>
---
src/drivers/driver_wext.c | 15 +++++++++++++--
src/drivers/driver_wext.h | 2 ++
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/src/drivers/driver_wext.c b/src/drivers/driver_wext.c
index c34c13b804..7243146ccc 100644
--- a/src/drivers/driver_wext.c
+++ b/src/drivers/driver_wext.c
@@ -460,13 +460,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:
@@ -1993,6 +1998,9 @@ static void wpa_driver_wext_disconnect(struct wpa_driver_wext_data *drv)
"SSID to disconnect");
}
}
+
+ /* The supplicant generates a disconnect event internally already */
+ drv->ignore_next_disconnect = true;
}
@@ -2226,6 +2234,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;
}
diff --git a/src/drivers/driver_wext.h b/src/drivers/driver_wext.h
index 6214cdf42a..1c6144770f 100644
--- a/src/drivers/driver_wext.h
+++ b/src/drivers/driver_wext.h
@@ -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);
--
2.50.1
More information about the Hostap
mailing list