wifi: mac80211: report multicast transmission from lookup_ra_sta()

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.

Link: https://patch.msgid.link/20260803141309.292711-14-johannes@sipsolutions.net
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
Johannes Berg committed 2026-09-04 10:31:55 +02:00
1 parent 1ebbdad2b7
commit 78b843974f
2 files changed
+15 -9

No files matched your search

-5
View File
@@ -2479,11 +2479,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,
+15 -4
View File
@@ -2538,9 +2538,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;
@@ -2565,6 +2572,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;
@@ -2607,7 +2618,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;
}