Linux wireless drivers development
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Cc: linux-wireless@vger.kernel.org, Ilan Peer <ilan.peer@intel.com>
Subject: Re: [PATCH wireless-next 4/7] wifi: mac80211: nan: allow Rx registration for NAN beacons
Date: Fri, 02 Oct 2026 09:10:42 +0200	[thread overview]
Message-ID: <1327040865acb1ef04142b28b7aa6c878c692123.camel@sipsolutions.net> (raw)
In-Reply-To: <20261001162941.42c8f2a8e1b2.Ibb92f6652a447acbf47f5b8d654fe34a0fd845e0@changeid>

On Thu, 2026-10-01 at 16:33 +0300, Miri Korenblit wrote:
> From: Ilan Peer <ilan.peer@intel.com>
> 
> Instant Communication requires user space to track the NAN beacons, so
> let it register for Rx of beacons on a NAN interface. Add support for
> passing beacon on NAN Device interface when instant communication is
> enabled.
> 
> Add a helper function to identify NAN beacons, based on the BSSID
> and the beacon frame content. Skip NAN beacons so they would not
> be used to update the BSS table.

This does two things, please split it.


> +++ b/net/mac80211/rx.c
> @@ -4536,7 +4536,10 @@ static bool ieee80211_accept_frame(struct ieee80211_rx_data *rx)
>  	struct ieee80211_hdr *hdr = (void *)skb->data;
>  	struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
>  	u8 *bssid = ieee80211_get_bssid(hdr, skb->len, sdata->vif.type);
> +	bool nan_beacon = ieee80211_is_nan_beacon((struct ieee80211_mgmt *)hdr,
> +						  skb->len);

Doing that fairly long inline here for every single frame seems like a
bad idea. It's also really not necessary at this spot, we accept just
about every beacon frame here and today even every NAN beacon if it
bubbles up. Also, BSSID filter will reject it anyway in most cases, so
is it even needed at all?

We can always be attacked in some way with this, so that's not an excuse
either, could even trivially just put a non-vendor-element into what
otherwise looks like a NAN beacon and then it'd be rejected by
"is_nan_beacon()" but parse exactly the same way as one.

> --- a/net/mac80211/scan.c
> +++ b/net/mac80211/scan.c
> @@ -353,6 +353,10 @@ void ieee80211_scan_rx(struct ieee80211_local *local, struct sk_buff *skb)
>  		if (!ieee80211_is_s1g_beacon(mgmt->frame_control) &&
>  		    !is_broadcast_ether_addr(mgmt->da))
>  			return;
> +
> +		/* NAN beacons are not a BSS, don't add to the BSS table */
> +		if (ieee80211_is_nan_beacon(mgmt, skb->len))
> +			return;

If that's such a hard general rule, why in mac80211?

johannes

  reply	other threads:[~2026-10-02  7:10 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-01 13:33 [PATCH wireless-next 0/7] wifi: cfg80211/mac80211: add NAN Instant Communication support Miri Korenblit
2026-10-01 13:33 ` [PATCH wireless-next 1/7] wifi: cfg80211: nan: add " Miri Korenblit
2026-10-01 13:33 ` [PATCH wireless-next 2/7] wifi: mac80211: nan: Update NAN configuration copy Miri Korenblit
2026-10-01 13:33 ` [PATCH wireless-next 3/7] wifi: cfg80211: nan: check Rx registration for NAN beacons Miri Korenblit
2026-10-02  7:03   ` Johannes Berg
2026-10-01 13:33 ` [PATCH wireless-next 4/7] wifi: mac80211: nan: allow " Miri Korenblit
2026-10-02  7:10   ` Johannes Berg [this message]
2026-10-04 12:40     ` Peer, Ilan
2026-10-01 13:33 ` [PATCH wireless-next 5/7] wifi: ieee80211: add NAN service ID list attribute definitions Miri Korenblit
2026-10-01 13:33 ` [PATCH wireless-next 6/7] wifi: mac80211_hwsim: nan: use ieee80211_is_nan_beacon() helper Miri Korenblit
2026-10-01 13:33 ` [PATCH wireless-next 7/7] wifi: mac80211_hwsim: add NAN Instant Communication support Miri Korenblit
2026-10-02  7:26   ` Johannes Berg
2026-10-04 13:12     ` Peer, Ilan

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=1327040865acb1ef04142b28b7aa6c878c692123.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=ilan.peer@intel.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=miriam.rachel.korenblit@intel.com \
    /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