aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/net/mac80211
diff options
context:
space:
mode:
authorJouni Malinen <jouni@codeaurora.org>2020-02-22 15:25:46 +0200
committerJohannes Berg <johannes.berg@intel.com>2020-02-24 10:36:11 +0100
commit0a3a84360b376e474f8cc0b6d03b7fcf2dd5c592 (patch)
treedf5ae4e32dfab767c0aee35c15ff8d11de6f8bf7 /net/mac80211
parentmac80211: Update BIP to support Beacon frames (diff)
downloadwireguard-linux-0a3a84360b376e474f8cc0b6d03b7fcf2dd5c592.tar.xz
wireguard-linux-0a3a84360b376e474f8cc0b6d03b7fcf2dd5c592.zip
mac80211: Beacon protection using the new BIGTK (AP)
This adds support for mac80211 to add an MME into Beacon frames in AP mode when a BIGTK is configured. Signed-off-by: Jouni Malinen <jouni@codeaurora.org> Link: https://lore.kernel.org/r/20200222132548.20835-5-jouni@codeaurora.org Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r--net/mac80211/tx.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index cddaacaa31a3..83147385c200 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -4664,6 +4664,28 @@ bool ieee80211_csa_is_complete(struct ieee80211_vif *vif)
}
EXPORT_SYMBOL(ieee80211_csa_is_complete);
+static int ieee80211_beacon_protect(struct sk_buff *skb,
+ struct ieee80211_local *local,
+ struct ieee80211_sub_if_data *sdata)
+{
+ ieee80211_tx_result res;
+ struct ieee80211_tx_data tx;
+
+ memset(&tx, 0, sizeof(tx));
+ tx.key = rcu_dereference(sdata->default_beacon_key);
+ if (!tx.key)
+ return 0;
+ tx.local = local;
+ tx.sdata = sdata;
+ __skb_queue_head_init(&tx.skbs);
+ __skb_queue_tail(&tx.skbs, skb);
+ res = ieee80211_tx_h_encrypt(&tx);
+ if (WARN_ON_ONCE(res != TX_CONTINUE))
+ return -1;
+
+ return 0;
+}
+
static struct sk_buff *
__ieee80211_beacon_get(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
@@ -4731,6 +4753,9 @@ __ieee80211_beacon_get(struct ieee80211_hw *hw,
if (beacon->tail)
skb_put_data(skb, beacon->tail,
beacon->tail_len);
+
+ if (ieee80211_beacon_protect(skb, local, sdata) < 0)
+ goto out;
} else
goto out;
} else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) {