aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Ketrenos <jketreno@linux.intel.com>2005-09-13 18:35:21 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-09-16 03:06:32 -0400
commit74079fdce472a2b16d502fe39e06b135ef06c69b (patch)
treea2f097836efccc5b4758888bd97599aecd56e37e
parentb1b508e1b13529b3cc5b59c352f49b9b58a302b6 (diff)
[PATCH] ieee80211 Added wireless spy support
Added wireless spy support to Rx code path. Signed-off-by: James Ketrenos <jketreno@linux.intel.com> NOTE: Looks like scripts/Lindent generated output different than the Lindented version already in-kernel, hence all the whitespace deltas... *sigh* Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
-rw-r--r--include/net/ieee80211.h109
-rw-r--r--include/net/ieee80211_crypt.h24
-rw-r--r--net/ieee80211/ieee80211_crypt.c24
-rw-r--r--net/ieee80211/ieee80211_crypt_ccmp.c26
-rw-r--r--net/ieee80211/ieee80211_crypt_tkip.c26
-rw-r--r--net/ieee80211/ieee80211_crypt_wep.c26
-rw-r--r--net/ieee80211/ieee80211_rx.c43
7 files changed, 134 insertions, 144 deletions
diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h
index ce966b7ff563..d8bb8f74ed7b 100644
--- a/include/net/ieee80211.h
+++ b/include/net/ieee80211.h
@@ -20,8 +20,8 @@
20 */ 20 */
21#ifndef IEEE80211_H 21#ifndef IEEE80211_H
22#define IEEE80211_H 22#define IEEE80211_H
23#include <linux/if_ether.h> /* ETH_ALEN */ 23#include <linux/if_ether.h> /* ETH_ALEN */
24#include <linux/kernel.h> /* ARRAY_SIZE */ 24#include <linux/kernel.h> /* ARRAY_SIZE */
25#include <linux/wireless.h> 25#include <linux/wireless.h>
26 26
27#define IEEE80211_DATA_LEN 2304 27#define IEEE80211_DATA_LEN 2304
@@ -33,7 +33,6 @@
33 represents the 2304 bytes of real data, plus a possible 8 bytes of 33 represents the 2304 bytes of real data, plus a possible 8 bytes of
34 WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) */ 34 WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) */
35 35
36
37#define IEEE80211_HLEN 30 36#define IEEE80211_HLEN 30
38#define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN) 37#define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN)
39 38
@@ -117,7 +116,6 @@ struct ieee80211_hdr_3addr {
117#define IEEE80211_SCTL_FRAG 0x000F 116#define IEEE80211_SCTL_FRAG 0x000F
118#define IEEE80211_SCTL_SEQ 0xFFF0 117#define IEEE80211_SCTL_SEQ 0xFFF0
119 118
120
121/* debug macros */ 119/* debug macros */
122 120
123#ifdef CONFIG_IEEE80211_DEBUG 121#ifdef CONFIG_IEEE80211_DEBUG
@@ -128,8 +126,7 @@ do { if (ieee80211_debug_level & (level)) \
128 in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0) 126 in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0)
129#else 127#else
130#define IEEE80211_DEBUG(level, fmt, args...) do {} while (0) 128#define IEEE80211_DEBUG(level, fmt, args...) do {} while (0)
131#endif /* CONFIG_IEEE80211_DEBUG */ 129#endif /* CONFIG_IEEE80211_DEBUG */
132
133 130
134/* debug macros not dependent on CONFIG_IEEE80211_DEBUG */ 131/* debug macros not dependent on CONFIG_IEEE80211_DEBUG */
135 132
@@ -140,7 +137,6 @@ do { if (ieee80211_debug_level & (level)) \
140 * messages. It should never be used for passing essid to user space. */ 137 * messages. It should never be used for passing essid to user space. */
141const char *escape_essid(const char *essid, u8 essid_len); 138const char *escape_essid(const char *essid, u8 essid_len);
142 139
143
144/* 140/*
145 * To use the debug system: 141 * To use the debug system:
146 * 142 *
@@ -192,7 +188,7 @@ const char *escape_essid(const char *essid, u8 essid_len);
192#define IEEE80211_DEBUG_RX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_RX, f, ## a) 188#define IEEE80211_DEBUG_RX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_RX, f, ## a)
193#include <linux/netdevice.h> 189#include <linux/netdevice.h>
194#include <linux/wireless.h> 190#include <linux/wireless.h>
195#include <linux/if_arp.h> /* ARPHRD_ETHER */ 191#include <linux/if_arp.h> /* ARPHRD_ETHER */
196 192
197#ifndef WIRELESS_SPY 193#ifndef WIRELESS_SPY
198#define WIRELESS_SPY /* enable iwspy support */ 194#define WIRELESS_SPY /* enable iwspy support */
@@ -200,10 +196,10 @@ const char *escape_essid(const char *essid, u8 essid_len);
200#include <net/iw_handler.h> /* new driver API */ 196#include <net/iw_handler.h> /* new driver API */
201 197
202#ifndef ETH_P_PAE 198#ifndef ETH_P_PAE
203#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */ 199#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
204#endif /* ETH_P_PAE */ 200#endif /* ETH_P_PAE */
205 201
206#define ETH_P_PREAUTH 0x88C7 /* IEEE 802.11i pre-authentication */ 202#define ETH_P_PREAUTH 0x88C7 /* IEEE 802.11i pre-authentication */
207 203
208#ifndef ETH_P_80211_RAW 204#ifndef ETH_P_80211_RAW
209#define ETH_P_80211_RAW (ETH_P_ECONET + 1) 205#define ETH_P_80211_RAW (ETH_P_ECONET + 1)
@@ -215,10 +211,10 @@ const char *escape_essid(const char *essid, u8 essid_len);
215 211
216struct ieee80211_snap_hdr { 212struct ieee80211_snap_hdr {
217 213
218 u8 dsap; /* always 0xAA */ 214 u8 dsap; /* always 0xAA */
219 u8 ssap; /* always 0xAA */ 215 u8 ssap; /* always 0xAA */
220 u8 ctrl; /* always 0x03 */ 216 u8 ctrl; /* always 0x03 */
221 u8 oui[P80211_OUI_LEN]; /* organizational universal id */ 217 u8 oui[P80211_OUI_LEN]; /* organizational universal id */
222 218
223} __attribute__ ((packed)); 219} __attribute__ ((packed));
224 220
@@ -312,14 +308,12 @@ enum ieee80211_reasoncode {
312 WLAN_REASON_CIPHER_SUITE_REJECTED = 24, 308 WLAN_REASON_CIPHER_SUITE_REJECTED = 24,
313}; 309};
314 310
315
316#define IEEE80211_STATMASK_SIGNAL (1<<0) 311#define IEEE80211_STATMASK_SIGNAL (1<<0)
317#define IEEE80211_STATMASK_RSSI (1<<1) 312#define IEEE80211_STATMASK_RSSI (1<<1)
318#define IEEE80211_STATMASK_NOISE (1<<2) 313#define IEEE80211_STATMASK_NOISE (1<<2)
319#define IEEE80211_STATMASK_RATE (1<<3) 314#define IEEE80211_STATMASK_RATE (1<<3)
320#define IEEE80211_STATMASK_WEMASK 0x7 315#define IEEE80211_STATMASK_WEMASK 0x7
321 316
322
323#define IEEE80211_CCK_MODULATION (1<<0) 317#define IEEE80211_CCK_MODULATION (1<<0)
324#define IEEE80211_OFDM_MODULATION (1<<1) 318#define IEEE80211_OFDM_MODULATION (1<<1)
325 319
@@ -377,9 +371,6 @@ enum ieee80211_reasoncode {
377#define IEEE80211_NUM_CCK_RATES 4 371#define IEEE80211_NUM_CCK_RATES 4
378#define IEEE80211_OFDM_SHIFT_MASK_A 4 372#define IEEE80211_OFDM_SHIFT_MASK_A 4
379 373
380
381
382
383/* NOTE: This data is for statistical purposes; not all hardware provides this 374/* NOTE: This data is for statistical purposes; not all hardware provides this
384 * information for frames received. Not setting these will not cause 375 * information for frames received. Not setting these will not cause
385 * any adverse affects. */ 376 * any adverse affects. */
@@ -388,7 +379,7 @@ struct ieee80211_rx_stats {
388 s8 rssi; 379 s8 rssi;
389 u8 signal; 380 u8 signal;
390 u8 noise; 381 u8 noise;
391 u16 rate; /* in 100 kbps */ 382 u16 rate; /* in 100 kbps */
392 u8 received_channel; 383 u8 received_channel;
393 u8 control; 384 u8 control;
394 u8 mask; 385 u8 mask;
@@ -449,28 +440,24 @@ struct ieee80211_device;
449#define SEC_LEVEL (1<<7) 440#define SEC_LEVEL (1<<7)
450#define SEC_ENABLED (1<<8) 441#define SEC_ENABLED (1<<8)
451 442
452#define SEC_LEVEL_0 0 /* None */ 443#define SEC_LEVEL_0 0 /* None */
453#define SEC_LEVEL_1 1 /* WEP 40 and 104 bit */ 444#define SEC_LEVEL_1 1 /* WEP 40 and 104 bit */
454#define SEC_LEVEL_2 2 /* Level 1 + TKIP */ 445#define SEC_LEVEL_2 2 /* Level 1 + TKIP */
455#define SEC_LEVEL_2_CKIP 3 /* Level 1 + CKIP */ 446#define SEC_LEVEL_2_CKIP 3 /* Level 1 + CKIP */
456#define SEC_LEVEL_3 4 /* Level 2 + CCMP */ 447#define SEC_LEVEL_3 4 /* Level 2 + CCMP */
457 448
458#define WEP_KEYS 4 449#define WEP_KEYS 4
459#define WEP_KEY_LEN 13 450#define WEP_KEY_LEN 13
460 451
461struct ieee80211_security { 452struct ieee80211_security {
462 u16 active_key:2, 453 u16 active_key:2,
463 enabled:1, 454 enabled:1, auth_mode:2, auth_algo:4, unicast_uses_group:1;
464 auth_mode:2,
465 auth_algo:4,
466 unicast_uses_group:1;
467 u8 key_sizes[WEP_KEYS]; 455 u8 key_sizes[WEP_KEYS];
468 u8 keys[WEP_KEYS][WEP_KEY_LEN]; 456 u8 keys[WEP_KEYS][WEP_KEY_LEN];
469 u8 level; 457 u8 level;
470 u16 flags; 458 u16 flags;
471} __attribute__ ((packed)); 459} __attribute__ ((packed));
472 460
473
474/* 461/*
475 462
476 802.11 data frame from AP 463 802.11 data frame from AP
@@ -494,7 +481,7 @@ enum ieee80211_mfie {
494 MFIE_TYPE_RATES = 1, 481 MFIE_TYPE_RATES = 1,
495 MFIE_TYPE_FH_SET = 2, 482 MFIE_TYPE_FH_SET = 2,
496 MFIE_TYPE_DS_SET = 3, 483 MFIE_TYPE_DS_SET = 3,
497 MFIE_TYPE_CF_SET = 4, 484 MFIE_TYPE_CF_SET = 4,
498 MFIE_TYPE_TIM = 5, 485 MFIE_TYPE_TIM = 5,
499 MFIE_TYPE_IBSS_SET = 6, 486 MFIE_TYPE_IBSS_SET = 6,
500 MFIE_TYPE_COUNTRY = 7, 487 MFIE_TYPE_COUNTRY = 7,
@@ -554,7 +541,6 @@ struct ieee80211_authentication {
554 struct ieee80211_info_element info_element; 541 struct ieee80211_info_element info_element;
555} __attribute__ ((packed)); 542} __attribute__ ((packed));
556 543
557
558struct ieee80211_probe_response { 544struct ieee80211_probe_response {
559 struct ieee80211_hdr_3addr header; 545 struct ieee80211_hdr_3addr header;
560 u32 time_stamp[2]; 546 u32 time_stamp[2];
@@ -575,10 +561,9 @@ struct ieee80211_assoc_response_frame {
575 __le16 capability; 561 __le16 capability;
576 __le16 status; 562 __le16 status;
577 __le16 aid; 563 __le16 aid;
578 struct ieee80211_info_element info_element; /* supported rates */ 564 struct ieee80211_info_element info_element; /* supported rates */
579} __attribute__ ((packed)); 565} __attribute__ ((packed));
580 566
581
582struct ieee80211_txb { 567struct ieee80211_txb {
583 u8 nr_frags; 568 u8 nr_frags;
584 u8 encrypted; 569 u8 encrypted;
@@ -588,7 +573,6 @@ struct ieee80211_txb {
588 struct sk_buff *fragments[0]; 573 struct sk_buff *fragments[0];
589}; 574};
590 575
591
592/* SWEEP TABLE ENTRIES NUMBER */ 576/* SWEEP TABLE ENTRIES NUMBER */
593#define MAX_SWEEP_TAB_ENTRIES 42 577#define MAX_SWEEP_TAB_ENTRIES 42
594#define MAX_SWEEP_TAB_ENTRIES_PER_PACKET 7 578#define MAX_SWEEP_TAB_ENTRIES_PER_PACKET 7
@@ -651,7 +635,6 @@ enum ieee80211_state {
651#define DEFAULT_MAX_SCAN_AGE (15 * HZ) 635#define DEFAULT_MAX_SCAN_AGE (15 * HZ)
652#define DEFAULT_FTS 2346 636#define DEFAULT_FTS 2346
653 637
654
655#define CFG_IEEE80211_RESERVE_FCS (1<<0) 638#define CFG_IEEE80211_RESERVE_FCS (1<<0)
656#define CFG_IEEE80211_COMPUTE_FCS (1<<1) 639#define CFG_IEEE80211_COMPUTE_FCS (1<<1)
657 640
@@ -669,24 +652,25 @@ struct ieee80211_device {
669 int scans; 652 int scans;
670 int scan_age; 653 int scan_age;
671 654
672 int iw_mode; /* operating mode (IW_MODE_*) */ 655 int iw_mode; /* operating mode (IW_MODE_*) */
656 struct iw_spy_data spy_data; /* iwspy support */
673 657
674 spinlock_t lock; 658 spinlock_t lock;
675 659
676 int tx_headroom; /* Set to size of any additional room needed at front 660 int tx_headroom; /* Set to size of any additional room needed at front
677 * of allocated Tx SKBs */ 661 * of allocated Tx SKBs */
678 u32 config; 662 u32 config;
679 663
680 /* WEP and other encryption related settings at the device level */ 664 /* WEP and other encryption related settings at the device level */
681 int open_wep; /* Set to 1 to allow unencrypted frames */ 665 int open_wep; /* Set to 1 to allow unencrypted frames */
682 666
683 int reset_on_keychange; /* Set to 1 if the HW needs to be reset on 667 int reset_on_keychange; /* Set to 1 if the HW needs to be reset on
684 * WEP key changes */ 668 * WEP key changes */
685 669
686 /* If the host performs {en,de}cryption, then set to 1 */ 670 /* If the host performs {en,de}cryption, then set to 1 */
687 int host_encrypt; 671 int host_encrypt;
688 int host_decrypt; 672 int host_decrypt;
689 int ieee802_1x; /* is IEEE 802.1X used */ 673 int ieee802_1x; /* is IEEE 802.1X used */
690 674
691 /* WPA data */ 675 /* WPA data */
692 int wpa_enabled; 676 int wpa_enabled;
@@ -698,36 +682,36 @@ struct ieee80211_device {
698 682
699 struct list_head crypt_deinit_list; 683 struct list_head crypt_deinit_list;
700 struct ieee80211_crypt_data *crypt[WEP_KEYS]; 684 struct ieee80211_crypt_data *crypt[WEP_KEYS];
701 int tx_keyidx; /* default TX key index (crypt[tx_keyidx]) */ 685 int tx_keyidx; /* default TX key index (crypt[tx_keyidx]) */
702 struct timer_list crypt_deinit_timer; 686 struct timer_list crypt_deinit_timer;
703 687
704 int bcrx_sta_key; /* use individual keys to override default keys even 688 int bcrx_sta_key; /* use individual keys to override default keys even
705 * with RX of broad/multicast frames */ 689 * with RX of broad/multicast frames */
706 690
707 /* Fragmentation structures */ 691 /* Fragmentation structures */
708 struct ieee80211_frag_entry frag_cache[IEEE80211_FRAG_CACHE_LEN]; 692 struct ieee80211_frag_entry frag_cache[IEEE80211_FRAG_CACHE_LEN];
709 unsigned int frag_next_idx; 693 unsigned int frag_next_idx;
710 u16 fts; /* Fragmentation Threshold */ 694 u16 fts; /* Fragmentation Threshold */
711 695
712 /* Association info */ 696 /* Association info */
713 u8 bssid[ETH_ALEN]; 697 u8 bssid[ETH_ALEN];
714 698
715 enum ieee80211_state state; 699 enum ieee80211_state state;
716 700
717 int mode; /* A, B, G */ 701 int mode; /* A, B, G */
718 int modulation; /* CCK, OFDM */ 702 int modulation; /* CCK, OFDM */
719 int freq_band; /* 2.4Ghz, 5.2Ghz, Mixed */ 703 int freq_band; /* 2.4Ghz, 5.2Ghz, Mixed */
720 int abg_ture; /* ABG flag */ 704 int abg_ture; /* ABG flag */
721 705
722 int perfect_rssi; 706 int perfect_rssi;
723 int worst_rssi; 707 int worst_rssi;
724 708
725 /* Callback functions */ 709 /* Callback functions */
726 void (*set_security)(struct net_device *dev, 710 void (*set_security) (struct net_device * dev,
727 struct ieee80211_security *sec); 711 struct ieee80211_security * sec);
728 int (*hard_start_xmit)(struct ieee80211_txb *txb, 712 int (*hard_start_xmit) (struct ieee80211_txb * txb,
729 struct net_device *dev); 713 struct net_device * dev);
730 int (*reset_port)(struct net_device *dev); 714 int (*reset_port) (struct net_device * dev);
731 715
732 /* This must be the last item so that it points to the data 716 /* This must be the last item so that it points to the data
733 * allocated beyond this structure by alloc_ieee80211 */ 717 * allocated beyond this structure by alloc_ieee80211 */
@@ -760,7 +744,8 @@ extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
760 return 1; 744 return 1;
761} 745}
762 746
763extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode) 747extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee,
748 int mode)
764{ 749{
765 /* 750 /*
766 * It is possible for both access points and our device to support 751 * It is possible for both access points and our device to support
@@ -811,8 +796,6 @@ extern inline int ieee80211_get_hdrlen(u16 fc)
811 return hdrlen; 796 return hdrlen;
812} 797}
813 798
814
815
816/* ieee80211.c */ 799/* ieee80211.c */
817extern void free_ieee80211(struct net_device *dev); 800extern void free_ieee80211(struct net_device *dev);
818extern struct net_device *alloc_ieee80211(int sizeof_priv); 801extern struct net_device *alloc_ieee80211(int sizeof_priv);
@@ -820,11 +803,9 @@ extern struct net_device *alloc_ieee80211(int sizeof_priv);
820extern int ieee80211_set_encryption(struct ieee80211_device *ieee); 803extern int ieee80211_set_encryption(struct ieee80211_device *ieee);
821 804
822/* ieee80211_tx.c */ 805/* ieee80211_tx.c */
823extern int ieee80211_xmit(struct sk_buff *skb, 806extern int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev);
824 struct net_device *dev);
825extern void ieee80211_txb_free(struct ieee80211_txb *); 807extern void ieee80211_txb_free(struct ieee80211_txb *);
826 808
827
828/* ieee80211_rx.c */ 809/* ieee80211_rx.c */
829extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, 810extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
830 struct ieee80211_rx_stats *rx_stats); 811 struct ieee80211_rx_stats *rx_stats);
@@ -843,7 +824,6 @@ extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
843 struct iw_request_info *info, 824 struct iw_request_info *info,
844 union iwreq_data *wrqu, char *key); 825 union iwreq_data *wrqu, char *key);
845 826
846
847extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee) 827extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee)
848{ 828{
849 ieee->scans++; 829 ieee->scans++;
@@ -854,5 +834,4 @@ extern inline int ieee80211_get_scans(struct ieee80211_device *ieee)
854 return ieee->scans; 834 return ieee->scans;
855} 835}
856 836
857 837#endif /* IEEE80211_H */
858#endif /* IEEE80211_H */
diff --git a/include/net/ieee80211_crypt.h b/include/net/ieee80211_crypt.h
index b58a3bcc0dc0..93bf91fda82e 100644
--- a/include/net/ieee80211_crypt.h
+++ b/include/net/ieee80211_crypt.h
@@ -31,10 +31,10 @@ struct ieee80211_crypto_ops {
31 /* init new crypto context (e.g., allocate private data space, 31 /* init new crypto context (e.g., allocate private data space,
32 * select IV, etc.); returns NULL on failure or pointer to allocated 32 * select IV, etc.); returns NULL on failure or pointer to allocated
33 * private data on success */ 33 * private data on success */
34 void * (*init)(int keyidx); 34 void *(*init) (int keyidx);
35 35
36 /* deinitialize crypto context and free allocated private data */ 36 /* deinitialize crypto context and free allocated private data */
37 void (*deinit)(void *priv); 37 void (*deinit) (void *priv);
38 38
39 /* encrypt/decrypt return < 0 on error or >= 0 on success. The return 39 /* encrypt/decrypt return < 0 on error or >= 0 on success. The return
40 * value from decrypt_mpdu is passed as the keyidx value for 40 * value from decrypt_mpdu is passed as the keyidx value for
@@ -42,21 +42,21 @@ struct ieee80211_crypto_ops {
42 * encryption; if not, error will be returned; these functions are 42 * encryption; if not, error will be returned; these functions are
43 * called for all MPDUs (i.e., fragments). 43 * called for all MPDUs (i.e., fragments).
44 */ 44 */
45 int (*encrypt_mpdu)(struct sk_buff *skb, int hdr_len, void *priv); 45 int (*encrypt_mpdu) (struct sk_buff * skb, int hdr_len, void *priv);
46 int (*decrypt_mpdu)(struct sk_buff *skb, int hdr_len, void *priv); 46 int (*decrypt_mpdu) (struct sk_buff * skb, int hdr_len, void *priv);
47 47
48 /* These functions are called for full MSDUs, i.e. full frames. 48 /* These functions are called for full MSDUs, i.e. full frames.
49 * These can be NULL if full MSDU operations are not needed. */ 49 * These can be NULL if full MSDU operations are not needed. */
50 int (*encrypt_msdu)(struct sk_buff *skb, int hdr_len, void *priv); 50 int (*encrypt_msdu) (struct sk_buff * skb, int hdr_len, void *priv);
51 int (*decrypt_msdu)(struct sk_buff *skb, int keyidx, int hdr_len, 51 int (*decrypt_msdu) (struct sk_buff * skb, int keyidx, int hdr_len,
52 void *priv); 52 void *priv);
53 53
54 int (*set_key)(void *key, int len, u8 *seq, void *priv); 54 int (*set_key) (void *key, int len, u8 * seq, void *priv);
55 int (*get_key)(void *key, int len, u8 *seq, void *priv); 55 int (*get_key) (void *key, int len, u8 * seq, void *priv);
56 56
57 /* procfs handler for printing out key information and possible 57 /* procfs handler for printing out key information and possible
58 * statistics */ 58 * statistics */
59 char * (*print_stats)(char *p, void *priv); 59 char *(*print_stats) (char *p, void *priv);
60 60
61 /* maximum number of bytes added by encryption; encrypt buf is 61 /* maximum number of bytes added by encryption; encrypt buf is
62 * allocated with extra_prefix_len bytes, copy of in_buf, and 62 * allocated with extra_prefix_len bytes, copy of in_buf, and
@@ -69,7 +69,7 @@ struct ieee80211_crypto_ops {
69}; 69};
70 70
71struct ieee80211_crypt_data { 71struct ieee80211_crypt_data {
72 struct list_head list; /* delayed deletion list */ 72 struct list_head list; /* delayed deletion list */
73 struct ieee80211_crypto_ops *ops; 73 struct ieee80211_crypto_ops *ops;
74 void *priv; 74 void *priv;
75 atomic_t refcnt; 75 atomic_t refcnt;
@@ -77,7 +77,7 @@ struct ieee80211_crypt_data {
77 77
78int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops); 78int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops);
79int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops); 79int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops);
80struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name); 80struct ieee80211_crypto_ops *ieee80211_get_crypto_ops(const char *name);
81void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int); 81void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int);
82void ieee80211_crypt_deinit_handler(unsigned long); 82void ieee80211_crypt_deinit_handler(unsigned long);
83void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee, 83void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
diff --git a/net/ieee80211/ieee80211_crypt.c b/net/ieee80211/ieee80211_crypt.c
index 61a9d92e455b..dc835f68edd3 100644
--- a/net/ieee80211/ieee80211_crypt.c
+++ b/net/ieee80211/ieee80211_crypt.c
@@ -191,18 +191,18 @@ static void ieee80211_crypt_null_deinit(void *priv)
191} 191}
192 192
193static struct ieee80211_crypto_ops ieee80211_crypt_null = { 193static struct ieee80211_crypto_ops ieee80211_crypt_null = {
194 .name = "NULL", 194 .name = "NULL",
195 .init = ieee80211_crypt_null_init, 195 .init = ieee80211_crypt_null_init,
196 .deinit = ieee80211_crypt_null_deinit, 196 .deinit = ieee80211_crypt_null_deinit,
197 .encrypt_mpdu = NULL, 197 .encrypt_mpdu = NULL,
198 .decrypt_mpdu = NULL, 198 .decrypt_mpdu = NULL,
199 .encrypt_msdu = NULL, 199 .encrypt_msdu = NULL,
200 .decrypt_msdu = NULL, 200 .decrypt_msdu = NULL,
201 .set_key = NULL, 201 .set_key = NULL,
202 .get_key = NULL, 202 .get_key = NULL,
203 .extra_prefix_len = 0, 203 .extra_prefix_len = 0,
204 .extra_postfix_len = 0, 204 .extra_postfix_len = 0,
205 .owner = THIS_MODULE, 205 .owner = THIS_MODULE,
206}; 206};
207 207
208static int __init ieee80211_crypto_init(void) 208static int __init ieee80211_crypto_init(void)
diff --git a/net/ieee80211/ieee80211_crypt_ccmp.c b/net/ieee80211/ieee80211_crypt_ccmp.c
index 8fc13f45971e..7b6290885e7d 100644
--- a/net/ieee80211/ieee80211_crypt_ccmp.c
+++ b/net/ieee80211/ieee80211_crypt_ccmp.c
@@ -426,19 +426,19 @@ static char *ieee80211_ccmp_print_stats(char *p, void *priv)
426} 426}
427 427
428static struct ieee80211_crypto_ops ieee80211_crypt_ccmp = { 428static struct ieee80211_crypto_ops ieee80211_crypt_ccmp = {
429 .name = "CCMP", 429 .name = "CCMP",
430 .init = ieee80211_ccmp_init, 430 .init = ieee80211_ccmp_init,
431 .deinit = ieee80211_ccmp_deinit, 431 .deinit = ieee80211_ccmp_deinit,
432 .encrypt_mpdu = ieee80211_ccmp_encrypt, 432 .encrypt_mpdu = ieee80211_ccmp_encrypt,
433 .decrypt_mpdu = ieee80211_ccmp_decrypt, 433 .decrypt_mpdu = ieee80211_ccmp_decrypt,
434 .encrypt_msdu = NULL, 434 .encrypt_msdu = NULL,
435 .decrypt_msdu = NULL, 435 .decrypt_msdu = NULL,
436 .set_key = ieee80211_ccmp_set_key, 436 .set_key = ieee80211_ccmp_set_key,
437 .get_key = ieee80211_ccmp_get_key, 437 .get_key = ieee80211_ccmp_get_key,
438 .print_stats = ieee80211_ccmp_print_stats, 438 .print_stats = ieee80211_ccmp_print_stats,
439 .extra_prefix_len = CCMP_HDR_LEN, 439 .extra_prefix_len = CCMP_HDR_LEN,
440 .extra_postfix_len = CCMP_MIC_LEN, 440 .extra_postfix_len = CCMP_MIC_LEN,
441 .owner = THIS_MODULE, 441 .owner = THIS_MODULE,
442}; 442};
443 443
444static int __init ieee80211_crypto_ccmp_init(void) 444static int __init ieee80211_crypto_ccmp_init(void)
diff --git a/net/ieee80211/ieee80211_crypt_tkip.c b/net/ieee80211/ieee80211_crypt_tkip.c
index d4f9164be1a1..dca380e57454 100644
--- a/net/ieee80211/ieee80211_crypt_tkip.c
+++ b/net/ieee80211/ieee80211_crypt_tkip.c
@@ -654,19 +654,19 @@ static char *ieee80211_tkip_print_stats(char *p, void *priv)
654} 654}
655 655
656static struct ieee80211_crypto_ops ieee80211_crypt_tkip = { 656static struct ieee80211_crypto_ops ieee80211_crypt_tkip = {
657 .name = "TKIP", 657 .name = "TKIP",
658 .init = ieee80211_tkip_init, 658 .init = ieee80211_tkip_init,
659 .deinit = ieee80211_tkip_deinit, 659 .deinit = ieee80211_tkip_deinit,
660 .encrypt_mpdu = ieee80211_tkip_encrypt, 660 .encrypt_mpdu = ieee80211_tkip_encrypt,
661 .decrypt_mpdu = ieee80211_tkip_decrypt, 661 .decrypt_mpdu = ieee80211_tkip_decrypt,
662 .encrypt_msdu = ieee80211_michael_mic_add, 662 .encrypt_msdu = ieee80211_michael_mic_add,
663 .decrypt_msdu = ieee80211_michael_mic_verify, 663 .decrypt_msdu = ieee80211_michael_mic_verify,
664 .set_key = ieee80211_tkip_set_key, 664 .set_key = ieee80211_tkip_set_key,
665 .get_key = ieee80211_tkip_get_key, 665 .get_key = ieee80211_tkip_get_key,
666 .print_stats = ieee80211_tkip_print_stats, 666 .print_stats = ieee80211_tkip_print_stats,
667 .extra_prefix_len = 4 + 4, /* IV + ExtIV */ 667 .extra_prefix_len = 4 + 4, /* IV + ExtIV */
668 .extra_postfix_len = 8 + 4, /* MIC + ICV */ 668 .extra_postfix_len = 8 + 4, /* MIC + ICV */
669 .owner = THIS_MODULE, 669 .owner = THIS_MODULE,
670}; 670};
671 671
672static int __init ieee80211_crypto_tkip_init(void) 672static int __init ieee80211_crypto_tkip_init(void)
diff --git a/net/ieee80211/ieee80211_crypt_wep.c b/net/ieee80211/ieee80211_crypt_wep.c
index b4d2514a0902..ebe16155e792 100644
--- a/net/ieee80211/ieee80211_crypt_wep.c
+++ b/net/ieee80211/ieee80211_crypt_wep.c
@@ -229,19 +229,19 @@ static char *prism2_wep_print_stats(char *p, void *priv)
229} 229}
230 230
231static struct ieee80211_crypto_ops ieee80211_crypt_wep = { 231static struct ieee80211_crypto_ops ieee80211_crypt_wep = {
232 .name = "WEP", 232 .name = "WEP",
233 .init = prism2_wep_init, 233 .init = prism2_wep_init,
234 .deinit = prism2_wep_deinit, 234 .deinit = prism2_wep_deinit,
235 .encrypt_mpdu = prism2_wep_encrypt, 235 .encrypt_mpdu = prism2_wep_encrypt,
236 .decrypt_mpdu = prism2_wep_decrypt, 236 .decrypt_mpdu = prism2_wep_decrypt,
237 .encrypt_msdu = NULL, 237 .encrypt_msdu = NULL,
238 .decrypt_msdu = NULL, 238 .decrypt_msdu = NULL,
239 .set_key = prism2_wep_set_key, 239 .set_key = prism2_wep_set_key,
240 .get_key = prism2_wep_get_key, 240 .get_key = prism2_wep_get_key,
241 .print_stats = prism2_wep_print_stats, 241 .print_stats = prism2_wep_print_stats,
242 .extra_prefix_len = 4, /* IV */ 242 .extra_prefix_len = 4, /* IV */
243 .extra_postfix_len = 4, /* ICV */ 243 .extra_postfix_len = 4, /* ICV */
244 .owner = THIS_MODULE, 244 .owner = THIS_MODULE,
245}; 245};
246 246
247static int __init ieee80211_crypto_wep_init(void) 247static int __init ieee80211_crypto_wep_init(void)
diff --git a/net/ieee80211/ieee80211_rx.c b/net/ieee80211/ieee80211_rx.c
index 74c4ed77cfd9..6bbaa44a0d03 100644
--- a/net/ieee80211/ieee80211_rx.c
+++ b/net/ieee80211/ieee80211_rx.c
@@ -378,33 +378,47 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
378 frag = WLAN_GET_SEQ_FRAG(sc); 378 frag = WLAN_GET_SEQ_FRAG(sc);
379 hdrlen = ieee80211_get_hdrlen(fc); 379 hdrlen = ieee80211_get_hdrlen(fc);
380 380
381#ifdef NOT_YET
382#if WIRELESS_EXT > 15
383 /* Put this code here so that we avoid duplicating it in all 381 /* Put this code here so that we avoid duplicating it in all
384 * Rx paths. - Jean II */ 382 * Rx paths. - Jean II */
385#ifdef IW_WIRELESS_SPY /* defined in iw_handler.h */ 383#ifdef IW_WIRELESS_SPY /* defined in iw_handler.h */
386 /* If spy monitoring on */ 384 /* If spy monitoring on */
387 if (iface->spy_data.spy_number > 0) { 385 if (ieee->spy_data.spy_number > 0) {
388 struct iw_quality wstats; 386 struct iw_quality wstats;
389 wstats.level = rx_stats->signal; 387
390 wstats.noise = rx_stats->noise; 388 wstats.updated = 0;
391 wstats.updated = 6; /* No qual value */ 389 if (rx_stats->mask & IEEE80211_STATMASK_RSSI) {
390 wstats.level = rx_stats->rssi;
391 wstats.updated |= IW_QUAL_LEVEL_UPDATED;
392 } else
393 wstats.updated |= IW_QUAL_LEVEL_INVALID;
394
395 if (rx_stats->mask & IEEE80211_STATMASK_NOISE) {
396 wstats.noise = rx_stats->noise;
397 wstats.updated |= IW_QUAL_NOISE_UPDATED;
398 } else
399 wstats.updated |= IW_QUAL_NOISE_INVALID;
400
401 if (rx_stats->mask & IEEE80211_STATMASK_SIGNAL) {
402 wstats.qual = rx_stats->signal;
403 wstats.updated |= IW_QUAL_QUAL_UPDATED;
404 } else
405 wstats.updated |= IW_QUAL_QUAL_INVALID;
406
392 /* Update spy records */ 407 /* Update spy records */
393 wireless_spy_update(dev, hdr->addr2, &wstats); 408 wireless_spy_update(ieee->dev, hdr->addr2, &wstats);
394 } 409 }
395#endif /* IW_WIRELESS_SPY */ 410#endif /* IW_WIRELESS_SPY */
396#endif /* WIRELESS_EXT > 15 */ 411
412#ifdef NOT_YET
397 hostap_update_rx_stats(local->ap, hdr, rx_stats); 413 hostap_update_rx_stats(local->ap, hdr, rx_stats);
398#endif 414#endif
399 415
400#if WIRELESS_EXT > 15
401 if (ieee->iw_mode == IW_MODE_MONITOR) { 416 if (ieee->iw_mode == IW_MODE_MONITOR) {
402 ieee80211_monitor_rx(ieee, skb, rx_stats); 417 ieee80211_monitor_rx(ieee, skb, rx_stats);
403 stats->rx_packets++; 418 stats->rx_packets++;
404 stats->rx_bytes += skb->len; 419 stats->rx_bytes += skb->len;
405 return 1; 420 return 1;
406 } 421 }
407#endif
408 422
409 if (ieee->host_decrypt) { 423 if (ieee->host_decrypt) {
410 int idx = 0; 424 int idx = 0;
@@ -771,8 +785,7 @@ static inline int ieee80211_is_ofdm_rate(u8 rate)
771 return 0; 785 return 0;
772} 786}
773 787
774static inline int ieee80211_network_init(struct ieee80211_device *ieee, 788static inline int ieee80211_network_init(struct ieee80211_device *ieee, struct ieee80211_probe_response
775 struct ieee80211_probe_response
776 *beacon, 789 *beacon,
777 struct ieee80211_network *network, 790 struct ieee80211_network *network,
778 struct ieee80211_rx_stats *stats) 791 struct ieee80211_rx_stats *stats)
@@ -1028,11 +1041,9 @@ static inline void update_network(struct ieee80211_network *dst,
1028} 1041}
1029 1042
1030static inline void ieee80211_process_probe_response(struct ieee80211_device 1043static inline void ieee80211_process_probe_response(struct ieee80211_device
1031 *ieee, 1044 *ieee, struct
1032 struct
1033 ieee80211_probe_response 1045 ieee80211_probe_response
1034 *beacon, 1046 *beacon, struct ieee80211_rx_stats
1035 struct ieee80211_rx_stats
1036 *stats) 1047 *stats)
1037{ 1048{
1038 struct ieee80211_network network; 1049 struct ieee80211_network network;