blob: 136ef3865e9abb57003f50de92bf8fec59ee96fc [file] [log] [blame]
From db3b035491cb7be00b1ac169863a172a5aebbacf Mon Sep 17 00:00:00 2001
From: Michael-CY Lee <michael-cy.lee@mediatek.com>
Date: Mon, 25 Mar 2024 16:26:34 +0800
Subject: [PATCH 58/61] mtk: wifi: mt76: mt7996: assign link address to the
header of broadcast mgmt.
AAD calculation should use link addr as input for broadcast mgmt. skb.
This commit assigns link address to the header of cloned broadcast mgmt.
for the correct AAD calculation.
Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com>
---
net/mac80211/offchannel.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/net/mac80211/offchannel.c b/net/mac80211/offchannel.c
index a571be0..15948f9 100644
--- a/net/mac80211/offchannel.c
+++ b/net/mac80211/offchannel.c
@@ -981,16 +981,26 @@ int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
if (is_multicast_ether_addr(mgmt->da) && hweight16(links) > 1) {
unsigned int link;
struct sk_buff *dskb;
+ struct ieee80211_hdr *hdr;
+ struct ieee80211_bss_conf *conf;
for_each_set_bit(link, &links, IEEE80211_MLD_MAX_NUM_LINKS) {
+ conf = rcu_dereference(sdata->vif.link_conf[link]);
+ if (!conf)
+ continue;
+
dskb = skb_clone(skb, GFP_ATOMIC);
- if (dskb) {
- ieee80211_tx_skb_tid(sdata, dskb, 7, link);
- } else {
+ if (!dskb) {
ret = -ENOMEM;
kfree_skb(skb);
goto out_unlock;
}
+
+ /* Assign link address */
+ hdr = (void *)dskb->data;
+ memcpy(hdr->addr2, conf->addr, ETH_ALEN);
+ memcpy(hdr->addr3, conf->addr, ETH_ALEN);
+ ieee80211_tx_skb_tid(sdata, dskb, 7, link);
}
kfree_skb(skb);
} else {
--
2.18.0