[PATCH wireless-next 1/3] wifi: mac80211: Do not set link_id for received management frame

Remi Pommarel posted 3 patches 3 months, 1 week ago
There is a newer version of this series
[PATCH wireless-next 1/3] wifi: mac80211: Do not set link_id for received management frame
Posted by Remi Pommarel 3 months, 1 week ago
A non-MLD sta could want to send offchannel management frame (e.g. to
do a offchannel scan). Because ieee80211_rx_for_interface() fills the
link_id information with the link the sta is currently using; hostapd
would send back management frame responses through wrong link causing
the sta to miss them.

To fix that, do not fill link_id indication for management frames,
relying on hostapd instead to infer the proper link from the received
frame frequency.

Signed-off-by: Remi Pommarel <repk@triplefau.lt>
---
 net/mac80211/rx.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index e73431549ce7..deebdce6d9c7 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -5112,9 +5112,14 @@ static bool ieee80211_rx_for_interface(struct ieee80211_rx_data *rx,
 	 * have the link information if needed.
 	 */
 	link_sta = link_sta_info_get_bss(rx->sdata, hdr->addr2);
+
 	if (link_sta) {
 		sta = link_sta->sta;
-		link_id = link_sta->link_id;
+		/* Do no use sta link id information on management frames to allow for
+		 * offchannel scan, roaming, etc.
+		 */
+		if (!ieee80211_is_mgmt(hdr->frame_control))
+			link_id = link_sta->link_id;
 	} else {
 		struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
 
-- 
2.40.0