diff options
Diffstat (limited to 'net/mac80211/rx.c')
-rw-r--r-- | net/mac80211/rx.c | 40 |
1 files changed, 17 insertions, 23 deletions
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index a0dfafb4f38b..453ccab060a2 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -662,36 +662,32 @@ ieee80211_rx_h_wep_weak_iv_detection(struct ieee80211_txrx_data *rx) | |||
662 | } | 662 | } |
663 | 663 | ||
664 | static ieee80211_txrx_result | 664 | static ieee80211_txrx_result |
665 | ieee80211_rx_h_wep_decrypt(struct ieee80211_txrx_data *rx) | 665 | ieee80211_rx_h_decrypt(struct ieee80211_txrx_data *rx) |
666 | { | 666 | { |
667 | if ((rx->key && rx->key->conf.alg != ALG_WEP) || | 667 | if (!(rx->fc & IEEE80211_FCTL_PROTECTED)) |
668 | !(rx->fc & IEEE80211_FCTL_PROTECTED) || | ||
669 | ((rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA && | ||
670 | ((rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_MGMT || | ||
671 | (rx->fc & IEEE80211_FCTL_STYPE) != IEEE80211_STYPE_AUTH))) | ||
672 | return TXRX_CONTINUE; | 668 | return TXRX_CONTINUE; |
673 | 669 | ||
674 | if (!rx->key) { | 670 | if (!rx->key) { |
675 | if (net_ratelimit()) | 671 | if (net_ratelimit()) |
676 | printk(KERN_DEBUG "%s: RX WEP frame, but no key set\n", | 672 | printk(KERN_DEBUG "%s: RX protected frame," |
677 | rx->dev->name); | 673 | " but have no key\n", rx->dev->name); |
678 | return TXRX_DROP; | 674 | return TXRX_DROP; |
679 | } | 675 | } |
680 | 676 | ||
681 | if (!(rx->u.rx.status->flag & RX_FLAG_DECRYPTED)) { | 677 | switch (rx->key->conf.alg) { |
682 | if (ieee80211_wep_decrypt(rx->local, rx->skb, rx->key)) { | 678 | case ALG_WEP: |
683 | if (net_ratelimit()) | 679 | return ieee80211_crypto_wep_decrypt(rx); |
684 | printk(KERN_DEBUG "%s: RX WEP frame, decrypt " | 680 | case ALG_TKIP: |
685 | "failed\n", rx->dev->name); | 681 | return ieee80211_crypto_tkip_decrypt(rx); |
686 | return TXRX_DROP; | 682 | case ALG_CCMP: |
687 | } | 683 | return ieee80211_crypto_ccmp_decrypt(rx); |
688 | } else if (!(rx->u.rx.status->flag & RX_FLAG_IV_STRIPPED)) { | 684 | case ALG_NONE: |
689 | ieee80211_wep_remove_iv(rx->local, rx->skb, rx->key); | 685 | return TXRX_CONTINUE; |
690 | /* remove ICV */ | ||
691 | skb_trim(rx->skb, rx->skb->len - 4); | ||
692 | } | 686 | } |
693 | 687 | ||
694 | return TXRX_CONTINUE; | 688 | /* not reached */ |
689 | WARN_ON(1); | ||
690 | return TXRX_DROP; | ||
695 | } | 691 | } |
696 | 692 | ||
697 | static inline struct ieee80211_fragment_entry * | 693 | static inline struct ieee80211_fragment_entry * |
@@ -1371,10 +1367,8 @@ ieee80211_rx_handler ieee80211_rx_handlers[] = | |||
1371 | ieee80211_rx_h_check, | 1367 | ieee80211_rx_h_check, |
1372 | ieee80211_rx_h_load_key, | 1368 | ieee80211_rx_h_load_key, |
1373 | ieee80211_rx_h_sta_process, | 1369 | ieee80211_rx_h_sta_process, |
1374 | ieee80211_rx_h_ccmp_decrypt, | ||
1375 | ieee80211_rx_h_tkip_decrypt, | ||
1376 | ieee80211_rx_h_wep_weak_iv_detection, | 1370 | ieee80211_rx_h_wep_weak_iv_detection, |
1377 | ieee80211_rx_h_wep_decrypt, | 1371 | ieee80211_rx_h_decrypt, |
1378 | ieee80211_rx_h_defragment, | 1372 | ieee80211_rx_h_defragment, |
1379 | ieee80211_rx_h_ps_poll, | 1373 | ieee80211_rx_h_ps_poll, |
1380 | ieee80211_rx_h_michael_mic_verify, | 1374 | ieee80211_rx_h_michael_mic_verify, |