Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 4 Aug 2018 18:32:13 -0400
From:      Farhan Khan <khanzf@gmail.com>
To:        freebsd-wireless@freebsd.org
Subject:   Where do monitor mode and STA mode begin to differ?
Message-ID:  <CAFd4kYB-0jm9OibSbosoH1Lh0B6%2BzQF9X=eXZC1GFBJXWyxCFg@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Hi all,

Is there anything in net80211(4)'s initialization that is different
between STA and monitor mode, specially around Rx?

Short explanation: My extension to rtwn(4)'s monitor mode works, I can
see arbitrary frames with tcpdump, but STA mode does not receive
anything except the probe requests it sends out itself. Every 30
seconds in STA mode I get this: "rtwn0: device timeout" and the device
re-initializes.

I suspect this is due to it not receiving any frames. What might be
initializing differently depending on if its STA or Monitor mode? If I
can find where that is, I might be able to make an adjustment. I do
not see anything that stands out in rtwn(4)'s init sequence, but I'll
give it another look. Is there anything in net80211(4) that happens
different based on the mode of the vap?

Verbose explanation: As Adrian suggested on IRC, I went through
rtwn_scan_start and rtwn_scan_end. This matched the Linux code. All
these lines did, however, was adjust the Rx filter to receive
beacons/probes from any BSSID, then uses ieee80211's probe functions
to send out probe requests for whatever the VAP's ssid is set to.

Running "tcpdump -ni wlan0 -y IEEE802_11_RADIO" **only** shows probes
from what the device is sending and dtrace probes do not show the
net80211(4) functions you would expect to happen to classify the
frame. On a separate device, I monitored for frames and saw the Probe
requests and responses to and from a test AP I setup, followed by an
empty probe requests, which is exactly what
ieee80211_swscan_probe_curchan() does. So Tx works. Great!

rtwn(4) performs filter initialization in rtwn_rxfilter_init(). I
checked that code to see if anything was being filtered that should
not and nothing stood out to me. I unfiltered everything using
rtwn_write_2(sc, R92C-RXFLTMAP0/1/2, 0xffff), and #IFDEF 0'd out the
entire function. Same result. I should also note that
rtwn_rxfilter_init() is used by every rtwn(4) device and is probably
standard for this Realtek series.

This suggests to me that somewhere during the initialization STA
fails. Again, I will look through rtwn(4)'s init sequence, but is
there anything in ieee80211(4) that might be different depending on if
its in monitor mode or STA mode?

And if you don't know, can you kindly guide me to what net80211(4)
function first discriminates between the device mode?

Thank you and I apologize for the long email.

--
Farhan Khan
PGP Fingerprint: B28D 2726 E2BC A97E 3854 5ABE 9A9F 00BC D525 16EE



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAFd4kYB-0jm9OibSbosoH1Lh0B6%2BzQF9X=eXZC1GFBJXWyxCFg>