[PATCH] Disable bgscan for modes other than infrastructure

Pavel Roskin proski at gnu.org
Tue Aug 2 18:37:54 EDT 2011


On 07/28/2011 02:32 AM, Bartosz.Markowski at tieto.com wrote:
> Signed-off-by: Bartosz Markowski<bartosz.markowski at tieto.com>
> ---
>   wpa_supplicant/wpa_supplicant.c |    3 +++
>   1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
> index 3f3e435..7a11b21 100644
> --- a/wpa_supplicant/wpa_supplicant.c
> +++ b/wpa_supplicant/wpa_supplicant.c
> @@ -527,6 +527,9 @@ const char * wpa_supplicant_state_txt(enum wpa_states state)
>
>   static void wpa_supplicant_start_bgscan(struct wpa_supplicant *wpa_s)
>   {
> +       if (wpa_s->current_ssid->mode)
> +               return;

I think it would be better to write:

if (wpa_s->current_ssid->mode != WPAS_MODE_INFRA)

This would make the code more robust and clear.  The code won't break if 
the numeric value of WPAS_MODE_INFRA changes.  And the meaning of the 
code becomes clear without reading the log.

-- 
Regards,
Pavel Roskin


More information about the HostAP mailing list