Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=1990af8d14e48445a0ddcca7765a177b6661d676
Commit:     1990af8d14e48445a0ddcca7765a177b6661d676
Parent:     70f0876579ceeea9fd7bd4a20fade524a0b3bdda
Author:     Johannes Berg <[EMAIL PROTECTED]>
AuthorDate: Wed Sep 26 17:53:15 2007 +0200
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Wed Oct 10 16:54:16 2007 -0700

    [MAC80211]: consolidate decryption more
    
    Currently, we have three RX handlers doing the decryption.
    This patch changes it to have only one handler doing
    everything, thereby getting rid of many duplicate checks.
    
    Signed-off-by: Johannes Berg <[EMAIL PROTECTED]>
    Signed-off-by: John W. Linville <[EMAIL PROTECTED]>
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
    --
     net/mac80211/rx.c |   46 ++++++++++++----------------------------------
     1 files changed, 12 insertions(+), 34 deletions(-)
---
 net/mac80211/rx.c |   46 ++++++++++++----------------------------------
 1 files changed, 12 insertions(+), 34 deletions(-)

diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 6973d5c..d5ce5d3 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -419,7 +419,7 @@ ieee80211_rx_h_check(struct ieee80211_txrx_data *rx)
 
 
 static ieee80211_txrx_result
-ieee80211_rx_h_load_key(struct ieee80211_txrx_data *rx)
+ieee80211_rx_h_decrypt(struct ieee80211_txrx_data *rx)
 {
        struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) rx->skb->data;
        int keyidx;
@@ -456,7 +456,7 @@ ieee80211_rx_h_load_key(struct ieee80211_txrx_data *rx)
                return TXRX_CONTINUE;
 
        /*
-        * No point in finding a key if the frame is neither
+        * No point in finding a key and decrypting if the frame is neither
         * addressed to us nor a multicast frame.
         */
        if (!(rx->flags & IEEE80211_TXRXD_RXRA_MATCH))
@@ -507,42 +507,21 @@ ieee80211_rx_h_load_key(struct ieee80211_txrx_data *rx)
        if (rx->key) {
                rx->key->tx_rx_count++;
                /* TODO: add threshold stuff again */
-       }
-
-       return TXRX_CONTINUE;
-}
-
-static ieee80211_txrx_result
-ieee80211_rx_h_wep_weak_iv_detection(struct ieee80211_txrx_data *rx)
-{
-       if (!rx->sta || !(rx->fc & IEEE80211_FCTL_PROTECTED) ||
-           (rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA ||
-           !rx->key || rx->key->conf.alg != ALG_WEP ||
-           !(rx->flags & IEEE80211_TXRXD_RXRA_MATCH))
-               return TXRX_CONTINUE;
-
-       /* Check for weak IVs, if hwaccel did not remove IV from the frame */
-       if (!(rx->u.rx.status->flag & RX_FLAG_IV_STRIPPED) ||
-           !(rx->u.rx.status->flag & RX_FLAG_DECRYPTED))
-               if (ieee80211_wep_is_weak_iv(rx->skb, rx->key))
-                       rx->sta->wep_weak_iv_count++;
-
-       return TXRX_CONTINUE;
-}
-
-static ieee80211_txrx_result
-ieee80211_rx_h_decrypt(struct ieee80211_txrx_data *rx)
-{
-       if (!(rx->fc & IEEE80211_FCTL_PROTECTED))
-               return TXRX_CONTINUE;
-
-       if (!rx->key) {
+       } else {
                if (net_ratelimit())
                        printk(KERN_DEBUG "%s: RX protected frame,"
                               " but have no key\n", rx->dev->name);
                return TXRX_DROP;
        }
 
+       /* Check for weak IVs if possible */
+       if (rx->sta && rx->key->conf.alg == ALG_WEP &&
+           ((rx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA) &&
+           (!(rx->u.rx.status->flag & RX_FLAG_IV_STRIPPED) ||
+            !(rx->u.rx.status->flag & RX_FLAG_DECRYPTED)) &&
+           ieee80211_wep_is_weak_iv(rx->skb, rx->key))
+               rx->sta->wep_weak_iv_count++;
+
        switch (rx->key->conf.alg) {
        case ALG_WEP:
                return ieee80211_crypto_wep_decrypt(rx);
@@ -551,6 +530,7 @@ ieee80211_rx_h_decrypt(struct ieee80211_txrx_data *rx)
        case ALG_CCMP:
                return ieee80211_crypto_ccmp_decrypt(rx);
        case ALG_NONE:
+               WARN_ON(1);
                return TXRX_CONTINUE;
        }
 
@@ -1348,8 +1328,6 @@ ieee80211_rx_handler ieee80211_rx_handlers[] =
        ieee80211_rx_h_if_stats,
        ieee80211_rx_h_passive_scan,
        ieee80211_rx_h_check,
-       ieee80211_rx_h_load_key,
-       ieee80211_rx_h_wep_weak_iv_detection,
        ieee80211_rx_h_decrypt,
        ieee80211_rx_h_sta_process,
        ieee80211_rx_h_defragment,
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to