Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Nov 2017 08:59:20 -0800
From:      Adrian Chadd <adrian.chadd@gmail.com>
To:        Farhan Khan <khanzf@gmail.com>
Cc:        "freebsd-wireless@freebsd.org" <freebsd-wireless@freebsd.org>
Subject:   Re: ieee80211 scan function starting point
Message-ID:  <CAJ-VmonGPznLGzftHv5QxP8qvs8_tbHt2RXMuWyJq53yVxYpeA@mail.gmail.com>
In-Reply-To: <e1b4b026-a166-d8a7-e779-53a6b1a94608@gmail.com>
References:  <e1b4b026-a166-d8a7-e779-53a6b1a94608@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
hi!

So, the scan portion works a couple ways.

Firstly, the interface moves to mode IEEE80211_S_SCAN . That's when
it's looking for networks to connect to.

Secondly, it marks a FEXT or a normal flag SCAN, which says "i'm doing
scanning as well as normal receive." Think of this for example like
doing a background scan whilst doing traffic.

The routines in ieee80211_scan.c and ieee80211_scan_sw.c and
ieee80211_scan_sta.c take care of starting the scan, changing channels
if needed, etc.

There are two paths here.

ieee80211_scan_sw.c implements the net80211 controlled scanner. This
schedules channel changes, background scanning, etc. Most drivers do
this.

Drivers that implement scanning in the driver/firmware instead tie
into the scan routines and will start their own scans. rsu, iwm, iwn
do this - they send a scan command to the firmware. It doesn't require
normal traffic to be stopped; the firmware takes care of scheduling
when to do scanning and when to do data!

Then there's two paths into populating the scan cache.

One - the device (eg almost everything) just pass up received beacons
in scan mode. ieee80211_input_sta() will filter out the relevant
beacon frames. Look at sta_recv_mgmt(), SUBTYPE_BEACON, it'll
eventually end up at ieee80211_add_scan() .

Two - intelligent devices can populate the scan cache directly. I
think if_ndis does this (via a call to ieee80211_add_scan()).
Everything else so far returns beacon frames as RX frames when
scanning.

So, that's why I said "do monitor mode first." Ideally you'd like to
get monitor mode RX working first. Once you get beacons showing up in
an 802.11 tcpdump you know you're ready for doing STA mode (and
transmit!).


-adrian

On 13 November 2017 at 08:40, Farhan Khan <khanzf@gmail.com> wrote:
> Hi all,
>
> I am trying to get the "ifconfig wlan0 list scan" command to display local
> access points. I am fairly certain I have the "up" part working (loading
> firmware, turning it on) but the scan portion does not yet.
>
> I am trying to identify what functions I might have missed with dtrace, but
> I do not know where to start off and the probes are too rapid to identify
> where it starts when I run the "ifconfig" command. I am fairly certain it
> originates in ieee80211 and kicks that off to the driver, but I cannot
> easily identify where.
>
> Does anyone know where? Thank you.
>
> Farhan
> _______________________________________________
> freebsd-wireless@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-wireless
> To unsubscribe, send any mail to "freebsd-wireless-unsubscribe@freebsd.org"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJ-VmonGPznLGzftHv5QxP8qvs8_tbHt2RXMuWyJq53yVxYpeA>