From: Ilan Peer <ilan.peer@intel.com>
To: johannes@sipsolutions.net
Cc: linux-wireless@vger.kernel.org, Ilan Peer <ilan.peer@intel.com>
Subject: [PATCH v3 04/11] wifi: cfg80211: do not use NAN beacons to update the BSS table
Date: Mon, 5 Oct 2026 11:44:51 +0300 [thread overview]
Message-ID: <20261005084458.3666739-5-ilan.peer@intel.com> (raw)
In-Reply-To: <20261005084458.3666739-1-ilan.peer@intel.com>
As NAN beacons have a different structure compared to beacons
defined in the IEEE802.11 specification, e.g., they do not contain
a SSID element etc., they cannot be used to update the BSS table.
Add a utility function to check if a frame is a NAN beacon and
use it do return early in cfg80211_inform_bss_frame_data().
Signed-off-by: Ilan Peer <ilan.peer@intel.com>
---
include/linux/ieee80211-nan.h | 26 ++++++++++++++++++++++++++
net/wireless/scan.c | 4 ++++
2 files changed, 30 insertions(+)
diff --git a/include/linux/ieee80211-nan.h b/include/linux/ieee80211-nan.h
index 455033955e54..b332a94671ba 100644
--- a/include/linux/ieee80211-nan.h
+++ b/include/linux/ieee80211-nan.h
@@ -74,4 +74,30 @@ struct ieee80211_nan_anchor_master_info {
_attr = (const struct ieee80211_nan_attr *) \
(_attr->data + le16_to_cpu(_attr->length)))
+static inline bool ieee80211_is_nan_beacon(const struct ieee80211_mgmt *mgmt,
+ size_t len)
+{
+ const struct element *elem;
+
+ /* The NAN IE is at least 6 octets */
+ if (len < offsetofend(struct ieee80211_mgmt, u.beacon) + 6)
+ return false;
+
+ if (!ieee80211_is_beacon(mgmt->frame_control))
+ return false;
+
+ /* NAN Cluster IDs range from 50-6F-9A-01-00-00 to 50-6F-9A-01-FF-FF */
+ if (get_unaligned_be32(mgmt->bssid) != ((WLAN_OUI_WFA << 8) | 0x01))
+ return false;
+
+ elem = (const struct element *)mgmt->u.beacon.variable;
+ if (elem->id != WLAN_EID_VENDOR_SPECIFIC ||
+ elem->datalen < 4 ||
+ get_unaligned_be32(elem->data) !=
+ (WLAN_OUI_WFA << 8 | WLAN_OUI_TYPE_WFA_NAN))
+ return false;
+
+ return true;
+}
+
#endif /* LINUX_IEEE80211_NAN_H */
diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index d35c826c4b1a..b7c6c856b3c9 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -3338,6 +3338,10 @@ cfg80211_inform_bss_frame_data(struct wiphy *wiphy,
if (WARN_ON(!wiphy))
return NULL;
+ /* NAN beacons are not a BSS, don't add to the BSS table */
+ if (ieee80211_is_nan_beacon(mgmt, len))
+ return NULL;
+
BUILD_BUG_ON(offsetof(struct ieee80211_mgmt, u.probe_resp.variable) !=
offsetof(struct ieee80211_mgmt, u.beacon.variable));
--
2.55.0
next prev parent reply other threads:[~2026-10-04 14:30 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-05 8:44 [PATCH v3 00/11] wifi: cfg80211/mac80211: add NAN Instant Communication support Ilan Peer
2026-10-05 8:44 ` [PATCH v3 01/11] wifi: cfg80211: nan: add " Ilan Peer
2026-10-05 8:44 ` [PATCH v3 02/11] wifi: mac80211: nan: Update NAN configuration copy Ilan Peer
2026-10-05 8:44 ` [PATCH v3 03/11] wifi: cfg80211: nan: check Rx registration for NAN beacons Ilan Peer
2026-10-05 8:44 ` Ilan Peer [this message]
2026-10-05 8:44 ` [PATCH v3 05/11] wifi: mac80211: nan: allow " Ilan Peer
2026-10-05 8:44 ` [PATCH v3 06/11] wifi: mac80211: accept NAN beacons only when IC is enabled Ilan Peer
2026-10-05 8:44 ` [PATCH v3 07/11] wifi: ieee80211: add NAN service ID list attribute definitions Ilan Peer
2026-10-05 8:44 ` [PATCH v3 08/11] wifi: mac80211_hwsim: nan: use ieee80211_is_nan_beacon() helper Ilan Peer
2026-10-05 8:44 ` [PATCH v3 09/11] wifi: mac80211_hwsim: nan: prepare for more configurable NAN settings Ilan Peer
2026-10-05 8:44 ` [PATCH v3 10/11] wifi: mac80211_hwsim: nan: Handle more of the NAN configuration Ilan Peer
2026-10-05 8:44 ` [PATCH v3 11/11] wifi: mac80211_hwsim: add NAN Instant Communication support Ilan Peer
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=20261005084458.3666739-5-ilan.peer@intel.com \
--to=ilan.peer@intel.com \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
/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