| From 70e027ce4ac9e4de16829c88ee846b7e12f14953 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. |
| |
| CR-Id: WCNCR00289305 |
| Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com> |
| Change-Id: Ieeee17cc2121fdbc9eb34f171f2d4da583d91154 |
| --- |
| 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.39.2 |
| |