[PATCH 2/2] wpa_s: use minimal scan delay upon EVENT_INTERFACE_ADDED

Arend van Spriel arend
Wed Jan 15 01:11:33 PST 2014

This patch resets the static interface_count to zero in case of
wpa_supplicant_driver_init() call for wpa_s which is in DISABLED
state. This interface_count is used for the delay of the scan
which is now minimal so a reconnect. This may collide with a scan
for another interface, but the same is true for any chosen delay
in this scenario. Also the state change to DISCONNECTED is moved
to wpa_supplicant_driver_init() so it will move from DISABLED to
INACTIVE when there are no enabled networks.

Tested-by: Hante Meuleman <meuleman at broadcom.com>
Signed-off-by: Arend van Spriel <arend at broadcom.com>
 wpa_supplicant/events.c         |    1 -
 wpa_supplicant/wpa_supplicant.c |    4 ++++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index 632f0fe..2121bf0 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -2311,7 +2311,6 @@ wpa_supplicant_event_interface_status(struct wpa_supplicant *wpa_s,
 			wpa_msg(wpa_s, MSG_INFO, "Failed to initialize the "
 				"driver after interface was added");
-		wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED);
 		wpa_dbg(wpa_s, MSG_DEBUG, "Configured interface was removed");
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index a2281f1..86f8eac 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -2622,6 +2622,10 @@ int wpa_supplicant_driver_init(struct wpa_supplicant *wpa_s)
 	wpa_s->prev_scan_wildcard = 0;
 	if (wpa_supplicant_enabled_networks(wpa_s)) {
+		if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED) {
+			wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED);
+			interface_count = 0;
+		}
 		if (wpa_supplicant_delayed_sched_scan(wpa_s, interface_count,
 			wpa_supplicant_req_scan(wpa_s, interface_count,

More information about the Hostap mailing list