wifi: mac80211: accept protected frames for NAN device

Some frames sent to the NAN device may be protected, such as
protected action frames (in particular protected dual of
public action).

Accept robust management frames except disassoc on the NAN
device, and clean up the code a little bit.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20260504101829.1900c926c2e8.Ia25b2e82b250058fefa179c39327d9c8b3c3cd62@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
Avraham Stern 2026-05-04 10:20:43 +03:00 committed by Johannes Berg
parent 5f244f17ec
commit fe553d240d

View File

@ -4624,16 +4624,24 @@ static bool ieee80211_accept_frame(struct ieee80211_rx_data *rx)
ieee80211_has_fromds(hdr->frame_control))
return false;
/* Accept only frames that are addressed to the NAN cluster
/*
* Accept only frames that are addressed to the NAN cluster
* (based on the Cluster ID). From these frames, accept only
* action frames or authentication frames that are addressed to
* the local NAN interface.
* - public action frames,
* - authentication frames to the local address, and
* - robust management frames except disassoc.
*/
return memcmp(sdata->u.nan.conf.cluster_id,
hdr->addr3, ETH_ALEN) == 0 &&
(ieee80211_is_public_action(hdr, skb->len) ||
(ieee80211_is_auth(hdr->frame_control) &&
ether_addr_equal(sdata->vif.addr, hdr->addr1)));
if (!ether_addr_equal(sdata->u.nan.conf.cluster_id, hdr->addr3))
return false;
if (ieee80211_is_public_action(hdr, skb->len))
return true;
if (ieee80211_is_auth(hdr->frame_control) &&
ether_addr_equal(sdata->vif.addr, hdr->addr1))
return true;
if (!ieee80211_is_disassoc(hdr->frame_control) &&
ieee80211_is_robust_mgmt_frame(skb))
return true;
return false;
case NL80211_IFTYPE_NAN_DATA:
if (ieee80211_has_tods(hdr->frame_control) ||
ieee80211_has_fromds(hdr->frame_control))