blob: 136ef3865e9abb57003f50de92bf8fec59ee96fc [file] [log] [blame]
developerdad89a32024-04-29 14:17:17 +08001From db3b035491cb7be00b1ac169863a172a5aebbacf Mon Sep 17 00:00:00 2001
developer66e89bc2024-04-23 14:50:01 +08002From: Michael-CY Lee <michael-cy.lee@mediatek.com>
3Date: Mon, 25 Mar 2024 16:26:34 +0800
4Subject: [PATCH 58/61] mtk: wifi: mt76: mt7996: assign link address to the
5 header of broadcast mgmt.
6
7AAD calculation should use link addr as input for broadcast mgmt. skb.
8This commit assigns link address to the header of cloned broadcast mgmt.
9for the correct AAD calculation.
10
developer66e89bc2024-04-23 14:50:01 +080011Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com>
developer66e89bc2024-04-23 14:50:01 +080012---
13 net/mac80211/offchannel.c | 16 +++++++++++++---
14 1 file changed, 13 insertions(+), 3 deletions(-)
15
16diff --git a/net/mac80211/offchannel.c b/net/mac80211/offchannel.c
17index a571be0..15948f9 100644
18--- a/net/mac80211/offchannel.c
19+++ b/net/mac80211/offchannel.c
20@@ -981,16 +981,26 @@ int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
21 if (is_multicast_ether_addr(mgmt->da) && hweight16(links) > 1) {
22 unsigned int link;
23 struct sk_buff *dskb;
24+ struct ieee80211_hdr *hdr;
25+ struct ieee80211_bss_conf *conf;
26
27 for_each_set_bit(link, &links, IEEE80211_MLD_MAX_NUM_LINKS) {
28+ conf = rcu_dereference(sdata->vif.link_conf[link]);
29+ if (!conf)
30+ continue;
31+
32 dskb = skb_clone(skb, GFP_ATOMIC);
33- if (dskb) {
34- ieee80211_tx_skb_tid(sdata, dskb, 7, link);
35- } else {
36+ if (!dskb) {
37 ret = -ENOMEM;
38 kfree_skb(skb);
39 goto out_unlock;
40 }
41+
42+ /* Assign link address */
43+ hdr = (void *)dskb->data;
44+ memcpy(hdr->addr2, conf->addr, ETH_ALEN);
45+ memcpy(hdr->addr3, conf->addr, ETH_ALEN);
46+ ieee80211_tx_skb_tid(sdata, dskb, 7, link);
47 }
48 kfree_skb(skb);
49 } else {
50--
developerdad89a32024-04-29 14:17:17 +0800512.18.0
developer66e89bc2024-04-23 14:50:01 +080052