]> pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
ieee80211: fix misannotations
authorAl Viro <viro@zeniv.linux.org.uk>
Sat, 29 Dec 2007 10:01:07 +0000 (05:01 -0500)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Jan 2008 23:08:48 +0000 (15:08 -0800)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
include/net/ieee80211.h
net/ieee80211/ieee80211_crypt_tkip.c
net/ieee80211/ieee80211_rx.c
net/ieee80211/ieee80211_tx.c

index d8ae48439f120a27b18e7d226ba49d54a16b322e..285b2adfa648c1cc6c9ccfc5d3ce853c51732543 100644 (file)
@@ -677,7 +677,7 @@ struct ieee80211_probe_request {
 
 struct ieee80211_probe_response {
        struct ieee80211_hdr_3addr header;
-       u32 time_stamp[2];
+       __le32 time_stamp[2];
        __le16 beacon_interval;
        __le16 capability;
        /* SSID, supported rates, FH params, DS params,
@@ -718,8 +718,8 @@ struct ieee80211_txb {
        u8 encrypted;
        u8 rts_included;
        u8 reserved;
-       __le16 frag_size;
-       __le16 payload_size;
+       u16 frag_size;
+       u16 payload_size;
        struct sk_buff *fragments[0];
 };
 
index 8e146949fc6f595eb75ca15f234060347ade8c89..bba0152e2d713b5798e6501711312e59a4267cef 100644 (file)
@@ -189,7 +189,7 @@ static inline u16 Mk16(u8 hi, u8 lo)
        return lo | (((u16) hi) << 8);
 }
 
-static inline u16 Mk16_le(u16 * v)
+static inline u16 Mk16_le(__le16 * v)
 {
        return le16_to_cpu(*v);
 }
@@ -275,15 +275,15 @@ static void tkip_mixing_phase2(u8 * WEPSeed, const u8 * TK, const u16 * TTAK,
        PPK[5] = TTAK[4] + IV16;
 
        /* Step 2 - 96-bit bijective mixing using S-box */
-       PPK[0] += _S_(PPK[5] ^ Mk16_le((u16 *) & TK[0]));
-       PPK[1] += _S_(PPK[0] ^ Mk16_le((u16 *) & TK[2]));
-       PPK[2] += _S_(PPK[1] ^ Mk16_le((u16 *) & TK[4]));
-       PPK[3] += _S_(PPK[2] ^ Mk16_le((u16 *) & TK[6]));
-       PPK[4] += _S_(PPK[3] ^ Mk16_le((u16 *) & TK[8]));
-       PPK[5] += _S_(PPK[4] ^ Mk16_le((u16 *) & TK[10]));
-
-       PPK[0] += RotR1(PPK[5] ^ Mk16_le((u16 *) & TK[12]));
-       PPK[1] += RotR1(PPK[0] ^ Mk16_le((u16 *) & TK[14]));
+       PPK[0] += _S_(PPK[5] ^ Mk16_le((__le16 *) & TK[0]));
+       PPK[1] += _S_(PPK[0] ^ Mk16_le((__le16 *) & TK[2]));
+       PPK[2] += _S_(PPK[1] ^ Mk16_le((__le16 *) & TK[4]));
+       PPK[3] += _S_(PPK[2] ^ Mk16_le((__le16 *) & TK[6]));
+       PPK[4] += _S_(PPK[3] ^ Mk16_le((__le16 *) & TK[8]));
+       PPK[5] += _S_(PPK[4] ^ Mk16_le((__le16 *) & TK[10]));
+
+       PPK[0] += RotR1(PPK[5] ^ Mk16_le((__le16 *) & TK[12]));
+       PPK[1] += RotR1(PPK[0] ^ Mk16_le((__le16 *) & TK[14]));
        PPK[2] += RotR1(PPK[1]);
        PPK[3] += RotR1(PPK[2]);
        PPK[4] += RotR1(PPK[3]);
@@ -294,7 +294,7 @@ static void tkip_mixing_phase2(u8 * WEPSeed, const u8 * TK, const u16 * TTAK,
        WEPSeed[0] = Hi8(IV16);
        WEPSeed[1] = (Hi8(IV16) | 0x20) & 0x7F;
        WEPSeed[2] = Lo8(IV16);
-       WEPSeed[3] = Lo8((PPK[5] ^ Mk16_le((u16 *) & TK[0])) >> 1);
+       WEPSeed[3] = Lo8((PPK[5] ^ Mk16_le((__le16 *) & TK[0])) >> 1);
 
 #ifdef __BIG_ENDIAN
        {
index 0a18edbdfcb5bd38d36dc433d27503b10b5b226a..6a9c07f9b10f8564955128b80b4088586cfbc4a1 100644 (file)
@@ -754,7 +754,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
                memcpy(skb_push(skb, ETH_ALEN), src, ETH_ALEN);
                memcpy(skb_push(skb, ETH_ALEN), dst, ETH_ALEN);
        } else {
-               u16 len;
+               __be16 len;
                /* Leave Ethernet header part of hdr and full payload */
                skb_pull(skb, hdrlen);
                len = htons(skb->len);
index 6d06f1385e2803cd1f263917e8bd6f8d2684a834..d8b02603cbe5d9a86811b88c5510620cfec42a94 100644 (file)
@@ -126,7 +126,7 @@ payload of each frame is reduced to 492 bytes.
 static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 };
 static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 };
 
-static int ieee80211_copy_snap(u8 * data, u16 h_proto)
+static int ieee80211_copy_snap(u8 * data, __be16 h_proto)
 {
        struct ieee80211_snap_hdr *snap;
        u8 *oui;
@@ -136,7 +136,7 @@ static int ieee80211_copy_snap(u8 * data, u16 h_proto)
        snap->ssap = 0xaa;
        snap->ctrl = 0x03;
 
-       if (h_proto == 0x8137 || h_proto == 0x80f3)
+       if (h_proto == htons(ETH_P_AARP) || h_proto == htons(ETH_P_IPX))
                oui = P802_1H_OUI;
        else
                oui = RFC1042_OUI;
@@ -144,7 +144,6 @@ static int ieee80211_copy_snap(u8 * data, u16 h_proto)
        snap->oui[1] = oui[1];
        snap->oui[2] = oui[2];
 
-       h_proto = htons(h_proto);
        memcpy(data + SNAP_SIZE, &h_proto, sizeof(u16));
 
        return SNAP_SIZE + sizeof(u16);
@@ -261,7 +260,8 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev)
            rts_required;
        unsigned long flags;
        struct net_device_stats *stats = &ieee->stats;
-       int ether_type, encrypt, host_encrypt, host_encrypt_msdu, host_build_iv;
+       int encrypt, host_encrypt, host_encrypt_msdu, host_build_iv;
+       __be16 ether_type;
        int bytes, fc, hdr_len;
        struct sk_buff *skb_frag;
        struct ieee80211_hdr_3addrqos header = {/* Ensure zero initialized */
@@ -292,11 +292,11 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev)
                goto success;
        }
 
-       ether_type = ntohs(((struct ethhdr *)skb->data)->h_proto);
+       ether_type = ((struct ethhdr *)skb->data)->h_proto;
 
        crypt = ieee->crypt[ieee->tx_keyidx];
 
-       encrypt = !(ether_type == ETH_P_PAE && ieee->ieee802_1x) &&
+       encrypt = !(ether_type == htons(ETH_P_PAE) && ieee->ieee802_1x) &&
            ieee->sec.encrypt;
 
        host_encrypt = ieee->host_encrypt && encrypt && crypt;
@@ -304,7 +304,7 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev)
        host_build_iv = ieee->host_build_iv && encrypt && crypt;
 
        if (!encrypt && ieee->ieee802_1x &&
-           ieee->drop_unencrypted && ether_type != ETH_P_PAE) {
+           ieee->drop_unencrypted && ether_type != htons(ETH_P_PAE)) {
                stats->tx_dropped++;
                goto success;
        }