diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/mac80211/rx.c | 53 | ||||
-rw-r--r-- | net/mac80211/tx.c | 35 | ||||
-rw-r--r-- | net/mac80211/wep.c | 7 |
3 files changed, 44 insertions, 51 deletions
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 4e9631c140a3..3a96251379f9 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -867,16 +867,18 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx) | |||
867 | { | 867 | { |
868 | struct ieee80211_hdr *hdr; | 868 | struct ieee80211_hdr *hdr; |
869 | u16 sc; | 869 | u16 sc; |
870 | __le16 fc; | ||
870 | unsigned int frag, seq; | 871 | unsigned int frag, seq; |
871 | struct ieee80211_fragment_entry *entry; | 872 | struct ieee80211_fragment_entry *entry; |
872 | struct sk_buff *skb; | 873 | struct sk_buff *skb; |
873 | DECLARE_MAC_BUF(mac); | 874 | DECLARE_MAC_BUF(mac); |
874 | 875 | ||
875 | hdr = (struct ieee80211_hdr *)rx->skb->data; | 876 | hdr = (struct ieee80211_hdr *)rx->skb->data; |
877 | fc = hdr->frame_control; | ||
876 | sc = le16_to_cpu(hdr->seq_ctrl); | 878 | sc = le16_to_cpu(hdr->seq_ctrl); |
877 | frag = sc & IEEE80211_SCTL_FRAG; | 879 | frag = sc & IEEE80211_SCTL_FRAG; |
878 | 880 | ||
879 | if (likely((!ieee80211_has_morefrags(hdr->frame_control) && frag == 0) || | 881 | if (likely((!ieee80211_has_morefrags(fc) && frag == 0) || |
880 | (rx->skb)->len < 24 || | 882 | (rx->skb)->len < 24 || |
881 | is_multicast_ether_addr(hdr->addr1))) { | 883 | is_multicast_ether_addr(hdr->addr1))) { |
882 | /* not fragmented */ | 884 | /* not fragmented */ |
@@ -891,7 +893,7 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx) | |||
891 | entry = ieee80211_reassemble_add(rx->sdata, frag, seq, | 893 | entry = ieee80211_reassemble_add(rx->sdata, frag, seq, |
892 | rx->queue, &(rx->skb)); | 894 | rx->queue, &(rx->skb)); |
893 | if (rx->key && rx->key->conf.alg == ALG_CCMP && | 895 | if (rx->key && rx->key->conf.alg == ALG_CCMP && |
894 | ieee80211_has_protected(hdr->frame_control)) { | 896 | ieee80211_has_protected(fc)) { |
895 | /* Store CCMP PN so that we can verify that the next | 897 | /* Store CCMP PN so that we can verify that the next |
896 | * fragment has a sequential PN value. */ | 898 | * fragment has a sequential PN value. */ |
897 | entry->ccmp = 1; | 899 | entry->ccmp = 1; |
@@ -930,11 +932,11 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx) | |||
930 | memcpy(entry->last_pn, pn, CCMP_PN_LEN); | 932 | memcpy(entry->last_pn, pn, CCMP_PN_LEN); |
931 | } | 933 | } |
932 | 934 | ||
933 | skb_pull(rx->skb, ieee80211_hdrlen(hdr->frame_control)); | 935 | skb_pull(rx->skb, ieee80211_hdrlen(fc)); |
934 | __skb_queue_tail(&entry->skb_list, rx->skb); | 936 | __skb_queue_tail(&entry->skb_list, rx->skb); |
935 | entry->last_frag = frag; | 937 | entry->last_frag = frag; |
936 | entry->extra_len += rx->skb->len; | 938 | entry->extra_len += rx->skb->len; |
937 | if (rx->fc & IEEE80211_FCTL_MOREFRAGS) { | 939 | if (ieee80211_has_morefrags(fc)) { |
938 | rx->skb = NULL; | 940 | rx->skb = NULL; |
939 | return RX_QUEUED; | 941 | return RX_QUEUED; |
940 | } | 942 | } |
@@ -974,10 +976,9 @@ ieee80211_rx_h_ps_poll(struct ieee80211_rx_data *rx) | |||
974 | struct sk_buff *skb; | 976 | struct sk_buff *skb; |
975 | int no_pending_pkts; | 977 | int no_pending_pkts; |
976 | DECLARE_MAC_BUF(mac); | 978 | DECLARE_MAC_BUF(mac); |
979 | __le16 fc = ((struct ieee80211_hdr *)rx->skb->data)->frame_control; | ||
977 | 980 | ||
978 | if (likely(!rx->sta || | 981 | if (likely(!rx->sta || !ieee80211_is_pspoll(fc) || |
979 | (rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_CTL || | ||
980 | (rx->fc & IEEE80211_FCTL_STYPE) != IEEE80211_STYPE_PSPOLL || | ||
981 | !(rx->flags & IEEE80211_RX_RA_MATCH))) | 982 | !(rx->flags & IEEE80211_RX_RA_MATCH))) |
982 | return RX_CONTINUE; | 983 | return RX_CONTINUE; |
983 | 984 | ||
@@ -1073,7 +1074,7 @@ ieee80211_802_1x_port_control(struct ieee80211_rx_data *rx) | |||
1073 | } | 1074 | } |
1074 | 1075 | ||
1075 | static int | 1076 | static int |
1076 | ieee80211_drop_unencrypted(struct ieee80211_rx_data *rx) | 1077 | ieee80211_drop_unencrypted(struct ieee80211_rx_data *rx, __le16 fc) |
1077 | { | 1078 | { |
1078 | /* | 1079 | /* |
1079 | * Pass through unencrypted frames if the hardware has | 1080 | * Pass through unencrypted frames if the hardware has |
@@ -1083,9 +1084,8 @@ ieee80211_drop_unencrypted(struct ieee80211_rx_data *rx) | |||
1083 | return 0; | 1084 | return 0; |
1084 | 1085 | ||
1085 | /* Drop unencrypted frames if key is set. */ | 1086 | /* Drop unencrypted frames if key is set. */ |
1086 | if (unlikely(!(rx->fc & IEEE80211_FCTL_PROTECTED) && | 1087 | if (unlikely(!ieee80211_has_protected(fc) && |
1087 | (rx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA && | 1088 | !ieee80211_is_nullfunc(fc) && |
1088 | (rx->fc & IEEE80211_FCTL_STYPE) != IEEE80211_STYPE_NULLFUNC && | ||
1089 | (rx->key || rx->sdata->drop_unencrypted))) | 1089 | (rx->key || rx->sdata->drop_unencrypted))) |
1090 | return -EACCES; | 1090 | return -EACCES; |
1091 | 1091 | ||
@@ -1184,7 +1184,7 @@ ieee80211_data_to_8023(struct ieee80211_rx_data *rx) | |||
1184 | /* | 1184 | /* |
1185 | * requires that rx->skb is a frame with ethernet header | 1185 | * requires that rx->skb is a frame with ethernet header |
1186 | */ | 1186 | */ |
1187 | static bool ieee80211_frame_allowed(struct ieee80211_rx_data *rx) | 1187 | static bool ieee80211_frame_allowed(struct ieee80211_rx_data *rx, __le16 fc) |
1188 | { | 1188 | { |
1189 | static const u8 pae_group_addr[ETH_ALEN] __aligned(2) | 1189 | static const u8 pae_group_addr[ETH_ALEN] __aligned(2) |
1190 | = { 0x01, 0x80, 0xC2, 0x00, 0x00, 0x03 }; | 1190 | = { 0x01, 0x80, 0xC2, 0x00, 0x00, 0x03 }; |
@@ -1200,7 +1200,7 @@ static bool ieee80211_frame_allowed(struct ieee80211_rx_data *rx) | |||
1200 | return true; | 1200 | return true; |
1201 | 1201 | ||
1202 | if (ieee80211_802_1x_port_control(rx) || | 1202 | if (ieee80211_802_1x_port_control(rx) || |
1203 | ieee80211_drop_unencrypted(rx)) | 1203 | ieee80211_drop_unencrypted(rx, fc)) |
1204 | return false; | 1204 | return false; |
1205 | 1205 | ||
1206 | return true; | 1206 | return true; |
@@ -1270,20 +1270,21 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx) | |||
1270 | { | 1270 | { |
1271 | struct net_device *dev = rx->dev; | 1271 | struct net_device *dev = rx->dev; |
1272 | struct ieee80211_local *local = rx->local; | 1272 | struct ieee80211_local *local = rx->local; |
1273 | u16 fc, ethertype; | 1273 | u16 ethertype; |
1274 | u8 *payload; | 1274 | u8 *payload; |
1275 | struct sk_buff *skb = rx->skb, *frame = NULL; | 1275 | struct sk_buff *skb = rx->skb, *frame = NULL; |
1276 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | ||
1277 | __le16 fc = hdr->frame_control; | ||
1276 | const struct ethhdr *eth; | 1278 | const struct ethhdr *eth; |
1277 | int remaining, err; | 1279 | int remaining, err; |
1278 | u8 dst[ETH_ALEN]; | 1280 | u8 dst[ETH_ALEN]; |
1279 | u8 src[ETH_ALEN]; | 1281 | u8 src[ETH_ALEN]; |
1280 | DECLARE_MAC_BUF(mac); | 1282 | DECLARE_MAC_BUF(mac); |
1281 | 1283 | ||
1282 | fc = rx->fc; | 1284 | if (unlikely(!ieee80211_is_data(fc))) |
1283 | if (unlikely((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA)) | ||
1284 | return RX_CONTINUE; | 1285 | return RX_CONTINUE; |
1285 | 1286 | ||
1286 | if (unlikely(!WLAN_FC_DATA_PRESENT(fc))) | 1287 | if (unlikely(!ieee80211_is_data_present(fc))) |
1287 | return RX_DROP_MONITOR; | 1288 | return RX_DROP_MONITOR; |
1288 | 1289 | ||
1289 | if (!(rx->flags & IEEE80211_RX_AMSDU)) | 1290 | if (!(rx->flags & IEEE80211_RX_AMSDU)) |
@@ -1365,7 +1366,7 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx) | |||
1365 | memcpy(skb_push(frame, ETH_ALEN), dst, ETH_ALEN); | 1366 | memcpy(skb_push(frame, ETH_ALEN), dst, ETH_ALEN); |
1366 | } | 1367 | } |
1367 | 1368 | ||
1368 | if (!ieee80211_frame_allowed(rx)) { | 1369 | if (!ieee80211_frame_allowed(rx, fc)) { |
1369 | if (skb == frame) /* last frame */ | 1370 | if (skb == frame) /* last frame */ |
1370 | return RX_DROP_UNUSABLE; | 1371 | return RX_DROP_UNUSABLE; |
1371 | dev_kfree_skb(frame); | 1372 | dev_kfree_skb(frame); |
@@ -1439,21 +1440,21 @@ static ieee80211_rx_result debug_noinline | |||
1439 | ieee80211_rx_h_data(struct ieee80211_rx_data *rx) | 1440 | ieee80211_rx_h_data(struct ieee80211_rx_data *rx) |
1440 | { | 1441 | { |
1441 | struct net_device *dev = rx->dev; | 1442 | struct net_device *dev = rx->dev; |
1442 | u16 fc; | 1443 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data; |
1444 | __le16 fc = hdr->frame_control; | ||
1443 | int err; | 1445 | int err; |
1444 | 1446 | ||
1445 | fc = rx->fc; | 1447 | if (unlikely(!ieee80211_is_data(hdr->frame_control))) |
1446 | if (unlikely((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA)) | ||
1447 | return RX_CONTINUE; | 1448 | return RX_CONTINUE; |
1448 | 1449 | ||
1449 | if (unlikely(!WLAN_FC_DATA_PRESENT(fc))) | 1450 | if (unlikely(!ieee80211_is_data_present(hdr->frame_control))) |
1450 | return RX_DROP_MONITOR; | 1451 | return RX_DROP_MONITOR; |
1451 | 1452 | ||
1452 | err = ieee80211_data_to_8023(rx); | 1453 | err = ieee80211_data_to_8023(rx); |
1453 | if (unlikely(err)) | 1454 | if (unlikely(err)) |
1454 | return RX_DROP_UNUSABLE; | 1455 | return RX_DROP_UNUSABLE; |
1455 | 1456 | ||
1456 | if (!ieee80211_frame_allowed(rx)) | 1457 | if (!ieee80211_frame_allowed(rx, fc)) |
1457 | return RX_DROP_MONITOR; | 1458 | return RX_DROP_MONITOR; |
1458 | 1459 | ||
1459 | rx->skb->dev = dev; | 1460 | rx->skb->dev = dev; |
@@ -1818,13 +1819,12 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, | |||
1818 | struct ieee80211_sub_if_data *sdata; | 1819 | struct ieee80211_sub_if_data *sdata; |
1819 | struct ieee80211_hdr *hdr; | 1820 | struct ieee80211_hdr *hdr; |
1820 | struct ieee80211_rx_data rx; | 1821 | struct ieee80211_rx_data rx; |
1821 | u16 type; | ||
1822 | int prepares; | 1822 | int prepares; |
1823 | struct ieee80211_sub_if_data *prev = NULL; | 1823 | struct ieee80211_sub_if_data *prev = NULL; |
1824 | struct sk_buff *skb_new; | 1824 | struct sk_buff *skb_new; |
1825 | u8 *bssid; | 1825 | u8 *bssid; |
1826 | 1826 | ||
1827 | hdr = (struct ieee80211_hdr *) skb->data; | 1827 | hdr = (struct ieee80211_hdr *)skb->data; |
1828 | memset(&rx, 0, sizeof(rx)); | 1828 | memset(&rx, 0, sizeof(rx)); |
1829 | rx.skb = skb; | 1829 | rx.skb = skb; |
1830 | rx.local = local; | 1830 | rx.local = local; |
@@ -1832,9 +1832,8 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, | |||
1832 | rx.status = status; | 1832 | rx.status = status; |
1833 | rx.rate = rate; | 1833 | rx.rate = rate; |
1834 | rx.fc = le16_to_cpu(hdr->frame_control); | 1834 | rx.fc = le16_to_cpu(hdr->frame_control); |
1835 | type = rx.fc & IEEE80211_FCTL_FTYPE; | ||
1836 | 1835 | ||
1837 | if (type == IEEE80211_FTYPE_DATA || type == IEEE80211_FTYPE_MGMT) | 1836 | if (ieee80211_is_data(hdr->frame_control) || ieee80211_is_mgmt(hdr->frame_control)) |
1838 | local->dot11ReceivedFragmentCount++; | 1837 | local->dot11ReceivedFragmentCount++; |
1839 | 1838 | ||
1840 | rx.sta = sta_info_get(local, hdr->addr2); | 1839 | rx.sta = sta_info_get(local, hdr->addr2); |
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 9c60dedc3687..96ffb4d8dfbb 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -82,6 +82,7 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx, int group_addr, | |||
82 | struct ieee80211_rate *txrate; | 82 | struct ieee80211_rate *txrate; |
83 | struct ieee80211_local *local = tx->local; | 83 | struct ieee80211_local *local = tx->local; |
84 | struct ieee80211_supported_band *sband; | 84 | struct ieee80211_supported_band *sband; |
85 | struct ieee80211_hdr *hdr; | ||
85 | 86 | ||
86 | sband = local->hw.wiphy->bands[tx->channel->band]; | 87 | sband = local->hw.wiphy->bands[tx->channel->band]; |
87 | txrate = &sband->bitrates[tx->rate_idx]; | 88 | txrate = &sband->bitrates[tx->rate_idx]; |
@@ -107,8 +108,8 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx, int group_addr, | |||
107 | * at the highest possible rate belonging to the PHY rates in the | 108 | * at the highest possible rate belonging to the PHY rates in the |
108 | * BSSBasicRateSet | 109 | * BSSBasicRateSet |
109 | */ | 110 | */ |
110 | 111 | hdr = (struct ieee80211_hdr *)tx->skb->data; | |
111 | if ((tx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_CTL) { | 112 | if (ieee80211_is_ctl(hdr->frame_control)) { |
112 | /* TODO: These control frames are not currently sent by | 113 | /* TODO: These control frames are not currently sent by |
113 | * 80211.o, but should they be implemented, this function | 114 | * 80211.o, but should they be implemented, this function |
114 | * needs to be updated to support duration field calculation. | 115 | * needs to be updated to support duration field calculation. |
@@ -213,9 +214,8 @@ static int inline is_ieee80211_device(struct net_device *dev, | |||
213 | static ieee80211_tx_result debug_noinline | 214 | static ieee80211_tx_result debug_noinline |
214 | ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx) | 215 | ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx) |
215 | { | 216 | { |
216 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 217 | |
217 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data; | 218 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data; |
218 | #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ | ||
219 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); | 219 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); |
220 | u32 sta_flags; | 220 | u32 sta_flags; |
221 | 221 | ||
@@ -223,8 +223,7 @@ ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx) | |||
223 | return TX_CONTINUE; | 223 | return TX_CONTINUE; |
224 | 224 | ||
225 | if (unlikely(tx->local->sta_sw_scanning) && | 225 | if (unlikely(tx->local->sta_sw_scanning) && |
226 | ((tx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_MGMT || | 226 | !ieee80211_is_probe_req(hdr->frame_control)) |
227 | (tx->fc & IEEE80211_FCTL_STYPE) != IEEE80211_STYPE_PROBE_REQ)) | ||
228 | return TX_DROP; | 227 | return TX_DROP; |
229 | 228 | ||
230 | if (tx->sdata->vif.type == IEEE80211_IF_TYPE_MESH_POINT) | 229 | if (tx->sdata->vif.type == IEEE80211_IF_TYPE_MESH_POINT) |
@@ -238,7 +237,7 @@ ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx) | |||
238 | if (likely(tx->flags & IEEE80211_TX_UNICAST)) { | 237 | if (likely(tx->flags & IEEE80211_TX_UNICAST)) { |
239 | if (unlikely(!(sta_flags & WLAN_STA_ASSOC) && | 238 | if (unlikely(!(sta_flags & WLAN_STA_ASSOC) && |
240 | tx->sdata->vif.type != IEEE80211_IF_TYPE_IBSS && | 239 | tx->sdata->vif.type != IEEE80211_IF_TYPE_IBSS && |
241 | (tx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA)) { | 240 | ieee80211_is_data(hdr->frame_control))) { |
242 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 241 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
243 | DECLARE_MAC_BUF(mac); | 242 | DECLARE_MAC_BUF(mac); |
244 | printk(KERN_DEBUG "%s: dropped data frame to not " | 243 | printk(KERN_DEBUG "%s: dropped data frame to not " |
@@ -249,7 +248,7 @@ ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx) | |||
249 | return TX_DROP; | 248 | return TX_DROP; |
250 | } | 249 | } |
251 | } else { | 250 | } else { |
252 | if (unlikely((tx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA && | 251 | if (unlikely(ieee80211_is_data(hdr->frame_control) && |
253 | tx->local->num_sta == 0 && | 252 | tx->local->num_sta == 0 && |
254 | tx->sdata->vif.type != IEEE80211_IF_TYPE_IBSS)) { | 253 | tx->sdata->vif.type != IEEE80211_IF_TYPE_IBSS)) { |
255 | /* | 254 | /* |
@@ -315,6 +314,7 @@ static ieee80211_tx_result | |||
315 | ieee80211_tx_h_multicast_ps_buf(struct ieee80211_tx_data *tx) | 314 | ieee80211_tx_h_multicast_ps_buf(struct ieee80211_tx_data *tx) |
316 | { | 315 | { |
317 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); | 316 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); |
317 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data; | ||
318 | 318 | ||
319 | /* | 319 | /* |
320 | * broadcast/multicast frame | 320 | * broadcast/multicast frame |
@@ -329,7 +329,7 @@ ieee80211_tx_h_multicast_ps_buf(struct ieee80211_tx_data *tx) | |||
329 | return TX_CONTINUE; | 329 | return TX_CONTINUE; |
330 | 330 | ||
331 | /* no buffering for ordered frames */ | 331 | /* no buffering for ordered frames */ |
332 | if (tx->fc & IEEE80211_FCTL_ORDER) | 332 | if (ieee80211_has_order(hdr->frame_control)) |
333 | return TX_CONTINUE; | 333 | return TX_CONTINUE; |
334 | 334 | ||
335 | /* no stations in PS mode */ | 335 | /* no stations in PS mode */ |
@@ -367,12 +367,11 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx) | |||
367 | { | 367 | { |
368 | struct sta_info *sta = tx->sta; | 368 | struct sta_info *sta = tx->sta; |
369 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); | 369 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); |
370 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data; | ||
370 | u32 staflags; | 371 | u32 staflags; |
371 | DECLARE_MAC_BUF(mac); | 372 | DECLARE_MAC_BUF(mac); |
372 | 373 | ||
373 | if (unlikely(!sta || | 374 | if (unlikely(!sta || ieee80211_is_probe_resp(hdr->frame_control))) |
374 | ((tx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT && | ||
375 | (tx->fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_PROBE_RESP))) | ||
376 | return TX_CONTINUE; | 375 | return TX_CONTINUE; |
377 | 376 | ||
378 | staflags = get_sta_flags(sta); | 377 | staflags = get_sta_flags(sta); |
@@ -437,7 +436,7 @@ ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx) | |||
437 | { | 436 | { |
438 | struct ieee80211_key *key; | 437 | struct ieee80211_key *key; |
439 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); | 438 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); |
440 | u16 fc = tx->fc; | 439 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data; |
441 | 440 | ||
442 | if (unlikely(tx->skb->do_not_encrypt)) | 441 | if (unlikely(tx->skb->do_not_encrypt)) |
443 | tx->key = NULL; | 442 | tx->key = NULL; |
@@ -454,22 +453,16 @@ ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx) | |||
454 | tx->key = NULL; | 453 | tx->key = NULL; |
455 | 454 | ||
456 | if (tx->key) { | 455 | if (tx->key) { |
457 | u16 ftype, stype; | ||
458 | |||
459 | tx->key->tx_rx_count++; | 456 | tx->key->tx_rx_count++; |
460 | /* TODO: add threshold stuff again */ | 457 | /* TODO: add threshold stuff again */ |
461 | 458 | ||
462 | switch (tx->key->conf.alg) { | 459 | switch (tx->key->conf.alg) { |
463 | case ALG_WEP: | 460 | case ALG_WEP: |
464 | ftype = fc & IEEE80211_FCTL_FTYPE; | 461 | if (ieee80211_is_auth(hdr->frame_control)) |
465 | stype = fc & IEEE80211_FCTL_STYPE; | ||
466 | |||
467 | if (ftype == IEEE80211_FTYPE_MGMT && | ||
468 | stype == IEEE80211_STYPE_AUTH) | ||
469 | break; | 462 | break; |
470 | case ALG_TKIP: | 463 | case ALG_TKIP: |
471 | case ALG_CCMP: | 464 | case ALG_CCMP: |
472 | if (!WLAN_FC_DATA_PRESENT(fc)) | 465 | if (!ieee80211_is_data_present(hdr->frame_control)) |
473 | tx->key = NULL; | 466 | tx->key = NULL; |
474 | break; | 467 | break; |
475 | } | 468 | } |
diff --git a/net/mac80211/wep.c b/net/mac80211/wep.c index 639998775b48..376c84987e4f 100644 --- a/net/mac80211/wep.c +++ b/net/mac80211/wep.c | |||
@@ -291,9 +291,10 @@ u8 * ieee80211_wep_is_weak_iv(struct sk_buff *skb, struct ieee80211_key *key) | |||
291 | ieee80211_rx_result | 291 | ieee80211_rx_result |
292 | ieee80211_crypto_wep_decrypt(struct ieee80211_rx_data *rx) | 292 | ieee80211_crypto_wep_decrypt(struct ieee80211_rx_data *rx) |
293 | { | 293 | { |
294 | if ((rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA && | 294 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data; |
295 | ((rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_MGMT || | 295 | |
296 | (rx->fc & IEEE80211_FCTL_STYPE) != IEEE80211_STYPE_AUTH)) | 296 | if (!ieee80211_is_data(hdr->frame_control) && |
297 | !ieee80211_is_auth(hdr->frame_control)) | ||
297 | return RX_CONTINUE; | 298 | return RX_CONTINUE; |
298 | 299 | ||
299 | if (!(rx->status->flag & RX_FLAG_DECRYPTED)) { | 300 | if (!(rx->status->flag & RX_FLAG_DECRYPTED)) { |