From: Johannes Berg <johannes@sipsolutions.net>
To: Louis Kotze <loukot@gmail.com>
Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/2] wifi: cfg80211: say why the auth/assoc BSS lookup failed
Date: Wed, 22 Jul 2026 00:10:57 +0200 [thread overview]
Message-ID: <bbb15b0ae332d7344f5b69da5e993acc6813aca7.camel@sipsolutions.net> (raw)
In-Reply-To: <20260721181158.3004022-2-loukot@gmail.com> (sfid-20260721_201208_795052_C22F5E20)
On Tue, 2026-07-21 at 20:11 +0200, Louis Kotze wrote:
>
> - if (!attrs[NL80211_ATTR_MAC] || !attrs[NL80211_ATTR_WIPHY_FREQ])
> + if (!attrs[NL80211_ATTR_MAC] || !attrs[NL80211_ATTR_WIPHY_FREQ]) {
> + NL_SET_ERR_MSG(info->extack, "BSSID or frequency missing");
>
>
could use the GENL versions and save some characters :)
> if (IS_ERR(links[link_id].bss)) {
> err = PTR_ERR(links[link_id].bss);
> links[link_id].bss = NULL;
> - NL_SET_ERR_MSG_ATTR(info->extack, link,
> - "Error fetching BSS for link");
> + NL_SET_BAD_ATTR(info->extack, link);
why remove the message, it's possible to have both?
>
> - req.bss = nl80211_assoc_bss(rdev, ssid, ssid_len, info->attrs,
> - -1, -1);
> + req.bss = nl80211_assoc_bss(rdev, info, ssid, ssid_len,
> + info->attrs, -1, -1);
entirely unrelated (whitespace) change?
> +++ b/net/wireless/scan.c
> @@ -1609,10 +1609,12 @@ struct cfg80211_bss *__cfg80211_get_bss(struct wiphy *wiphy,
> const u8 *ssid, size_t ssid_len,
> enum ieee80211_bss_type bss_type,
> enum ieee80211_privacy privacy,
> - u32 use_for)
> + u32 use_for,
> + struct netlink_ext_ack *extack)
> {
> struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);
> struct cfg80211_internal_bss *bss, *res = NULL;
> + bool expired = false, unusable = false;
> unsigned long now = jiffies;
> int bss_privacy;
>
> @@ -1634,22 +1636,39 @@ struct cfg80211_bss *__cfg80211_get_bss(struct wiphy *wiphy,
> continue;
> if (!is_valid_ether_addr(bss->pub.bssid))
> continue;
> - if ((bss->pub.use_for & use_for) != use_for)
> + if (!is_bss(&bss->pub, bssid, ssid, ssid_len))
> continue;
> +
> /* Don't get expired BSS structs */
> if (time_after(now, bss->ts + IEEE80211_SCAN_RESULT_EXPIRE) &&
> - !atomic_read(&bss->hold))
> + !atomic_read(&bss->hold)) {
> + expired = true;
> + continue;
> + }
> +
> + if ((bss->pub.use_for & use_for) != use_for) {
> + unusable = true;
> continue;
> - if (is_bss(&bss->pub, bssid, ssid, ssid_len)) {
> - res = bss;
> - bss_ref_get(rdev, res);
> - break;
> }
> +
> + res = bss;
> + bss_ref_get(rdev, res);
> + break;
That code should probably have a comment that the is_bss() must come
first...
Also however, it could result in having *both* 'unusable' and 'expired'
set, and then
> - if (!res)
> + if (!res) {
> + if (unusable)
> + NL_SET_ERR_MSG(extack,
> + "BSS cannot be used for the requested operation");
> + else if (expired)
> + NL_SET_ERR_MSG(extack,
> + "BSS entry is expired, scan again");
> + else
> + NL_SET_ERR_MSG(extack,
> + "BSS not found in scan results");
> return NULL;
you prefer the 'unusable' message... not sure that makes sense?
I also don't think the "scan again" instruction makes any sense here -
this is meant to provide an error message, not instructions how to fix
it?
johannes
next prev parent reply other threads:[~2026-07-21 22:11 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-11 4:34 [PATCH] wifi: nl80211: say why the association " Louis Kotze
2026-07-21 15:31 ` Johannes Berg
2026-07-21 18:11 ` [PATCH v2 0/2] wifi: cfg80211: say why the auth/assoc " Louis Kotze
2026-07-21 18:11 ` [PATCH v2 1/2] " Louis Kotze
2026-07-21 22:10 ` Johannes Berg [this message]
2026-07-22 7:07 ` Louis Kotze
2026-07-22 7:07 ` [PATCH v3 0/2] " Louis Kotze
2026-07-22 7:07 ` [PATCH v3 1/2] " Louis Kotze
2026-07-22 7:07 ` [PATCH v3 2/2] wifi: cfg80211: tests: check BSS lookup failure reasons Louis Kotze
2026-07-21 18:11 ` [PATCH v2 " Louis Kotze
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bbb15b0ae332d7344f5b69da5e993acc6813aca7.camel@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=loukot@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®