mirror of
https://github.com/torvalds/linux.git
synced 2026-11-06 21:58:01 +01:00
wifi: cfg80211: do not use NAN beacons to update the BSS table
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> Link: https://patch.msgid.link/20261005084458.3666739-5-ilan.peer@intel.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
parent
f4134597a0
commit
41da18108d
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -3339,6 +3339,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));
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user