From a0e9d89203d9dfdf80fc807327b05a0bb4d355c7 Mon Sep 17 00:00:00 2001 From: Arend van Spriel Date: Wed, 15 Jan 2014 10:11:33 +0100 Subject: [PATCH] Use minimal scan delay upon EVENT_INTERFACE_ADDED This patch resets the static interface_count to zero in case of wpa_supplicant_driver_init() call for wpa_s which is in INTERFACE_DISABLED state. This interface_count is used for the delay of the scan which is now minimal for dynamically added interfaces. 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 INTERFACE_DISABLED to INACTIVE when there are no enabled networks. Tested-by: Hante Meuleman Signed-off-by: Arend van Spriel --- 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 632f0fe01..2121bf014 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); break; case EVENT_INTERFACE_REMOVED: 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 b7c16caaf..aa9c32d6d 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -2623,6 +2623,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, 100000)) wpa_supplicant_req_scan(wpa_s, interface_count,