[PATCH] Prevent explicit scan command during scan or association

Jouni Malinen j at w1.fi
Mon Apr 11 14:44:11 EDT 2011


On Fri, Apr 08, 2011 at 03:45:12PM -0700, Dmitry Shmidt wrote:
> diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
> index 4f3f7e0..c48d1a7 100644
> @@ -3181,8 +3181,14 @@ char * wpa_supplicant_ctrl_iface_process(struct
> wpa_supplicant *wpa_s,
>  		if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED)
>  			reply_len = -1;
>  		else {
> -			wpa_s->scan_req = 2;
> -			wpa_supplicant_req_scan(wpa_s, 0, 0);
> +			if (!wpa_s->scanning &&
> +			    ((wpa_s->wpa_state <= WPA_SCANNING) ||
> +			     (wpa_s->wpa_state == WPA_COMPLETED))) {
> +				wpa_s->scan_req = 2;
> +				wpa_supplicant_req_scan(wpa_s, 0, 0);
> +			} else {
> +				wpa_printf(MSG_ERROR, "Ongoing Scan action");
> +			}

Hmm.. This would still indicate success to the program that requested
the scan. That does not sound reasonable. At minimum, this would need to
return something like FAIL-BUSY instead of OK in the case that the
request was not accepted. It should also be noted that scan request can
be made over the D-Bus interface and it would probably be a good idea to
handle these in the same way with the ctrl_interface command.

-- 
Jouni Malinen                                            PGP id EFC895FA


More information about the HostAP mailing list