Search Linux Wireless

Re: [PATCH v2] cfg80211: fix cmp_hidden_bss

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Nov 29, 2012 at 11:01 AM, Johannes Berg
<johannes@xxxxxxxxxxxxxxxx> wrote:
> From: Johannes Berg <johannes.berg@xxxxxxxxx>
>
> The cmp_bss() comparator function uses memcmp() to
> compare the SSID. This means that cmp_hidden_bss()
> needs to similarly return a number bigger than zero
> (use 1) instead of -1 when ie1 is bigger than ie2,
> which is the case if an ie2 byte is non-zero.
>
> Signed-off-by: Johannes Berg <johannes.berg@xxxxxxxxx>
> ---
>  net/wireless/scan.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/net/wireless/scan.c b/net/wireless/scan.c
> index 9233910..456c342 100644
> --- a/net/wireless/scan.c
> +++ b/net/wireless/scan.c
> @@ -469,10 +469,14 @@ static int cmp_hidden_bss(struct cfg80211_bss *a, struct cfg80211_bss *b)
>         if (ie1[1] != ie2[1])
>                 return ie2[1] - ie1[1];
>
> -       /* zeroed SSID ie is another indication of a hidden bss */
> +       /*
> +        * zeroed SSID ie is another indication of a hidden bss;
> +        * if it isn't zeroed just return the regular sort value
> +        * to find the next candidate
> +        */
>         for (i = 0; i < ie2[1]; i++)
>                 if (ie2[i + 2])
> -                       return -1;
> +                       return memcmp(ie1 + 2, ie2 + 2, ie1[1]);
>
>         return 0;
>  }

btw, it might be worth noting that this comparator works correctly
only in one way (if hidden ssid is in "b")...

Eliad.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux