diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2006-01-28 16:07:32 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2006-01-28 16:07:32 -0500 |
commit | 4f975b32433df87b8ead3de9944e0a9f90d261fd (patch) | |
tree | 85fc678ccca9eac622b9513919812d2602ea4da1 | |
parent | 0cc349d130b34de3046fb3d0e31eaf6ff5540cad (diff) | |
parent | d1b46b0fba8c1049135ee5d60910b04463dccc95 (diff) |
Merge branch 'upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-2.6
-rw-r--r-- | include/net/ieee80211.h | 169 | ||||
-rw-r--r-- | include/net/ieee80211_crypt.h | 3 | ||||
-rw-r--r-- | net/ieee80211/ieee80211_crypt.c | 11 | ||||
-rw-r--r-- | net/ieee80211/ieee80211_crypt_ccmp.c | 8 | ||||
-rw-r--r-- | net/ieee80211/ieee80211_crypt_tkip.c | 56 | ||||
-rw-r--r-- | net/ieee80211/ieee80211_crypt_wep.c | 5 | ||||
-rw-r--r-- | net/ieee80211/ieee80211_geo.c | 39 | ||||
-rw-r--r-- | net/ieee80211/ieee80211_module.c | 18 | ||||
-rw-r--r-- | net/ieee80211/ieee80211_rx.c | 123 | ||||
-rw-r--r-- | net/ieee80211/ieee80211_tx.c | 30 | ||||
-rw-r--r-- | net/ieee80211/ieee80211_wx.c | 31 |
11 files changed, 426 insertions, 67 deletions
diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h index 9a92aef8b0b2..ff6ef9e1a691 100644 --- a/include/net/ieee80211.h +++ b/include/net/ieee80211.h | |||
@@ -220,6 +220,7 @@ struct ieee80211_snap_hdr { | |||
220 | /* Authentication algorithms */ | 220 | /* Authentication algorithms */ |
221 | #define WLAN_AUTH_OPEN 0 | 221 | #define WLAN_AUTH_OPEN 0 |
222 | #define WLAN_AUTH_SHARED_KEY 1 | 222 | #define WLAN_AUTH_SHARED_KEY 1 |
223 | #define WLAN_AUTH_LEAP 2 | ||
223 | 224 | ||
224 | #define WLAN_AUTH_CHALLENGE_LEN 128 | 225 | #define WLAN_AUTH_CHALLENGE_LEN 128 |
225 | 226 | ||
@@ -299,6 +300,23 @@ enum ieee80211_reasoncode { | |||
299 | WLAN_REASON_CIPHER_SUITE_REJECTED = 24, | 300 | WLAN_REASON_CIPHER_SUITE_REJECTED = 24, |
300 | }; | 301 | }; |
301 | 302 | ||
303 | /* Action categories - 802.11h */ | ||
304 | enum ieee80211_actioncategories { | ||
305 | WLAN_ACTION_SPECTRUM_MGMT = 0, | ||
306 | /* Reserved 1-127 */ | ||
307 | /* Error 128-255 */ | ||
308 | }; | ||
309 | |||
310 | /* Action details - 802.11h */ | ||
311 | enum ieee80211_actiondetails { | ||
312 | WLAN_ACTION_CATEGORY_MEASURE_REQUEST = 0, | ||
313 | WLAN_ACTION_CATEGORY_MEASURE_REPORT = 1, | ||
314 | WLAN_ACTION_CATEGORY_TPC_REQUEST = 2, | ||
315 | WLAN_ACTION_CATEGORY_TPC_REPORT = 3, | ||
316 | WLAN_ACTION_CATEGORY_CHANNEL_SWITCH = 4, | ||
317 | /* 5 - 255 Reserved */ | ||
318 | }; | ||
319 | |||
302 | #define IEEE80211_STATMASK_SIGNAL (1<<0) | 320 | #define IEEE80211_STATMASK_SIGNAL (1<<0) |
303 | #define IEEE80211_STATMASK_RSSI (1<<1) | 321 | #define IEEE80211_STATMASK_RSSI (1<<1) |
304 | #define IEEE80211_STATMASK_NOISE (1<<2) | 322 | #define IEEE80211_STATMASK_NOISE (1<<2) |
@@ -377,6 +395,8 @@ struct ieee80211_rx_stats { | |||
377 | u8 mask; | 395 | u8 mask; |
378 | u8 freq; | 396 | u8 freq; |
379 | u16 len; | 397 | u16 len; |
398 | u64 tsf; | ||
399 | u32 beacon_time; | ||
380 | }; | 400 | }; |
381 | 401 | ||
382 | /* IEEE 802.11 requires that STA supports concurrent reception of at least | 402 | /* IEEE 802.11 requires that STA supports concurrent reception of at least |
@@ -608,6 +628,28 @@ struct ieee80211_auth { | |||
608 | struct ieee80211_info_element info_element[0]; | 628 | struct ieee80211_info_element info_element[0]; |
609 | } __attribute__ ((packed)); | 629 | } __attribute__ ((packed)); |
610 | 630 | ||
631 | struct ieee80211_channel_switch { | ||
632 | u8 id; | ||
633 | u8 len; | ||
634 | u8 mode; | ||
635 | u8 channel; | ||
636 | u8 count; | ||
637 | } __attribute__ ((packed)); | ||
638 | |||
639 | struct ieee80211_action { | ||
640 | struct ieee80211_hdr_3addr header; | ||
641 | u8 category; | ||
642 | u8 action; | ||
643 | union { | ||
644 | struct ieee80211_action_exchange { | ||
645 | u8 token; | ||
646 | struct ieee80211_info_element info_element[0]; | ||
647 | } exchange; | ||
648 | struct ieee80211_channel_switch channel_switch; | ||
649 | |||
650 | } format; | ||
651 | } __attribute__ ((packed)); | ||
652 | |||
611 | struct ieee80211_disassoc { | 653 | struct ieee80211_disassoc { |
612 | struct ieee80211_hdr_3addr header; | 654 | struct ieee80211_hdr_3addr header; |
613 | __le16 reason; | 655 | __le16 reason; |
@@ -692,7 +734,15 @@ struct ieee80211_txb { | |||
692 | /* QoS structure */ | 734 | /* QoS structure */ |
693 | #define NETWORK_HAS_QOS_PARAMETERS (1<<3) | 735 | #define NETWORK_HAS_QOS_PARAMETERS (1<<3) |
694 | #define NETWORK_HAS_QOS_INFORMATION (1<<4) | 736 | #define NETWORK_HAS_QOS_INFORMATION (1<<4) |
695 | #define NETWORK_HAS_QOS_MASK (NETWORK_HAS_QOS_PARAMETERS | NETWORK_HAS_QOS_INFORMATION) | 737 | #define NETWORK_HAS_QOS_MASK (NETWORK_HAS_QOS_PARAMETERS | \ |
738 | NETWORK_HAS_QOS_INFORMATION) | ||
739 | |||
740 | /* 802.11h */ | ||
741 | #define NETWORK_HAS_POWER_CONSTRAINT (1<<5) | ||
742 | #define NETWORK_HAS_CSA (1<<6) | ||
743 | #define NETWORK_HAS_QUIET (1<<7) | ||
744 | #define NETWORK_HAS_IBSS_DFS (1<<8) | ||
745 | #define NETWORK_HAS_TPC_REPORT (1<<9) | ||
696 | 746 | ||
697 | #define QOS_QUEUE_NUM 4 | 747 | #define QOS_QUEUE_NUM 4 |
698 | #define QOS_OUI_LEN 3 | 748 | #define QOS_OUI_LEN 3 |
@@ -748,6 +798,91 @@ struct ieee80211_tim_parameters { | |||
748 | 798 | ||
749 | /*******************************************************/ | 799 | /*******************************************************/ |
750 | 800 | ||
801 | enum { /* ieee80211_basic_report.map */ | ||
802 | IEEE80211_BASIC_MAP_BSS = (1 << 0), | ||
803 | IEEE80211_BASIC_MAP_OFDM = (1 << 1), | ||
804 | IEEE80211_BASIC_MAP_UNIDENTIFIED = (1 << 2), | ||
805 | IEEE80211_BASIC_MAP_RADAR = (1 << 3), | ||
806 | IEEE80211_BASIC_MAP_UNMEASURED = (1 << 4), | ||
807 | /* Bits 5-7 are reserved */ | ||
808 | |||
809 | }; | ||
810 | struct ieee80211_basic_report { | ||
811 | u8 channel; | ||
812 | __le64 start_time; | ||
813 | __le16 duration; | ||
814 | u8 map; | ||
815 | } __attribute__ ((packed)); | ||
816 | |||
817 | enum { /* ieee80211_measurement_request.mode */ | ||
818 | /* Bit 0 is reserved */ | ||
819 | IEEE80211_MEASUREMENT_ENABLE = (1 << 1), | ||
820 | IEEE80211_MEASUREMENT_REQUEST = (1 << 2), | ||
821 | IEEE80211_MEASUREMENT_REPORT = (1 << 3), | ||
822 | /* Bits 4-7 are reserved */ | ||
823 | }; | ||
824 | |||
825 | enum { | ||
826 | IEEE80211_REPORT_BASIC = 0, /* required */ | ||
827 | IEEE80211_REPORT_CCA = 1, /* optional */ | ||
828 | IEEE80211_REPORT_RPI = 2, /* optional */ | ||
829 | /* 3-255 reserved */ | ||
830 | }; | ||
831 | |||
832 | struct ieee80211_measurement_params { | ||
833 | u8 channel; | ||
834 | __le64 start_time; | ||
835 | __le16 duration; | ||
836 | } __attribute__ ((packed)); | ||
837 | |||
838 | struct ieee80211_measurement_request { | ||
839 | struct ieee80211_info_element ie; | ||
840 | u8 token; | ||
841 | u8 mode; | ||
842 | u8 type; | ||
843 | struct ieee80211_measurement_params params[0]; | ||
844 | } __attribute__ ((packed)); | ||
845 | |||
846 | struct ieee80211_measurement_report { | ||
847 | struct ieee80211_info_element ie; | ||
848 | u8 token; | ||
849 | u8 mode; | ||
850 | u8 type; | ||
851 | union { | ||
852 | struct ieee80211_basic_report basic[0]; | ||
853 | } u; | ||
854 | } __attribute__ ((packed)); | ||
855 | |||
856 | struct ieee80211_tpc_report { | ||
857 | u8 transmit_power; | ||
858 | u8 link_margin; | ||
859 | } __attribute__ ((packed)); | ||
860 | |||
861 | struct ieee80211_channel_map { | ||
862 | u8 channel; | ||
863 | u8 map; | ||
864 | } __attribute__ ((packed)); | ||
865 | |||
866 | struct ieee80211_ibss_dfs { | ||
867 | struct ieee80211_info_element ie; | ||
868 | u8 owner[ETH_ALEN]; | ||
869 | u8 recovery_interval; | ||
870 | struct ieee80211_channel_map channel_map[0]; | ||
871 | }; | ||
872 | |||
873 | struct ieee80211_csa { | ||
874 | u8 mode; | ||
875 | u8 channel; | ||
876 | u8 count; | ||
877 | } __attribute__ ((packed)); | ||
878 | |||
879 | struct ieee80211_quiet { | ||
880 | u8 count; | ||
881 | u8 period; | ||
882 | u8 duration; | ||
883 | u8 offset; | ||
884 | } __attribute__ ((packed)); | ||
885 | |||
751 | struct ieee80211_network { | 886 | struct ieee80211_network { |
752 | /* These entries are used to identify a unique network */ | 887 | /* These entries are used to identify a unique network */ |
753 | u8 bssid[ETH_ALEN]; | 888 | u8 bssid[ETH_ALEN]; |
@@ -767,7 +902,7 @@ struct ieee80211_network { | |||
767 | u8 rates_ex_len; | 902 | u8 rates_ex_len; |
768 | unsigned long last_scanned; | 903 | unsigned long last_scanned; |
769 | u8 mode; | 904 | u8 mode; |
770 | u8 flags; | 905 | u32 flags; |
771 | u32 last_associate; | 906 | u32 last_associate; |
772 | u32 time_stamp[2]; | 907 | u32 time_stamp[2]; |
773 | u16 beacon_interval; | 908 | u16 beacon_interval; |
@@ -779,6 +914,25 @@ struct ieee80211_network { | |||
779 | u8 rsn_ie[MAX_WPA_IE_LEN]; | 914 | u8 rsn_ie[MAX_WPA_IE_LEN]; |
780 | size_t rsn_ie_len; | 915 | size_t rsn_ie_len; |
781 | struct ieee80211_tim_parameters tim; | 916 | struct ieee80211_tim_parameters tim; |
917 | |||
918 | /* 802.11h info */ | ||
919 | |||
920 | /* Power Constraint - mandatory if spctrm mgmt required */ | ||
921 | u8 power_constraint; | ||
922 | |||
923 | /* TPC Report - mandatory if spctrm mgmt required */ | ||
924 | struct ieee80211_tpc_report tpc_report; | ||
925 | |||
926 | /* IBSS DFS - mandatory if spctrm mgmt required and IBSS | ||
927 | * NOTE: This is variable length and so must be allocated dynamically */ | ||
928 | struct ieee80211_ibss_dfs *ibss_dfs; | ||
929 | |||
930 | /* Channel Switch Announcement - optional if spctrm mgmt required */ | ||
931 | struct ieee80211_csa csa; | ||
932 | |||
933 | /* Quiet - optional if spctrm mgmt required */ | ||
934 | struct ieee80211_quiet quiet; | ||
935 | |||
782 | struct list_head list; | 936 | struct list_head list; |
783 | }; | 937 | }; |
784 | 938 | ||
@@ -924,7 +1078,10 @@ struct ieee80211_device { | |||
924 | int (*handle_auth) (struct net_device * dev, | 1078 | int (*handle_auth) (struct net_device * dev, |
925 | struct ieee80211_auth * auth); | 1079 | struct ieee80211_auth * auth); |
926 | int (*handle_deauth) (struct net_device * dev, | 1080 | int (*handle_deauth) (struct net_device * dev, |
927 | struct ieee80211_auth * auth); | 1081 | struct ieee80211_deauth * auth); |
1082 | int (*handle_action) (struct net_device * dev, | ||
1083 | struct ieee80211_action * action, | ||
1084 | struct ieee80211_rx_stats * stats); | ||
928 | int (*handle_disassoc) (struct net_device * dev, | 1085 | int (*handle_disassoc) (struct net_device * dev, |
929 | struct ieee80211_disassoc * assoc); | 1086 | struct ieee80211_disassoc * assoc); |
930 | int (*handle_beacon) (struct net_device * dev, | 1087 | int (*handle_beacon) (struct net_device * dev, |
@@ -1093,6 +1250,7 @@ extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
1093 | extern void ieee80211_rx_mgt(struct ieee80211_device *ieee, | 1250 | extern void ieee80211_rx_mgt(struct ieee80211_device *ieee, |
1094 | struct ieee80211_hdr_4addr *header, | 1251 | struct ieee80211_hdr_4addr *header, |
1095 | struct ieee80211_rx_stats *stats); | 1252 | struct ieee80211_rx_stats *stats); |
1253 | extern void ieee80211_network_reset(struct ieee80211_network *network); | ||
1096 | 1254 | ||
1097 | /* ieee80211_geo.c */ | 1255 | /* ieee80211_geo.c */ |
1098 | extern const struct ieee80211_geo *ieee80211_get_geo(struct ieee80211_device | 1256 | extern const struct ieee80211_geo *ieee80211_get_geo(struct ieee80211_device |
@@ -1105,6 +1263,11 @@ extern int ieee80211_is_valid_channel(struct ieee80211_device *ieee, | |||
1105 | extern int ieee80211_channel_to_index(struct ieee80211_device *ieee, | 1263 | extern int ieee80211_channel_to_index(struct ieee80211_device *ieee, |
1106 | u8 channel); | 1264 | u8 channel); |
1107 | extern u8 ieee80211_freq_to_channel(struct ieee80211_device *ieee, u32 freq); | 1265 | extern u8 ieee80211_freq_to_channel(struct ieee80211_device *ieee, u32 freq); |
1266 | extern u8 ieee80211_get_channel_flags(struct ieee80211_device *ieee, | ||
1267 | u8 channel); | ||
1268 | extern const struct ieee80211_channel *ieee80211_get_channel(struct | ||
1269 | ieee80211_device | ||
1270 | *ieee, u8 channel); | ||
1108 | 1271 | ||
1109 | /* ieee80211_wx.c */ | 1272 | /* ieee80211_wx.c */ |
1110 | extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee, | 1273 | extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee, |
diff --git a/include/net/ieee80211_crypt.h b/include/net/ieee80211_crypt.h index cd82c3e998e4..eb476414fd72 100644 --- a/include/net/ieee80211_crypt.h +++ b/include/net/ieee80211_crypt.h | |||
@@ -47,7 +47,8 @@ struct ieee80211_crypto_ops { | |||
47 | /* deinitialize crypto context and free allocated private data */ | 47 | /* deinitialize crypto context and free allocated private data */ |
48 | void (*deinit) (void *priv); | 48 | void (*deinit) (void *priv); |
49 | 49 | ||
50 | int (*build_iv) (struct sk_buff * skb, int hdr_len, void *priv); | 50 | int (*build_iv) (struct sk_buff * skb, int hdr_len, |
51 | u8 *key, int keylen, void *priv); | ||
51 | 52 | ||
52 | /* encrypt/decrypt return < 0 on error or >= 0 on success. The return | 53 | /* encrypt/decrypt return < 0 on error or >= 0 on success. The return |
53 | * value from decrypt_mpdu is passed as the keyidx value for | 54 | * value from decrypt_mpdu is passed as the keyidx value for |
diff --git a/net/ieee80211/ieee80211_crypt.c b/net/ieee80211/ieee80211_crypt.c index ecc9bb196abc..cb71d794a7d1 100644 --- a/net/ieee80211/ieee80211_crypt.c +++ b/net/ieee80211/ieee80211_crypt.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include <linux/string.h> | 18 | #include <linux/string.h> |
19 | #include <net/ieee80211.h> | 19 | #include <net/ieee80211.h> |
20 | 20 | ||
21 | |||
22 | MODULE_AUTHOR("Jouni Malinen"); | 21 | MODULE_AUTHOR("Jouni Malinen"); |
23 | MODULE_DESCRIPTION("HostAP crypto"); | 22 | MODULE_DESCRIPTION("HostAP crypto"); |
24 | MODULE_LICENSE("GPL"); | 23 | MODULE_LICENSE("GPL"); |
@@ -33,11 +32,11 @@ static DEFINE_SPINLOCK(ieee80211_crypto_lock); | |||
33 | 32 | ||
34 | void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee, int force) | 33 | void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee, int force) |
35 | { | 34 | { |
36 | struct ieee80211_crypt_data *entry, *next; | 35 | struct ieee80211_crypt_data *entry, *next; |
37 | unsigned long flags; | 36 | unsigned long flags; |
38 | 37 | ||
39 | spin_lock_irqsave(&ieee->lock, flags); | 38 | spin_lock_irqsave(&ieee->lock, flags); |
40 | list_for_each_entry_safe(entry, next, &ieee->crypt_deinit_list, list) { | 39 | list_for_each_entry_safe(entry, next, &ieee->crypt_deinit_list, list) { |
41 | if (atomic_read(&entry->refcnt) != 0 && !force) | 40 | if (atomic_read(&entry->refcnt) != 0 && !force) |
42 | continue; | 41 | continue; |
43 | 42 | ||
@@ -141,9 +140,9 @@ int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops) | |||
141 | spin_unlock_irqrestore(&ieee80211_crypto_lock, flags); | 140 | spin_unlock_irqrestore(&ieee80211_crypto_lock, flags); |
142 | return -EINVAL; | 141 | return -EINVAL; |
143 | 142 | ||
144 | found: | 143 | found: |
145 | printk(KERN_DEBUG "ieee80211_crypt: unregistered algorithm " | 144 | printk(KERN_DEBUG "ieee80211_crypt: unregistered algorithm " |
146 | "'%s'\n", ops->name); | 145 | "'%s'\n", ops->name); |
147 | list_del(&alg->list); | 146 | list_del(&alg->list); |
148 | spin_unlock_irqrestore(&ieee80211_crypto_lock, flags); | 147 | spin_unlock_irqrestore(&ieee80211_crypto_lock, flags); |
149 | kfree(alg); | 148 | kfree(alg); |
@@ -163,7 +162,7 @@ struct ieee80211_crypto_ops *ieee80211_get_crypto_ops(const char *name) | |||
163 | spin_unlock_irqrestore(&ieee80211_crypto_lock, flags); | 162 | spin_unlock_irqrestore(&ieee80211_crypto_lock, flags); |
164 | return NULL; | 163 | return NULL; |
165 | 164 | ||
166 | found: | 165 | found: |
167 | spin_unlock_irqrestore(&ieee80211_crypto_lock, flags); | 166 | spin_unlock_irqrestore(&ieee80211_crypto_lock, flags); |
168 | return alg->ops; | 167 | return alg->ops; |
169 | } | 168 | } |
diff --git a/net/ieee80211/ieee80211_crypt_ccmp.c b/net/ieee80211/ieee80211_crypt_ccmp.c index 470221728503..097bcea2129f 100644 --- a/net/ieee80211/ieee80211_crypt_ccmp.c +++ b/net/ieee80211/ieee80211_crypt_ccmp.c | |||
@@ -190,7 +190,8 @@ static void ccmp_init_blocks(struct crypto_tfm *tfm, | |||
190 | ieee80211_ccmp_aes_encrypt(tfm, b0, s0); | 190 | ieee80211_ccmp_aes_encrypt(tfm, b0, s0); |
191 | } | 191 | } |
192 | 192 | ||
193 | static int ieee80211_ccmp_hdr(struct sk_buff *skb, int hdr_len, void *priv) | 193 | static int ieee80211_ccmp_hdr(struct sk_buff *skb, int hdr_len, |
194 | u8 *aeskey, int keylen, void *priv) | ||
194 | { | 195 | { |
195 | struct ieee80211_ccmp_data *key = priv; | 196 | struct ieee80211_ccmp_data *key = priv; |
196 | int i; | 197 | int i; |
@@ -199,6 +200,9 @@ static int ieee80211_ccmp_hdr(struct sk_buff *skb, int hdr_len, void *priv) | |||
199 | if (skb_headroom(skb) < CCMP_HDR_LEN || skb->len < hdr_len) | 200 | if (skb_headroom(skb) < CCMP_HDR_LEN || skb->len < hdr_len) |
200 | return -1; | 201 | return -1; |
201 | 202 | ||
203 | if (aeskey != NULL && keylen >= CCMP_TK_LEN) | ||
204 | memcpy(aeskey, key->key, CCMP_TK_LEN); | ||
205 | |||
202 | pos = skb_push(skb, CCMP_HDR_LEN); | 206 | pos = skb_push(skb, CCMP_HDR_LEN); |
203 | memmove(pos, pos + CCMP_HDR_LEN, hdr_len); | 207 | memmove(pos, pos + CCMP_HDR_LEN, hdr_len); |
204 | pos += hdr_len; | 208 | pos += hdr_len; |
@@ -238,7 +242,7 @@ static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
238 | return -1; | 242 | return -1; |
239 | 243 | ||
240 | data_len = skb->len - hdr_len; | 244 | data_len = skb->len - hdr_len; |
241 | len = ieee80211_ccmp_hdr(skb, hdr_len, priv); | 245 | len = ieee80211_ccmp_hdr(skb, hdr_len, NULL, 0, priv); |
242 | if (len < 0) | 246 | if (len < 0) |
243 | return -1; | 247 | return -1; |
244 | 248 | ||
diff --git a/net/ieee80211/ieee80211_crypt_tkip.c b/net/ieee80211/ieee80211_crypt_tkip.c index e0988320efbf..93def94c1b32 100644 --- a/net/ieee80211/ieee80211_crypt_tkip.c +++ b/net/ieee80211/ieee80211_crypt_tkip.c | |||
@@ -80,10 +80,9 @@ static void *ieee80211_tkip_init(int key_idx) | |||
80 | { | 80 | { |
81 | struct ieee80211_tkip_data *priv; | 81 | struct ieee80211_tkip_data *priv; |
82 | 82 | ||
83 | priv = kmalloc(sizeof(*priv), GFP_ATOMIC); | 83 | priv = kzalloc(sizeof(*priv), GFP_ATOMIC); |
84 | if (priv == NULL) | 84 | if (priv == NULL) |
85 | goto fail; | 85 | goto fail; |
86 | memset(priv, 0, sizeof(*priv)); | ||
87 | 86 | ||
88 | priv->key_idx = key_idx; | 87 | priv->key_idx = key_idx; |
89 | 88 | ||
@@ -271,34 +270,33 @@ static void tkip_mixing_phase2(u8 * WEPSeed, const u8 * TK, const u16 * TTAK, | |||
271 | #endif | 270 | #endif |
272 | } | 271 | } |
273 | 272 | ||
274 | static u8 *ieee80211_tkip_hdr(struct sk_buff *skb, int hdr_len, void *priv) | 273 | static int ieee80211_tkip_hdr(struct sk_buff *skb, int hdr_len, |
274 | u8 * rc4key, int keylen, void *priv) | ||
275 | { | 275 | { |
276 | struct ieee80211_tkip_data *tkey = priv; | 276 | struct ieee80211_tkip_data *tkey = priv; |
277 | int len; | 277 | int len; |
278 | u8 *rc4key, *pos, *icv; | 278 | u8 *pos; |
279 | struct ieee80211_hdr_4addr *hdr; | 279 | struct ieee80211_hdr_4addr *hdr; |
280 | u32 crc; | ||
281 | 280 | ||
282 | hdr = (struct ieee80211_hdr_4addr *)skb->data; | 281 | hdr = (struct ieee80211_hdr_4addr *)skb->data; |
283 | 282 | ||
284 | if (skb_headroom(skb) < 8 || skb->len < hdr_len) | 283 | if (skb_headroom(skb) < 8 || skb->len < hdr_len) |
285 | return NULL; | 284 | return -1; |
285 | |||
286 | if (rc4key == NULL || keylen < 16) | ||
287 | return -1; | ||
286 | 288 | ||
287 | if (!tkey->tx_phase1_done) { | 289 | if (!tkey->tx_phase1_done) { |
288 | tkip_mixing_phase1(tkey->tx_ttak, tkey->key, hdr->addr2, | 290 | tkip_mixing_phase1(tkey->tx_ttak, tkey->key, hdr->addr2, |
289 | tkey->tx_iv32); | 291 | tkey->tx_iv32); |
290 | tkey->tx_phase1_done = 1; | 292 | tkey->tx_phase1_done = 1; |
291 | } | 293 | } |
292 | rc4key = kmalloc(16, GFP_ATOMIC); | ||
293 | if (!rc4key) | ||
294 | return NULL; | ||
295 | tkip_mixing_phase2(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16); | 294 | tkip_mixing_phase2(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16); |
296 | 295 | ||
297 | len = skb->len - hdr_len; | 296 | len = skb->len - hdr_len; |
298 | pos = skb_push(skb, 8); | 297 | pos = skb_push(skb, 8); |
299 | memmove(pos, pos + 8, hdr_len); | 298 | memmove(pos, pos + 8, hdr_len); |
300 | pos += hdr_len; | 299 | pos += hdr_len; |
301 | icv = skb_put(skb, 4); | ||
302 | 300 | ||
303 | *pos++ = *rc4key; | 301 | *pos++ = *rc4key; |
304 | *pos++ = *(rc4key + 1); | 302 | *pos++ = *(rc4key + 1); |
@@ -309,28 +307,28 @@ static u8 *ieee80211_tkip_hdr(struct sk_buff *skb, int hdr_len, void *priv) | |||
309 | *pos++ = (tkey->tx_iv32 >> 16) & 0xff; | 307 | *pos++ = (tkey->tx_iv32 >> 16) & 0xff; |
310 | *pos++ = (tkey->tx_iv32 >> 24) & 0xff; | 308 | *pos++ = (tkey->tx_iv32 >> 24) & 0xff; |
311 | 309 | ||
312 | crc = ~crc32_le(~0, pos, len); | 310 | tkey->tx_iv16++; |
313 | icv[0] = crc; | 311 | if (tkey->tx_iv16 == 0) { |
314 | icv[1] = crc >> 8; | 312 | tkey->tx_phase1_done = 0; |
315 | icv[2] = crc >> 16; | 313 | tkey->tx_iv32++; |
316 | icv[3] = crc >> 24; | 314 | } |
317 | 315 | ||
318 | return rc4key; | 316 | return 8; |
319 | } | 317 | } |
320 | 318 | ||
321 | static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv) | 319 | static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv) |
322 | { | 320 | { |
323 | struct ieee80211_tkip_data *tkey = priv; | 321 | struct ieee80211_tkip_data *tkey = priv; |
324 | int len; | 322 | int len; |
325 | const u8 *rc4key; | 323 | u8 rc4key[16], *pos, *icv; |
326 | u8 *pos; | 324 | u32 crc; |
327 | struct scatterlist sg; | 325 | struct scatterlist sg; |
328 | 326 | ||
329 | if (tkey->flags & IEEE80211_CRYPTO_TKIP_COUNTERMEASURES) { | 327 | if (tkey->flags & IEEE80211_CRYPTO_TKIP_COUNTERMEASURES) { |
330 | if (net_ratelimit()) { | 328 | if (net_ratelimit()) { |
331 | struct ieee80211_hdr_4addr *hdr = | 329 | struct ieee80211_hdr_4addr *hdr = |
332 | (struct ieee80211_hdr_4addr *)skb->data; | 330 | (struct ieee80211_hdr_4addr *)skb->data; |
333 | printk(KERN_DEBUG "TKIP countermeasures: dropped " | 331 | printk(KERN_DEBUG ": TKIP countermeasures: dropped " |
334 | "TX packet to " MAC_FMT "\n", | 332 | "TX packet to " MAC_FMT "\n", |
335 | MAC_ARG(hdr->addr1)); | 333 | MAC_ARG(hdr->addr1)); |
336 | } | 334 | } |
@@ -343,22 +341,23 @@ static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
343 | len = skb->len - hdr_len; | 341 | len = skb->len - hdr_len; |
344 | pos = skb->data + hdr_len; | 342 | pos = skb->data + hdr_len; |
345 | 343 | ||
346 | rc4key = ieee80211_tkip_hdr(skb, hdr_len, priv); | 344 | if ((ieee80211_tkip_hdr(skb, hdr_len, rc4key, 16, priv)) < 0) |
347 | if (!rc4key) | ||
348 | return -1; | 345 | return -1; |
349 | 346 | ||
347 | icv = skb_put(skb, 4); | ||
348 | |||
349 | crc = ~crc32_le(~0, pos, len); | ||
350 | icv[0] = crc; | ||
351 | icv[1] = crc >> 8; | ||
352 | icv[2] = crc >> 16; | ||
353 | icv[3] = crc >> 24; | ||
354 | |||
350 | crypto_cipher_setkey(tkey->tfm_arc4, rc4key, 16); | 355 | crypto_cipher_setkey(tkey->tfm_arc4, rc4key, 16); |
351 | sg.page = virt_to_page(pos); | 356 | sg.page = virt_to_page(pos); |
352 | sg.offset = offset_in_page(pos); | 357 | sg.offset = offset_in_page(pos); |
353 | sg.length = len + 4; | 358 | sg.length = len + 4; |
354 | crypto_cipher_encrypt(tkey->tfm_arc4, &sg, &sg, len + 4); | 359 | crypto_cipher_encrypt(tkey->tfm_arc4, &sg, &sg, len + 4); |
355 | 360 | ||
356 | tkey->tx_iv16++; | ||
357 | if (tkey->tx_iv16 == 0) { | ||
358 | tkey->tx_phase1_done = 0; | ||
359 | tkey->tx_iv32++; | ||
360 | } | ||
361 | |||
362 | return 0; | 361 | return 0; |
363 | } | 362 | } |
364 | 363 | ||
@@ -379,7 +378,7 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
379 | 378 | ||
380 | if (tkey->flags & IEEE80211_CRYPTO_TKIP_COUNTERMEASURES) { | 379 | if (tkey->flags & IEEE80211_CRYPTO_TKIP_COUNTERMEASURES) { |
381 | if (net_ratelimit()) { | 380 | if (net_ratelimit()) { |
382 | printk(KERN_DEBUG "TKIP countermeasures: dropped " | 381 | printk(KERN_DEBUG ": TKIP countermeasures: dropped " |
383 | "received packet from " MAC_FMT "\n", | 382 | "received packet from " MAC_FMT "\n", |
384 | MAC_ARG(hdr->addr2)); | 383 | MAC_ARG(hdr->addr2)); |
385 | } | 384 | } |
@@ -695,6 +694,7 @@ static struct ieee80211_crypto_ops ieee80211_crypt_tkip = { | |||
695 | .name = "TKIP", | 694 | .name = "TKIP", |
696 | .init = ieee80211_tkip_init, | 695 | .init = ieee80211_tkip_init, |
697 | .deinit = ieee80211_tkip_deinit, | 696 | .deinit = ieee80211_tkip_deinit, |
697 | .build_iv = ieee80211_tkip_hdr, | ||
698 | .encrypt_mpdu = ieee80211_tkip_encrypt, | 698 | .encrypt_mpdu = ieee80211_tkip_encrypt, |
699 | .decrypt_mpdu = ieee80211_tkip_decrypt, | 699 | .decrypt_mpdu = ieee80211_tkip_decrypt, |
700 | .encrypt_msdu = ieee80211_michael_mic_add, | 700 | .encrypt_msdu = ieee80211_michael_mic_add, |
diff --git a/net/ieee80211/ieee80211_crypt_wep.c b/net/ieee80211/ieee80211_crypt_wep.c index f8dca31be5dd..649e581fa565 100644 --- a/net/ieee80211/ieee80211_crypt_wep.c +++ b/net/ieee80211/ieee80211_crypt_wep.c | |||
@@ -76,7 +76,8 @@ static void prism2_wep_deinit(void *priv) | |||
76 | } | 76 | } |
77 | 77 | ||
78 | /* Add WEP IV/key info to a frame that has at least 4 bytes of headroom */ | 78 | /* Add WEP IV/key info to a frame that has at least 4 bytes of headroom */ |
79 | static int prism2_wep_build_iv(struct sk_buff *skb, int hdr_len, void *priv) | 79 | static int prism2_wep_build_iv(struct sk_buff *skb, int hdr_len, |
80 | u8 *key, int keylen, void *priv) | ||
80 | { | 81 | { |
81 | struct prism2_wep_data *wep = priv; | 82 | struct prism2_wep_data *wep = priv; |
82 | u32 klen, len; | 83 | u32 klen, len; |
@@ -131,7 +132,7 @@ static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
131 | return -1; | 132 | return -1; |
132 | 133 | ||
133 | /* add the IV to the frame */ | 134 | /* add the IV to the frame */ |
134 | if (prism2_wep_build_iv(skb, hdr_len, priv)) | 135 | if (prism2_wep_build_iv(skb, hdr_len, NULL, 0, priv)) |
135 | return -1; | 136 | return -1; |
136 | 137 | ||
137 | /* Copy the IV into the first 3 bytes of the key */ | 138 | /* Copy the IV into the first 3 bytes of the key */ |
diff --git a/net/ieee80211/ieee80211_geo.c b/net/ieee80211/ieee80211_geo.c index 610cc5cbc252..3027153940fc 100644 --- a/net/ieee80211/ieee80211_geo.c +++ b/net/ieee80211/ieee80211_geo.c | |||
@@ -58,13 +58,15 @@ int ieee80211_is_valid_channel(struct ieee80211_device *ieee, u8 channel) | |||
58 | * this is a B only channel, we don't see it | 58 | * this is a B only channel, we don't see it |
59 | * as valid. */ | 59 | * as valid. */ |
60 | if ((ieee->geo.bg[i].channel == channel) && | 60 | if ((ieee->geo.bg[i].channel == channel) && |
61 | !(ieee->geo.bg[i].flags & IEEE80211_CH_INVALID) && | ||
61 | (!(ieee->mode & IEEE_G) || | 62 | (!(ieee->mode & IEEE_G) || |
62 | !(ieee->geo.bg[i].flags & IEEE80211_CH_B_ONLY))) | 63 | !(ieee->geo.bg[i].flags & IEEE80211_CH_B_ONLY))) |
63 | return IEEE80211_24GHZ_BAND; | 64 | return IEEE80211_24GHZ_BAND; |
64 | 65 | ||
65 | if (ieee->freq_band & IEEE80211_52GHZ_BAND) | 66 | if (ieee->freq_band & IEEE80211_52GHZ_BAND) |
66 | for (i = 0; i < ieee->geo.a_channels; i++) | 67 | for (i = 0; i < ieee->geo.a_channels; i++) |
67 | if (ieee->geo.a[i].channel == channel) | 68 | if ((ieee->geo.a[i].channel == channel) && |
69 | !(ieee->geo.a[i].flags & IEEE80211_CH_INVALID)) | ||
68 | return IEEE80211_52GHZ_BAND; | 70 | return IEEE80211_52GHZ_BAND; |
69 | 71 | ||
70 | return 0; | 72 | return 0; |
@@ -133,6 +135,41 @@ const struct ieee80211_geo *ieee80211_get_geo(struct ieee80211_device *ieee) | |||
133 | return &ieee->geo; | 135 | return &ieee->geo; |
134 | } | 136 | } |
135 | 137 | ||
138 | u8 ieee80211_get_channel_flags(struct ieee80211_device * ieee, u8 channel) | ||
139 | { | ||
140 | int index = ieee80211_channel_to_index(ieee, channel); | ||
141 | |||
142 | if (index == -1) | ||
143 | return IEEE80211_CH_INVALID; | ||
144 | |||
145 | if (channel <= IEEE80211_24GHZ_CHANNELS) | ||
146 | return ieee->geo.bg[index].flags; | ||
147 | |||
148 | return ieee->geo.a[index].flags; | ||
149 | } | ||
150 | |||
151 | static const struct ieee80211_channel bad_channel = { | ||
152 | .channel = 0, | ||
153 | .flags = IEEE80211_CH_INVALID, | ||
154 | .max_power = 0, | ||
155 | }; | ||
156 | |||
157 | const struct ieee80211_channel *ieee80211_get_channel(struct ieee80211_device | ||
158 | *ieee, u8 channel) | ||
159 | { | ||
160 | int index = ieee80211_channel_to_index(ieee, channel); | ||
161 | |||
162 | if (index == -1) | ||
163 | return &bad_channel; | ||
164 | |||
165 | if (channel <= IEEE80211_24GHZ_CHANNELS) | ||
166 | return &ieee->geo.bg[index]; | ||
167 | |||
168 | return &ieee->geo.a[index]; | ||
169 | } | ||
170 | |||
171 | EXPORT_SYMBOL(ieee80211_get_channel); | ||
172 | EXPORT_SYMBOL(ieee80211_get_channel_flags); | ||
136 | EXPORT_SYMBOL(ieee80211_is_valid_channel); | 173 | EXPORT_SYMBOL(ieee80211_is_valid_channel); |
137 | EXPORT_SYMBOL(ieee80211_freq_to_channel); | 174 | EXPORT_SYMBOL(ieee80211_freq_to_channel); |
138 | EXPORT_SYMBOL(ieee80211_channel_to_index); | 175 | EXPORT_SYMBOL(ieee80211_channel_to_index); |
diff --git a/net/ieee80211/ieee80211_module.c b/net/ieee80211/ieee80211_module.c index 90d18b72da3d..5f67c684afc2 100644 --- a/net/ieee80211/ieee80211_module.c +++ b/net/ieee80211/ieee80211_module.c | |||
@@ -82,10 +82,28 @@ static int ieee80211_networks_allocate(struct ieee80211_device *ieee) | |||
82 | return 0; | 82 | return 0; |
83 | } | 83 | } |
84 | 84 | ||
85 | void ieee80211_network_reset(struct ieee80211_network *network) | ||
86 | { | ||
87 | if (!network) | ||
88 | return; | ||
89 | |||
90 | if (network->ibss_dfs) { | ||
91 | kfree(network->ibss_dfs); | ||
92 | network->ibss_dfs = NULL; | ||
93 | } | ||
94 | } | ||
95 | |||
85 | static inline void ieee80211_networks_free(struct ieee80211_device *ieee) | 96 | static inline void ieee80211_networks_free(struct ieee80211_device *ieee) |
86 | { | 97 | { |
98 | int i; | ||
99 | |||
87 | if (!ieee->networks) | 100 | if (!ieee->networks) |
88 | return; | 101 | return; |
102 | |||
103 | for (i = 0; i < MAX_NETWORK_COUNT; i++) | ||
104 | if (ieee->networks[i].ibss_dfs) | ||
105 | kfree(ieee->networks[i].ibss_dfs); | ||
106 | |||
89 | kfree(ieee->networks); | 107 | kfree(ieee->networks); |
90 | ieee->networks = NULL; | 108 | ieee->networks = NULL; |
91 | } | 109 | } |
diff --git a/net/ieee80211/ieee80211_rx.c b/net/ieee80211/ieee80211_rx.c index 695d0478fd12..a4ebc22ee712 100644 --- a/net/ieee80211/ieee80211_rx.c +++ b/net/ieee80211/ieee80211_rx.c | |||
@@ -754,7 +754,14 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
754 | memset(skb->cb, 0, sizeof(skb->cb)); | 754 | memset(skb->cb, 0, sizeof(skb->cb)); |
755 | skb->dev = dev; | 755 | skb->dev = dev; |
756 | skb->ip_summed = CHECKSUM_NONE; /* 802.11 crc not sufficient */ | 756 | skb->ip_summed = CHECKSUM_NONE; /* 802.11 crc not sufficient */ |
757 | netif_rx(skb); | 757 | if (netif_rx(skb) == NET_RX_DROP) { |
758 | /* netif_rx always succeeds, but it might drop | ||
759 | * the packet. If it drops the packet, we log that | ||
760 | * in our stats. */ | ||
761 | IEEE80211_DEBUG_DROP | ||
762 | ("RX: netif_rx dropped the packet\n"); | ||
763 | stats->rx_dropped++; | ||
764 | } | ||
758 | } | 765 | } |
759 | 766 | ||
760 | rx_exit: | 767 | rx_exit: |
@@ -930,6 +937,45 @@ static int ieee80211_parse_qos_info_param_IE(struct ieee80211_info_element | |||
930 | return rc; | 937 | return rc; |
931 | } | 938 | } |
932 | 939 | ||
940 | #ifdef CONFIG_IEEE80211_DEBUG | ||
941 | #define MFIE_STRING(x) case MFIE_TYPE_ ##x: return #x | ||
942 | |||
943 | static const char *get_info_element_string(u16 id) | ||
944 | { | ||
945 | switch (id) { | ||
946 | MFIE_STRING(SSID); | ||
947 | MFIE_STRING(RATES); | ||
948 | MFIE_STRING(FH_SET); | ||
949 | MFIE_STRING(DS_SET); | ||
950 | MFIE_STRING(CF_SET); | ||
951 | MFIE_STRING(TIM); | ||
952 | MFIE_STRING(IBSS_SET); | ||
953 | MFIE_STRING(COUNTRY); | ||
954 | MFIE_STRING(HOP_PARAMS); | ||
955 | MFIE_STRING(HOP_TABLE); | ||
956 | MFIE_STRING(REQUEST); | ||
957 | MFIE_STRING(CHALLENGE); | ||
958 | MFIE_STRING(POWER_CONSTRAINT); | ||
959 | MFIE_STRING(POWER_CAPABILITY); | ||
960 | MFIE_STRING(TPC_REQUEST); | ||
961 | MFIE_STRING(TPC_REPORT); | ||
962 | MFIE_STRING(SUPP_CHANNELS); | ||
963 | MFIE_STRING(CSA); | ||
964 | MFIE_STRING(MEASURE_REQUEST); | ||
965 | MFIE_STRING(MEASURE_REPORT); | ||
966 | MFIE_STRING(QUIET); | ||
967 | MFIE_STRING(IBSS_DFS); | ||
968 | MFIE_STRING(ERP_INFO); | ||
969 | MFIE_STRING(RSN); | ||
970 | MFIE_STRING(RATES_EX); | ||
971 | MFIE_STRING(GENERIC); | ||
972 | MFIE_STRING(QOS_PARAMETER); | ||
973 | default: | ||
974 | return "UNKNOWN"; | ||
975 | } | ||
976 | } | ||
977 | #endif | ||
978 | |||
933 | static int ieee80211_parse_info_param(struct ieee80211_info_element | 979 | static int ieee80211_parse_info_param(struct ieee80211_info_element |
934 | *info_element, u16 length, | 980 | *info_element, u16 length, |
935 | struct ieee80211_network *network) | 981 | struct ieee80211_network *network) |
@@ -1040,7 +1086,9 @@ static int ieee80211_parse_info_param(struct ieee80211_info_element | |||
1040 | break; | 1086 | break; |
1041 | 1087 | ||
1042 | case MFIE_TYPE_TIM: | 1088 | case MFIE_TYPE_TIM: |
1043 | IEEE80211_DEBUG_MGMT("MFIE_TYPE_TIM: ignored\n"); | 1089 | network->tim.tim_count = info_element->data[0]; |
1090 | network->tim.tim_period = info_element->data[1]; | ||
1091 | IEEE80211_DEBUG_MGMT("MFIE_TYPE_TIM: partially ignored\n"); | ||
1044 | break; | 1092 | break; |
1045 | 1093 | ||
1046 | case MFIE_TYPE_ERP_INFO: | 1094 | case MFIE_TYPE_ERP_INFO: |
@@ -1091,10 +1139,49 @@ static int ieee80211_parse_info_param(struct ieee80211_info_element | |||
1091 | printk(KERN_ERR | 1139 | printk(KERN_ERR |
1092 | "QoS Error need to parse QOS_PARAMETER IE\n"); | 1140 | "QoS Error need to parse QOS_PARAMETER IE\n"); |
1093 | break; | 1141 | break; |
1142 | /* 802.11h */ | ||
1143 | case MFIE_TYPE_POWER_CONSTRAINT: | ||
1144 | network->power_constraint = info_element->data[0]; | ||
1145 | network->flags |= NETWORK_HAS_POWER_CONSTRAINT; | ||
1146 | break; | ||
1147 | |||
1148 | case MFIE_TYPE_CSA: | ||
1149 | network->power_constraint = info_element->data[0]; | ||
1150 | network->flags |= NETWORK_HAS_CSA; | ||
1151 | break; | ||
1152 | |||
1153 | case MFIE_TYPE_QUIET: | ||
1154 | network->quiet.count = info_element->data[0]; | ||
1155 | network->quiet.period = info_element->data[1]; | ||
1156 | network->quiet.duration = info_element->data[2]; | ||
1157 | network->quiet.offset = info_element->data[3]; | ||
1158 | network->flags |= NETWORK_HAS_QUIET; | ||
1159 | break; | ||
1160 | |||
1161 | case MFIE_TYPE_IBSS_DFS: | ||
1162 | if (network->ibss_dfs) | ||
1163 | break; | ||
1164 | network->ibss_dfs = | ||
1165 | kmalloc(info_element->len, GFP_ATOMIC); | ||
1166 | if (!network->ibss_dfs) | ||
1167 | return 1; | ||
1168 | memcpy(network->ibss_dfs, info_element->data, | ||
1169 | info_element->len); | ||
1170 | network->flags |= NETWORK_HAS_IBSS_DFS; | ||
1171 | break; | ||
1172 | |||
1173 | case MFIE_TYPE_TPC_REPORT: | ||
1174 | network->tpc_report.transmit_power = | ||
1175 | info_element->data[0]; | ||
1176 | network->tpc_report.link_margin = info_element->data[1]; | ||
1177 | network->flags |= NETWORK_HAS_TPC_REPORT; | ||
1178 | break; | ||
1094 | 1179 | ||
1095 | default: | 1180 | default: |
1096 | IEEE80211_DEBUG_MGMT("unsupported IE %d\n", | 1181 | IEEE80211_DEBUG_MGMT |
1097 | info_element->id); | 1182 | ("Unsupported info element: %s (%d)\n", |
1183 | get_info_element_string(info_element->id), | ||
1184 | info_element->id); | ||
1098 | break; | 1185 | break; |
1099 | } | 1186 | } |
1100 | 1187 | ||
@@ -1110,7 +1197,9 @@ static int ieee80211_parse_info_param(struct ieee80211_info_element | |||
1110 | static int ieee80211_handle_assoc_resp(struct ieee80211_device *ieee, struct ieee80211_assoc_response | 1197 | static int ieee80211_handle_assoc_resp(struct ieee80211_device *ieee, struct ieee80211_assoc_response |
1111 | *frame, struct ieee80211_rx_stats *stats) | 1198 | *frame, struct ieee80211_rx_stats *stats) |
1112 | { | 1199 | { |
1113 | struct ieee80211_network network_resp; | 1200 | struct ieee80211_network network_resp = { |
1201 | .ibss_dfs = NULL, | ||
1202 | }; | ||
1114 | struct ieee80211_network *network = &network_resp; | 1203 | struct ieee80211_network *network = &network_resp; |
1115 | struct net_device *dev = ieee->dev; | 1204 | struct net_device *dev = ieee->dev; |
1116 | 1205 | ||
@@ -1253,6 +1342,9 @@ static void update_network(struct ieee80211_network *dst, | |||
1253 | int qos_active; | 1342 | int qos_active; |
1254 | u8 old_param; | 1343 | u8 old_param; |
1255 | 1344 | ||
1345 | ieee80211_network_reset(dst); | ||
1346 | dst->ibss_dfs = src->ibss_dfs; | ||
1347 | |||
1256 | memcpy(&dst->stats, &src->stats, sizeof(struct ieee80211_rx_stats)); | 1348 | memcpy(&dst->stats, &src->stats, sizeof(struct ieee80211_rx_stats)); |
1257 | dst->capability = src->capability; | 1349 | dst->capability = src->capability; |
1258 | memcpy(dst->rates, src->rates, src->rates_len); | 1350 | memcpy(dst->rates, src->rates, src->rates_len); |
@@ -1269,6 +1361,7 @@ static void update_network(struct ieee80211_network *dst, | |||
1269 | dst->listen_interval = src->listen_interval; | 1361 | dst->listen_interval = src->listen_interval; |
1270 | dst->atim_window = src->atim_window; | 1362 | dst->atim_window = src->atim_window; |
1271 | dst->erp_value = src->erp_value; | 1363 | dst->erp_value = src->erp_value; |
1364 | dst->tim = src->tim; | ||
1272 | 1365 | ||
1273 | memcpy(dst->wpa_ie, src->wpa_ie, src->wpa_ie_len); | 1366 | memcpy(dst->wpa_ie, src->wpa_ie, src->wpa_ie_len); |
1274 | dst->wpa_ie_len = src->wpa_ie_len; | 1367 | dst->wpa_ie_len = src->wpa_ie_len; |
@@ -1313,7 +1406,9 @@ static void ieee80211_process_probe_response(struct ieee80211_device | |||
1313 | *stats) | 1406 | *stats) |
1314 | { | 1407 | { |
1315 | struct net_device *dev = ieee->dev; | 1408 | struct net_device *dev = ieee->dev; |
1316 | struct ieee80211_network network; | 1409 | struct ieee80211_network network = { |
1410 | .ibss_dfs = NULL, | ||
1411 | }; | ||
1317 | struct ieee80211_network *target; | 1412 | struct ieee80211_network *target; |
1318 | struct ieee80211_network *oldest = NULL; | 1413 | struct ieee80211_network *oldest = NULL; |
1319 | #ifdef CONFIG_IEEE80211_DEBUG | 1414 | #ifdef CONFIG_IEEE80211_DEBUG |
@@ -1388,6 +1483,7 @@ static void ieee80211_process_probe_response(struct ieee80211_device | |||
1388 | escape_essid(target->ssid, | 1483 | escape_essid(target->ssid, |
1389 | target->ssid_len), | 1484 | target->ssid_len), |
1390 | MAC_ARG(target->bssid)); | 1485 | MAC_ARG(target->bssid)); |
1486 | ieee80211_network_reset(target); | ||
1391 | } else { | 1487 | } else { |
1392 | /* Otherwise just pull from the free list */ | 1488 | /* Otherwise just pull from the free list */ |
1393 | target = list_entry(ieee->network_free_list.next, | 1489 | target = list_entry(ieee->network_free_list.next, |
@@ -1406,6 +1502,7 @@ static void ieee80211_process_probe_response(struct ieee80211_device | |||
1406 | "BEACON" : "PROBE RESPONSE"); | 1502 | "BEACON" : "PROBE RESPONSE"); |
1407 | #endif | 1503 | #endif |
1408 | memcpy(target, &network, sizeof(*target)); | 1504 | memcpy(target, &network, sizeof(*target)); |
1505 | network.ibss_dfs = NULL; | ||
1409 | list_add_tail(&target->list, &ieee->network_list); | 1506 | list_add_tail(&target->list, &ieee->network_list); |
1410 | } else { | 1507 | } else { |
1411 | IEEE80211_DEBUG_SCAN("Updating '%s' (" MAC_FMT ") via %s.\n", | 1508 | IEEE80211_DEBUG_SCAN("Updating '%s' (" MAC_FMT ") via %s.\n", |
@@ -1417,6 +1514,7 @@ static void ieee80211_process_probe_response(struct ieee80211_device | |||
1417 | frame_ctl)) ? | 1514 | frame_ctl)) ? |
1418 | "BEACON" : "PROBE RESPONSE"); | 1515 | "BEACON" : "PROBE RESPONSE"); |
1419 | update_network(target, &network); | 1516 | update_network(target, &network); |
1517 | network.ibss_dfs = NULL; | ||
1420 | } | 1518 | } |
1421 | 1519 | ||
1422 | spin_unlock_irqrestore(&ieee->lock, flags); | 1520 | spin_unlock_irqrestore(&ieee->lock, flags); |
@@ -1501,10 +1599,19 @@ void ieee80211_rx_mgt(struct ieee80211_device *ieee, | |||
1501 | header); | 1599 | header); |
1502 | break; | 1600 | break; |
1503 | 1601 | ||
1602 | case IEEE80211_STYPE_ACTION: | ||
1603 | IEEE80211_DEBUG_MGMT("ACTION\n"); | ||
1604 | if (ieee->handle_action) | ||
1605 | ieee->handle_action(ieee->dev, | ||
1606 | (struct ieee80211_action *) | ||
1607 | header, stats); | ||
1608 | break; | ||
1609 | |||
1504 | case IEEE80211_STYPE_DEAUTH: | 1610 | case IEEE80211_STYPE_DEAUTH: |
1505 | printk("DEAUTH from AP\n"); | 1611 | IEEE80211_DEBUG_MGMT("DEAUTH\n"); |
1506 | if (ieee->handle_deauth != NULL) | 1612 | if (ieee->handle_deauth != NULL) |
1507 | ieee->handle_deauth(ieee->dev, (struct ieee80211_auth *) | 1613 | ieee->handle_deauth(ieee->dev, |
1614 | (struct ieee80211_deauth *) | ||
1508 | header); | 1615 | header); |
1509 | break; | 1616 | break; |
1510 | default: | 1617 | default: |
diff --git a/net/ieee80211/ieee80211_tx.c b/net/ieee80211/ieee80211_tx.c index 8fdd943ebe8e..8b4332f53394 100644 --- a/net/ieee80211/ieee80211_tx.c +++ b/net/ieee80211/ieee80211_tx.c | |||
@@ -56,7 +56,18 @@ Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | Frame | fcs | | |||
56 | `--------------------------------------------------| |------' | 56 | `--------------------------------------------------| |------' |
57 | Total: 28 non-data bytes `----.----' | 57 | Total: 28 non-data bytes `----.----' |
58 | | | 58 | | |
59 | .- 'Frame data' expands to <---------------------------' | 59 | .- 'Frame data' expands, if WEP enabled, to <----------' |
60 | | | ||
61 | V | ||
62 | ,-----------------------. | ||
63 | Bytes | 4 | 0-2296 | 4 | | ||
64 | |-----|-----------|-----| | ||
65 | Desc. | IV | Encrypted | ICV | | ||
66 | | | Packet | | | ||
67 | `-----| |-----' | ||
68 | `-----.-----' | ||
69 | | | ||
70 | .- 'Encrypted Packet' expands to | ||
60 | | | 71 | | |
61 | V | 72 | V |
62 | ,---------------------------------------------------. | 73 | ,---------------------------------------------------. |
@@ -65,18 +76,7 @@ Bytes | 1 | 1 | 1 | 3 | 2 | 0-2304 | | |||
65 | Desc. | SNAP | SNAP | Control |Eth Tunnel| Type | IP | | 76 | Desc. | SNAP | SNAP | Control |Eth Tunnel| Type | IP | |
66 | | DSAP | SSAP | | | | Packet | | 77 | | DSAP | SSAP | | | | Packet | |
67 | | 0xAA | 0xAA |0x03 (UI)|0x00-00-F8| | | | 78 | | 0xAA | 0xAA |0x03 (UI)|0x00-00-F8| | | |
68 | `-----------------------------------------| | | 79 | `---------------------------------------------------- |
69 | Total: 8 non-data bytes `----.----' | ||
70 | | | ||
71 | .- 'IP Packet' expands, if WEP enabled, to <--' | ||
72 | | | ||
73 | V | ||
74 | ,-----------------------. | ||
75 | Bytes | 4 | 0-2296 | 4 | | ||
76 | |-----|-----------|-----| | ||
77 | Desc. | IV | Encrypted | ICV | | ||
78 | | | IP Packet | | | ||
79 | `-----------------------' | ||
80 | Total: 8 non-data bytes | 80 | Total: 8 non-data bytes |
81 | 81 | ||
82 | 802.3 Ethernet Data Frame | 82 | 802.3 Ethernet Data Frame |
@@ -470,7 +470,9 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) | |||
470 | atomic_inc(&crypt->refcnt); | 470 | atomic_inc(&crypt->refcnt); |
471 | if (crypt->ops->build_iv) | 471 | if (crypt->ops->build_iv) |
472 | crypt->ops->build_iv(skb_frag, hdr_len, | 472 | crypt->ops->build_iv(skb_frag, hdr_len, |
473 | crypt->priv); | 473 | ieee->sec.keys[ieee->sec.active_key], |
474 | ieee->sec.key_sizes[ieee->sec.active_key], | ||
475 | crypt->priv); | ||
474 | atomic_dec(&crypt->refcnt); | 476 | atomic_dec(&crypt->refcnt); |
475 | } | 477 | } |
476 | 478 | ||
diff --git a/net/ieee80211/ieee80211_wx.c b/net/ieee80211/ieee80211_wx.c index f87c6b89f845..9496918e6106 100644 --- a/net/ieee80211/ieee80211_wx.c +++ b/net/ieee80211/ieee80211_wx.c | |||
@@ -149,9 +149,7 @@ static char *ipw2100_translate_scan(struct ieee80211_device *ieee, | |||
149 | iwe.u.qual.updated |= IW_QUAL_QUAL_INVALID | | 149 | iwe.u.qual.updated |= IW_QUAL_QUAL_INVALID | |
150 | IW_QUAL_LEVEL_INVALID; | 150 | IW_QUAL_LEVEL_INVALID; |
151 | iwe.u.qual.qual = 0; | 151 | iwe.u.qual.qual = 0; |
152 | iwe.u.qual.level = 0; | ||
153 | } else { | 152 | } else { |
154 | iwe.u.qual.level = network->stats.rssi; | ||
155 | if (ieee->perfect_rssi == ieee->worst_rssi) | 153 | if (ieee->perfect_rssi == ieee->worst_rssi) |
156 | iwe.u.qual.qual = 100; | 154 | iwe.u.qual.qual = 100; |
157 | else | 155 | else |
@@ -179,6 +177,13 @@ static char *ipw2100_translate_scan(struct ieee80211_device *ieee, | |||
179 | iwe.u.qual.noise = network->stats.noise; | 177 | iwe.u.qual.noise = network->stats.noise; |
180 | } | 178 | } |
181 | 179 | ||
180 | if (!(network->stats.mask & IEEE80211_STATMASK_SIGNAL)) { | ||
181 | iwe.u.qual.updated |= IW_QUAL_LEVEL_INVALID; | ||
182 | iwe.u.qual.level = 0; | ||
183 | } else { | ||
184 | iwe.u.qual.level = network->stats.signal; | ||
185 | } | ||
186 | |||
182 | start = iwe_stream_add_event(start, stop, &iwe, IW_EV_QUAL_LEN); | 187 | start = iwe_stream_add_event(start, stop, &iwe, IW_EV_QUAL_LEN); |
183 | 188 | ||
184 | iwe.cmd = IWEVCUSTOM; | 189 | iwe.cmd = IWEVCUSTOM; |
@@ -229,6 +234,28 @@ static char *ipw2100_translate_scan(struct ieee80211_device *ieee, | |||
229 | if (iwe.u.data.length) | 234 | if (iwe.u.data.length) |
230 | start = iwe_stream_add_point(start, stop, &iwe, custom); | 235 | start = iwe_stream_add_point(start, stop, &iwe, custom); |
231 | 236 | ||
237 | /* Add spectrum management information */ | ||
238 | iwe.cmd = -1; | ||
239 | p = custom; | ||
240 | p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), " Channel flags: "); | ||
241 | |||
242 | if (ieee80211_get_channel_flags(ieee, network->channel) & | ||
243 | IEEE80211_CH_INVALID) { | ||
244 | iwe.cmd = IWEVCUSTOM; | ||
245 | p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), "INVALID "); | ||
246 | } | ||
247 | |||
248 | if (ieee80211_get_channel_flags(ieee, network->channel) & | ||
249 | IEEE80211_CH_RADAR_DETECT) { | ||
250 | iwe.cmd = IWEVCUSTOM; | ||
251 | p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), "DFS "); | ||
252 | } | ||
253 | |||
254 | if (iwe.cmd == IWEVCUSTOM) { | ||
255 | iwe.u.data.length = p - custom; | ||
256 | start = iwe_stream_add_point(start, stop, &iwe, custom); | ||
257 | } | ||
258 | |||
232 | return start; | 259 | return start; |
233 | } | 260 | } |
234 | 261 | ||