[PATCH v2 1/4] wext: suppress kernel generated disassoc event

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Benjamin Berg <benjamin.berg@xxxxxxxxx>

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@xxxxxxxxx>
---
 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


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux