d6bc082f35e7504fed6319f0c839bc337ebc81b2
[openwrt/openwrt.git] / package / kernel / mac80211 / patches / 311-mac80211-remove-drop_unencrypted-code.patch
1 From: Johannes Berg <johannes.berg@intel.com>
2 Date: Fri, 20 Mar 2015 11:41:58 +0100
3 Subject: [PATCH] mac80211: remove drop_unencrypted code
4
5 This mechanism was historic, and only ever used by IBSS, which
6 also doesn't need to have it as it properly manages station's
7 802.1X PAE state (or, with WEP, always has a key.)
8
9 Remove the mechanism to clean up the code.
10
11 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 ---
13
14 --- a/net/mac80211/debugfs.c
15 +++ b/net/mac80211/debugfs.c
16 @@ -274,8 +274,6 @@ void debugfs_hw_add(struct ieee80211_loc
17 #ifdef CPTCFG_MAC80211_DEBUG_COUNTERS
18 DEBUGFS_STATS_ADD(tx_handlers_drop, local->tx_handlers_drop);
19 DEBUGFS_STATS_ADD(tx_handlers_queued, local->tx_handlers_queued);
20 - DEBUGFS_STATS_ADD(tx_handlers_drop_unencrypted,
21 - local->tx_handlers_drop_unencrypted);
22 DEBUGFS_STATS_ADD(tx_handlers_drop_fragment,
23 local->tx_handlers_drop_fragment);
24 DEBUGFS_STATS_ADD(tx_handlers_drop_wep,
25 --- a/net/mac80211/debugfs_netdev.c
26 +++ b/net/mac80211/debugfs_netdev.c
27 @@ -177,7 +177,6 @@ static ssize_t ieee80211_if_write_##name
28 IEEE80211_IF_FILE_R(name)
29
30 /* common attributes */
31 -IEEE80211_IF_FILE(drop_unencrypted, drop_unencrypted, DEC);
32 IEEE80211_IF_FILE(rc_rateidx_mask_2ghz, rc_rateidx_mask[IEEE80211_BAND_2GHZ],
33 HEX);
34 IEEE80211_IF_FILE(rc_rateidx_mask_5ghz, rc_rateidx_mask[IEEE80211_BAND_5GHZ],
35 @@ -562,7 +561,6 @@ IEEE80211_IF_FILE(dot11MeshAwakeWindowDu
36
37 static void add_common_files(struct ieee80211_sub_if_data *sdata)
38 {
39 - DEBUGFS_ADD(drop_unencrypted);
40 DEBUGFS_ADD(rc_rateidx_mask_2ghz);
41 DEBUGFS_ADD(rc_rateidx_mask_5ghz);
42 DEBUGFS_ADD(rc_rateidx_mcs_mask_2ghz);
43 --- a/net/mac80211/ibss.c
44 +++ b/net/mac80211/ibss.c
45 @@ -249,8 +249,6 @@ static void __ieee80211_sta_join_ibss(st
46 if (presp)
47 kfree_rcu(presp, rcu_head);
48
49 - sdata->drop_unencrypted = capability & WLAN_CAPABILITY_PRIVACY ? 1 : 0;
50 -
51 /* make a copy of the chandef, it could be modified below. */
52 chandef = *req_chandef;
53 chan = chandef.chan;
54 @@ -1289,8 +1287,6 @@ static void ieee80211_sta_create_ibss(st
55
56 if (ifibss->privacy)
57 capability |= WLAN_CAPABILITY_PRIVACY;
58 - else
59 - sdata->drop_unencrypted = 0;
60
61 __ieee80211_sta_join_ibss(sdata, bssid, sdata->vif.bss_conf.beacon_int,
62 &ifibss->chandef, ifibss->basic_rates,
63 --- a/net/mac80211/ieee80211_i.h
64 +++ b/net/mac80211/ieee80211_i.h
65 @@ -842,8 +842,6 @@ struct ieee80211_sub_if_data {
66
67 unsigned long state;
68
69 - int drop_unencrypted;
70 -
71 char name[IFNAMSIZ];
72
73 /* Fragment table for host-based reassembly */
74 @@ -1289,7 +1287,6 @@ struct ieee80211_local {
75 /* TX/RX handler statistics */
76 unsigned int tx_handlers_drop;
77 unsigned int tx_handlers_queued;
78 - unsigned int tx_handlers_drop_unencrypted;
79 unsigned int tx_handlers_drop_fragment;
80 unsigned int tx_handlers_drop_wep;
81 unsigned int tx_handlers_drop_not_assoc;
82 --- a/net/mac80211/iface.c
83 +++ b/net/mac80211/iface.c
84 @@ -1535,7 +1535,6 @@ int ieee80211_if_change_type(struct ieee
85 }
86
87 /* reset some values that shouldn't be kept across type changes */
88 - sdata->drop_unencrypted = 0;
89 if (type == NL80211_IFTYPE_STATION)
90 sdata->u.mgd.use_4addr = false;
91
92 --- a/net/mac80211/rx.c
93 +++ b/net/mac80211/rx.c
94 @@ -1897,8 +1897,7 @@ static int ieee80211_drop_unencrypted(st
95 /* Drop unencrypted frames if key is set. */
96 if (unlikely(!ieee80211_has_protected(fc) &&
97 !ieee80211_is_nullfunc(fc) &&
98 - ieee80211_is_data(fc) &&
99 - (rx->key || rx->sdata->drop_unencrypted)))
100 + ieee80211_is_data(fc) && rx->key))
101 return -EACCES;
102
103 return 0;
104 --- a/net/mac80211/tx.c
105 +++ b/net/mac80211/tx.c
106 @@ -594,23 +594,8 @@ ieee80211_tx_h_select_key(struct ieee802
107 else if (!is_multicast_ether_addr(hdr->addr1) &&
108 (key = rcu_dereference(tx->sdata->default_unicast_key)))
109 tx->key = key;
110 - else if (info->flags & IEEE80211_TX_CTL_INJECTED)
111 - tx->key = NULL;
112 - else if (!tx->sdata->drop_unencrypted)
113 - tx->key = NULL;
114 - else if (tx->skb->protocol == tx->sdata->control_port_protocol)
115 - tx->key = NULL;
116 - else if (ieee80211_is_robust_mgmt_frame(tx->skb) &&
117 - !(ieee80211_is_action(hdr->frame_control) &&
118 - tx->sta && test_sta_flag(tx->sta, WLAN_STA_MFP)))
119 - tx->key = NULL;
120 - else if (ieee80211_is_mgmt(hdr->frame_control) &&
121 - !ieee80211_is_robust_mgmt_frame(tx->skb))
122 + else
123 tx->key = NULL;
124 - else {
125 - I802_DEBUG_INC(tx->local->tx_handlers_drop_unencrypted);
126 - return TX_DROP;
127 - }
128
129 if (tx->key) {
130 bool skip_hw = false;