2024-04-10 05:33:06

by Aditya Kumar Singh

[permalink] [raw]
Subject: [PATCH v2] wifi: mac80211: handle link ID during management Tx

From: Sriram R <[email protected]>

During management Tx, when source address is same as one of the link conf's
address and even when userspace requested Tx on a specific link, link ID
is not set. Now if MLD address is also same as that of the link address,
then mac80211 fills link as unspecified. Due to this, later in driver, the
channel context is fetched from vif->bss_conf instead of link's conf which
in turn gives channel as NULL and hence as a result, the packet is
ultimately dropped.

Add changes to use the same link id and set it if the link bss is matching
the requested channel. This will prevent the packet from getting dropped.

Signed-off-by: Sriram R <[email protected]>
Signed-off-by: Aditya Kumar Singh <[email protected]>
---
v2: rephrased commit message to describe how packet is getting dropped.

---
net/mac80211/offchannel.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/net/mac80211/offchannel.c b/net/mac80211/offchannel.c
index 221695d841fd..65e1e9e971fd 100644
--- a/net/mac80211/offchannel.c
+++ b/net/mac80211/offchannel.c
@@ -897,8 +897,18 @@ int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
break;
}

- if (ether_addr_equal(conf->addr, mgmt->sa))
+ if (ether_addr_equal(conf->addr, mgmt->sa)) {
+ /* If userspace requested Tx on a specific link
+ * use the same link id if the link bss is matching
+ * the requested chan.
+ */
+ if (sdata->vif.valid_links &&
+ params->link_id >= 0 && params->link_id == i &&
+ params->chan == chanctx_conf->def.chan)
+ link_id = i;
+
break;
+ }

chanctx_conf = NULL;
}

base-commit: a35b36e6ee5dcf323d846ec3881159e4af90c9b4
--
2.25.1