]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: mac80211: accept protected frames for NAN device
authorAvraham Stern <avraham.stern@intel.com>
Mon, 4 May 2026 07:20:43 +0000 (10:20 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 5 May 2026 10:10:14 +0000 (12:10 +0200)
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>
net/mac80211/rx.c

index 82ea7404f3dafec124b5880adc3b91f79cb38e80..e1f376e0620c348ff4fdd3538a4bc594235501b7 100644 (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))