Page MenuHomeFreeBSD

net80211: make sure to not start a BGSCAN if not enabled
ClosedPublic

Authored by bz on May 24 2025, 5:12 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Oct 22, 2:37 AM
Unknown Object (File)
Sun, Oct 19, 10:38 AM
Unknown Object (File)
Sun, Oct 19, 1:05 AM
Unknown Object (File)
Sep 20 2025, 10:47 AM
Unknown Object (File)
Sep 9 2025, 2:50 PM
Unknown Object (File)
Aug 17 2025, 1:25 PM
Unknown Object (File)
Aug 17 2025, 2:23 AM
Unknown Object (File)
Aug 7 2025, 4:47 AM

Details

Summary

On drivers not supporting background scanning (not having announced
IEEE80211_C_BGSCAN) we repeatedly have seen scanning issues and
BGSCAN was "on" according to, e.g., ddb show com /a.

Turns out there are multiple problems:
(a) the ioctl scanreq code can pass IEEE80211_[IOC_]SCAN_BGSCAN in
(ifconfig wlanX scan will do so by default). That flag ends up
on flags in the scanning code which have no other checks, and
we are doing a BGSCAN.
So make sure BGSCAN is announced by the driver and enabled
(and it's STA mode for the full check) or filter the BGSCAN out.

(b) ieee80211_bg_scan() never checked if background scanning was
available/enabled. Do so now.

(c) ieee80211_swscan_start_scan_locked() as a consequence of (a) would
start the BGSCAN unconditionally. Also check for BGSCAN to be
available/enabled here.

Lastly, we should no longer reach ieee80211_swscan_bg_scan() without
background scanning being available/enabled, so document that fact
by placing a KASSERT. That will also help in case future changes
will open a new hole or there are further which I have not noticed.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

Test Plan

Make lots of people with lots of drivers test this.
I have so far not tested with any driver doing BGSCAN!

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

bz requested review of this revision.May 24 2025, 5:12 PM
bz added inline comments.
sys/net80211/ieee80211_ioctl.c
2603

driver

bz retitled this revision from net80211: make sure to not start a BGSCAN is not enabled to net80211: make sure to not start a BGSCAN if not enabled.May 24 2025, 5:31 PM
This revision is now accepted and ready to land.May 25 2025, 5:00 PM