From: Johannes Berg <johannes@sipsolutions.net>
To: Eliad Peller <eliad@wizery.com>
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
Dmitry Tarnyagin <abi.dmitryt@gmail.com>
Subject: Re: [PATCH] cfg80211: fix cmp_hidden_bss
Date: Thu, 29 Nov 2012 01:28:14 +0100 [thread overview]
Message-ID: <1354148894.26800.0.camel@jlt4.sipsolutions.net> (raw)
In-Reply-To: <CAB3XZEcr_D6hKKcwtXxTbH3quQ4TT_ZjjnbWOvHWSnAP+=Mw2Q@mail.gmail.com> (sfid-20121129_010753_910972_25A7443C)
On Thu, 2012-11-29 at 02:07 +0200, Eliad Peller wrote:
> On Thu, Nov 29, 2012 at 2:00 AM, Johannes Berg
> <johannes@sipsolutions.net> wrote:
> > On Thu, 2012-11-29 at 01:53 +0200, Eliad Peller wrote:
> >> On Wed, Nov 28, 2012 at 11:44 PM, Johannes Berg
> >> <johannes@sipsolutions.net> wrote:
> >> > From: Johannes Berg <johannes.berg@intel.com>
> >> >
> >> > 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.
> >
> >> > +++ b/net/wireless/scan.c
> >> > @@ -472,7 +472,7 @@ static int cmp_hidden_bss(struct cfg80211_bss *a, struct cfg80211_bss *b)
> >> > /* zeroed SSID ie is another indication of a hidden bss */
> >> > for (i = 0; i < ie2[1]; i++)
> >> > if (ie2[i + 2])
> >> > - return -1;
> >> > + return 1;
> >> >
> >> > return 0;
> >> > }
> >>
> >> maybe i'm misreading it, but there is still no comparison here at all,
> >> so it seems wrong as well :)
> >> (practically, i guess it doesn't really matter, because if there is
> >> some non-null char, this is not a hidden ssid anyway)
> >
> > Hmm yeah you're right, it should be
> > return ie2[i + 1] - ie1[i + 1];
> >
> > (or the other way around? need to sleep on that first...)
> >
> that's also not enough, because you ignore the previous chars.
> ("A" < "B" vs. "AA" > "\x00B")
>
> i think returning memcmp() is the easiest solution, but sleeping on
> that is definitely a good idea :)
Hmm, yeah, indeed. If we find a non-zero byte we should return memcmp().
I'll fix it in the morning :)
johannes
next prev parent reply other threads:[~2012-11-29 0:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-28 21:44 [PATCH] cfg80211: fix cmp_hidden_bss Johannes Berg
2012-11-28 23:53 ` Eliad Peller
2012-11-29 0:00 ` Johannes Berg
2012-11-29 0:07 ` Eliad Peller
2012-11-29 0:28 ` Johannes Berg [this message]
2012-11-29 9:01 ` [PATCH v2] " Johannes Berg
2012-11-29 9:42 ` Eliad Peller
2012-11-29 10:48 ` [PATCH v3] " Johannes Berg
2012-11-30 12:43 ` Johannes Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1354148894.26800.0.camel@jlt4.sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=abi.dmitryt@gmail.com \
--cc=eliad@wizery.com \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox