]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
staging: rtl8192u: remove checks for CONFIG_IEEE80211_CRYPT_TKIP
authorPaul Bolle <pebolle@tiscali.nl>
Fri, 30 May 2014 12:52:18 +0000 (14:52 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 19 Jun 2014 22:14:12 +0000 (15:14 -0700)
Ever since rtl8192u was added as a staging driver in v2.6.33 it contained
checks for CONFIG_IEEE80211_CRYPT_TKIP. But the Kconfig symbol
IEEE80211_CRYPT_TKIP was renamed to LIB80211_CRYPT_TKIP in v2.6.29. So
these checks have always evaluated to false. And these checks were rather
odd to begin with, since rtl8192u comes with its own ieee80211 stack,
which has support for TKIP built in.

Now the safe and easy thing to do here would be to remove these checks
and the code they hide. But it turns out that with some minor cleanup
the code currently hidden behind these checks builds cleanly. And by
building it we allow the people actually running this code to test
whether it is any good.

That minor cleanup is needed because ieee80211_encrypt_fragment()
accesses struct sk_buff's data member as if it is a struct
ieee80211_hdr. It's not. See, in ieee80211_xmit() a struct
ieee80211_hdr_3addrqos is skb_put() into the sk_buff with which
ieee80211_encrypt_fragment() will be called. So switch from
ieee80211_hdr to ieee80211_hdr_3addrqos here.

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c

index d9a8299c48eb59412426b8f93590316768e9e625..73410ccfb1ec5a57e65f1f2a38e7828ccacc2735 100644 (file)
@@ -352,7 +352,6 @@ ieee80211_rx_frame_decrypt(struct ieee80211_device *ieee, struct sk_buff *skb,
        hdr = (struct ieee80211_hdr_4addr *) skb->data;
        hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl));
 
-#ifdef CONFIG_IEEE80211_CRYPT_TKIP
        if (ieee->tkip_countermeasures &&
            strcmp(crypt->ops->name, "TKIP") == 0) {
                if (net_ratelimit()) {
@@ -362,7 +361,6 @@ ieee80211_rx_frame_decrypt(struct ieee80211_device *ieee, struct sk_buff *skb,
                }
                return -1;
        }
-#endif
 
        atomic_inc(&crypt->refcnt);
        res = crypt->ops->decrypt_mpdu(skb, hdrlen, crypt->priv);
index 029a97651797140c34247a120d6ab08efff039c4..7f9e655f9eb8989e71a5eb93956b9118f907cafa 100644 (file)
@@ -191,20 +191,20 @@ int ieee80211_encrypt_fragment(
                printk("=========>%s(), crypt is null\n", __func__);
                return -1;
        }
-#ifdef CONFIG_IEEE80211_CRYPT_TKIP
-       struct ieee80211_hdr *header;
 
        if (ieee->tkip_countermeasures &&
            crypt && crypt->ops && strcmp(crypt->ops->name, "TKIP") == 0) {
-               header = (struct ieee80211_hdr *) frag->data;
                if (net_ratelimit()) {
+                       struct ieee80211_hdr_3addrqos *header;
+
+                       header = (struct ieee80211_hdr_3addrqos *)frag->data;
                        printk(KERN_DEBUG "%s: TKIP countermeasures: dropped "
                               "TX packet to %pM\n",
                               ieee->dev->name, header->addr1);
                }
                return -1;
        }
-#endif
+
        /* To encrypt, frame format is:
         * IV (4 bytes), clear payload (including SNAP), ICV (4 bytes) */