]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: mac80211: Accept management frames on NAN interface
authorIlan Peer <ilan.peer@intel.com>
Mon, 8 Sep 2025 11:13:03 +0000 (14:13 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Fri, 19 Sep 2025 09:26:23 +0000 (11:26 +0200)
Accept Public Action frames and Authentication frames on
NAN Device interface to support flows that require these frames:

- SDFs: For user space Discovery Engine (DE) implementation.
- NAFs: For user space NAN Data Path (NDP) establishment.
- Authentication frames: For NAN Pairing and Verification.

Accept only frames from devices that are part of the NAN
cluster.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250908140015.46528d69e881.Ifccd87fb2a49a3af05238f74f52fa6da8de28811@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/rx.c

index 4d4ff4d4917a2564cdc109fec8ddd605a3b677d7..feb81ffa4f8c88f1afafdd0a50cdf53bac841600 100644 (file)
@@ -4502,8 +4502,16 @@ static bool ieee80211_accept_frame(struct ieee80211_rx_data *rx)
                       (ieee80211_is_auth(hdr->frame_control) &&
                        ether_addr_equal(sdata->vif.addr, hdr->addr1));
        case NL80211_IFTYPE_NAN:
-               /* Currently no frames on NAN interface are allowed */
-               return false;
+               /* 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.
+                */
+               return memcmp(sdata->wdev.u.nan.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)));
        default:
                break;
        }