aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/ieee80211.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/ieee80211.h')
-rw-r--r--include/net/ieee80211.h214
1 files changed, 128 insertions, 86 deletions
diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h
index 51a20b5f3b5d..8bc126938cd4 100644
--- a/include/net/ieee80211.h
+++ b/include/net/ieee80211.h
@@ -47,22 +47,22 @@
47#define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN) 47#define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN)
48 48
49struct ieee80211_hdr { 49struct ieee80211_hdr {
50 u16 frame_ctl; 50 __le16 frame_ctl;
51 u16 duration_id; 51 __le16 duration_id;
52 u8 addr1[ETH_ALEN]; 52 u8 addr1[ETH_ALEN];
53 u8 addr2[ETH_ALEN]; 53 u8 addr2[ETH_ALEN];
54 u8 addr3[ETH_ALEN]; 54 u8 addr3[ETH_ALEN];
55 u16 seq_ctl; 55 __le16 seq_ctl;
56 u8 addr4[ETH_ALEN]; 56 u8 addr4[ETH_ALEN];
57} __attribute__ ((packed)); 57} __attribute__ ((packed));
58 58
59struct ieee80211_hdr_3addr { 59struct ieee80211_hdr_3addr {
60 u16 frame_ctl; 60 __le16 frame_ctl;
61 u16 duration_id; 61 __le16 duration_id;
62 u8 addr1[ETH_ALEN]; 62 u8 addr1[ETH_ALEN];
63 u8 addr2[ETH_ALEN]; 63 u8 addr2[ETH_ALEN];
64 u8 addr3[ETH_ALEN]; 64 u8 addr3[ETH_ALEN];
65 u16 seq_ctl; 65 __le16 seq_ctl;
66} __attribute__ ((packed)); 66} __attribute__ ((packed));
67 67
68enum eap_type { 68enum eap_type {
@@ -88,10 +88,10 @@ static inline const char *eap_get_type(int type)
88 88
89struct eapol { 89struct eapol {
90 u8 snap[6]; 90 u8 snap[6];
91 u16 ethertype; 91 __be16 ethertype;
92 u8 version; 92 u8 version;
93 u8 type; 93 u8 type;
94 u16 length; 94 __be16 length;
95} __attribute__ ((packed)); 95} __attribute__ ((packed));
96 96
97#define IEEE80211_1ADDR_LEN 10 97#define IEEE80211_1ADDR_LEN 10
@@ -112,8 +112,8 @@ struct eapol {
112#define IEEE80211_FCTL_MOREFRAGS 0x0400 112#define IEEE80211_FCTL_MOREFRAGS 0x0400
113#define IEEE80211_FCTL_RETRY 0x0800 113#define IEEE80211_FCTL_RETRY 0x0800
114#define IEEE80211_FCTL_PM 0x1000 114#define IEEE80211_FCTL_PM 0x1000
115#define IEEE80211_FCTL_MOREDATA 0x2000 115#define IEEE80211_FCTL_MOREDATA 0x2000
116#define IEEE80211_FCTL_WEP 0x4000 116#define IEEE80211_FCTL_PROTECTED 0x4000
117#define IEEE80211_FCTL_ORDER 0x8000 117#define IEEE80211_FCTL_ORDER 0x8000
118 118
119#define IEEE80211_FTYPE_MGMT 0x0000 119#define IEEE80211_FTYPE_MGMT 0x0000
@@ -132,6 +132,7 @@ struct eapol {
132#define IEEE80211_STYPE_DISASSOC 0x00A0 132#define IEEE80211_STYPE_DISASSOC 0x00A0
133#define IEEE80211_STYPE_AUTH 0x00B0 133#define IEEE80211_STYPE_AUTH 0x00B0
134#define IEEE80211_STYPE_DEAUTH 0x00C0 134#define IEEE80211_STYPE_DEAUTH 0x00C0
135#define IEEE80211_STYPE_ACTION 0x00D0
135 136
136/* control */ 137/* control */
137#define IEEE80211_STYPE_PSPOLL 0x00A0 138#define IEEE80211_STYPE_PSPOLL 0x00A0
@@ -167,8 +168,19 @@ do { if (ieee80211_debug_level & (level)) \
167#define IEEE80211_DEBUG(level, fmt, args...) do {} while (0) 168#define IEEE80211_DEBUG(level, fmt, args...) do {} while (0)
168#endif /* CONFIG_IEEE80211_DEBUG */ 169#endif /* CONFIG_IEEE80211_DEBUG */
169 170
171
172/* debug macros not dependent on CONFIG_IEEE80211_DEBUG */
173
174#define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x"
175#define MAC_ARG(x) ((u8*)(x))[0],((u8*)(x))[1],((u8*)(x))[2],((u8*)(x))[3],((u8*)(x))[4],((u8*)(x))[5]
176
177/* escape_essid() is intended to be used in debug (and possibly error)
178 * messages. It should never be used for passing essid to user space. */
179const char *escape_essid(const char *essid, u8 essid_len);
180
181
170/* 182/*
171 * To use the debug system; 183 * To use the debug system:
172 * 184 *
173 * If you are defining a new debug classification, simply add it to the #define 185 * If you are defining a new debug classification, simply add it to the #define
174 * list here in the form of: 186 * list here in the form of:
@@ -223,9 +235,9 @@ do { if (ieee80211_debug_level & (level)) \
223#include <linux/if_arp.h> /* ARPHRD_ETHER */ 235#include <linux/if_arp.h> /* ARPHRD_ETHER */
224 236
225#ifndef WIRELESS_SPY 237#ifndef WIRELESS_SPY
226#define WIRELESS_SPY // enable iwspy support 238#define WIRELESS_SPY /* enable iwspy support */
227#endif 239#endif
228#include <net/iw_handler.h> // new driver API 240#include <net/iw_handler.h> /* new driver API */
229 241
230#ifndef ETH_P_PAE 242#ifndef ETH_P_PAE
231#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */ 243#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
@@ -252,6 +264,7 @@ struct ieee80211_snap_hdr {
252 264
253#define SNAP_SIZE sizeof(struct ieee80211_snap_hdr) 265#define SNAP_SIZE sizeof(struct ieee80211_snap_hdr)
254 266
267#define WLAN_FC_GET_VERS(fc) ((fc) & IEEE80211_FCTL_VERS)
255#define WLAN_FC_GET_TYPE(fc) ((fc) & IEEE80211_FCTL_FTYPE) 268#define WLAN_FC_GET_TYPE(fc) ((fc) & IEEE80211_FCTL_FTYPE)
256#define WLAN_FC_GET_STYPE(fc) ((fc) & IEEE80211_FCTL_STYPE) 269#define WLAN_FC_GET_STYPE(fc) ((fc) & IEEE80211_FCTL_STYPE)
257 270
@@ -272,34 +285,72 @@ struct ieee80211_snap_hdr {
272#define WLAN_CAPABILITY_SHORT_PREAMBLE (1<<5) 285#define WLAN_CAPABILITY_SHORT_PREAMBLE (1<<5)
273#define WLAN_CAPABILITY_PBCC (1<<6) 286#define WLAN_CAPABILITY_PBCC (1<<6)
274#define WLAN_CAPABILITY_CHANNEL_AGILITY (1<<7) 287#define WLAN_CAPABILITY_CHANNEL_AGILITY (1<<7)
288#define WLAN_CAPABILITY_SPECTRUM_MGMT (1<<8)
289#define WLAN_CAPABILITY_SHORT_SLOT_TIME (1<<10)
290#define WLAN_CAPABILITY_OSSS_OFDM (1<<13)
275 291
276/* Status codes */ 292/* Status codes */
277#define WLAN_STATUS_SUCCESS 0 293enum ieee80211_statuscode {
278#define WLAN_STATUS_UNSPECIFIED_FAILURE 1 294 WLAN_STATUS_SUCCESS = 0,
279#define WLAN_STATUS_CAPS_UNSUPPORTED 10 295 WLAN_STATUS_UNSPECIFIED_FAILURE = 1,
280#define WLAN_STATUS_REASSOC_NO_ASSOC 11 296 WLAN_STATUS_CAPS_UNSUPPORTED = 10,
281#define WLAN_STATUS_ASSOC_DENIED_UNSPEC 12 297 WLAN_STATUS_REASSOC_NO_ASSOC = 11,
282#define WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG 13 298 WLAN_STATUS_ASSOC_DENIED_UNSPEC = 12,
283#define WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION 14 299 WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG = 13,
284#define WLAN_STATUS_CHALLENGE_FAIL 15 300 WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION = 14,
285#define WLAN_STATUS_AUTH_TIMEOUT 16 301 WLAN_STATUS_CHALLENGE_FAIL = 15,
286#define WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA 17 302 WLAN_STATUS_AUTH_TIMEOUT = 16,
287#define WLAN_STATUS_ASSOC_DENIED_RATES 18 303 WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA = 17,
288/* 802.11b */ 304 WLAN_STATUS_ASSOC_DENIED_RATES = 18,
289#define WLAN_STATUS_ASSOC_DENIED_NOSHORT 19 305 /* 802.11b */
290#define WLAN_STATUS_ASSOC_DENIED_NOPBCC 20 306 WLAN_STATUS_ASSOC_DENIED_NOSHORTPREAMBLE = 19,
291#define WLAN_STATUS_ASSOC_DENIED_NOAGILITY 21 307 WLAN_STATUS_ASSOC_DENIED_NOPBCC = 20,
308 WLAN_STATUS_ASSOC_DENIED_NOAGILITY = 21,
309 /* 802.11h */
310 WLAN_STATUS_ASSOC_DENIED_NOSPECTRUM = 22,
311 WLAN_STATUS_ASSOC_REJECTED_BAD_POWER = 23,
312 WLAN_STATUS_ASSOC_REJECTED_BAD_SUPP_CHAN = 24,
313 /* 802.11g */
314 WLAN_STATUS_ASSOC_DENIED_NOSHORTTIME = 25,
315 WLAN_STATUS_ASSOC_DENIED_NODSSSOFDM = 26,
316 /* 802.11i */
317 WLAN_STATUS_INVALID_IE = 40,
318 WLAN_STATUS_INVALID_GROUP_CIPHER = 41,
319 WLAN_STATUS_INVALID_PAIRWISE_CIPHER = 42,
320 WLAN_STATUS_INVALID_AKMP = 43,
321 WLAN_STATUS_UNSUPP_RSN_VERSION = 44,
322 WLAN_STATUS_INVALID_RSN_IE_CAP = 45,
323 WLAN_STATUS_CIPHER_SUITE_REJECTED = 46,
324};
292 325
293/* Reason codes */ 326/* Reason codes */
294#define WLAN_REASON_UNSPECIFIED 1 327enum ieee80211_reasoncode {
295#define WLAN_REASON_PREV_AUTH_NOT_VALID 2 328 WLAN_REASON_UNSPECIFIED = 1,
296#define WLAN_REASON_DEAUTH_LEAVING 3 329 WLAN_REASON_PREV_AUTH_NOT_VALID = 2,
297#define WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY 4 330 WLAN_REASON_DEAUTH_LEAVING = 3,
298#define WLAN_REASON_DISASSOC_AP_BUSY 5 331 WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY = 4,
299#define WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA 6 332 WLAN_REASON_DISASSOC_AP_BUSY = 5,
300#define WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA 7 333 WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA = 6,
301#define WLAN_REASON_DISASSOC_STA_HAS_LEFT 8 334 WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA = 7,
302#define WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH 9 335 WLAN_REASON_DISASSOC_STA_HAS_LEFT = 8,
336 WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH = 9,
337 /* 802.11h */
338 WLAN_REASON_DISASSOC_BAD_POWER = 10,
339 WLAN_REASON_DISASSOC_BAD_SUPP_CHAN = 11,
340 /* 802.11i */
341 WLAN_REASON_INVALID_IE = 13,
342 WLAN_REASON_MIC_FAILURE = 14,
343 WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT = 15,
344 WLAN_REASON_GROUP_KEY_HANDSHAKE_TIMEOUT = 16,
345 WLAN_REASON_IE_DIFFERENT = 17,
346 WLAN_REASON_INVALID_GROUP_CIPHER = 18,
347 WLAN_REASON_INVALID_PAIRWISE_CIPHER = 19,
348 WLAN_REASON_INVALID_AKMP = 20,
349 WLAN_REASON_UNSUPP_RSN_VERSION = 21,
350 WLAN_REASON_INVALID_RSN_IE_CAP = 22,
351 WLAN_REASON_IEEE8021X_FAILED = 23,
352 WLAN_REASON_CIPHER_SUITE_REJECTED = 24,
353};
303 354
304 355
305#define IEEE80211_STATMASK_SIGNAL (1<<0) 356#define IEEE80211_STATMASK_SIGNAL (1<<0)
@@ -478,17 +529,34 @@ Total: 28-2340 bytes
478#define BEACON_PROBE_SSID_ID_POSITION 12 529#define BEACON_PROBE_SSID_ID_POSITION 12
479 530
480/* Management Frame Information Element Types */ 531/* Management Frame Information Element Types */
481#define MFIE_TYPE_SSID 0 532enum ieee80211_mfie {
482#define MFIE_TYPE_RATES 1 533 MFIE_TYPE_SSID = 0,
483#define MFIE_TYPE_FH_SET 2 534 MFIE_TYPE_RATES = 1,
484#define MFIE_TYPE_DS_SET 3 535 MFIE_TYPE_FH_SET = 2,
485#define MFIE_TYPE_CF_SET 4 536 MFIE_TYPE_DS_SET = 3,
486#define MFIE_TYPE_TIM 5 537 MFIE_TYPE_CF_SET = 4,
487#define MFIE_TYPE_IBSS_SET 6 538 MFIE_TYPE_TIM = 5,
488#define MFIE_TYPE_CHALLENGE 16 539 MFIE_TYPE_IBSS_SET = 6,
489#define MFIE_TYPE_RSN 48 540 MFIE_TYPE_COUNTRY = 7,
490#define MFIE_TYPE_RATES_EX 50 541 MFIE_TYPE_HOP_PARAMS = 8,
491#define MFIE_TYPE_GENERIC 221 542 MFIE_TYPE_HOP_TABLE = 9,
543 MFIE_TYPE_REQUEST = 10,
544 MFIE_TYPE_CHALLENGE = 16,
545 MFIE_TYPE_POWER_CONSTRAINT = 32,
546 MFIE_TYPE_POWER_CAPABILITY = 33,
547 MFIE_TYPE_TPC_REQUEST = 34,
548 MFIE_TYPE_TPC_REPORT = 35,
549 MFIE_TYPE_SUPP_CHANNELS = 36,
550 MFIE_TYPE_CSA = 37,
551 MFIE_TYPE_MEASURE_REQUEST = 38,
552 MFIE_TYPE_MEASURE_REPORT = 39,
553 MFIE_TYPE_QUIET = 40,
554 MFIE_TYPE_IBSS_DFS = 41,
555 MFIE_TYPE_ERP_INFO = 42,
556 MFIE_TYPE_RSN = 48,
557 MFIE_TYPE_RATES_EX = 50,
558 MFIE_TYPE_GENERIC = 221,
559};
492 560
493struct ieee80211_info_element_hdr { 561struct ieee80211_info_element_hdr {
494 u8 id; 562 u8 id;
@@ -520,9 +588,9 @@ struct ieee80211_info_element {
520 588
521struct ieee80211_authentication { 589struct ieee80211_authentication {
522 struct ieee80211_hdr_3addr header; 590 struct ieee80211_hdr_3addr header;
523 u16 algorithm; 591 __le16 algorithm;
524 u16 transaction; 592 __le16 transaction;
525 u16 status; 593 __le16 status;
526 struct ieee80211_info_element info_element; 594 struct ieee80211_info_element info_element;
527} __attribute__ ((packed)); 595} __attribute__ ((packed));
528 596
@@ -530,23 +598,23 @@ struct ieee80211_authentication {
530struct ieee80211_probe_response { 598struct ieee80211_probe_response {
531 struct ieee80211_hdr_3addr header; 599 struct ieee80211_hdr_3addr header;
532 u32 time_stamp[2]; 600 u32 time_stamp[2];
533 u16 beacon_interval; 601 __le16 beacon_interval;
534 u16 capability; 602 __le16 capability;
535 struct ieee80211_info_element info_element; 603 struct ieee80211_info_element info_element;
536} __attribute__ ((packed)); 604} __attribute__ ((packed));
537 605
538struct ieee80211_assoc_request_frame { 606struct ieee80211_assoc_request_frame {
539 u16 capability; 607 __le16 capability;
540 u16 listen_interval; 608 __le16 listen_interval;
541 u8 current_ap[ETH_ALEN]; 609 u8 current_ap[ETH_ALEN];
542 struct ieee80211_info_element info_element; 610 struct ieee80211_info_element info_element;
543} __attribute__ ((packed)); 611} __attribute__ ((packed));
544 612
545struct ieee80211_assoc_response_frame { 613struct ieee80211_assoc_response_frame {
546 struct ieee80211_hdr_3addr header; 614 struct ieee80211_hdr_3addr header;
547 u16 capability; 615 __le16 capability;
548 u16 status; 616 __le16 status;
549 u16 aid; 617 __le16 aid;
550 struct ieee80211_info_element info_element; /* supported rates */ 618 struct ieee80211_info_element info_element; /* supported rates */
551} __attribute__ ((packed)); 619} __attribute__ ((packed));
552 620
@@ -561,7 +629,7 @@ struct ieee80211_txb {
561}; 629};
562 630
563 631
564/* SWEEP TABLE ENTRIES NUMBER*/ 632/* SWEEP TABLE ENTRIES NUMBER */
565#define MAX_SWEEP_TAB_ENTRIES 42 633#define MAX_SWEEP_TAB_ENTRIES 42
566#define MAX_SWEEP_TAB_ENTRIES_PER_PACKET 7 634#define MAX_SWEEP_TAB_ENTRIES_PER_PACKET 7
567/* MAX_RATES_LENGTH needs to be 12. The spec says 8, and many APs 635/* MAX_RATES_LENGTH needs to be 12. The spec says 8, and many APs
@@ -622,8 +690,6 @@ enum ieee80211_state {
622 690
623#define DEFAULT_MAX_SCAN_AGE (15 * HZ) 691#define DEFAULT_MAX_SCAN_AGE (15 * HZ)
624#define DEFAULT_FTS 2346 692#define DEFAULT_FTS 2346
625#define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x"
626#define MAC_ARG(x) ((u8*)(x))[0],((u8*)(x))[1],((u8*)(x))[2],((u8*)(x))[3],((u8*)(x))[4],((u8*)(x))[5]
627 693
628 694
629#define CFG_IEEE80211_RESERVE_FCS (1<<0) 695#define CFG_IEEE80211_RESERVE_FCS (1<<0)
@@ -791,8 +857,6 @@ extern struct net_device *alloc_ieee80211(int sizeof_priv);
791extern int ieee80211_set_encryption(struct ieee80211_device *ieee); 857extern int ieee80211_set_encryption(struct ieee80211_device *ieee);
792 858
793/* ieee80211_tx.c */ 859/* ieee80211_tx.c */
794
795
796extern int ieee80211_xmit(struct sk_buff *skb, 860extern int ieee80211_xmit(struct sk_buff *skb,
797 struct net_device *dev); 861 struct net_device *dev);
798extern void ieee80211_txb_free(struct ieee80211_txb *); 862extern void ieee80211_txb_free(struct ieee80211_txb *);
@@ -805,7 +869,7 @@ extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
805 struct ieee80211_hdr *header, 869 struct ieee80211_hdr *header,
806 struct ieee80211_rx_stats *stats); 870 struct ieee80211_rx_stats *stats);
807 871
808/* iee80211_wx.c */ 872/* ieee80211_wx.c */
809extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee, 873extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
810 struct iw_request_info *info, 874 struct iw_request_info *info,
811 union iwreq_data *wrqu, char *key); 875 union iwreq_data *wrqu, char *key);
@@ -827,27 +891,5 @@ extern inline int ieee80211_get_scans(struct ieee80211_device *ieee)
827 return ieee->scans; 891 return ieee->scans;
828} 892}
829 893
830static inline const char *escape_essid(const char *essid, u8 essid_len) {
831 static char escaped[IW_ESSID_MAX_SIZE * 2 + 1];
832 const char *s = essid;
833 char *d = escaped;
834
835 if (ieee80211_is_empty_essid(essid, essid_len)) {
836 memcpy(escaped, "<hidden>", sizeof("<hidden>"));
837 return escaped;
838 }
839 894
840 essid_len = min(essid_len, (u8)IW_ESSID_MAX_SIZE);
841 while (essid_len--) {
842 if (*s == '\0') {
843 *d++ = '\\';
844 *d++ = '0';
845 s++;
846 } else {
847 *d++ = *s++;
848 }
849 }
850 *d = '\0';
851 return escaped;
852}
853#endif /* IEEE80211_H */ 895#endif /* IEEE80211_H */