Commit 7f3f96ce authored by Markus Theil's avatar Markus Theil Committed by Johannes Berg

mac80211: handle no-preauth flag for control port

This patch adds support for disabling pre-auth rx over the nl80211 control
port for mac80211.
Signed-off-by: default avatarMarkus Theil <markus.theil@tu-ilmenau.de>
Link: https://lore.kernel.org/r/20200312091055.54257-3-markus.theil@tu-ilmenau.de
[fix indentation slightly, squash feature enablement]
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 5631d96a
...@@ -924,6 +924,7 @@ struct cfg80211_crypto_settings { ...@@ -924,6 +924,7 @@ struct cfg80211_crypto_settings {
__be16 control_port_ethertype; __be16 control_port_ethertype;
bool control_port_no_encrypt; bool control_port_no_encrypt;
bool control_port_over_nl80211; bool control_port_over_nl80211;
bool control_port_no_preauth;
struct key_params *wep_keys; struct key_params *wep_keys;
int wep_tx_key; int wep_tx_key;
const u8 *psk; const u8 *psk;
......
...@@ -1034,6 +1034,8 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev, ...@@ -1034,6 +1034,8 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
sdata->control_port_no_encrypt = params->crypto.control_port_no_encrypt; sdata->control_port_no_encrypt = params->crypto.control_port_no_encrypt;
sdata->control_port_over_nl80211 = sdata->control_port_over_nl80211 =
params->crypto.control_port_over_nl80211; params->crypto.control_port_over_nl80211;
sdata->control_port_no_preauth =
params->crypto.control_port_no_preauth;
sdata->encrypt_headroom = ieee80211_cs_headroom(sdata->local, sdata->encrypt_headroom = ieee80211_cs_headroom(sdata->local,
&params->crypto, &params->crypto,
sdata->vif.type); sdata->vif.type);
...@@ -1045,6 +1047,8 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev, ...@@ -1045,6 +1047,8 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
params->crypto.control_port_no_encrypt; params->crypto.control_port_no_encrypt;
vlan->control_port_over_nl80211 = vlan->control_port_over_nl80211 =
params->crypto.control_port_over_nl80211; params->crypto.control_port_over_nl80211;
vlan->control_port_no_preauth =
params->crypto.control_port_no_preauth;
vlan->encrypt_headroom = vlan->encrypt_headroom =
ieee80211_cs_headroom(sdata->local, ieee80211_cs_headroom(sdata->local,
&params->crypto, &params->crypto,
......
...@@ -912,6 +912,7 @@ struct ieee80211_sub_if_data { ...@@ -912,6 +912,7 @@ struct ieee80211_sub_if_data {
u16 sequence_number; u16 sequence_number;
__be16 control_port_protocol; __be16 control_port_protocol;
bool control_port_no_encrypt; bool control_port_no_encrypt;
bool control_port_no_preauth;
bool control_port_over_nl80211; bool control_port_over_nl80211;
int encrypt_headroom; int encrypt_headroom;
......
...@@ -519,6 +519,8 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up) ...@@ -519,6 +519,8 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up)
master->control_port_no_encrypt; master->control_port_no_encrypt;
sdata->control_port_over_nl80211 = sdata->control_port_over_nl80211 =
master->control_port_over_nl80211; master->control_port_over_nl80211;
sdata->control_port_no_preauth =
master->control_port_no_preauth;
sdata->vif.cab_queue = master->vif.cab_queue; sdata->vif.cab_queue = master->vif.cab_queue;
memcpy(sdata->vif.hw_queue, master->vif.hw_queue, memcpy(sdata->vif.hw_queue, master->vif.hw_queue,
sizeof(sdata->vif.hw_queue)); sizeof(sdata->vif.hw_queue));
...@@ -1463,6 +1465,8 @@ static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata, ...@@ -1463,6 +1465,8 @@ static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata,
sdata->control_port_protocol = cpu_to_be16(ETH_P_PAE); sdata->control_port_protocol = cpu_to_be16(ETH_P_PAE);
sdata->control_port_no_encrypt = false; sdata->control_port_no_encrypt = false;
sdata->control_port_over_nl80211 = false;
sdata->control_port_no_preauth = false;
sdata->encrypt_headroom = IEEE80211_ENCRYPT_HEADROOM; sdata->encrypt_headroom = IEEE80211_ENCRYPT_HEADROOM;
sdata->vif.bss_conf.idle = true; sdata->vif.bss_conf.idle = true;
sdata->vif.bss_conf.txpower = INT_MIN; /* unset */ sdata->vif.bss_conf.txpower = INT_MIN; /* unset */
......
...@@ -589,6 +589,8 @@ struct ieee80211_hw *ieee80211_alloc_hw_nm(size_t priv_data_len, ...@@ -589,6 +589,8 @@ struct ieee80211_hw *ieee80211_alloc_hw_nm(size_t priv_data_len,
wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_FILS_STA); wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_FILS_STA);
wiphy_ext_feature_set(wiphy, wiphy_ext_feature_set(wiphy,
NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211); NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211);
wiphy_ext_feature_set(wiphy,
NL80211_EXT_FEATURE_CONTROL_PORT_NO_PREAUTH);
if (!ops->hw_scan) { if (!ops->hw_scan) {
wiphy->features |= NL80211_FEATURE_LOW_PRIORITY_SCAN | wiphy->features |= NL80211_FEATURE_LOW_PRIORITY_SCAN |
......
...@@ -5458,6 +5458,7 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata, ...@@ -5458,6 +5458,7 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
sdata->control_port_no_encrypt = req->crypto.control_port_no_encrypt; sdata->control_port_no_encrypt = req->crypto.control_port_no_encrypt;
sdata->control_port_over_nl80211 = sdata->control_port_over_nl80211 =
req->crypto.control_port_over_nl80211; req->crypto.control_port_over_nl80211;
sdata->control_port_no_preauth = req->crypto.control_port_no_preauth;
sdata->encrypt_headroom = ieee80211_cs_headroom(local, &req->crypto, sdata->encrypt_headroom = ieee80211_cs_headroom(local, &req->crypto,
sdata->vif.type); sdata->vif.type);
......
...@@ -2497,7 +2497,8 @@ static void ieee80211_deliver_skb_to_local_stack(struct sk_buff *skb, ...@@ -2497,7 +2497,8 @@ static void ieee80211_deliver_skb_to_local_stack(struct sk_buff *skb,
struct net_device *dev = sdata->dev; struct net_device *dev = sdata->dev;
if (unlikely((skb->protocol == sdata->control_port_protocol || if (unlikely((skb->protocol == sdata->control_port_protocol ||
skb->protocol == cpu_to_be16(ETH_P_PREAUTH)) && (skb->protocol == cpu_to_be16(ETH_P_PREAUTH) &&
!sdata->control_port_no_preauth)) &&
sdata->control_port_over_nl80211)) { sdata->control_port_over_nl80211)) {
struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
bool noencrypt = !(status->flag & RX_FLAG_DECRYPTED); bool noencrypt = !(status->flag & RX_FLAG_DECRYPTED);
......
...@@ -9307,6 +9307,9 @@ static int nl80211_crypto_settings(struct cfg80211_registered_device *rdev, ...@@ -9307,6 +9307,9 @@ static int nl80211_crypto_settings(struct cfg80211_registered_device *rdev,
return r; return r;
settings->control_port_over_nl80211 = true; settings->control_port_over_nl80211 = true;
if (info->attrs[NL80211_ATTR_CONTROL_PORT_NO_PREAUTH])
settings->control_port_no_preauth = true;
} }
if (info->attrs[NL80211_ATTR_CIPHER_SUITES_PAIRWISE]) { if (info->attrs[NL80211_ATTR_CIPHER_SUITES_PAIRWISE]) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment