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

Louis Kotze posted 2 patches 2 days, 15 hours ago
include/net/cfg80211.h    |   7 ++-
net/wireless/nl80211.c    |  27 +++++----
net/wireless/scan.c       |  44 +++++++++++---
net/wireless/tests/scan.c | 121 +++++++++++++++++++++++++++++++++++++-
4 files changed, 178 insertions(+), 21 deletions(-)
[PATCH v3 0/2] wifi: cfg80211: say why the auth/assoc BSS lookup failed
Posted by Louis Kotze 2 days, 15 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.

Still demonstrated end-to-end in a mac80211_hwsim VM: an unpatched
wpa_supplicant failing an MLD reassociation on a stale per-link BSS
now logs "nl80211: kernel reports: BSS not found in scan results"
plus the failing link, instead of the generic message.

v3: address Johannes' review of v2: use GENL_SET_ERR_MSG for the
-EINVAL messages in nl80211_assoc_bss(); comment why the bare
NL_SET_BAD_ATTR is enough there (the lookup already set the specific
message); comment that the identity checks in the walk must precede
the expired/unusable classification; report a combined message when
matching entries were rejected for different reasons instead of
preferring one of them; drop the "scan again" instruction so the
messages are purely descriptive; keep the original argument wrapping
at the nl80211_associate() call site so only the new argument shows
in the diff.

v2: per Johannes' feedback on v1, capture the reason inside
__cfg80211_get_bss() during the single bss_lock walk instead of a
separate re-walk helper; cover the previously silent authentication
path; add the KUnit test.

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    |  27 +++++----
 net/wireless/scan.c       |  44 +++++++++++---
 net/wireless/tests/scan.c | 121 +++++++++++++++++++++++++++++++++++++-
 4 files changed, 178 insertions(+), 21 deletions(-)


base-commit: 69bd85e933c617a84fa54fcc80e628e98afdc45d
-- 
2.55.0