[PATCH] wpa_supplicant: Add 'SCAN TYPE=ONLY' functionality

Jouni Malinen j
Thu Feb 7 08:12:03 PST 2013


On Thu, Jan 17, 2013 at 10:32:35AM -0800, Dmitry Shmidt wrote:
> Usual manual scan request may cause reassociation due to several reasons.
> New command is intended to perform pure scan.

Thanks, applied with some small changes.

> diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c
> @@ -1583,3 +1584,14 @@ int wpa_supplicant_update_scan_results(struct wpa_supplicant *wpa_s)
> +void scan_only_handler(struct wpa_supplicant *wpa_s,
> +		       struct wpa_scan_results *scan_res)
> +{
> +	wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_SCAN_RESULTS);
> +	wpas_notify_scan_results(wpa_s);

I added a debug message and wpas_notify_scan_done() call here. The
latter is needed to keep D-Bus interface up-to-date with scans (and the
former to keep my sanity if I need to debug issues where a new scan does
not trigger something I might expect to happen there ;-).

> diff --git a/wpa_supplicant/wpa_cli.c b/wpa_supplicant/wpa_cli.c
> @@ -1459,6 +1459,8 @@ static int wpa_cli_cmd_save_config(struct wpa_ctrl *ctrl, int argc,
>  static int wpa_cli_cmd_scan(struct wpa_ctrl *ctrl, int argc, char *argv[])
>  {
> +	if (argc > 0)
> +		return wpa_cli_cmd(ctrl, "SCAN", 1, argc, argv);
>  	return wpa_ctrl_command(ctrl, "SCAN");
>  }

This can use wpa_cli_cmd() unconditionally to make the implementation a
bit simpler.

-- 
Jouni Malinen                                            PGP id EFC895FA



More information about the Hostap mailing list