developer | dad89a3 | 2024-04-29 14:17:17 +0800 | [diff] [blame] | 1 | From db3b035491cb7be00b1ac169863a172a5aebbacf Mon Sep 17 00:00:00 2001 |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2 | From: Michael-CY Lee <michael-cy.lee@mediatek.com> |
| 3 | Date: Mon, 25 Mar 2024 16:26:34 +0800 |
| 4 | Subject: [PATCH 58/61] mtk: wifi: mt76: mt7996: assign link address to the |
| 5 | header of broadcast mgmt. |
| 6 | |
| 7 | AAD calculation should use link addr as input for broadcast mgmt. skb. |
| 8 | This commit assigns link address to the header of cloned broadcast mgmt. |
| 9 | for the correct AAD calculation. |
| 10 | |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 11 | Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com> |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 12 | --- |
| 13 | net/mac80211/offchannel.c | 16 +++++++++++++--- |
| 14 | 1 file changed, 13 insertions(+), 3 deletions(-) |
| 15 | |
| 16 | diff --git a/net/mac80211/offchannel.c b/net/mac80211/offchannel.c |
| 17 | index 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 | -- |
developer | dad89a3 | 2024-04-29 14:17:17 +0800 | [diff] [blame] | 51 | 2.18.0 |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 52 | |