diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2007-09-26 11:53:14 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:54:16 -0400 |
commit | 70f0876579ceeea9fd7bd4a20fade524a0b3bdda (patch) | |
tree | 9421b62d8cc8e4fd7c8dddbcafad2628dac19a70 /net/mac80211/rx.c | |
parent | f9d540ee5f7e480339911df8d7389ef4c435ab54 (diff) |
[MAC80211]: move sta_process rx handler later
This moves the sta_process RX handler to after decryption
so that frames that cannot be decrypted don't influence
statistics, it is likely that they were injected or something
else is totally wrong.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/mac80211/rx.c')
-rw-r--r-- | net/mac80211/rx.c | 96 |
1 files changed, 48 insertions, 48 deletions
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 7cd185e9dde4..6973d5c8e9e0 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -512,6 +512,53 @@ ieee80211_rx_h_load_key(struct ieee80211_txrx_data *rx) | |||
512 | return TXRX_CONTINUE; | 512 | return TXRX_CONTINUE; |
513 | } | 513 | } |
514 | 514 | ||
515 | static ieee80211_txrx_result | ||
516 | ieee80211_rx_h_wep_weak_iv_detection(struct ieee80211_txrx_data *rx) | ||
517 | { | ||
518 | if (!rx->sta || !(rx->fc & IEEE80211_FCTL_PROTECTED) || | ||
519 | (rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA || | ||
520 | !rx->key || rx->key->conf.alg != ALG_WEP || | ||
521 | !(rx->flags & IEEE80211_TXRXD_RXRA_MATCH)) | ||
522 | return TXRX_CONTINUE; | ||
523 | |||
524 | /* Check for weak IVs, if hwaccel did not remove IV from the frame */ | ||
525 | if (!(rx->u.rx.status->flag & RX_FLAG_IV_STRIPPED) || | ||
526 | !(rx->u.rx.status->flag & RX_FLAG_DECRYPTED)) | ||
527 | if (ieee80211_wep_is_weak_iv(rx->skb, rx->key)) | ||
528 | rx->sta->wep_weak_iv_count++; | ||
529 | |||
530 | return TXRX_CONTINUE; | ||
531 | } | ||
532 | |||
533 | static ieee80211_txrx_result | ||
534 | ieee80211_rx_h_decrypt(struct ieee80211_txrx_data *rx) | ||
535 | { | ||
536 | if (!(rx->fc & IEEE80211_FCTL_PROTECTED)) | ||
537 | return TXRX_CONTINUE; | ||
538 | |||
539 | if (!rx->key) { | ||
540 | if (net_ratelimit()) | ||
541 | printk(KERN_DEBUG "%s: RX protected frame," | ||
542 | " but have no key\n", rx->dev->name); | ||
543 | return TXRX_DROP; | ||
544 | } | ||
545 | |||
546 | switch (rx->key->conf.alg) { | ||
547 | case ALG_WEP: | ||
548 | return ieee80211_crypto_wep_decrypt(rx); | ||
549 | case ALG_TKIP: | ||
550 | return ieee80211_crypto_tkip_decrypt(rx); | ||
551 | case ALG_CCMP: | ||
552 | return ieee80211_crypto_ccmp_decrypt(rx); | ||
553 | case ALG_NONE: | ||
554 | return TXRX_CONTINUE; | ||
555 | } | ||
556 | |||
557 | /* not reached */ | ||
558 | WARN_ON(1); | ||
559 | return TXRX_DROP; | ||
560 | } | ||
561 | |||
515 | static void ap_sta_ps_start(struct net_device *dev, struct sta_info *sta) | 562 | static void ap_sta_ps_start(struct net_device *dev, struct sta_info *sta) |
516 | { | 563 | { |
517 | struct ieee80211_sub_if_data *sdata; | 564 | struct ieee80211_sub_if_data *sdata; |
@@ -637,53 +684,6 @@ ieee80211_rx_h_sta_process(struct ieee80211_txrx_data *rx) | |||
637 | return TXRX_CONTINUE; | 684 | return TXRX_CONTINUE; |
638 | } /* ieee80211_rx_h_sta_process */ | 685 | } /* ieee80211_rx_h_sta_process */ |
639 | 686 | ||
640 | static ieee80211_txrx_result | ||
641 | ieee80211_rx_h_wep_weak_iv_detection(struct ieee80211_txrx_data *rx) | ||
642 | { | ||
643 | if (!rx->sta || !(rx->fc & IEEE80211_FCTL_PROTECTED) || | ||
644 | (rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA || | ||
645 | !rx->key || rx->key->conf.alg != ALG_WEP || | ||
646 | !(rx->flags & IEEE80211_TXRXD_RXRA_MATCH)) | ||
647 | return TXRX_CONTINUE; | ||
648 | |||
649 | /* Check for weak IVs, if hwaccel did not remove IV from the frame */ | ||
650 | if (!(rx->u.rx.status->flag & RX_FLAG_IV_STRIPPED) || | ||
651 | !(rx->u.rx.status->flag & RX_FLAG_DECRYPTED)) | ||
652 | if (ieee80211_wep_is_weak_iv(rx->skb, rx->key)) | ||
653 | rx->sta->wep_weak_iv_count++; | ||
654 | |||
655 | return TXRX_CONTINUE; | ||
656 | } | ||
657 | |||
658 | static ieee80211_txrx_result | ||
659 | ieee80211_rx_h_decrypt(struct ieee80211_txrx_data *rx) | ||
660 | { | ||
661 | if (!(rx->fc & IEEE80211_FCTL_PROTECTED)) | ||
662 | return TXRX_CONTINUE; | ||
663 | |||
664 | if (!rx->key) { | ||
665 | if (net_ratelimit()) | ||
666 | printk(KERN_DEBUG "%s: RX protected frame," | ||
667 | " but have no key\n", rx->dev->name); | ||
668 | return TXRX_DROP; | ||
669 | } | ||
670 | |||
671 | switch (rx->key->conf.alg) { | ||
672 | case ALG_WEP: | ||
673 | return ieee80211_crypto_wep_decrypt(rx); | ||
674 | case ALG_TKIP: | ||
675 | return ieee80211_crypto_tkip_decrypt(rx); | ||
676 | case ALG_CCMP: | ||
677 | return ieee80211_crypto_ccmp_decrypt(rx); | ||
678 | case ALG_NONE: | ||
679 | return TXRX_CONTINUE; | ||
680 | } | ||
681 | |||
682 | /* not reached */ | ||
683 | WARN_ON(1); | ||
684 | return TXRX_DROP; | ||
685 | } | ||
686 | |||
687 | static inline struct ieee80211_fragment_entry * | 687 | static inline struct ieee80211_fragment_entry * |
688 | ieee80211_reassemble_add(struct ieee80211_sub_if_data *sdata, | 688 | ieee80211_reassemble_add(struct ieee80211_sub_if_data *sdata, |
689 | unsigned int frag, unsigned int seq, int rx_queue, | 689 | unsigned int frag, unsigned int seq, int rx_queue, |
@@ -1349,9 +1349,9 @@ ieee80211_rx_handler ieee80211_rx_handlers[] = | |||
1349 | ieee80211_rx_h_passive_scan, | 1349 | ieee80211_rx_h_passive_scan, |
1350 | ieee80211_rx_h_check, | 1350 | ieee80211_rx_h_check, |
1351 | ieee80211_rx_h_load_key, | 1351 | ieee80211_rx_h_load_key, |
1352 | ieee80211_rx_h_sta_process, | ||
1353 | ieee80211_rx_h_wep_weak_iv_detection, | 1352 | ieee80211_rx_h_wep_weak_iv_detection, |
1354 | ieee80211_rx_h_decrypt, | 1353 | ieee80211_rx_h_decrypt, |
1354 | ieee80211_rx_h_sta_process, | ||
1355 | ieee80211_rx_h_defragment, | 1355 | ieee80211_rx_h_defragment, |
1356 | ieee80211_rx_h_ps_poll, | 1356 | ieee80211_rx_h_ps_poll, |
1357 | ieee80211_rx_h_michael_mic_verify, | 1357 | ieee80211_rx_h_michael_mic_verify, |