[PATCH 03/11] wpa_s: use sched_scan in driver init

Jouni Malinen j
Sat Oct 15 09:10:48 PDT 2011

On Tue, Sep 27, 2011 at 10:21:31PM +0300, Luciano Coelho wrote:
> This patch uses sched_scan, if available, when the driver is
> initialized.  It also adds a couple of cancel operations where
> appropriate.

> diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
> @@ -990,10 +990,14 @@ static int _wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s,
> +				wpa_supplicant_req_new_scan(wpa_s, timeout_sec,
> +							    timeout_usec);
> +				return 0;
>  			}
>  #endif /* CONFIG_P2P */
> -			wpa_supplicant_req_new_scan(wpa_s, timeout_sec,
> -						    timeout_usec);
> +			if(wpa_supplicant_req_sched_scan(wpa_s))
> +				wpa_supplicant_req_new_scan(wpa_s, timeout_sec,
> +							    timeout_usec);

This disables code in wpa_supplicant_req_new_scan() to move into
WPA_INACTIVE state if no networks are enabled. If I understood
wpa_supplicant_req_sched_scan() correctly, it would not actually
schedule a scan since params.num_ssids would be 0. However, it would
set wpa_state to WPA_SCANNING and leave it at that even in such a case..
I would assume this was not on purpose, so at minimum the
!params.num_ssids case would need to revert the wpa_state change or the
call here could be changed to figure out whether we should go to
WPA_INACTIVE state just like wpa_supplicant_req_new_scan() is doing.

Jouni Malinen                                            PGP id EFC895FA

More information about the Hostap mailing list