From: Miri Korenblit <miriam.rachel.korenblit@intel.com>
To: linux-wireless@vger.kernel.org
Subject: [PATCH v2 wireless-next 12/15] wifi: mac80211: Accept frames on NAN DATA interfaces
Date: Thu, 26 Mar 2026 12:14:42 +0200 [thread overview]
Message-ID: <20260326121156.0e6f37d4a40c.Iaa84cc3d063392f0150fcdf2bf610bdb41062f70@changeid> (raw)
In-Reply-To: <20260326101445.1443198-1-miriam.rachel.korenblit@intel.com>
Accept frames there were received on NAN DATA interfaces:
- Data frames, both multicast or unicast
- Non-Public action frames, both multicast or unicast
- Unicast secure management frames
- FromDS and ToDS are 0.
While at it, check FromDS/ToDS also for NAN management frames.
Accept only data frames from devices that are part of the NAN
cluster.
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
---
net/mac80211/rx.c | 37 ++++++++++++++++++++++++++++++++++++-
1 file changed, 36 insertions(+), 1 deletion(-)
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index dbdd67c181d8..a00b73420929 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -4469,6 +4469,9 @@ static bool ieee80211_accept_frame(struct ieee80211_rx_data *rx)
u8 *bssid = ieee80211_get_bssid(hdr, skb->len, sdata->vif.type);
bool multicast = is_multicast_ether_addr(hdr->addr1) ||
ieee80211_is_s1g_beacon(hdr->frame_control);
+ static const u8 nan_network_id[ETH_ALEN] __aligned(2) = {
+ 0x51, 0x6F, 0x9A, 0x01, 0x00, 0x00
+ };
switch (sdata->vif.type) {
case NL80211_IFTYPE_STATION:
@@ -4597,6 +4600,10 @@ 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:
+ if (ieee80211_has_tods(hdr->frame_control) ||
+ ieee80211_has_fromds(hdr->frame_control))
+ 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
@@ -4608,7 +4615,35 @@ 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_DATA:
- return false;
+ if (ieee80211_has_tods(hdr->frame_control) ||
+ ieee80211_has_fromds(hdr->frame_control))
+ return false;
+
+ if (ieee80211_is_data(hdr->frame_control)) {
+ struct ieee80211_sub_if_data *nmi;
+
+ nmi = rcu_dereference(sdata->u.nan_data.nmi);
+ if (!nmi)
+ return false;
+
+ if (!ether_addr_equal(nmi->wdev.u.nan.cluster_id,
+ hdr->addr3))
+ return false;
+
+ return multicast ||
+ ether_addr_equal(sdata->vif.addr, hdr->addr1);
+ }
+
+ /* Non-public action frames (unicast or multicast) */
+ if (ieee80211_is_action(hdr->frame_control) &&
+ !ieee80211_is_public_action(hdr, skb->len) &&
+ (ether_addr_equal(nan_network_id, hdr->addr1) ||
+ ether_addr_equal(sdata->vif.addr, hdr->addr1)))
+ return true;
+
+ /* Unicast secure management frames */
+ return ether_addr_equal(sdata->vif.addr, hdr->addr1) &&
+ ieee80211_is_unicast_robust_mgmt_frame(skb);
default:
break;
}
--
2.34.1
next prev 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 ` Miri Korenblit [this message]
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 ` [PATCH v2 wireless-next 14/15] wifi: mac80211: report and drop spurious NAN Data frames Miri Korenblit
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.0e6f37d4a40c.Iaa84cc3d063392f0150fcdf2bf610bdb41062f70@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