From: Devin Wittmayer <lucid_duck@justthetip.ca>
To: Matheus Alves de Almeida <matheus.aalmeida@inf.ufrgs.br>
Cc: Johannes Berg <johannes@sipsolutions.net>,
linux-wireless@vger.kernel.org
Subject: Re: [PATCH wireless] wifi: mac80211: fix channel changes for active monitors
Date: Tue, 1 Sep 2026 12:22:58 -0700 [thread overview]
Message-ID: <20260901192258.6603-1-lucid_duck@justthetip.ca> (raw)
In-Reply-To: <20260901025525.4017-1-matheus.aalmeida@inf.ufrgs.br>
Nice catch. This has been sitting there since early 2024 and it is good
to see it on the list.
Tested-by: Devin Wittmayer <lucid_duck@justthetip.ca>
Two MediaTek USB adapters on the same chip, before and after on each.
One on 7.2.2, where it applies clean and I tested it as posted. One on
a Pi 5 on 6.18.34, which needs two small edits, since that tree has not
had the chan.c refactor and calls the iterator link instead of iter.
Before, the monitor sits on one frequency and every channel request is
accepted and thrown away. Eight cells across the two machines, hundreds
of frames, not one on the channel I asked for, and nothing in the log to
say so. After, it goes where it is told, every time, on both.
I went through this in March on the same chip and wrote it up with diffs
and results, three defects in all:
https://github.com/morrownr/USB-WiFi/issues/682#issuecomment-4115109552
Yours is the third, and the SMPS hunk is a piece I did not have. Still
open is that an active monitor gets no channel at all when it is
created, only when something later asks for one. Your patch covers that
in practice for anything that sets a channel.
The iface.c hunk there gives it one at creation, but do not take it
alone. On mt76 the sniffer is armed only when the channel changes,
never when it is first assigned. So once the interface starts life on
the right channel, asking for that channel changes nothing and it hears
nothing: four runs, zero frames every time, with a passive monitor on
the same channel hearing traffic in all four. Ask for a different
channel and it works. The driver half is mine.
Good to have another pair of eyes on the monitor paths, they do not get
many.
Devin
On Mon, Sep 1, 2026 at 2:55 AM Matheus Alves de Almeida
<matheus.aalmeida@inf.ufrgs.br> wrote:
> Active monitor interfaces are added to the driver as real VIFs so that
> frames addressed to their MAC address can be acknowledged. However,
> ieee80211_set_monitor_channel() redirects monitor channel changes to the
> hidden monitor_sdata whenever the driver does not set
> NO_VIRTUAL_MONITOR.
>
> An active-only monitor does not create monitor_sdata, so the function can
> return success after only updating monitor_chanreq. The active monitor
> itself never gets a channel context, making channel changes ineffective.
>
> Use the active monitor VIF directly when changing channels, while keeping
> monitor_chanreq private to the hidden virtual monitor. Also treat active
> monitors as valid directly channel-bound monitor interfaces in channel
> width and SMPS accounting.
>
> This fixes active monitor channel switching with mac80211_hwsim. Before
> this change, an active monitor failed to discover any APs while scanning.
> With the fix applied, scanning works across channels 1, 6 and 11 with both
> channels=1 and channels=2, and authentication and association on channel 6
> succeed without mac80211 or hwsim warnings.
>
> Fixes: 0a44dfc07074 ("wifi: mac80211: simplify non-chanctx drivers")
> Assisted-by: Codex:gpt-5.6-sol
> Signed-off-by: Matheus Alves de Almeida <matheus.aalmeida@inf.ufrgs.br>
next prev parent reply other threads:[~2026-09-01 19:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-01 2:55 [PATCH wireless] wifi: mac80211: fix channel changes for active monitors Matheus Alves de Almeida
2026-09-01 19:22 ` Devin Wittmayer [this message]
2026-09-01 20:25 ` Matheus Alves de Almeida
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260901192258.6603-1-lucid_duck@justthetip.ca \
--to=lucid_duck@justthetip.ca \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=matheus.aalmeida@inf.ufrgs.br \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox