Skip to content

net80211: report scan done when a foreground scan is interrupted - #389

Merged
ericbsd merged 1 commit into
releng/15.1from
foreground-scan
Oct 12, 2026
Merged

ericbsd merged 1 commit into
releng/15.1from
foreground-scan

Conversation

@ericbsd

@ericbsd ericbsd commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

scan_done() skipped the scan done event whenever outgoing traffic interrupted a scan before it covered every channel. That only makes sense for background scans, which net80211 resumes later. A foreground scan, such as one requested by wpa_supplicant while associated, is never resumed, so the requester waited forever.

With wpa_supplicant this left the scan radio work open and every later "wpa_cli scan" returned FAIL-BUSY until wpa_supplicant was restarted. Seen on rtwn(4) with an RTL8821AU: the scan was paused on its first of nine channels and no RTM_IEEE80211_SCAN was sent.

Send the event unless the interrupted scan is a background scan.

Summary by Sourcery

Bug Fixes:

  • Ensure interrupted foreground scans report completion so requesters do not remain blocked indefinitely.

scan_done() skipped the scan done event whenever outgoing traffic
interrupted a scan before it covered every channel. That only makes
sense for background scans, which net80211 resumes later. A
foreground scan, such as one requested by wpa_supplicant while
associated, is never resumed, so the requester waited forever.

With wpa_supplicant this left the scan radio work open and every
later "wpa_cli scan" returned FAIL-BUSY until wpa_supplicant was
restarted. Seen on rtwn(4) with an RTL8821AU: the scan was paused on
its first of nine channels and no RTM_IEEE80211_SCAN was sent.

Send the event unless the interrupted scan is a background scan.
@ericbsd
ericbsd requested review from a team as code owners October 12, 2026 01:52
@github-actions

Copy link
Copy Markdown

Thank you for taking the time to contribute to FreeBSD!
There is an issue that needs to be fixed:

  • Missing Signed-off-by lines8d4382c

Please review CONTRIBUTING.md, then update and push your branch again.

@sourcery-ai

sourcery-ai Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Updates scan completion handling so traffic-interrupted foreground scans send the scan-done event immediately, preventing requesters such as wpa_supplicant from waiting indefinitely, while retaining resumable behavior for background scans.

Sequence diagram for traffic-interrupted scan completion

sequenceDiagram
    participant Requester as wpa_supplicant
    participant Scanner as net80211_scan_sw
    participant VAP as ieee80211_vap

    Requester->>Scanner: scan request
    Scanner->>Scanner: scan_done(scandone)
    alt traffic interrupt and foreground scan
        Scanner->>VAP: ieee80211_notify_scan_done(vap)
        VAP-->>Requester: RTM_IEEE80211_SCAN
    else traffic interrupt and background scan
        Scanner->>Scanner: retain interrupted scan for resume
    else scan reaches final channel
        Scanner->>VAP: ieee80211_notify_scan_done(vap)
        VAP-->>Requester: RTM_IEEE80211_SCAN
    end
Loading

File-Level Changes

Change Details Files
Ensure interrupted foreground scans always emit the scan-completion notification.
  • Extend the scan-done condition to notify when the interruption was caused by traffic unless the scan is specifically a background scan.
  • Preserve deferred completion for background scans that still have channels remaining, while notifying when the scan reaches its final channel.
sys/net80211/ieee80211_scan_sw.c

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@ericbsd
ericbsd merged commit 3fcd936 into releng/15.1 Oct 12, 2026
6 of 7 checks passed
@ericbsd
ericbsd deleted the foreground-scan branch October 12, 2026 02:20
@github-project-automation github-project-automation Bot moved this from In Review to Done in Development Tracker Oct 12, 2026
@ericbsd ericbsd self-assigned this Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant