]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commitdiff
wifi: mac80211: report and drop spurious NAN Data frames
authorMiri Korenblit <miriam.rachel.korenblit@intel.com>
Thu, 26 Mar 2026 10:14:44 +0000 (12:14 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 7 Apr 2026 13:36:04 +0000 (15:36 +0200)
According to Wi-Fi Aware (TM) 4.0 specification 6.2.5, in case a frame
is recevied from an address that doesn't belong to any active NDP, the
frame should be dropped and a NAN Data Path Termination should be sent
to the transmitter.
Do it by dropping the frame and calling cfg80211_rx_spurious_frame in
that case.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20260326121156.721b3a61c580.I19e3572508beeba143871682c80e9a56b6c1046a@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/rx.c

index 979ac26d11733319a5830849ab1ae5f18b9c6aaa..3e5d1c47a5b067708d27163cc97b70734c0b1957 100644 (file)
@@ -1589,6 +1589,25 @@ ieee80211_rx_h_check(struct ieee80211_rx_data *rx)
        if (ieee80211_vif_is_mesh(&rx->sdata->vif))
                return ieee80211_rx_mesh_check(rx);
 
+       /*
+        * Wi-Fi Aware (TM) 4.0 specification 6.2.5:
+        * For NAN_DATA, unicast data frames must have A2 (source)
+        * assigned to an active NDP. If not the frame must be dropped
+        * and NAN Data Path termination frame should be sent. Notify
+        * user space so it can do so.
+        */
+       if (rx->sdata->vif.type == NL80211_IFTYPE_NAN_DATA) {
+               if (ieee80211_is_data(hdr->frame_control) &&
+                   !is_multicast_ether_addr(hdr->addr1) &&
+                   (!rx->sta || !test_sta_flag(rx->sta, WLAN_STA_ASSOC))) {
+                       if (cfg80211_rx_spurious_frame(rx->sdata->dev, hdr->addr2,
+                                                      rx->link_id, GFP_ATOMIC))
+                               return RX_DROP_U_SPURIOUS_NOTIF;
+                       return RX_DROP_U_SPURIOUS;
+               }
+               return RX_CONTINUE;
+       }
+
        if (unlikely((ieee80211_is_data(hdr->frame_control) ||
                      ieee80211_is_pspoll(hdr->frame_control)) &&
                     rx->sdata->vif.type != NL80211_IFTYPE_ADHOC &&