1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Wed, 16 Dec 2020 21:23:24 +0100
3 Subject: [PATCH] mac80211: fix encryption key selection for 802.3 xmit
5 When using WEP, the default unicast key needs to be selected, instead of
8 Signed-off-by: Felix Fietkau <nbd@nbd.name>
11 --- a/net/mac80211/tx.c
12 +++ b/net/mac80211/tx.c
13 @@ -4262,7 +4262,6 @@ netdev_tx_t ieee80211_subif_start_xmit_8
14 struct ethhdr *ehdr = (struct ethhdr *)skb->data;
15 struct ieee80211_key *key;
17 - bool offload = true;
19 if (unlikely(skb->len < ETH_HLEN)) {
21 @@ -4278,18 +4277,22 @@ netdev_tx_t ieee80211_subif_start_xmit_8
23 if (unlikely(IS_ERR_OR_NULL(sta) || !sta->uploaded ||
24 !test_sta_flag(sta, WLAN_STA_AUTHORIZED) ||
25 - sdata->control_port_protocol == ehdr->h_proto))
27 - else if ((key = rcu_dereference(sta->ptk[sta->ptk_idx])) &&
28 - (!(key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) ||
29 - key->conf.cipher == WLAN_CIPHER_SUITE_TKIP))
31 + sdata->control_port_protocol == ehdr->h_proto))
35 - ieee80211_8023_xmit(sdata, dev, sta, key, skb);
37 - ieee80211_subif_start_xmit(skb, dev);
38 + key = rcu_dereference(sta->ptk[sta->ptk_idx]);
40 + key = rcu_dereference(sdata->default_unicast_key);
42 + if (key && (!(key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) ||
43 + key->conf.cipher == WLAN_CIPHER_SUITE_TKIP))
46 + ieee80211_8023_xmit(sdata, dev, sta, key, skb);
50 + ieee80211_subif_start_xmit(skb, dev);