2011-08-02 17:35:31

by Daniel Drake

[permalink] [raw]
Subject: Making sense of cfg80211_scan_request.n_ssids

Hi,

I'm looking at libertas scanning code, and I'm wondering exactly what
the cfg80211_scan_request.n_ssids field is supposed to mean.

I would guess that it is supposed to indicate how many SSIDs should be
explicitly scanned for. However, this doesn't seem to be the case.

iwlist eth0 scan essid test
iw dev eth0 scan ssid test

Both of those commands result in libertas being called with
cfg80211_scan_request with n_ssids=1 and the "test" SSID present in
cfg80211_scan_request.ssids[0], as expected.


iwlist eth0 scan
iw dev eth0 scan

Both of those commands result in libertas being called with
cfg80211_scan_request with n_ssids=1 and a zero-length SSID present in
cfg80211_scan_request.ssids[0].
Is this a bug? I would expect it to be passed n_ssids=0 in this case.

Thanks,
Daniel


2011-08-08 08:37:24

by Johannes Berg

[permalink] [raw]
Subject: Re: Making sense of cfg80211_scan_request.n_ssids

On Tue, 2011-08-02 at 18:10 -0400, Pavel Roskin wrote:

> > Both of those commands result in libertas being called with
> > cfg80211_scan_request with n_ssids=1 and the "test" SSID present in
> > cfg80211_scan_request.ssids[0], as expected.
> >
> >
> > iwlist eth0 scan
> > iw dev eth0 scan
> >
> > Both of those commands result in libertas being called with
> > cfg80211_scan_request with n_ssids=1 and a zero-length SSID present in
> > cfg80211_scan_request.ssids[0].
> > Is this a bug? I would expect it to be passed n_ssids=0 in this case.
>
> I believe n_ssids is the number of probe requests to be sent per
> channel. It scanning for all SSIDs, one probe request is sent. It is
> only for passive scanning that we don't need any probes.

Yeah. "iw dev eth0 scan passive" will cause n_ssids to be 0.

johannes


2011-08-09 09:42:37

by Luciano Coelho

[permalink] [raw]
Subject: Re: Making sense of cfg80211_scan_request.n_ssids

On Tue, 2011-08-09 at 11:40 +0200, Johannes Berg wrote:
> On Tue, 2011-08-09 at 12:36 +0300, Luciano Coelho wrote:
>
> > > Yeah. "iw dev eth0 scan passive" will cause n_ssids to be 0.
> >
> > I think the question was slightly different. As I understand, Daniel
> > wants to know why the n_ssids is 1 even if no SSID is passed from user
> > space.
>
> Well, actually, in the iw scan/iwlist scan case an SSID _is_ passed from
> userspace: the zero-length wildcard SSID. I made iw do that because an
> active scan is more useful :-)

Yep, I can't agree more. :)


--
Cheers,
Luca.


2011-08-09 09:36:05

by Luciano Coelho

[permalink] [raw]
Subject: Re: Making sense of cfg80211_scan_request.n_ssids

On Mon, 2011-08-08 at 10:37 +0200, Johannes Berg wrote:
> On Tue, 2011-08-02 at 18:10 -0400, Pavel Roskin wrote:
>
> > > Both of those commands result in libertas being called with
> > > cfg80211_scan_request with n_ssids=1 and the "test" SSID present in
> > > cfg80211_scan_request.ssids[0], as expected.
> > >
> > >
> > > iwlist eth0 scan
> > > iw dev eth0 scan
> > >
> > > Both of those commands result in libertas being called with
> > > cfg80211_scan_request with n_ssids=1 and a zero-length SSID present in
> > > cfg80211_scan_request.ssids[0].
> > > Is this a bug? I would expect it to be passed n_ssids=0 in this case.
> >
> > I believe n_ssids is the number of probe requests to be sent per
> > channel. It scanning for all SSIDs, one probe request is sent. It is
> > only for passive scanning that we don't need any probes.
>
> Yeah. "iw dev eth0 scan passive" will cause n_ssids to be 0.

I think the question was slightly different. As I understand, Daniel
wants to know why the n_ssids is 1 even if no SSID is passed from user
space.

A zero-length SSID is a broadcast SSID. So probe requests *will* be
sent, but with the broadcast SSID. If you explicitly ask for a passive
scan (as Johannes mentioned), then n_ssids will be 0 which means that no
probe requests should be sent at all.

The n_ssids field is the number of *different* probe_reqs that will be
sent per channel. Some drivers will send more than one probe_req with
the same SSID per channel (eg. wl12xx sends 2 probe_reqs per SSID on
each channel).


--
Cheers,
Luca.


2011-08-09 09:40:16

by Johannes Berg

[permalink] [raw]
Subject: Re: Making sense of cfg80211_scan_request.n_ssids

On Tue, 2011-08-09 at 12:36 +0300, Luciano Coelho wrote:

> > Yeah. "iw dev eth0 scan passive" will cause n_ssids to be 0.
>
> I think the question was slightly different. As I understand, Daniel
> wants to know why the n_ssids is 1 even if no SSID is passed from user
> space.

Well, actually, in the iw scan/iwlist scan case an SSID _is_ passed from
userspace: the zero-length wildcard SSID. I made iw do that because an
active scan is more useful :-)

johannes


2011-08-02 22:10:09

by Pavel Roskin

[permalink] [raw]
Subject: Re: Making sense of cfg80211_scan_request.n_ssids

On 08/02/2011 01:35 PM, Daniel Drake wrote:
> Hi,
>
> I'm looking at libertas scanning code, and I'm wondering exactly what
> the cfg80211_scan_request.n_ssids field is supposed to mean.
>
> I would guess that it is supposed to indicate how many SSIDs should be
> explicitly scanned for. However, this doesn't seem to be the case.
>
> iwlist eth0 scan essid test
> iw dev eth0 scan ssid test
>
> Both of those commands result in libertas being called with
> cfg80211_scan_request with n_ssids=1 and the "test" SSID present in
> cfg80211_scan_request.ssids[0], as expected.
>
>
> iwlist eth0 scan
> iw dev eth0 scan
>
> Both of those commands result in libertas being called with
> cfg80211_scan_request with n_ssids=1 and a zero-length SSID present in
> cfg80211_scan_request.ssids[0].
> Is this a bug? I would expect it to be passed n_ssids=0 in this case.

I believe n_ssids is the number of probe requests to be sent per
channel. It scanning for all SSIDs, one probe request is sent. It is
only for passive scanning that we don't need any probes.

--
Regards,
Pavel Roskin