HomeFreeBSD

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

Description

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

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
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D50513

Details

Provenance
bzAuthored on May 24 2025, 5:01 PM
Reviewer
adrian
Differential Revision
D50513: net80211: make sure to not start a BGSCAN if not enabled
Parents
rG54d0e1772fb6: LinuxKPI: add struct_group_tagged()
Branches
Unknown
Tags
Unknown