[PATCH wireless-next 5/7] wifi: mac80211: report multicast transmission from lookup_ra_sta()
Johannes Berg <[email protected]> Mon, 3 Aug 2026 16:08:41 +0200
| Newsgroups | org.kernel.vger.linux-wireless |
|---|---|
| Message-ID | <[email protected]> |
From: Johannes Berg <[email protected]> ieee80211_lookup_ra_sta() returns ERR_PTR(-ENOENT) both when the 802.11 frame will be is group addressed and when it's going to an unknown station. Keep reporting an ERR_PTR() for group addressed but set to NULL for individually addressed frames so the callers can use it to distinguish later. This is already explicitly the case for all interface types except mesh, and callers already tolerate (but don't distinguish) both cases. Also change the ieee80211_lookup_ra_sta() to be static. Signed-off-by: Johannes Berg <[email protected]> --- net/mac80211/ieee80211_i.h | 5 ----- net/mac80211/tx.c | 19 +++++++++++++++---- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 85f72ad06ad7..f4ac945b5508 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -2471,11 +2471,6 @@ static inline bool ieee80211_require_encrypted_assoc(__le16 fc, return sta && sta->sta.epp_peer && ieee80211_is_assoc(fc); } -/* sta_out needs to be checked for ERR_PTR() before using */ -int ieee80211_lookup_ra_sta(struct ieee80211_sub_if_data *sdata, - struct sk_buff *skb, - struct sta_info **sta_out); - static inline void ieee80211_tx_skb_tid_band(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb, int tid, diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 1d139c2506bb..cc0c6b46d19c 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -2504,9 +2504,16 @@ static inline bool ieee80211_is_tdls_setup(struct sk_buff *skb) skb->data[14] == WLAN_TDLS_SNAP_RFTYPE; } -int ieee80211_lookup_ra_sta(struct ieee80211_sub_if_data *sdata, - struct sk_buff *skb, - struct sta_info **sta_out) +/* + * Returns an error if the frame should be dropped, otherwise + * the *sta_out pointer is filled: + * - valid sta pointer: frame goes to that station + * - NULL: frame will be unicast to a yet unknown station + * - ERR_PTR(-ENOENT): frame will be group addressed + */ +static int ieee80211_lookup_ra_sta(struct ieee80211_sub_if_data *sdata, + struct sk_buff *skb, + struct sta_info **sta_out) { struct sta_info *sta; @@ -2531,6 +2538,10 @@ int ieee80211_lookup_ra_sta(struct ieee80211_sub_if_data *sdata, break; #ifdef CONFIG_MAC80211_MESH case NL80211_IFTYPE_MESH_POINT: + if (is_multicast_ether_addr(skb->data)) { + *sta_out = ERR_PTR(-ENOENT); + return 0; + } /* determined much later */ *sta_out = NULL; return 0; @@ -2573,7 +2584,7 @@ int ieee80211_lookup_ra_sta(struct ieee80211_sub_if_data *sdata, return -EINVAL; } - *sta_out = sta ?: ERR_PTR(-ENOENT); + *sta_out = sta; return 0; } -- 2.55.0