diff options
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/ieee80211.h | 265 | ||||
-rw-r--r-- | include/net/ieee80211_crypt.h | 86 |
2 files changed, 218 insertions, 133 deletions
diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h index db09580ad14b..dc36b1be6745 100644 --- a/include/net/ieee80211.h +++ b/include/net/ieee80211.h | |||
@@ -20,18 +20,9 @@ | |||
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 | #include <linux/wireless.h> | |
27 | #if WIRELESS_EXT < 17 | ||
28 | #define IW_QUAL_QUAL_INVALID 0x10 | ||
29 | #define IW_QUAL_LEVEL_INVALID 0x20 | ||
30 | #define IW_QUAL_NOISE_INVALID 0x40 | ||
31 | #define IW_QUAL_QUAL_UPDATED 0x1 | ||
32 | #define IW_QUAL_LEVEL_UPDATED 0x2 | ||
33 | #define IW_QUAL_NOISE_UPDATED 0x4 | ||
34 | #endif | ||
35 | 26 | ||
36 | #define IEEE80211_DATA_LEN 2304 | 27 | #define IEEE80211_DATA_LEN 2304 |
37 | /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section | 28 | /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section |
@@ -47,51 +38,22 @@ | |||
47 | #define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN) | 38 | #define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN) |
48 | 39 | ||
49 | struct ieee80211_hdr { | 40 | struct ieee80211_hdr { |
50 | u16 frame_ctl; | 41 | __le16 frame_ctl; |
51 | u16 duration_id; | 42 | __le16 duration_id; |
52 | u8 addr1[ETH_ALEN]; | 43 | u8 addr1[ETH_ALEN]; |
53 | u8 addr2[ETH_ALEN]; | 44 | u8 addr2[ETH_ALEN]; |
54 | u8 addr3[ETH_ALEN]; | 45 | u8 addr3[ETH_ALEN]; |
55 | u16 seq_ctl; | 46 | __le16 seq_ctl; |
56 | u8 addr4[ETH_ALEN]; | 47 | u8 addr4[ETH_ALEN]; |
57 | } __attribute__ ((packed)); | 48 | } __attribute__ ((packed)); |
58 | 49 | ||
59 | struct ieee80211_hdr_3addr { | 50 | struct ieee80211_hdr_3addr { |
60 | u16 frame_ctl; | 51 | __le16 frame_ctl; |
61 | u16 duration_id; | 52 | __le16 duration_id; |
62 | u8 addr1[ETH_ALEN]; | 53 | u8 addr1[ETH_ALEN]; |
63 | u8 addr2[ETH_ALEN]; | 54 | u8 addr2[ETH_ALEN]; |
64 | u8 addr3[ETH_ALEN]; | 55 | u8 addr3[ETH_ALEN]; |
65 | u16 seq_ctl; | 56 | __le16 seq_ctl; |
66 | } __attribute__ ((packed)); | ||
67 | |||
68 | enum eap_type { | ||
69 | EAP_PACKET = 0, | ||
70 | EAPOL_START, | ||
71 | EAPOL_LOGOFF, | ||
72 | EAPOL_KEY, | ||
73 | EAPOL_ENCAP_ASF_ALERT | ||
74 | }; | ||
75 | |||
76 | static const char *eap_types[] = { | ||
77 | [EAP_PACKET] = "EAP-Packet", | ||
78 | [EAPOL_START] = "EAPOL-Start", | ||
79 | [EAPOL_LOGOFF] = "EAPOL-Logoff", | ||
80 | [EAPOL_KEY] = "EAPOL-Key", | ||
81 | [EAPOL_ENCAP_ASF_ALERT] = "EAPOL-Encap-ASF-Alert" | ||
82 | }; | ||
83 | |||
84 | static inline const char *eap_get_type(int type) | ||
85 | { | ||
86 | return (type >= ARRAY_SIZE(eap_types)) ? "Unknown" : eap_types[type]; | ||
87 | } | ||
88 | |||
89 | struct eapol { | ||
90 | u8 snap[6]; | ||
91 | u16 ethertype; | ||
92 | u8 version; | ||
93 | u8 type; | ||
94 | u16 length; | ||
95 | } __attribute__ ((packed)); | 57 | } __attribute__ ((packed)); |
96 | 58 | ||
97 | #define IEEE80211_1ADDR_LEN 10 | 59 | #define IEEE80211_1ADDR_LEN 10 |
@@ -104,7 +66,7 @@ struct eapol { | |||
104 | #define MAX_FRAG_THRESHOLD 2346U | 66 | #define MAX_FRAG_THRESHOLD 2346U |
105 | 67 | ||
106 | /* Frame control field constants */ | 68 | /* Frame control field constants */ |
107 | #define IEEE80211_FCTL_VERS 0x0002 | 69 | #define IEEE80211_FCTL_VERS 0x0003 |
108 | #define IEEE80211_FCTL_FTYPE 0x000c | 70 | #define IEEE80211_FCTL_FTYPE 0x000c |
109 | #define IEEE80211_FCTL_STYPE 0x00f0 | 71 | #define IEEE80211_FCTL_STYPE 0x00f0 |
110 | #define IEEE80211_FCTL_TODS 0x0100 | 72 | #define IEEE80211_FCTL_TODS 0x0100 |
@@ -112,8 +74,8 @@ struct eapol { | |||
112 | #define IEEE80211_FCTL_MOREFRAGS 0x0400 | 74 | #define IEEE80211_FCTL_MOREFRAGS 0x0400 |
113 | #define IEEE80211_FCTL_RETRY 0x0800 | 75 | #define IEEE80211_FCTL_RETRY 0x0800 |
114 | #define IEEE80211_FCTL_PM 0x1000 | 76 | #define IEEE80211_FCTL_PM 0x1000 |
115 | #define IEEE80211_FCTL_MOREDATA 0x2000 | 77 | #define IEEE80211_FCTL_MOREDATA 0x2000 |
116 | #define IEEE80211_FCTL_WEP 0x4000 | 78 | #define IEEE80211_FCTL_PROTECTED 0x4000 |
117 | #define IEEE80211_FCTL_ORDER 0x8000 | 79 | #define IEEE80211_FCTL_ORDER 0x8000 |
118 | 80 | ||
119 | #define IEEE80211_FTYPE_MGMT 0x0000 | 81 | #define IEEE80211_FTYPE_MGMT 0x0000 |
@@ -132,6 +94,7 @@ struct eapol { | |||
132 | #define IEEE80211_STYPE_DISASSOC 0x00A0 | 94 | #define IEEE80211_STYPE_DISASSOC 0x00A0 |
133 | #define IEEE80211_STYPE_AUTH 0x00B0 | 95 | #define IEEE80211_STYPE_AUTH 0x00B0 |
134 | #define IEEE80211_STYPE_DEAUTH 0x00C0 | 96 | #define IEEE80211_STYPE_DEAUTH 0x00C0 |
97 | #define IEEE80211_STYPE_ACTION 0x00D0 | ||
135 | 98 | ||
136 | /* control */ | 99 | /* control */ |
137 | #define IEEE80211_STYPE_PSPOLL 0x00A0 | 100 | #define IEEE80211_STYPE_PSPOLL 0x00A0 |
@@ -167,8 +130,19 @@ do { if (ieee80211_debug_level & (level)) \ | |||
167 | #define IEEE80211_DEBUG(level, fmt, args...) do {} while (0) | 130 | #define IEEE80211_DEBUG(level, fmt, args...) do {} while (0) |
168 | #endif /* CONFIG_IEEE80211_DEBUG */ | 131 | #endif /* CONFIG_IEEE80211_DEBUG */ |
169 | 132 | ||
133 | |||
134 | /* debug macros not dependent on CONFIG_IEEE80211_DEBUG */ | ||
135 | |||
136 | #define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x" | ||
137 | #define MAC_ARG(x) ((u8*)(x))[0],((u8*)(x))[1],((u8*)(x))[2],((u8*)(x))[3],((u8*)(x))[4],((u8*)(x))[5] | ||
138 | |||
139 | /* escape_essid() is intended to be used in debug (and possibly error) | ||
140 | * messages. It should never be used for passing essid to user space. */ | ||
141 | const char *escape_essid(const char *essid, u8 essid_len); | ||
142 | |||
143 | |||
170 | /* | 144 | /* |
171 | * To use the debug system; | 145 | * To use the debug system: |
172 | * | 146 | * |
173 | * If you are defining a new debug classification, simply add it to the #define | 147 | * If you are defining a new debug classification, simply add it to the #define |
174 | * list here in the form of: | 148 | * list here in the form of: |
@@ -184,11 +158,11 @@ do { if (ieee80211_debug_level & (level)) \ | |||
184 | * | 158 | * |
185 | * To add your debug level to the list of levels seen when you perform | 159 | * To add your debug level to the list of levels seen when you perform |
186 | * | 160 | * |
187 | * % cat /proc/net/ipw/debug_level | 161 | * % cat /proc/net/ieee80211/debug_level |
188 | * | 162 | * |
189 | * you simply need to add your entry to the ipw_debug_levels array. | 163 | * you simply need to add your entry to the ieee80211_debug_level array. |
190 | * | 164 | * |
191 | * If you do not see debug_level in /proc/net/ipw then you do not have | 165 | * If you do not see debug_level in /proc/net/ieee80211 then you do not have |
192 | * CONFIG_IEEE80211_DEBUG defined in your kernel configuration | 166 | * CONFIG_IEEE80211_DEBUG defined in your kernel configuration |
193 | * | 167 | * |
194 | */ | 168 | */ |
@@ -199,7 +173,6 @@ do { if (ieee80211_debug_level & (level)) \ | |||
199 | #define IEEE80211_DL_STATE (1<<3) | 173 | #define IEEE80211_DL_STATE (1<<3) |
200 | #define IEEE80211_DL_MGMT (1<<4) | 174 | #define IEEE80211_DL_MGMT (1<<4) |
201 | #define IEEE80211_DL_FRAG (1<<5) | 175 | #define IEEE80211_DL_FRAG (1<<5) |
202 | #define IEEE80211_DL_EAP (1<<6) | ||
203 | #define IEEE80211_DL_DROP (1<<7) | 176 | #define IEEE80211_DL_DROP (1<<7) |
204 | 177 | ||
205 | #define IEEE80211_DL_TX (1<<8) | 178 | #define IEEE80211_DL_TX (1<<8) |
@@ -214,7 +187,6 @@ do { if (ieee80211_debug_level & (level)) \ | |||
214 | #define IEEE80211_DEBUG_STATE(f, a...) IEEE80211_DEBUG(IEEE80211_DL_STATE, f, ## a) | 187 | #define IEEE80211_DEBUG_STATE(f, a...) IEEE80211_DEBUG(IEEE80211_DL_STATE, f, ## a) |
215 | #define IEEE80211_DEBUG_MGMT(f, a...) IEEE80211_DEBUG(IEEE80211_DL_MGMT, f, ## a) | 188 | #define IEEE80211_DEBUG_MGMT(f, a...) IEEE80211_DEBUG(IEEE80211_DL_MGMT, f, ## a) |
216 | #define IEEE80211_DEBUG_FRAG(f, a...) IEEE80211_DEBUG(IEEE80211_DL_FRAG, f, ## a) | 189 | #define IEEE80211_DEBUG_FRAG(f, a...) IEEE80211_DEBUG(IEEE80211_DL_FRAG, f, ## a) |
217 | #define IEEE80211_DEBUG_EAP(f, a...) IEEE80211_DEBUG(IEEE80211_DL_EAP, f, ## a) | ||
218 | #define IEEE80211_DEBUG_DROP(f, a...) IEEE80211_DEBUG(IEEE80211_DL_DROP, f, ## a) | 190 | #define IEEE80211_DEBUG_DROP(f, a...) IEEE80211_DEBUG(IEEE80211_DL_DROP, f, ## a) |
219 | #define IEEE80211_DEBUG_TX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_TX, f, ## a) | 191 | #define IEEE80211_DEBUG_TX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_TX, f, ## a) |
220 | #define IEEE80211_DEBUG_RX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_RX, f, ## a) | 192 | #define IEEE80211_DEBUG_RX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_RX, f, ## a) |
@@ -223,9 +195,9 @@ do { if (ieee80211_debug_level & (level)) \ | |||
223 | #include <linux/if_arp.h> /* ARPHRD_ETHER */ | 195 | #include <linux/if_arp.h> /* ARPHRD_ETHER */ |
224 | 196 | ||
225 | #ifndef WIRELESS_SPY | 197 | #ifndef WIRELESS_SPY |
226 | #define WIRELESS_SPY // enable iwspy support | 198 | #define WIRELESS_SPY /* enable iwspy support */ |
227 | #endif | 199 | #endif |
228 | #include <net/iw_handler.h> // new driver API | 200 | #include <net/iw_handler.h> /* new driver API */ |
229 | 201 | ||
230 | #ifndef ETH_P_PAE | 202 | #ifndef ETH_P_PAE |
231 | #define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */ | 203 | #define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */ |
@@ -252,6 +224,7 @@ struct ieee80211_snap_hdr { | |||
252 | 224 | ||
253 | #define SNAP_SIZE sizeof(struct ieee80211_snap_hdr) | 225 | #define SNAP_SIZE sizeof(struct ieee80211_snap_hdr) |
254 | 226 | ||
227 | #define WLAN_FC_GET_VERS(fc) ((fc) & IEEE80211_FCTL_VERS) | ||
255 | #define WLAN_FC_GET_TYPE(fc) ((fc) & IEEE80211_FCTL_FTYPE) | 228 | #define WLAN_FC_GET_TYPE(fc) ((fc) & IEEE80211_FCTL_FTYPE) |
256 | #define WLAN_FC_GET_STYPE(fc) ((fc) & IEEE80211_FCTL_STYPE) | 229 | #define WLAN_FC_GET_STYPE(fc) ((fc) & IEEE80211_FCTL_STYPE) |
257 | 230 | ||
@@ -264,7 +237,7 @@ struct ieee80211_snap_hdr { | |||
264 | 237 | ||
265 | #define WLAN_AUTH_CHALLENGE_LEN 128 | 238 | #define WLAN_AUTH_CHALLENGE_LEN 128 |
266 | 239 | ||
267 | #define WLAN_CAPABILITY_BSS (1<<0) | 240 | #define WLAN_CAPABILITY_ESS (1<<0) |
268 | #define WLAN_CAPABILITY_IBSS (1<<1) | 241 | #define WLAN_CAPABILITY_IBSS (1<<1) |
269 | #define WLAN_CAPABILITY_CF_POLLABLE (1<<2) | 242 | #define WLAN_CAPABILITY_CF_POLLABLE (1<<2) |
270 | #define WLAN_CAPABILITY_CF_POLL_REQUEST (1<<3) | 243 | #define WLAN_CAPABILITY_CF_POLL_REQUEST (1<<3) |
@@ -272,34 +245,72 @@ struct ieee80211_snap_hdr { | |||
272 | #define WLAN_CAPABILITY_SHORT_PREAMBLE (1<<5) | 245 | #define WLAN_CAPABILITY_SHORT_PREAMBLE (1<<5) |
273 | #define WLAN_CAPABILITY_PBCC (1<<6) | 246 | #define WLAN_CAPABILITY_PBCC (1<<6) |
274 | #define WLAN_CAPABILITY_CHANNEL_AGILITY (1<<7) | 247 | #define WLAN_CAPABILITY_CHANNEL_AGILITY (1<<7) |
248 | #define WLAN_CAPABILITY_SPECTRUM_MGMT (1<<8) | ||
249 | #define WLAN_CAPABILITY_SHORT_SLOT_TIME (1<<10) | ||
250 | #define WLAN_CAPABILITY_OSSS_OFDM (1<<13) | ||
275 | 251 | ||
276 | /* Status codes */ | 252 | /* Status codes */ |
277 | #define WLAN_STATUS_SUCCESS 0 | 253 | enum ieee80211_statuscode { |
278 | #define WLAN_STATUS_UNSPECIFIED_FAILURE 1 | 254 | WLAN_STATUS_SUCCESS = 0, |
279 | #define WLAN_STATUS_CAPS_UNSUPPORTED 10 | 255 | WLAN_STATUS_UNSPECIFIED_FAILURE = 1, |
280 | #define WLAN_STATUS_REASSOC_NO_ASSOC 11 | 256 | WLAN_STATUS_CAPS_UNSUPPORTED = 10, |
281 | #define WLAN_STATUS_ASSOC_DENIED_UNSPEC 12 | 257 | WLAN_STATUS_REASSOC_NO_ASSOC = 11, |
282 | #define WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG 13 | 258 | WLAN_STATUS_ASSOC_DENIED_UNSPEC = 12, |
283 | #define WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION 14 | 259 | WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG = 13, |
284 | #define WLAN_STATUS_CHALLENGE_FAIL 15 | 260 | WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION = 14, |
285 | #define WLAN_STATUS_AUTH_TIMEOUT 16 | 261 | WLAN_STATUS_CHALLENGE_FAIL = 15, |
286 | #define WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA 17 | 262 | WLAN_STATUS_AUTH_TIMEOUT = 16, |
287 | #define WLAN_STATUS_ASSOC_DENIED_RATES 18 | 263 | WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA = 17, |
288 | /* 802.11b */ | 264 | WLAN_STATUS_ASSOC_DENIED_RATES = 18, |
289 | #define WLAN_STATUS_ASSOC_DENIED_NOSHORT 19 | 265 | /* 802.11b */ |
290 | #define WLAN_STATUS_ASSOC_DENIED_NOPBCC 20 | 266 | WLAN_STATUS_ASSOC_DENIED_NOSHORTPREAMBLE = 19, |
291 | #define WLAN_STATUS_ASSOC_DENIED_NOAGILITY 21 | 267 | WLAN_STATUS_ASSOC_DENIED_NOPBCC = 20, |
268 | WLAN_STATUS_ASSOC_DENIED_NOAGILITY = 21, | ||
269 | /* 802.11h */ | ||
270 | WLAN_STATUS_ASSOC_DENIED_NOSPECTRUM = 22, | ||
271 | WLAN_STATUS_ASSOC_REJECTED_BAD_POWER = 23, | ||
272 | WLAN_STATUS_ASSOC_REJECTED_BAD_SUPP_CHAN = 24, | ||
273 | /* 802.11g */ | ||
274 | WLAN_STATUS_ASSOC_DENIED_NOSHORTTIME = 25, | ||
275 | WLAN_STATUS_ASSOC_DENIED_NODSSSOFDM = 26, | ||
276 | /* 802.11i */ | ||
277 | WLAN_STATUS_INVALID_IE = 40, | ||
278 | WLAN_STATUS_INVALID_GROUP_CIPHER = 41, | ||
279 | WLAN_STATUS_INVALID_PAIRWISE_CIPHER = 42, | ||
280 | WLAN_STATUS_INVALID_AKMP = 43, | ||
281 | WLAN_STATUS_UNSUPP_RSN_VERSION = 44, | ||
282 | WLAN_STATUS_INVALID_RSN_IE_CAP = 45, | ||
283 | WLAN_STATUS_CIPHER_SUITE_REJECTED = 46, | ||
284 | }; | ||
292 | 285 | ||
293 | /* Reason codes */ | 286 | /* Reason codes */ |
294 | #define WLAN_REASON_UNSPECIFIED 1 | 287 | enum ieee80211_reasoncode { |
295 | #define WLAN_REASON_PREV_AUTH_NOT_VALID 2 | 288 | WLAN_REASON_UNSPECIFIED = 1, |
296 | #define WLAN_REASON_DEAUTH_LEAVING 3 | 289 | WLAN_REASON_PREV_AUTH_NOT_VALID = 2, |
297 | #define WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY 4 | 290 | WLAN_REASON_DEAUTH_LEAVING = 3, |
298 | #define WLAN_REASON_DISASSOC_AP_BUSY 5 | 291 | WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY = 4, |
299 | #define WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA 6 | 292 | WLAN_REASON_DISASSOC_AP_BUSY = 5, |
300 | #define WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA 7 | 293 | WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA = 6, |
301 | #define WLAN_REASON_DISASSOC_STA_HAS_LEFT 8 | 294 | WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA = 7, |
302 | #define WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH 9 | 295 | WLAN_REASON_DISASSOC_STA_HAS_LEFT = 8, |
296 | WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH = 9, | ||
297 | /* 802.11h */ | ||
298 | WLAN_REASON_DISASSOC_BAD_POWER = 10, | ||
299 | WLAN_REASON_DISASSOC_BAD_SUPP_CHAN = 11, | ||
300 | /* 802.11i */ | ||
301 | WLAN_REASON_INVALID_IE = 13, | ||
302 | WLAN_REASON_MIC_FAILURE = 14, | ||
303 | WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT = 15, | ||
304 | WLAN_REASON_GROUP_KEY_HANDSHAKE_TIMEOUT = 16, | ||
305 | WLAN_REASON_IE_DIFFERENT = 17, | ||
306 | WLAN_REASON_INVALID_GROUP_CIPHER = 18, | ||
307 | WLAN_REASON_INVALID_PAIRWISE_CIPHER = 19, | ||
308 | WLAN_REASON_INVALID_AKMP = 20, | ||
309 | WLAN_REASON_UNSUPP_RSN_VERSION = 21, | ||
310 | WLAN_REASON_INVALID_RSN_IE_CAP = 22, | ||
311 | WLAN_REASON_IEEE8021X_FAILED = 23, | ||
312 | WLAN_REASON_CIPHER_SUITE_REJECTED = 24, | ||
313 | }; | ||
303 | 314 | ||
304 | 315 | ||
305 | #define IEEE80211_STATMASK_SIGNAL (1<<0) | 316 | #define IEEE80211_STATMASK_SIGNAL (1<<0) |
@@ -426,9 +437,7 @@ struct ieee80211_stats { | |||
426 | 437 | ||
427 | struct ieee80211_device; | 438 | struct ieee80211_device; |
428 | 439 | ||
429 | #if 0 /* for later */ | ||
430 | #include "ieee80211_crypt.h" | 440 | #include "ieee80211_crypt.h" |
431 | #endif | ||
432 | 441 | ||
433 | #define SEC_KEY_1 (1<<0) | 442 | #define SEC_KEY_1 (1<<0) |
434 | #define SEC_KEY_2 (1<<1) | 443 | #define SEC_KEY_2 (1<<1) |
@@ -480,17 +489,34 @@ Total: 28-2340 bytes | |||
480 | #define BEACON_PROBE_SSID_ID_POSITION 12 | 489 | #define BEACON_PROBE_SSID_ID_POSITION 12 |
481 | 490 | ||
482 | /* Management Frame Information Element Types */ | 491 | /* Management Frame Information Element Types */ |
483 | #define MFIE_TYPE_SSID 0 | 492 | enum ieee80211_mfie { |
484 | #define MFIE_TYPE_RATES 1 | 493 | MFIE_TYPE_SSID = 0, |
485 | #define MFIE_TYPE_FH_SET 2 | 494 | MFIE_TYPE_RATES = 1, |
486 | #define MFIE_TYPE_DS_SET 3 | 495 | MFIE_TYPE_FH_SET = 2, |
487 | #define MFIE_TYPE_CF_SET 4 | 496 | MFIE_TYPE_DS_SET = 3, |
488 | #define MFIE_TYPE_TIM 5 | 497 | MFIE_TYPE_CF_SET = 4, |
489 | #define MFIE_TYPE_IBSS_SET 6 | 498 | MFIE_TYPE_TIM = 5, |
490 | #define MFIE_TYPE_CHALLENGE 16 | 499 | MFIE_TYPE_IBSS_SET = 6, |
491 | #define MFIE_TYPE_RSN 48 | 500 | MFIE_TYPE_COUNTRY = 7, |
492 | #define MFIE_TYPE_RATES_EX 50 | 501 | MFIE_TYPE_HOP_PARAMS = 8, |
493 | #define MFIE_TYPE_GENERIC 221 | 502 | MFIE_TYPE_HOP_TABLE = 9, |
503 | MFIE_TYPE_REQUEST = 10, | ||
504 | MFIE_TYPE_CHALLENGE = 16, | ||
505 | MFIE_TYPE_POWER_CONSTRAINT = 32, | ||
506 | MFIE_TYPE_POWER_CAPABILITY = 33, | ||
507 | MFIE_TYPE_TPC_REQUEST = 34, | ||
508 | MFIE_TYPE_TPC_REPORT = 35, | ||
509 | MFIE_TYPE_SUPP_CHANNELS = 36, | ||
510 | MFIE_TYPE_CSA = 37, | ||
511 | MFIE_TYPE_MEASURE_REQUEST = 38, | ||
512 | MFIE_TYPE_MEASURE_REPORT = 39, | ||
513 | MFIE_TYPE_QUIET = 40, | ||
514 | MFIE_TYPE_IBSS_DFS = 41, | ||
515 | MFIE_TYPE_ERP_INFO = 42, | ||
516 | MFIE_TYPE_RSN = 48, | ||
517 | MFIE_TYPE_RATES_EX = 50, | ||
518 | MFIE_TYPE_GENERIC = 221, | ||
519 | }; | ||
494 | 520 | ||
495 | struct ieee80211_info_element_hdr { | 521 | struct ieee80211_info_element_hdr { |
496 | u8 id; | 522 | u8 id; |
@@ -522,9 +548,9 @@ struct ieee80211_info_element { | |||
522 | 548 | ||
523 | struct ieee80211_authentication { | 549 | struct ieee80211_authentication { |
524 | struct ieee80211_hdr_3addr header; | 550 | struct ieee80211_hdr_3addr header; |
525 | u16 algorithm; | 551 | __le16 algorithm; |
526 | u16 transaction; | 552 | __le16 transaction; |
527 | u16 status; | 553 | __le16 status; |
528 | struct ieee80211_info_element info_element; | 554 | struct ieee80211_info_element info_element; |
529 | } __attribute__ ((packed)); | 555 | } __attribute__ ((packed)); |
530 | 556 | ||
@@ -532,23 +558,23 @@ struct ieee80211_authentication { | |||
532 | struct ieee80211_probe_response { | 558 | struct ieee80211_probe_response { |
533 | struct ieee80211_hdr_3addr header; | 559 | struct ieee80211_hdr_3addr header; |
534 | u32 time_stamp[2]; | 560 | u32 time_stamp[2]; |
535 | u16 beacon_interval; | 561 | __le16 beacon_interval; |
536 | u16 capability; | 562 | __le16 capability; |
537 | struct ieee80211_info_element info_element; | 563 | struct ieee80211_info_element info_element; |
538 | } __attribute__ ((packed)); | 564 | } __attribute__ ((packed)); |
539 | 565 | ||
540 | struct ieee80211_assoc_request_frame { | 566 | struct ieee80211_assoc_request_frame { |
541 | u16 capability; | 567 | __le16 capability; |
542 | u16 listen_interval; | 568 | __le16 listen_interval; |
543 | u8 current_ap[ETH_ALEN]; | 569 | u8 current_ap[ETH_ALEN]; |
544 | struct ieee80211_info_element info_element; | 570 | struct ieee80211_info_element info_element; |
545 | } __attribute__ ((packed)); | 571 | } __attribute__ ((packed)); |
546 | 572 | ||
547 | struct ieee80211_assoc_response_frame { | 573 | struct ieee80211_assoc_response_frame { |
548 | struct ieee80211_hdr_3addr header; | 574 | struct ieee80211_hdr_3addr header; |
549 | u16 capability; | 575 | __le16 capability; |
550 | u16 status; | 576 | __le16 status; |
551 | u16 aid; | 577 | __le16 aid; |
552 | struct ieee80211_info_element info_element; /* supported rates */ | 578 | struct ieee80211_info_element info_element; /* supported rates */ |
553 | } __attribute__ ((packed)); | 579 | } __attribute__ ((packed)); |
554 | 580 | ||
@@ -563,7 +589,7 @@ struct ieee80211_txb { | |||
563 | }; | 589 | }; |
564 | 590 | ||
565 | 591 | ||
566 | /* SWEEP TABLE ENTRIES NUMBER*/ | 592 | /* SWEEP TABLE ENTRIES NUMBER */ |
567 | #define MAX_SWEEP_TAB_ENTRIES 42 | 593 | #define MAX_SWEEP_TAB_ENTRIES 42 |
568 | #define MAX_SWEEP_TAB_ENTRIES_PER_PACKET 7 | 594 | #define MAX_SWEEP_TAB_ENTRIES_PER_PACKET 7 |
569 | /* MAX_RATES_LENGTH needs to be 12. The spec says 8, and many APs | 595 | /* MAX_RATES_LENGTH needs to be 12. The spec says 8, and many APs |
@@ -624,8 +650,6 @@ enum ieee80211_state { | |||
624 | 650 | ||
625 | #define DEFAULT_MAX_SCAN_AGE (15 * HZ) | 651 | #define DEFAULT_MAX_SCAN_AGE (15 * HZ) |
626 | #define DEFAULT_FTS 2346 | 652 | #define DEFAULT_FTS 2346 |
627 | #define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x" | ||
628 | #define MAC_ARG(x) ((u8*)(x))[0],((u8*)(x))[1],((u8*)(x))[2],((u8*)(x))[3],((u8*)(x))[4],((u8*)(x))[5] | ||
629 | 653 | ||
630 | 654 | ||
631 | #define CFG_IEEE80211_RESERVE_FCS (1<<0) | 655 | #define CFG_IEEE80211_RESERVE_FCS (1<<0) |
@@ -793,8 +817,6 @@ extern struct net_device *alloc_ieee80211(int sizeof_priv); | |||
793 | extern int ieee80211_set_encryption(struct ieee80211_device *ieee); | 817 | extern int ieee80211_set_encryption(struct ieee80211_device *ieee); |
794 | 818 | ||
795 | /* ieee80211_tx.c */ | 819 | /* ieee80211_tx.c */ |
796 | |||
797 | |||
798 | extern int ieee80211_xmit(struct sk_buff *skb, | 820 | extern int ieee80211_xmit(struct sk_buff *skb, |
799 | struct net_device *dev); | 821 | struct net_device *dev); |
800 | extern void ieee80211_txb_free(struct ieee80211_txb *); | 822 | extern void ieee80211_txb_free(struct ieee80211_txb *); |
@@ -807,7 +829,7 @@ extern void ieee80211_rx_mgt(struct ieee80211_device *ieee, | |||
807 | struct ieee80211_hdr *header, | 829 | struct ieee80211_hdr *header, |
808 | struct ieee80211_rx_stats *stats); | 830 | struct ieee80211_rx_stats *stats); |
809 | 831 | ||
810 | /* iee80211_wx.c */ | 832 | /* ieee80211_wx.c */ |
811 | extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee, | 833 | extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee, |
812 | struct iw_request_info *info, | 834 | struct iw_request_info *info, |
813 | union iwreq_data *wrqu, char *key); | 835 | union iwreq_data *wrqu, char *key); |
@@ -829,28 +851,5 @@ extern inline int ieee80211_get_scans(struct ieee80211_device *ieee) | |||
829 | return ieee->scans; | 851 | return ieee->scans; |
830 | } | 852 | } |
831 | 853 | ||
832 | static inline const char *escape_essid(const char *essid, u8 essid_len) { | ||
833 | static char escaped[IW_ESSID_MAX_SIZE * 2 + 1]; | ||
834 | const char *s = essid; | ||
835 | char *d = escaped; | ||
836 | |||
837 | if (ieee80211_is_empty_essid(essid, essid_len)) { | ||
838 | memcpy(escaped, "<hidden>", sizeof("<hidden>")); | ||
839 | return escaped; | ||
840 | } | ||
841 | |||
842 | essid_len = min(essid_len, (u8)IW_ESSID_MAX_SIZE); | ||
843 | while (essid_len--) { | ||
844 | if (*s == '\0') { | ||
845 | *d++ = '\\'; | ||
846 | *d++ = '0'; | ||
847 | s++; | ||
848 | } else { | ||
849 | *d++ = *s++; | ||
850 | } | ||
851 | } | ||
852 | *d = '\0'; | ||
853 | return escaped; | ||
854 | } | ||
855 | 854 | ||
856 | #endif /* IEEE80211_H */ | 855 | #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 | ||