diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/etherdevice.h | 2 | ||||
-rw-r--r-- | include/net/ieee80211.h | 50 | ||||
-rw-r--r-- | include/net/ieee80211_crypt.h | 86 |
3 files changed, 97 insertions, 41 deletions
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h index a1478258d002..8a2df4dfbc59 100644 --- a/include/linux/etherdevice.h +++ b/include/linux/etherdevice.h | |||
@@ -65,7 +65,7 @@ static inline int is_zero_ether_addr(const u8 *addr) | |||
65 | */ | 65 | */ |
66 | static inline int is_multicast_ether_addr(const u8 *addr) | 66 | static inline int is_multicast_ether_addr(const u8 *addr) |
67 | { | 67 | { |
68 | return addr[0] & 0x01; | 68 | return ((addr[0] != 0xff) && (0x01 & addr[0])); |
69 | } | 69 | } |
70 | 70 | ||
71 | /** | 71 | /** |
diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h index 7fe57f957a51..065b702df563 100644 --- a/include/net/ieee80211.h +++ b/include/net/ieee80211.h | |||
@@ -20,7 +20,6 @@ | |||
20 | */ | 20 | */ |
21 | #ifndef IEEE80211_H | 21 | #ifndef IEEE80211_H |
22 | #define IEEE80211_H | 22 | #define IEEE80211_H |
23 | |||
24 | #include <linux/if_ether.h> /* ETH_ALEN */ | 23 | #include <linux/if_ether.h> /* ETH_ALEN */ |
25 | #include <linux/kernel.h> /* ARRAY_SIZE */ | 24 | #include <linux/kernel.h> /* ARRAY_SIZE */ |
26 | 25 | ||
@@ -94,6 +93,8 @@ struct eapol { | |||
94 | u16 length; | 93 | u16 length; |
95 | } __attribute__ ((packed)); | 94 | } __attribute__ ((packed)); |
96 | 95 | ||
96 | #define IEEE80211_1ADDR_LEN 10 | ||
97 | #define IEEE80211_2ADDR_LEN 16 | ||
97 | #define IEEE80211_3ADDR_LEN 24 | 98 | #define IEEE80211_3ADDR_LEN 24 |
98 | #define IEEE80211_4ADDR_LEN 30 | 99 | #define IEEE80211_4ADDR_LEN 30 |
99 | #define IEEE80211_FCS_LEN 4 | 100 | #define IEEE80211_FCS_LEN 4 |
@@ -300,23 +301,6 @@ struct ieee80211_snap_hdr { | |||
300 | #define WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH 9 | 301 | #define WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH 9 |
301 | 302 | ||
302 | 303 | ||
303 | /* Information Element IDs */ | ||
304 | #define WLAN_EID_SSID 0 | ||
305 | #define WLAN_EID_SUPP_RATES 1 | ||
306 | #define WLAN_EID_FH_PARAMS 2 | ||
307 | #define WLAN_EID_DS_PARAMS 3 | ||
308 | #define WLAN_EID_CF_PARAMS 4 | ||
309 | #define WLAN_EID_TIM 5 | ||
310 | #define WLAN_EID_IBSS_PARAMS 6 | ||
311 | #define WLAN_EID_CHALLENGE 16 | ||
312 | #define WLAN_EID_RSN 48 | ||
313 | #define WLAN_EID_GENERIC 221 | ||
314 | |||
315 | #define IEEE80211_MGMT_HDR_LEN 24 | ||
316 | #define IEEE80211_DATA_HDR3_LEN 24 | ||
317 | #define IEEE80211_DATA_HDR4_LEN 30 | ||
318 | |||
319 | |||
320 | #define IEEE80211_STATMASK_SIGNAL (1<<0) | 304 | #define IEEE80211_STATMASK_SIGNAL (1<<0) |
321 | #define IEEE80211_STATMASK_RSSI (1<<1) | 305 | #define IEEE80211_STATMASK_RSSI (1<<1) |
322 | #define IEEE80211_STATMASK_NOISE (1<<2) | 306 | #define IEEE80211_STATMASK_NOISE (1<<2) |
@@ -441,6 +425,8 @@ struct ieee80211_stats { | |||
441 | 425 | ||
442 | struct ieee80211_device; | 426 | struct ieee80211_device; |
443 | 427 | ||
428 | #include "ieee80211_crypt.h" | ||
429 | |||
444 | #define SEC_KEY_1 (1<<0) | 430 | #define SEC_KEY_1 (1<<0) |
445 | #define SEC_KEY_2 (1<<1) | 431 | #define SEC_KEY_2 (1<<1) |
446 | #define SEC_KEY_3 (1<<2) | 432 | #define SEC_KEY_3 (1<<2) |
@@ -488,15 +474,6 @@ Total: 28-2340 bytes | |||
488 | 474 | ||
489 | */ | 475 | */ |
490 | 476 | ||
491 | struct ieee80211_header_data { | ||
492 | u16 frame_ctl; | ||
493 | u16 duration_id; | ||
494 | u8 addr1[6]; | ||
495 | u8 addr2[6]; | ||
496 | u8 addr3[6]; | ||
497 | u16 seq_ctrl; | ||
498 | }; | ||
499 | |||
500 | #define BEACON_PROBE_SSID_ID_POSITION 12 | 477 | #define BEACON_PROBE_SSID_ID_POSITION 12 |
501 | 478 | ||
502 | /* Management Frame Information Element Types */ | 479 | /* Management Frame Information Element Types */ |
@@ -541,7 +518,7 @@ struct ieee80211_info_element { | |||
541 | */ | 518 | */ |
542 | 519 | ||
543 | struct ieee80211_authentication { | 520 | struct ieee80211_authentication { |
544 | struct ieee80211_header_data header; | 521 | struct ieee80211_hdr_3addr header; |
545 | u16 algorithm; | 522 | u16 algorithm; |
546 | u16 transaction; | 523 | u16 transaction; |
547 | u16 status; | 524 | u16 status; |
@@ -550,7 +527,7 @@ struct ieee80211_authentication { | |||
550 | 527 | ||
551 | 528 | ||
552 | struct ieee80211_probe_response { | 529 | struct ieee80211_probe_response { |
553 | struct ieee80211_header_data header; | 530 | struct ieee80211_hdr_3addr header; |
554 | u32 time_stamp[2]; | 531 | u32 time_stamp[2]; |
555 | u16 beacon_interval; | 532 | u16 beacon_interval; |
556 | u16 capability; | 533 | u16 capability; |
@@ -648,12 +625,6 @@ enum ieee80211_state { | |||
648 | #define MAC_ARG(x) ((u8*)(x))[0],((u8*)(x))[1],((u8*)(x))[2],((u8*)(x))[3],((u8*)(x))[4],((u8*)(x))[5] | 625 | #define MAC_ARG(x) ((u8*)(x))[0],((u8*)(x))[1],((u8*)(x))[2],((u8*)(x))[3],((u8*)(x))[4],((u8*)(x))[5] |
649 | 626 | ||
650 | 627 | ||
651 | extern inline int is_broadcast_ether_addr(const u8 *addr) | ||
652 | { | ||
653 | return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \ | ||
654 | (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff)); | ||
655 | } | ||
656 | |||
657 | #define CFG_IEEE80211_RESERVE_FCS (1<<0) | 628 | #define CFG_IEEE80211_RESERVE_FCS (1<<0) |
658 | #define CFG_IEEE80211_COMPUTE_FCS (1<<1) | 629 | #define CFG_IEEE80211_COMPUTE_FCS (1<<1) |
659 | 630 | ||
@@ -787,21 +758,21 @@ extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mod | |||
787 | 758 | ||
788 | extern inline int ieee80211_get_hdrlen(u16 fc) | 759 | extern inline int ieee80211_get_hdrlen(u16 fc) |
789 | { | 760 | { |
790 | int hdrlen = 24; | 761 | int hdrlen = IEEE80211_3ADDR_LEN; |
791 | 762 | ||
792 | switch (WLAN_FC_GET_TYPE(fc)) { | 763 | switch (WLAN_FC_GET_TYPE(fc)) { |
793 | case IEEE80211_FTYPE_DATA: | 764 | case IEEE80211_FTYPE_DATA: |
794 | if ((fc & IEEE80211_FCTL_FROMDS) && (fc & IEEE80211_FCTL_TODS)) | 765 | if ((fc & IEEE80211_FCTL_FROMDS) && (fc & IEEE80211_FCTL_TODS)) |
795 | hdrlen = 30; /* Addr4 */ | 766 | hdrlen = IEEE80211_4ADDR_LEN; |
796 | break; | 767 | break; |
797 | case IEEE80211_FTYPE_CTL: | 768 | case IEEE80211_FTYPE_CTL: |
798 | switch (WLAN_FC_GET_STYPE(fc)) { | 769 | switch (WLAN_FC_GET_STYPE(fc)) { |
799 | case IEEE80211_STYPE_CTS: | 770 | case IEEE80211_STYPE_CTS: |
800 | case IEEE80211_STYPE_ACK: | 771 | case IEEE80211_STYPE_ACK: |
801 | hdrlen = 10; | 772 | hdrlen = IEEE80211_1ADDR_LEN; |
802 | break; | 773 | break; |
803 | default: | 774 | default: |
804 | hdrlen = 16; | 775 | hdrlen = IEEE80211_2ADDR_LEN; |
805 | break; | 776 | break; |
806 | } | 777 | } |
807 | break; | 778 | break; |
@@ -878,5 +849,4 @@ static inline const char *escape_essid(const char *essid, u8 essid_len) { | |||
878 | *d = '\0'; | 849 | *d = '\0'; |
879 | return escaped; | 850 | return escaped; |
880 | } | 851 | } |
881 | |||
882 | #endif /* IEEE80211_H */ | 852 | #endif /* IEEE80211_H */ |
diff --git a/include/net/ieee80211_crypt.h b/include/net/ieee80211_crypt.h new file mode 100644 index 000000000000..b58a3bcc0dc0 --- /dev/null +++ b/include/net/ieee80211_crypt.h | |||
@@ -0,0 +1,86 @@ | |||
1 | /* | ||
2 | * Original code based on Host AP (software wireless LAN access point) driver | ||
3 | * for Intersil Prism2/2.5/3. | ||
4 | * | ||
5 | * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen | ||
6 | * <jkmaline@cc.hut.fi> | ||
7 | * Copyright (c) 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi> | ||
8 | * | ||
9 | * Adaption to a generic IEEE 802.11 stack by James Ketrenos | ||
10 | * <jketreno@linux.intel.com> | ||
11 | * | ||
12 | * Copyright (c) 2004, Intel Corporation | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or modify | ||
15 | * it under the terms of the GNU General Public License version 2 as | ||
16 | * published by the Free Software Foundation. See README and COPYING for | ||
17 | * more details. | ||
18 | */ | ||
19 | |||
20 | /* | ||
21 | * This file defines the interface to the ieee80211 crypto module. | ||
22 | */ | ||
23 | #ifndef IEEE80211_CRYPT_H | ||
24 | #define IEEE80211_CRYPT_H | ||
25 | |||
26 | #include <linux/skbuff.h> | ||
27 | |||
28 | struct ieee80211_crypto_ops { | ||
29 | const char *name; | ||
30 | |||
31 | /* init new crypto context (e.g., allocate private data space, | ||
32 | * select IV, etc.); returns NULL on failure or pointer to allocated | ||
33 | * private data on success */ | ||
34 | void * (*init)(int keyidx); | ||
35 | |||
36 | /* deinitialize crypto context and free allocated private data */ | ||
37 | void (*deinit)(void *priv); | ||
38 | |||
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 | ||
41 | * decrypt_msdu. skb must have enough head and tail room for the | ||
42 | * encryption; if not, error will be returned; these functions are | ||
43 | * called for all MPDUs (i.e., fragments). | ||
44 | */ | ||
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); | ||
47 | |||
48 | /* These functions are called for full MSDUs, i.e. full frames. | ||
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); | ||
51 | int (*decrypt_msdu)(struct sk_buff *skb, int keyidx, int hdr_len, | ||
52 | void *priv); | ||
53 | |||
54 | int (*set_key)(void *key, int len, u8 *seq, void *priv); | ||
55 | int (*get_key)(void *key, int len, u8 *seq, void *priv); | ||
56 | |||
57 | /* procfs handler for printing out key information and possible | ||
58 | * statistics */ | ||
59 | char * (*print_stats)(char *p, void *priv); | ||
60 | |||
61 | /* maximum number of bytes added by encryption; encrypt buf is | ||
62 | * allocated with extra_prefix_len bytes, copy of in_buf, and | ||
63 | * extra_postfix_len; encrypt need not use all this space, but | ||
64 | * the result must start at the beginning of the buffer and correct | ||
65 | * length must be returned */ | ||
66 | int extra_prefix_len, extra_postfix_len; | ||
67 | |||
68 | struct module *owner; | ||
69 | }; | ||
70 | |||
71 | struct ieee80211_crypt_data { | ||
72 | struct list_head list; /* delayed deletion list */ | ||
73 | struct ieee80211_crypto_ops *ops; | ||
74 | void *priv; | ||
75 | atomic_t refcnt; | ||
76 | }; | ||
77 | |||
78 | int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops); | ||
79 | int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops); | ||
80 | struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name); | ||
81 | void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int); | ||
82 | void ieee80211_crypt_deinit_handler(unsigned long); | ||
83 | void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee, | ||
84 | struct ieee80211_crypt_data **crypt); | ||
85 | |||
86 | #endif | ||