public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
From: Miri Korenblit <miriam.rachel.korenblit@intel.com>
To: linux-wireless@vger.kernel.org
Subject: [PATCH v2 wireless-next 14/15] wifi: mac80211: report and drop spurious NAN Data frames
Date: Thu, 26 Mar 2026 12:14:44 +0200	[thread overview]
Message-ID: <20260326121156.721b3a61c580.I19e3572508beeba143871682c80e9a56b6c1046a@changeid> (raw)
In-Reply-To: <20260326101445.1443198-1-miriam.rachel.korenblit@intel.com>

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>
---
 net/mac80211/rx.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 979ac26d1173..3e5d1c47a5b0 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -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 &&
-- 
2.34.1


  parent reply	other threads:[~2026-03-26 10:15 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-26 10:14 [PATCH v2 wireless-next 00/15] wifi: mac80211: add NAN support Miri Korenblit
2026-03-26 10:14 ` [PATCH v2 wireless-next 01/15] wifi: mac80211: add a TXQ for management frames on NAN devices Miri Korenblit
2026-03-26 10:14 ` [PATCH v2 wireless-next 02/15] wifi: ieee80211: add more NAN definitions Miri Korenblit
2026-03-26 10:14 ` [PATCH v2 wireless-next 03/15] wifi: mac80211: export ieee80211_calculate_rx_timestamp Miri Korenblit
2026-03-26 10:14 ` [PATCH v2 wireless-next 04/15] wifi: mac80211: run NAN DE code only when appropriate Miri Korenblit
2026-03-26 10:14 ` [PATCH v2 wireless-next 05/15] wifi: mac80211: add NAN local schedule support Miri Korenblit
2026-03-26 10:14 ` [PATCH v2 wireless-next 06/15] wifi: mac80211: support open and close for NAN_DATA interfaces Miri Korenblit
2026-03-26 10:14 ` [PATCH v2 wireless-next 07/15] wifi: mac80211: handle reconfig for NAN DATA interfaces Miri Korenblit
2026-03-26 10:14 ` [PATCH v2 wireless-next 08/15] wifi: mac80211: support NAN stations Miri Korenblit
2026-03-26 10:14 ` [PATCH v2 wireless-next 09/15] wifi: mac80211: add NAN peer schedule support Miri Korenblit
2026-03-26 10:14 ` [PATCH v2 wireless-next 10/15] wifi: mac80211: update NAN data path state on schedule changes Miri Korenblit
2026-03-26 10:14 ` [PATCH v2 wireless-next 11/15] wifi: mac80211: add support for TX over NAN_DATA interfaces Miri Korenblit
2026-03-26 10:14 ` [PATCH v2 wireless-next 12/15] wifi: mac80211: Accept frames on NAN DATA interfaces Miri Korenblit
2026-03-26 10:14 ` [PATCH v2 wireless-next 13/15] wifi: mac80211: allow block ack agreements in NAN Data Miri Korenblit
2026-03-26 10:14 ` Miri Korenblit [this message]
2026-03-26 10:14 ` [PATCH v2 wireless-next 15/15] wifi: mac80211: allow add_key on NAN interfaces Miri Korenblit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260326121156.721b3a61c580.I19e3572508beeba143871682c80e9a56b6c1046a@changeid \
    --to=miriam.rachel.korenblit@intel.com \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox