[PATCH v2 0/2] wifi: cfg80211: say why the auth/assoc BSS lookup failed

Louis Kotze posted 2 patches 3 days, 5 hours ago
There is a newer version of this series
include/net/cfg80211.h    |   7 ++-
net/wireless/nl80211.c    |  28 +++++----
net/wireless/scan.c       |  35 ++++++++---
net/wireless/tests/scan.c | 122 +++++++++++++++++++++++++++++++++++++-
4 files changed, 170 insertions(+), 22 deletions(-)
[PATCH v2 0/2] wifi: cfg80211: say why the auth/assoc BSS lookup failed
Posted by Louis Kotze 3 days, 5 hours ago
The BSS lookup for an authentication or association request can fail
because no scan entry exists, because the entry is expired, or because
the entry's use_for flags forbid the requested use. All three
currently produce the same generic (or no) diagnostic, which
wpa_supplicant relays verbatim as the only hint a user gets when e.g.
an MLO association degrades to fewer links.

Patch 1 makes __cfg80211_get_bss() record the reason via an optional
extack while it walks the BSS table, and wires the auth and assoc
paths up to it. Patch 2 adds a KUnit test for the reported reasons.

v2: per Johannes' feedback on v1, drop the separate failure-path
classification helper (which re-walked the table and could race
against it changing); the reason is now captured in
__cfg80211_get_bss() itself, during the same bss_lock walk that fails
the lookup, and the public cfg80211_get_bss() wrapper just passes
NULL. Since the reporting now lives in the lookup, the previously
silent authentication path gets the same messages for free, and a
KUnit test (new in v2) can cover all the reasons deterministically.

Demonstrated end-to-end in a mac80211_hwsim VM: with an unpatched
wpa_supplicant failing an MLD reassociation on a stale per-link BSS,
the supplicant log now shows
  nl80211: kernel reports: BSS not found in scan results
  nl80211: kernel reports error for link: 1
instead of the undiscriminating "Error fetching BSS for link".

Louis Kotze (2):
  wifi: cfg80211: say why the auth/assoc BSS lookup failed
  wifi: cfg80211: tests: check BSS lookup failure reasons

 include/net/cfg80211.h    |   7 ++-
 net/wireless/nl80211.c    |  28 +++++----
 net/wireless/scan.c       |  35 ++++++++---
 net/wireless/tests/scan.c | 122 +++++++++++++++++++++++++++++++++++++-
 4 files changed, 170 insertions(+), 22 deletions(-)


base-commit: ac798f757d6475dc6fee2ec899980d6740714596
-- 
2.55.0