On Wed, Jan 23, 2019 at 09:50:18AM +0100, Jesper Wallin wrote:
>
> Hi,
>
> This patch will allow urtwn(4) to see control frames when monitor mode
> is enabled. I've only tested this with my TP-LINK TL-WN821N v5 card, so
> perhaps more checks are needed to avoid breaking other cards.
>
> If you test this, enable monitor mode:
>
> $ doas ifconfig urtwn0 mediaopt monitor up
>
> Check with tcpdump if you receive any control frames (ack, rts, cts):
>
> $ doas tcpdump -i urtwn0 -n -v -y IEEE802_11_RADIO
>
>
> Also, please make sure that the NIC works BSS ("normal") mode as well.
First off, thanks for the diff. Right, urtwn(4) doesn't see any control
frames in monitor mode, I think we also need to set R92C_RCR_ADF, R92C_RCR_ACF,
and R92C_RCR_AMF bits in R92C_RCR to accept data/ctrl/mgmt frames explicitly.
ok?
Index: sys/dev/ic/rtwn.c
===================================================================
RCS file: /cvs/src/sys/dev/ic/rtwn.c,v
retrieving revision 1.43
diff -u -p -u -p -r1.43 rtwn.c
--- sys/dev/ic/rtwn.c 7 Dec 2018 01:53:20 -0000 1.43
+++ sys/dev/ic/rtwn.c 24 Jan 2019 07:20:29 -0000
@@ -1132,6 +1132,14 @@ rtwn_newstate(struct ieee80211com *ic, e
/* Enable Rx of data frames. */
rtwn_write_2(sc, R92C_RXFLTMAP2, 0xffff);
+ /* Enable Rx of control frames. */
+ rtwn_write_2(sc, R92C_RXFLTMAP1, 0xffff);
+
+ rtwn_write_4(sc, R92C_RCR,
+ rtwn_read_4(sc, R92C_RCR) |
+ R92C_RCR_AAP | R92C_RCR_ADF | R92C_RCR_ACF |
+ R92C_RCR_AMF);
+
/* Turn link LED on. */
rtwn_set_led(sc, RTWN_LED_LINK, 1);
break;