git: b28bab975e2e - main - iwx: unbreak monitor mode support
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 22 Nov 2026 19:56:33 UTC
The branch main has been updated by adrian:
URL: https://cgit.FreeBSD.org/src/commit/?id=b28bab975e2e378b43321ae0671bf15f1d8b7606
commit b28bab975e2e378b43321ae0671bf15f1d8b7606
Author: Andriy Voskoboinyk <avos@FreeBSD.org>
AuthorDate: 2026-11-22 19:43:33 +0000
Commit: Adrian Chadd <adrian@FreeBSD.org>
CommitDate: 2026-11-22 19:56:05 +0000
iwx: unbreak monitor mode support
A bunch of changes that turns it into a working mode (at least for me)
1) Call iwx_auth instead of iwx_run on -> RUN transition in monitor mode.
That's how it is intended to work because we never transition to the
AUTH state in this mode and current implementation of iwx_run just
results in endless 'firmware error' -> 'restart' loop.
2) Use ic_curchan instead of ic_bsschan while initializing NIC state;
the last one contains ANYC channel in monitor mode.
3) Do not print 'input_all returned -1' message - ieee80211_input_mimo_all
always returns -1 in monitor mode.
4) Always set IEEE80211_RADIOTAP_F_FCS in radiotap flags while in monitor mode.
While header documentation states it is controlled by IWX_MAC_FILTER_IN_CRC32
flag in practice IWX_MAC_FILTER_IN_PROMISC appends it as well - and it is
required since this is the only flag that allows to receive data and
control frames. While it alone is enough I left other flags in place for
smaller diff with other drivers.
And drop duplicate call to ieee80211_add_rx_params, it is already called few
lines above.
Reviewed by: adrian
Tested by: Idwer <vidwer+fbsdbugs@gmail.com>
Differential Revision: https://reviews.freebsd.org/D61123
---
sys/dev/iwx/if_iwx.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/sys/dev/iwx/if_iwx.c b/sys/dev/iwx/if_iwx.c
index 48413c8448ad..9034baec09a3 100644
--- a/sys/dev/iwx/if_iwx.c
+++ b/sys/dev/iwx/if_iwx.c
@@ -4471,6 +4471,9 @@ iwx_rx_frame(struct iwx_softc *sc, struct mbuf *m, int chanidx,
uint8_t mcs, rate;
tap->wr_flags = 0;
+ /* Enabled automatically in promiscuous mode. */
+ if (vap->iv_opmode == IEEE80211_M_MONITOR)
+ tap->wr_flags |= IEEE80211_RADIOTAP_F_FCS;
if (is_shortpre)
tap->wr_flags |= IEEE80211_RADIOTAP_F_SHORTPRE;
tap->wr_chan_freq =
@@ -4547,7 +4550,8 @@ iwx_rx_frame(struct iwx_softc *sc, struct mbuf *m, int chanidx,
IWX_UNLOCK(sc);
if (ni == NULL) {
- if (ieee80211_input_mimo_all(ic, m) == -1)
+ if (ieee80211_input_mimo_all(ic, m) == -1 &&
+ vap->iv_opmode != IEEE80211_M_MONITOR)
printf("%s:%d input_all returned -1\n", __func__, __LINE__);
} else {
@@ -4755,8 +4759,6 @@ iwx_rx_mpdu_mq(struct iwx_softc *sc, struct mbuf *m, void *pktdata,
return;
}
- ieee80211_add_rx_params(m, &rxs);
-
#if 0
if (iwx_rx_reorder(sc, m, chanidx, desc,
(phy_info & IWX_RX_MPDU_PHY_SHORT_PREAMBLE),
@@ -7614,7 +7616,7 @@ iwx_auth(struct ieee80211vap *vap, struct iwx_softc *sc)
if (ic->ic_opmode == IEEE80211_M_MONITOR) {
err = iwx_phy_ctxt_update(sc, &sc->sc_phyctxt[0],
- ic->ic_bsschan, 1, 1, 0, IEEE80211_HTOP0_SCO_SCN,
+ ic->ic_curchan, 1, 1, 0, IEEE80211_HTOP0_SCO_SCN,
IEEE80211_VHTOP0_CHAN_WIDTH_HT);
if (err)
return err;
@@ -8124,7 +8126,11 @@ iwx_newstate_sub(struct ieee80211vap *vap, enum ieee80211_state nstate)
break;
case IEEE80211_S_RUN:
- err = iwx_run(vap, sc);
+ if (ic->ic_opmode == IEEE80211_M_MONITOR) {
+ err = iwx_auth(vap, sc);
+ } else {
+ err = iwx_run(vap, sc);
+ }
break;
default:
break;