diff options
-rw-r--r-- | net/mac80211/ieee80211_i.h | 2 | ||||
-rw-r--r-- | net/mac80211/rx.c | 80 | ||||
-rw-r--r-- | net/mac80211/wep.c | 8 | ||||
-rw-r--r-- | net/mac80211/wpa.c | 25 |
4 files changed, 61 insertions, 54 deletions
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index b7598db5ade2..c612981fc23e 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -167,12 +167,10 @@ typedef unsigned __bitwise__ ieee80211_rx_result; | |||
167 | 167 | ||
168 | struct ieee80211_rx_data { | 168 | struct ieee80211_rx_data { |
169 | struct sk_buff *skb; | 169 | struct sk_buff *skb; |
170 | struct net_device *dev; | ||
171 | struct ieee80211_local *local; | 170 | struct ieee80211_local *local; |
172 | struct ieee80211_sub_if_data *sdata; | 171 | struct ieee80211_sub_if_data *sdata; |
173 | struct sta_info *sta; | 172 | struct sta_info *sta; |
174 | struct ieee80211_key *key; | 173 | struct ieee80211_key *key; |
175 | struct ieee80211_rx_status *status; | ||
176 | struct ieee80211_rate *rate; | 174 | struct ieee80211_rate *rate; |
177 | 175 | ||
178 | unsigned int flags; | 176 | unsigned int flags; |
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 37e9891605b4..904aaea081c8 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -477,7 +477,7 @@ ieee80211_rx_mesh_check(struct ieee80211_rx_data *rx) | |||
477 | { | 477 | { |
478 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data; | 478 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data; |
479 | unsigned int hdrlen = ieee80211_hdrlen(hdr->frame_control); | 479 | unsigned int hdrlen = ieee80211_hdrlen(hdr->frame_control); |
480 | char *dev_addr = rx->dev->dev_addr; | 480 | char *dev_addr = rx->sdata->dev->dev_addr; |
481 | 481 | ||
482 | if (ieee80211_is_data(hdr->frame_control)) { | 482 | if (ieee80211_is_data(hdr->frame_control)) { |
483 | if (is_multicast_ether_addr(hdr->addr1)) { | 483 | if (is_multicast_ether_addr(hdr->addr1)) { |
@@ -591,7 +591,9 @@ ieee80211_rx_h_check(struct ieee80211_rx_data *rx) | |||
591 | static ieee80211_rx_result debug_noinline | 591 | static ieee80211_rx_result debug_noinline |
592 | ieee80211_rx_h_decrypt(struct ieee80211_rx_data *rx) | 592 | ieee80211_rx_h_decrypt(struct ieee80211_rx_data *rx) |
593 | { | 593 | { |
594 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data; | 594 | struct sk_buff *skb = rx->skb; |
595 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); | ||
596 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | ||
595 | int keyidx; | 597 | int keyidx; |
596 | int hdrlen; | 598 | int hdrlen; |
597 | ieee80211_rx_result result = RX_DROP_UNUSABLE; | 599 | ieee80211_rx_result result = RX_DROP_UNUSABLE; |
@@ -645,8 +647,8 @@ ieee80211_rx_h_decrypt(struct ieee80211_rx_data *rx) | |||
645 | return RX_CONTINUE; | 647 | return RX_CONTINUE; |
646 | } else if (mmie_keyidx >= 0) { | 648 | } else if (mmie_keyidx >= 0) { |
647 | /* Broadcast/multicast robust management frame / BIP */ | 649 | /* Broadcast/multicast robust management frame / BIP */ |
648 | if ((rx->status->flag & RX_FLAG_DECRYPTED) && | 650 | if ((status->flag & RX_FLAG_DECRYPTED) && |
649 | (rx->status->flag & RX_FLAG_IV_STRIPPED)) | 651 | (status->flag & RX_FLAG_IV_STRIPPED)) |
650 | return RX_CONTINUE; | 652 | return RX_CONTINUE; |
651 | 653 | ||
652 | if (mmie_keyidx < NUM_DEFAULT_KEYS || | 654 | if (mmie_keyidx < NUM_DEFAULT_KEYS || |
@@ -678,8 +680,8 @@ ieee80211_rx_h_decrypt(struct ieee80211_rx_data *rx) | |||
678 | * we somehow allow the driver to tell us which key | 680 | * we somehow allow the driver to tell us which key |
679 | * the hardware used if this flag is set? | 681 | * the hardware used if this flag is set? |
680 | */ | 682 | */ |
681 | if ((rx->status->flag & RX_FLAG_DECRYPTED) && | 683 | if ((status->flag & RX_FLAG_DECRYPTED) && |
682 | (rx->status->flag & RX_FLAG_IV_STRIPPED)) | 684 | (status->flag & RX_FLAG_IV_STRIPPED)) |
683 | return RX_CONTINUE; | 685 | return RX_CONTINUE; |
684 | 686 | ||
685 | hdrlen = ieee80211_hdrlen(hdr->frame_control); | 687 | hdrlen = ieee80211_hdrlen(hdr->frame_control); |
@@ -715,8 +717,8 @@ ieee80211_rx_h_decrypt(struct ieee80211_rx_data *rx) | |||
715 | /* Check for weak IVs if possible */ | 717 | /* Check for weak IVs if possible */ |
716 | if (rx->sta && rx->key->conf.alg == ALG_WEP && | 718 | if (rx->sta && rx->key->conf.alg == ALG_WEP && |
717 | ieee80211_is_data(hdr->frame_control) && | 719 | ieee80211_is_data(hdr->frame_control) && |
718 | (!(rx->status->flag & RX_FLAG_IV_STRIPPED) || | 720 | (!(status->flag & RX_FLAG_IV_STRIPPED) || |
719 | !(rx->status->flag & RX_FLAG_DECRYPTED)) && | 721 | !(status->flag & RX_FLAG_DECRYPTED)) && |
720 | ieee80211_wep_is_weak_iv(rx->skb, rx->key)) | 722 | ieee80211_wep_is_weak_iv(rx->skb, rx->key)) |
721 | rx->sta->wep_weak_iv_count++; | 723 | rx->sta->wep_weak_iv_count++; |
722 | 724 | ||
@@ -736,7 +738,7 @@ ieee80211_rx_h_decrypt(struct ieee80211_rx_data *rx) | |||
736 | } | 738 | } |
737 | 739 | ||
738 | /* either the frame has been decrypted or will be dropped */ | 740 | /* either the frame has been decrypted or will be dropped */ |
739 | rx->status->flag |= RX_FLAG_DECRYPTED; | 741 | status->flag |= RX_FLAG_DECRYPTED; |
740 | 742 | ||
741 | return result; | 743 | return result; |
742 | } | 744 | } |
@@ -816,7 +818,9 @@ static ieee80211_rx_result debug_noinline | |||
816 | ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx) | 818 | ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx) |
817 | { | 819 | { |
818 | struct sta_info *sta = rx->sta; | 820 | struct sta_info *sta = rx->sta; |
819 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data; | 821 | struct sk_buff *skb = rx->skb; |
822 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); | ||
823 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | ||
820 | 824 | ||
821 | if (!sta) | 825 | if (!sta) |
822 | return RX_CONTINUE; | 826 | return RX_CONTINUE; |
@@ -847,8 +851,8 @@ ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx) | |||
847 | 851 | ||
848 | sta->rx_fragments++; | 852 | sta->rx_fragments++; |
849 | sta->rx_bytes += rx->skb->len; | 853 | sta->rx_bytes += rx->skb->len; |
850 | sta->last_signal = rx->status->signal; | 854 | sta->last_signal = status->signal; |
851 | sta->last_noise = rx->status->noise; | 855 | sta->last_noise = status->noise; |
852 | 856 | ||
853 | /* | 857 | /* |
854 | * Change STA power saving mode only at the end of a frame | 858 | * Change STA power saving mode only at the end of a frame |
@@ -1140,11 +1144,14 @@ ieee80211_802_1x_port_control(struct ieee80211_rx_data *rx) | |||
1140 | static int | 1144 | static int |
1141 | ieee80211_drop_unencrypted(struct ieee80211_rx_data *rx, __le16 fc) | 1145 | ieee80211_drop_unencrypted(struct ieee80211_rx_data *rx, __le16 fc) |
1142 | { | 1146 | { |
1147 | struct sk_buff *skb = rx->skb; | ||
1148 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); | ||
1149 | |||
1143 | /* | 1150 | /* |
1144 | * Pass through unencrypted frames if the hardware has | 1151 | * Pass through unencrypted frames if the hardware has |
1145 | * decrypted them already. | 1152 | * decrypted them already. |
1146 | */ | 1153 | */ |
1147 | if (rx->status->flag & RX_FLAG_DECRYPTED) | 1154 | if (status->flag & RX_FLAG_DECRYPTED) |
1148 | return 0; | 1155 | return 0; |
1149 | 1156 | ||
1150 | /* Drop unencrypted frames if key is set. */ | 1157 | /* Drop unencrypted frames if key is set. */ |
@@ -1178,8 +1185,8 @@ ieee80211_drop_unencrypted(struct ieee80211_rx_data *rx, __le16 fc) | |||
1178 | static int | 1185 | static int |
1179 | __ieee80211_data_to_8023(struct ieee80211_rx_data *rx) | 1186 | __ieee80211_data_to_8023(struct ieee80211_rx_data *rx) |
1180 | { | 1187 | { |
1181 | struct net_device *dev = rx->dev; | 1188 | struct ieee80211_sub_if_data *sdata = rx->sdata; |
1182 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 1189 | struct net_device *dev = sdata->dev; |
1183 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data; | 1190 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data; |
1184 | 1191 | ||
1185 | if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN && !sdata->use_4addr && | 1192 | if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN && !sdata->use_4addr && |
@@ -1205,7 +1212,7 @@ static bool ieee80211_frame_allowed(struct ieee80211_rx_data *rx, __le16 fc) | |||
1205 | * of whether the frame was encrypted or not. | 1212 | * of whether the frame was encrypted or not. |
1206 | */ | 1213 | */ |
1207 | if (ehdr->h_proto == htons(ETH_P_PAE) && | 1214 | if (ehdr->h_proto == htons(ETH_P_PAE) && |
1208 | (compare_ether_addr(ehdr->h_dest, rx->dev->dev_addr) == 0 || | 1215 | (compare_ether_addr(ehdr->h_dest, rx->sdata->dev->dev_addr) == 0 || |
1209 | compare_ether_addr(ehdr->h_dest, pae_group_addr) == 0)) | 1216 | compare_ether_addr(ehdr->h_dest, pae_group_addr) == 0)) |
1210 | return true; | 1217 | return true; |
1211 | 1218 | ||
@@ -1222,10 +1229,10 @@ static bool ieee80211_frame_allowed(struct ieee80211_rx_data *rx, __le16 fc) | |||
1222 | static void | 1229 | static void |
1223 | ieee80211_deliver_skb(struct ieee80211_rx_data *rx) | 1230 | ieee80211_deliver_skb(struct ieee80211_rx_data *rx) |
1224 | { | 1231 | { |
1225 | struct net_device *dev = rx->dev; | 1232 | struct ieee80211_sub_if_data *sdata = rx->sdata; |
1233 | struct net_device *dev = sdata->dev; | ||
1226 | struct ieee80211_local *local = rx->local; | 1234 | struct ieee80211_local *local = rx->local; |
1227 | struct sk_buff *skb, *xmit_skb; | 1235 | struct sk_buff *skb, *xmit_skb; |
1228 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
1229 | struct ethhdr *ehdr = (struct ethhdr *) rx->skb->data; | 1236 | struct ethhdr *ehdr = (struct ethhdr *) rx->skb->data; |
1230 | struct sta_info *dsta; | 1237 | struct sta_info *dsta; |
1231 | 1238 | ||
@@ -1306,7 +1313,7 @@ ieee80211_deliver_skb(struct ieee80211_rx_data *rx) | |||
1306 | static ieee80211_rx_result debug_noinline | 1313 | static ieee80211_rx_result debug_noinline |
1307 | ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx) | 1314 | ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx) |
1308 | { | 1315 | { |
1309 | struct net_device *dev = rx->dev; | 1316 | struct net_device *dev = rx->sdata->dev; |
1310 | struct ieee80211_local *local = rx->local; | 1317 | struct ieee80211_local *local = rx->local; |
1311 | u16 ethertype; | 1318 | u16 ethertype; |
1312 | u8 *payload; | 1319 | u8 *payload; |
@@ -1431,12 +1438,11 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) | |||
1431 | unsigned int hdrlen; | 1438 | unsigned int hdrlen; |
1432 | struct sk_buff *skb = rx->skb, *fwd_skb; | 1439 | struct sk_buff *skb = rx->skb, *fwd_skb; |
1433 | struct ieee80211_local *local = rx->local; | 1440 | struct ieee80211_local *local = rx->local; |
1434 | struct ieee80211_sub_if_data *sdata; | 1441 | struct ieee80211_sub_if_data *sdata = rx->sdata; |
1435 | 1442 | ||
1436 | hdr = (struct ieee80211_hdr *) skb->data; | 1443 | hdr = (struct ieee80211_hdr *) skb->data; |
1437 | hdrlen = ieee80211_hdrlen(hdr->frame_control); | 1444 | hdrlen = ieee80211_hdrlen(hdr->frame_control); |
1438 | mesh_hdr = (struct ieee80211s_hdr *) (skb->data + hdrlen); | 1445 | mesh_hdr = (struct ieee80211s_hdr *) (skb->data + hdrlen); |
1439 | sdata = IEEE80211_DEV_TO_SUB_IF(rx->dev); | ||
1440 | 1446 | ||
1441 | if (!ieee80211_is_data(hdr->frame_control)) | 1447 | if (!ieee80211_is_data(hdr->frame_control)) |
1442 | return RX_CONTINUE; | 1448 | return RX_CONTINUE; |
@@ -1474,7 +1480,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) | |||
1474 | 1480 | ||
1475 | /* Frame has reached destination. Don't forward */ | 1481 | /* Frame has reached destination. Don't forward */ |
1476 | if (!is_multicast_ether_addr(hdr->addr1) && | 1482 | if (!is_multicast_ether_addr(hdr->addr1) && |
1477 | compare_ether_addr(rx->dev->dev_addr, hdr->addr3) == 0) | 1483 | compare_ether_addr(sdata->dev->dev_addr, hdr->addr3) == 0) |
1478 | return RX_CONTINUE; | 1484 | return RX_CONTINUE; |
1479 | 1485 | ||
1480 | mesh_hdr->ttl--; | 1486 | mesh_hdr->ttl--; |
@@ -1491,10 +1497,10 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) | |||
1491 | 1497 | ||
1492 | if (!fwd_skb && net_ratelimit()) | 1498 | if (!fwd_skb && net_ratelimit()) |
1493 | printk(KERN_DEBUG "%s: failed to clone mesh frame\n", | 1499 | printk(KERN_DEBUG "%s: failed to clone mesh frame\n", |
1494 | rx->dev->name); | 1500 | sdata->dev->name); |
1495 | 1501 | ||
1496 | fwd_hdr = (struct ieee80211_hdr *) fwd_skb->data; | 1502 | fwd_hdr = (struct ieee80211_hdr *) fwd_skb->data; |
1497 | memcpy(fwd_hdr->addr2, rx->dev->dev_addr, ETH_ALEN); | 1503 | memcpy(fwd_hdr->addr2, sdata->dev->dev_addr, ETH_ALEN); |
1498 | info = IEEE80211_SKB_CB(fwd_skb); | 1504 | info = IEEE80211_SKB_CB(fwd_skb); |
1499 | memset(info, 0, sizeof(*info)); | 1505 | memset(info, 0, sizeof(*info)); |
1500 | info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING; | 1506 | info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING; |
@@ -1528,7 +1534,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) | |||
1528 | } | 1534 | } |
1529 | 1535 | ||
1530 | if (is_multicast_ether_addr(hdr->addr1) || | 1536 | if (is_multicast_ether_addr(hdr->addr1) || |
1531 | rx->dev->flags & IFF_PROMISC) | 1537 | sdata->dev->flags & IFF_PROMISC) |
1532 | return RX_CONTINUE; | 1538 | return RX_CONTINUE; |
1533 | else | 1539 | else |
1534 | return RX_DROP_MONITOR; | 1540 | return RX_DROP_MONITOR; |
@@ -1538,9 +1544,9 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) | |||
1538 | static ieee80211_rx_result debug_noinline | 1544 | static ieee80211_rx_result debug_noinline |
1539 | ieee80211_rx_h_data(struct ieee80211_rx_data *rx) | 1545 | ieee80211_rx_h_data(struct ieee80211_rx_data *rx) |
1540 | { | 1546 | { |
1541 | struct net_device *dev = rx->dev; | 1547 | struct ieee80211_sub_if_data *sdata = rx->sdata; |
1548 | struct net_device *dev = sdata->dev; | ||
1542 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data; | 1549 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data; |
1543 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
1544 | __le16 fc = hdr->frame_control; | 1550 | __le16 fc = hdr->frame_control; |
1545 | int err; | 1551 | int err; |
1546 | 1552 | ||
@@ -1664,7 +1670,7 @@ static ieee80211_rx_result debug_noinline | |||
1664 | ieee80211_rx_h_action(struct ieee80211_rx_data *rx) | 1670 | ieee80211_rx_h_action(struct ieee80211_rx_data *rx) |
1665 | { | 1671 | { |
1666 | struct ieee80211_local *local = rx->local; | 1672 | struct ieee80211_local *local = rx->local; |
1667 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(rx->dev); | 1673 | struct ieee80211_sub_if_data *sdata = rx->sdata; |
1668 | struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *) rx->skb->data; | 1674 | struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *) rx->skb->data; |
1669 | int len = rx->skb->len; | 1675 | int len = rx->skb->len; |
1670 | 1676 | ||
@@ -1776,7 +1782,7 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx) | |||
1776 | static ieee80211_rx_result debug_noinline | 1782 | static ieee80211_rx_result debug_noinline |
1777 | ieee80211_rx_h_mgmt(struct ieee80211_rx_data *rx) | 1783 | ieee80211_rx_h_mgmt(struct ieee80211_rx_data *rx) |
1778 | { | 1784 | { |
1779 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(rx->dev); | 1785 | struct ieee80211_sub_if_data *sdata = rx->sdata; |
1780 | struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *) rx->skb->data; | 1786 | struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *) rx->skb->data; |
1781 | 1787 | ||
1782 | if (!(rx->flags & IEEE80211_RX_RA_MATCH)) | 1788 | if (!(rx->flags & IEEE80211_RX_RA_MATCH)) |
@@ -1852,7 +1858,7 @@ static void ieee80211_rx_cooked_monitor(struct ieee80211_rx_data *rx) | |||
1852 | } __attribute__ ((packed)) *rthdr; | 1858 | } __attribute__ ((packed)) *rthdr; |
1853 | struct sk_buff *skb = rx->skb, *skb2; | 1859 | struct sk_buff *skb = rx->skb, *skb2; |
1854 | struct net_device *prev_dev = NULL; | 1860 | struct net_device *prev_dev = NULL; |
1855 | struct ieee80211_rx_status *status = rx->status; | 1861 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); |
1856 | 1862 | ||
1857 | if (rx->flags & IEEE80211_RX_CMNTR_REPORTED) | 1863 | if (rx->flags & IEEE80211_RX_CMNTR_REPORTED) |
1858 | goto out_free_skb; | 1864 | goto out_free_skb; |
@@ -1928,7 +1934,6 @@ static void ieee80211_invoke_rx_handlers(struct ieee80211_sub_if_data *sdata, | |||
1928 | 1934 | ||
1929 | rx->skb = skb; | 1935 | rx->skb = skb; |
1930 | rx->sdata = sdata; | 1936 | rx->sdata = sdata; |
1931 | rx->dev = sdata->dev; | ||
1932 | 1937 | ||
1933 | #define CALL_RXH(rxh) \ | 1938 | #define CALL_RXH(rxh) \ |
1934 | do { \ | 1939 | do { \ |
@@ -1987,7 +1992,9 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata, | |||
1987 | struct ieee80211_rx_data *rx, | 1992 | struct ieee80211_rx_data *rx, |
1988 | struct ieee80211_hdr *hdr) | 1993 | struct ieee80211_hdr *hdr) |
1989 | { | 1994 | { |
1990 | u8 *bssid = ieee80211_get_bssid(hdr, rx->skb->len, sdata->vif.type); | 1995 | struct sk_buff *skb = rx->skb; |
1996 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); | ||
1997 | u8 *bssid = ieee80211_get_bssid(hdr, skb->len, sdata->vif.type); | ||
1991 | int multicast = is_multicast_ether_addr(hdr->addr1); | 1998 | int multicast = is_multicast_ether_addr(hdr->addr1); |
1992 | 1999 | ||
1993 | switch (sdata->vif.type) { | 2000 | switch (sdata->vif.type) { |
@@ -2019,10 +2026,10 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata, | |||
2019 | rx->flags &= ~IEEE80211_RX_RA_MATCH; | 2026 | rx->flags &= ~IEEE80211_RX_RA_MATCH; |
2020 | } else if (!rx->sta) { | 2027 | } else if (!rx->sta) { |
2021 | int rate_idx; | 2028 | int rate_idx; |
2022 | if (rx->status->flag & RX_FLAG_HT) | 2029 | if (status->flag & RX_FLAG_HT) |
2023 | rate_idx = 0; /* TODO: HT rates */ | 2030 | rate_idx = 0; /* TODO: HT rates */ |
2024 | else | 2031 | else |
2025 | rate_idx = rx->status->rate_idx; | 2032 | rate_idx = status->rate_idx; |
2026 | rx->sta = ieee80211_ibss_add_sta(sdata, bssid, hdr->addr2, | 2033 | rx->sta = ieee80211_ibss_add_sta(sdata, bssid, hdr->addr2, |
2027 | BIT(rate_idx)); | 2034 | BIT(rate_idx)); |
2028 | } | 2035 | } |
@@ -2088,7 +2095,6 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, | |||
2088 | memset(&rx, 0, sizeof(rx)); | 2095 | memset(&rx, 0, sizeof(rx)); |
2089 | rx.skb = skb; | 2096 | rx.skb = skb; |
2090 | rx.local = local; | 2097 | rx.local = local; |
2091 | rx.status = status; | ||
2092 | rx.rate = rate; | 2098 | rx.rate = rate; |
2093 | 2099 | ||
2094 | if (ieee80211_is_data(hdr->frame_control) || ieee80211_is_mgmt(hdr->frame_control)) | 2100 | if (ieee80211_is_data(hdr->frame_control) || ieee80211_is_mgmt(hdr->frame_control)) |
@@ -2102,10 +2108,8 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, | |||
2102 | ieee80211_verify_alignment(&rx); | 2108 | ieee80211_verify_alignment(&rx); |
2103 | 2109 | ||
2104 | rx.sta = sta_info_get(local, hdr->addr2); | 2110 | rx.sta = sta_info_get(local, hdr->addr2); |
2105 | if (rx.sta) { | 2111 | if (rx.sta) |
2106 | rx.sdata = rx.sta->sdata; | 2112 | rx.sdata = rx.sta->sdata; |
2107 | rx.dev = rx.sta->sdata->dev; | ||
2108 | } | ||
2109 | 2113 | ||
2110 | if (rx.sdata && ieee80211_is_data(hdr->frame_control)) { | 2114 | if (rx.sdata && ieee80211_is_data(hdr->frame_control)) { |
2111 | rx.flags |= IEEE80211_RX_RA_MATCH; | 2115 | rx.flags |= IEEE80211_RX_RA_MATCH; |
diff --git a/net/mac80211/wep.c b/net/mac80211/wep.c index 8a980f136941..247123fe1a7a 100644 --- a/net/mac80211/wep.c +++ b/net/mac80211/wep.c | |||
@@ -281,16 +281,18 @@ bool ieee80211_wep_is_weak_iv(struct sk_buff *skb, struct ieee80211_key *key) | |||
281 | ieee80211_rx_result | 281 | ieee80211_rx_result |
282 | ieee80211_crypto_wep_decrypt(struct ieee80211_rx_data *rx) | 282 | ieee80211_crypto_wep_decrypt(struct ieee80211_rx_data *rx) |
283 | { | 283 | { |
284 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data; | 284 | struct sk_buff *skb = rx->skb; |
285 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); | ||
286 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | ||
285 | 287 | ||
286 | if (!ieee80211_is_data(hdr->frame_control) && | 288 | if (!ieee80211_is_data(hdr->frame_control) && |
287 | !ieee80211_is_auth(hdr->frame_control)) | 289 | !ieee80211_is_auth(hdr->frame_control)) |
288 | return RX_CONTINUE; | 290 | return RX_CONTINUE; |
289 | 291 | ||
290 | if (!(rx->status->flag & RX_FLAG_DECRYPTED)) { | 292 | if (!(status->flag & RX_FLAG_DECRYPTED)) { |
291 | if (ieee80211_wep_decrypt(rx->local, rx->skb, rx->key)) | 293 | if (ieee80211_wep_decrypt(rx->local, rx->skb, rx->key)) |
292 | return RX_DROP_UNUSABLE; | 294 | return RX_DROP_UNUSABLE; |
293 | } else if (!(rx->status->flag & RX_FLAG_IV_STRIPPED)) { | 295 | } else if (!(status->flag & RX_FLAG_IV_STRIPPED)) { |
294 | ieee80211_wep_remove_iv(rx->local, rx->skb, rx->key); | 296 | ieee80211_wep_remove_iv(rx->local, rx->skb, rx->key); |
295 | /* remove ICV */ | 297 | /* remove ICV */ |
296 | skb_trim(rx->skb, rx->skb->len - WEP_ICV_LEN); | 298 | skb_trim(rx->skb, rx->skb->len - WEP_ICV_LEN); |
diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c index 70778694877b..5332014cb229 100644 --- a/net/mac80211/wpa.c +++ b/net/mac80211/wpa.c | |||
@@ -85,16 +85,16 @@ ieee80211_rx_h_michael_mic_verify(struct ieee80211_rx_data *rx) | |||
85 | u8 *data, *key = NULL, key_offset; | 85 | u8 *data, *key = NULL, key_offset; |
86 | size_t data_len; | 86 | size_t data_len; |
87 | unsigned int hdrlen; | 87 | unsigned int hdrlen; |
88 | struct ieee80211_hdr *hdr; | ||
89 | u8 mic[MICHAEL_MIC_LEN]; | 88 | u8 mic[MICHAEL_MIC_LEN]; |
90 | struct sk_buff *skb = rx->skb; | 89 | struct sk_buff *skb = rx->skb; |
90 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); | ||
91 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | ||
91 | int authenticator = 1, wpa_test = 0; | 92 | int authenticator = 1, wpa_test = 0; |
92 | 93 | ||
93 | /* No way to verify the MIC if the hardware stripped it */ | 94 | /* No way to verify the MIC if the hardware stripped it */ |
94 | if (rx->status->flag & RX_FLAG_MMIC_STRIPPED) | 95 | if (status->flag & RX_FLAG_MMIC_STRIPPED) |
95 | return RX_CONTINUE; | 96 | return RX_CONTINUE; |
96 | 97 | ||
97 | hdr = (struct ieee80211_hdr *)skb->data; | ||
98 | if (!rx->key || rx->key->conf.alg != ALG_TKIP || | 98 | if (!rx->key || rx->key->conf.alg != ALG_TKIP || |
99 | !ieee80211_has_protected(hdr->frame_control) || | 99 | !ieee80211_has_protected(hdr->frame_control) || |
100 | !ieee80211_is_data_present(hdr->frame_control)) | 100 | !ieee80211_is_data_present(hdr->frame_control)) |
@@ -216,6 +216,7 @@ ieee80211_crypto_tkip_decrypt(struct ieee80211_rx_data *rx) | |||
216 | int hdrlen, res, hwaccel = 0, wpa_test = 0; | 216 | int hdrlen, res, hwaccel = 0, wpa_test = 0; |
217 | struct ieee80211_key *key = rx->key; | 217 | struct ieee80211_key *key = rx->key; |
218 | struct sk_buff *skb = rx->skb; | 218 | struct sk_buff *skb = rx->skb; |
219 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); | ||
219 | 220 | ||
220 | hdrlen = ieee80211_hdrlen(hdr->frame_control); | 221 | hdrlen = ieee80211_hdrlen(hdr->frame_control); |
221 | 222 | ||
@@ -225,8 +226,8 @@ ieee80211_crypto_tkip_decrypt(struct ieee80211_rx_data *rx) | |||
225 | if (!rx->sta || skb->len - hdrlen < 12) | 226 | if (!rx->sta || skb->len - hdrlen < 12) |
226 | return RX_DROP_UNUSABLE; | 227 | return RX_DROP_UNUSABLE; |
227 | 228 | ||
228 | if (rx->status->flag & RX_FLAG_DECRYPTED) { | 229 | if (status->flag & RX_FLAG_DECRYPTED) { |
229 | if (rx->status->flag & RX_FLAG_IV_STRIPPED) { | 230 | if (status->flag & RX_FLAG_IV_STRIPPED) { |
230 | /* | 231 | /* |
231 | * Hardware took care of all processing, including | 232 | * Hardware took care of all processing, including |
232 | * replay protection, and stripped the ICV/IV so | 233 | * replay protection, and stripped the ICV/IV so |
@@ -442,6 +443,7 @@ ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx) | |||
442 | int hdrlen; | 443 | int hdrlen; |
443 | struct ieee80211_key *key = rx->key; | 444 | struct ieee80211_key *key = rx->key; |
444 | struct sk_buff *skb = rx->skb; | 445 | struct sk_buff *skb = rx->skb; |
446 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); | ||
445 | u8 pn[CCMP_PN_LEN]; | 447 | u8 pn[CCMP_PN_LEN]; |
446 | int data_len; | 448 | int data_len; |
447 | 449 | ||
@@ -455,8 +457,8 @@ ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx) | |||
455 | if (!rx->sta || data_len < 0) | 457 | if (!rx->sta || data_len < 0) |
456 | return RX_DROP_UNUSABLE; | 458 | return RX_DROP_UNUSABLE; |
457 | 459 | ||
458 | if ((rx->status->flag & RX_FLAG_DECRYPTED) && | 460 | if ((status->flag & RX_FLAG_DECRYPTED) && |
459 | (rx->status->flag & RX_FLAG_IV_STRIPPED)) | 461 | (status->flag & RX_FLAG_IV_STRIPPED)) |
460 | return RX_CONTINUE; | 462 | return RX_CONTINUE; |
461 | 463 | ||
462 | ccmp_hdr2pn(pn, skb->data + hdrlen); | 464 | ccmp_hdr2pn(pn, skb->data + hdrlen); |
@@ -466,7 +468,7 @@ ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx) | |||
466 | return RX_DROP_UNUSABLE; | 468 | return RX_DROP_UNUSABLE; |
467 | } | 469 | } |
468 | 470 | ||
469 | if (!(rx->status->flag & RX_FLAG_DECRYPTED)) { | 471 | if (!(status->flag & RX_FLAG_DECRYPTED)) { |
470 | /* hardware didn't decrypt/verify MIC */ | 472 | /* hardware didn't decrypt/verify MIC */ |
471 | ccmp_special_blocks(skb, pn, key->u.ccmp.rx_crypto_buf, 1); | 473 | ccmp_special_blocks(skb, pn, key->u.ccmp.rx_crypto_buf, 1); |
472 | 474 | ||
@@ -563,6 +565,7 @@ ieee80211_rx_result | |||
563 | ieee80211_crypto_aes_cmac_decrypt(struct ieee80211_rx_data *rx) | 565 | ieee80211_crypto_aes_cmac_decrypt(struct ieee80211_rx_data *rx) |
564 | { | 566 | { |
565 | struct sk_buff *skb = rx->skb; | 567 | struct sk_buff *skb = rx->skb; |
568 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); | ||
566 | struct ieee80211_key *key = rx->key; | 569 | struct ieee80211_key *key = rx->key; |
567 | struct ieee80211_mmie *mmie; | 570 | struct ieee80211_mmie *mmie; |
568 | u8 aad[20], mic[8], ipn[6]; | 571 | u8 aad[20], mic[8], ipn[6]; |
@@ -571,8 +574,8 @@ ieee80211_crypto_aes_cmac_decrypt(struct ieee80211_rx_data *rx) | |||
571 | if (!ieee80211_is_mgmt(hdr->frame_control)) | 574 | if (!ieee80211_is_mgmt(hdr->frame_control)) |
572 | return RX_CONTINUE; | 575 | return RX_CONTINUE; |
573 | 576 | ||
574 | if ((rx->status->flag & RX_FLAG_DECRYPTED) && | 577 | if ((status->flag & RX_FLAG_DECRYPTED) && |
575 | (rx->status->flag & RX_FLAG_IV_STRIPPED)) | 578 | (status->flag & RX_FLAG_IV_STRIPPED)) |
576 | return RX_CONTINUE; | 579 | return RX_CONTINUE; |
577 | 580 | ||
578 | if (skb->len < 24 + sizeof(*mmie)) | 581 | if (skb->len < 24 + sizeof(*mmie)) |
@@ -591,7 +594,7 @@ ieee80211_crypto_aes_cmac_decrypt(struct ieee80211_rx_data *rx) | |||
591 | return RX_DROP_UNUSABLE; | 594 | return RX_DROP_UNUSABLE; |
592 | } | 595 | } |
593 | 596 | ||
594 | if (!(rx->status->flag & RX_FLAG_DECRYPTED)) { | 597 | if (!(status->flag & RX_FLAG_DECRYPTED)) { |
595 | /* hardware didn't decrypt/verify MIC */ | 598 | /* hardware didn't decrypt/verify MIC */ |
596 | bip_aad(skb, aad); | 599 | bip_aad(skb, aad); |
597 | ieee80211_aes_cmac(key->u.aes_cmac.tfm, | 600 | ieee80211_aes_cmac(key->u.aes_cmac.tfm, |