[PATCH 2/7] Automatic Scanning support added

Tomasz Bursztyka tomasz.bursztyka
Mon Apr 23 05:54:54 PDT 2012


Hi Alexander,

> Regarding this snippet, I'd suggest to do it slightly different - trigger scan only if candidate not found:
>
> diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
> index 8fdc544..ca5f415 100644
> --- a/wpa_supplicant/events.c
> +++ b/wpa_supplicant/events.c
> @@ -1135,9 +1135,10 @@ static int _wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s,
>                                  return 0;
>                          }
>   #endif /* CONFIG_P2P */
> -                       if (wpa_supplicant_req_sched_scan(wpa_s))
> -                               wpa_supplicant_req_new_scan(wpa_s, timeout_sec,
> -                                                           timeout_usec);
> +                        if (autoscan_notify_scan(wpa_s, scan_res)) {
> +                               wpa_scan_results_free(scan_res);
> +                               return 0;
> +                        }
>                  }
>          }
>          return 0;
The scan is already triggered if no candidate has been selected. See 
wpa_supplicant_pick_network()/wpa_supplicant_pick_new_network() above in 
events.c  so I don't see why you do that.
Calling autoscan_notify_scan() does not trigger a scan (and anyway here 
you are creating a bug: scan_res has been freed already and not set to 
null, so if the autoscan module eventually touches it, it will 
definitely crash.)
autoscan_notify_scan() is necessary to set up the new scan interval and 
the scan parameters (if any), that's why is it called before any network 
selection is done prior to the results and prior to any scan. Check my 
second version of the patchset, I think it solves what you requested 
(being able to manipulate scan parameters in autoscan module).

Br,

Tomasz





More information about the Hostap mailing list