2015-03-21 00:24:14 +08:00
|
|
|
From: Johannes Berg <johannes.berg@intel.com>
|
|
|
|
Date: Fri, 20 Mar 2015 11:41:58 +0100
|
|
|
|
Subject: [PATCH] mac80211: remove drop_unencrypted code
|
|
|
|
|
|
|
|
This mechanism was historic, and only ever used by IBSS, which
|
|
|
|
also doesn't need to have it as it properly manages station's
|
|
|
|
802.1X PAE state (or, with WEP, always has a key.)
|
|
|
|
|
|
|
|
Remove the mechanism to clean up the code.
|
|
|
|
|
|
|
|
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
|
|
|
|
---
|
|
|
|
|
|
|
|
--- a/net/mac80211/debugfs.c
|
|
|
|
+++ b/net/mac80211/debugfs.c
|
|
|
|
@@ -274,8 +274,6 @@ void debugfs_hw_add(struct ieee80211_loc
|
|
|
|
#ifdef CPTCFG_MAC80211_DEBUG_COUNTERS
|
|
|
|
DEBUGFS_STATS_ADD(tx_handlers_drop, local->tx_handlers_drop);
|
|
|
|
DEBUGFS_STATS_ADD(tx_handlers_queued, local->tx_handlers_queued);
|
|
|
|
- DEBUGFS_STATS_ADD(tx_handlers_drop_unencrypted,
|
|
|
|
- local->tx_handlers_drop_unencrypted);
|
|
|
|
DEBUGFS_STATS_ADD(tx_handlers_drop_fragment,
|
|
|
|
local->tx_handlers_drop_fragment);
|
|
|
|
DEBUGFS_STATS_ADD(tx_handlers_drop_wep,
|
|
|
|
--- a/net/mac80211/debugfs_netdev.c
|
|
|
|
+++ b/net/mac80211/debugfs_netdev.c
|
|
|
|
@@ -177,7 +177,6 @@ static ssize_t ieee80211_if_write_##name
|
|
|
|
IEEE80211_IF_FILE_R(name)
|
|
|
|
|
|
|
|
/* common attributes */
|
|
|
|
-IEEE80211_IF_FILE(drop_unencrypted, drop_unencrypted, DEC);
|
|
|
|
IEEE80211_IF_FILE(rc_rateidx_mask_2ghz, rc_rateidx_mask[IEEE80211_BAND_2GHZ],
|
|
|
|
HEX);
|
|
|
|
IEEE80211_IF_FILE(rc_rateidx_mask_5ghz, rc_rateidx_mask[IEEE80211_BAND_5GHZ],
|
|
|
|
@@ -562,7 +561,6 @@ IEEE80211_IF_FILE(dot11MeshAwakeWindowDu
|
|
|
|
|
|
|
|
static void add_common_files(struct ieee80211_sub_if_data *sdata)
|
|
|
|
{
|
|
|
|
- DEBUGFS_ADD(drop_unencrypted);
|
|
|
|
DEBUGFS_ADD(rc_rateidx_mask_2ghz);
|
|
|
|
DEBUGFS_ADD(rc_rateidx_mask_5ghz);
|
|
|
|
DEBUGFS_ADD(rc_rateidx_mcs_mask_2ghz);
|
|
|
|
--- a/net/mac80211/ibss.c
|
|
|
|
+++ b/net/mac80211/ibss.c
|
|
|
|
@@ -249,8 +249,6 @@ static void __ieee80211_sta_join_ibss(st
|
|
|
|
if (presp)
|
|
|
|
kfree_rcu(presp, rcu_head);
|
|
|
|
|
|
|
|
- sdata->drop_unencrypted = capability & WLAN_CAPABILITY_PRIVACY ? 1 : 0;
|
|
|
|
-
|
|
|
|
/* make a copy of the chandef, it could be modified below. */
|
|
|
|
chandef = *req_chandef;
|
|
|
|
chan = chandef.chan;
|
|
|
|
@@ -1289,8 +1287,6 @@ static void ieee80211_sta_create_ibss(st
|
|
|
|
|
|
|
|
if (ifibss->privacy)
|
|
|
|
capability |= WLAN_CAPABILITY_PRIVACY;
|
|
|
|
- else
|
|
|
|
- sdata->drop_unencrypted = 0;
|
|
|
|
|
|
|
|
__ieee80211_sta_join_ibss(sdata, bssid, sdata->vif.bss_conf.beacon_int,
|
|
|
|
&ifibss->chandef, ifibss->basic_rates,
|
|
|
|
--- a/net/mac80211/ieee80211_i.h
|
|
|
|
+++ b/net/mac80211/ieee80211_i.h
|
|
|
|
@@ -842,8 +842,6 @@ struct ieee80211_sub_if_data {
|
|
|
|
|
|
|
|
unsigned long state;
|
|
|
|
|
|
|
|
- int drop_unencrypted;
|
|
|
|
-
|
|
|
|
char name[IFNAMSIZ];
|
|
|
|
|
|
|
|
/* Fragment table for host-based reassembly */
|
|
|
|
@@ -1289,7 +1287,6 @@ struct ieee80211_local {
|
|
|
|
/* TX/RX handler statistics */
|
|
|
|
unsigned int tx_handlers_drop;
|
|
|
|
unsigned int tx_handlers_queued;
|
|
|
|
- unsigned int tx_handlers_drop_unencrypted;
|
|
|
|
unsigned int tx_handlers_drop_fragment;
|
|
|
|
unsigned int tx_handlers_drop_wep;
|
|
|
|
unsigned int tx_handlers_drop_not_assoc;
|
|
|
|
--- a/net/mac80211/iface.c
|
|
|
|
+++ b/net/mac80211/iface.c
|
|
|
|
@@ -1535,7 +1535,6 @@ int ieee80211_if_change_type(struct ieee
|
|
|
|
}
|
|
|
|
|
|
|
|
/* reset some values that shouldn't be kept across type changes */
|
|
|
|
- sdata->drop_unencrypted = 0;
|
|
|
|
if (type == NL80211_IFTYPE_STATION)
|
|
|
|
sdata->u.mgd.use_4addr = false;
|
|
|
|
|
|
|
|
--- a/net/mac80211/rx.c
|
|
|
|
+++ b/net/mac80211/rx.c
|
|
|
|
@@ -1897,8 +1897,7 @@ static int ieee80211_drop_unencrypted(st
|
|
|
|
/* Drop unencrypted frames if key is set. */
|
|
|
|
if (unlikely(!ieee80211_has_protected(fc) &&
|
|
|
|
!ieee80211_is_nullfunc(fc) &&
|
|
|
|
- ieee80211_is_data(fc) &&
|
|
|
|
- (rx->key || rx->sdata->drop_unencrypted)))
|
|
|
|
+ ieee80211_is_data(fc) && rx->key))
|
|
|
|
return -EACCES;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
--- a/net/mac80211/tx.c
|
|
|
|
+++ b/net/mac80211/tx.c
|
|
|
|
@@ -594,23 +594,8 @@ ieee80211_tx_h_select_key(struct ieee802
|
|
|
|
else if (!is_multicast_ether_addr(hdr->addr1) &&
|
|
|
|
(key = rcu_dereference(tx->sdata->default_unicast_key)))
|
|
|
|
tx->key = key;
|
|
|
|
- else if (info->flags & IEEE80211_TX_CTL_INJECTED)
|
2015-05-22 03:32:16 +08:00
|
|
|
+ else
|
|
|
|
tx->key = NULL;
|
2015-03-21 00:24:14 +08:00
|
|
|
- else if (!tx->sdata->drop_unencrypted)
|
|
|
|
- tx->key = NULL;
|
|
|
|
- else if (tx->skb->protocol == tx->sdata->control_port_protocol)
|
|
|
|
- tx->key = NULL;
|
|
|
|
- else if (ieee80211_is_robust_mgmt_frame(tx->skb) &&
|
|
|
|
- !(ieee80211_is_action(hdr->frame_control) &&
|
|
|
|
- tx->sta && test_sta_flag(tx->sta, WLAN_STA_MFP)))
|
|
|
|
- tx->key = NULL;
|
|
|
|
- else if (ieee80211_is_mgmt(hdr->frame_control) &&
|
|
|
|
- !ieee80211_is_robust_mgmt_frame(tx->skb))
|
2015-05-22 03:32:16 +08:00
|
|
|
- tx->key = NULL;
|
2015-03-21 00:24:14 +08:00
|
|
|
- else {
|
|
|
|
- I802_DEBUG_INC(tx->local->tx_handlers_drop_unencrypted);
|
|
|
|
- return TX_DROP;
|
|
|
|
- }
|
|
|
|
|
|
|
|
if (tx->key) {
|
|
|
|
bool skip_hw = false;
|