You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ieee80211.h 37KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182
  1. #ifndef _GPXE_IEEE80211_H
  2. #define _GPXE_IEEE80211_H
  3. #include <gpxe/if_ether.h> /* for ETH_ALEN */
  4. /** @file
  5. * Constants and data structures defined in IEEE 802.11, subsetted
  6. * according to what gPXE knows how to use.
  7. */
  8. FILE_LICENCE(GPL2_OR_LATER);
  9. /* ---------- Maximum lengths of things ---------- */
  10. /**
  11. * @defgroup ieee80211_maxlen Maximum lengths in the 802.11 protocol
  12. * @{
  13. */
  14. /** Maximum length of frame payload
  15. *
  16. * This does not include cryptographic overhead, which can be up to 20
  17. * bytes, but it DOES include the 802.2 LLC/SNAP headers that are used
  18. * on data frames (but not management frames).
  19. */
  20. #define IEEE80211_MAX_DATA_LEN 2304
  21. /** Length of LLC/SNAP headers on data frames */
  22. #define IEEE80211_LLC_HEADER_LEN 8
  23. /** Maximum cryptographic overhead before encrypted data */
  24. #define IEEE80211_MAX_CRYPTO_HEADER 8
  25. /** Maximum cryptographic overhead after encrypted data
  26. *
  27. * This does not count the MIC in TKIP frames, since that is
  28. * considered to be part of the MSDU and thus contributes to the size
  29. * of the data field.
  30. *
  31. * It @e does count the MIC in CCMP frames, which is considered part
  32. * of the MPDU (outside the data field).
  33. */
  34. #define IEEE80211_MAX_CRYPTO_TRAILER 8
  35. /** Total maximum cryptographic overhead */
  36. #define IEEE80211_MAX_CRYPTO_OVERHEAD 16
  37. /** Bytes of network-layer data that can go into a regular data frame */
  38. #define IEEE80211_MAX_FRAME_DATA 2296
  39. /** Frame header length for frames we might work with
  40. *
  41. * QoS adds a two-byte field on top of this, and APs communicating
  42. * with each other in Wireless Distribution System (WDS) mode add an
  43. * extra 6-byte MAC address field, but we do not work with such
  44. * frames.
  45. */
  46. #define IEEE80211_TYP_FRAME_HEADER_LEN 24
  47. /** Theoretical maximum frame header length
  48. *
  49. * This includes the QoS and WDS Addr4 fields that we should never
  50. * see.
  51. */
  52. #define IEEE80211_MAX_FRAME_HEADER_LEN 32
  53. /** Maximum combined frame length
  54. *
  55. * The biggest frame will include 32 frame header bytes, 16 bytes of
  56. * crypto overhead, and 2304 data bytes.
  57. */
  58. #define IEEE80211_MAX_FRAME_LEN 2352
  59. /** Maximum length of an ESSID */
  60. #define IEEE80211_MAX_SSID_LEN 32
  61. /** @} */
  62. /* ---------- Frame Control defines ---------- */
  63. /**
  64. * @defgroup ieee80211_fc 802.11 Frame Control field bits
  65. * @{
  66. */
  67. /** 802.11 Frame Control field, Version bitmask */
  68. #define IEEE80211_FC_VERSION 0x0003
  69. /** Expected value of Version bits in Frame Control */
  70. #define IEEE80211_THIS_VERSION 0x0000
  71. /** 802.11 Frame Control field, Frame Type bitmask */
  72. #define IEEE80211_FC_TYPE 0x000C
  73. /** Type value for management (layer-2) frames */
  74. #define IEEE80211_TYPE_MGMT 0x0000
  75. /** Type value for control (layer-1, hardware-managed) frames */
  76. #define IEEE80211_TYPE_CTRL 0x0004
  77. /** Type value for data frames */
  78. #define IEEE80211_TYPE_DATA 0x0008
  79. /** 802.11 Frame Control field, Frame Subtype bitmask */
  80. #define IEEE80211_FC_SUBTYPE 0x00F0
  81. /** Subtype value for association-request management frames
  82. *
  83. * Association request frames are sent after authentication from the
  84. * client to the Access Point to establish the client as part of the
  85. * Access Point's network.
  86. */
  87. #define IEEE80211_STYPE_ASSOC_REQ 0x0000
  88. /** Subtype value for association-response management frames
  89. *
  90. * Association response frames are sent by the Access Point to confirm
  91. * or deny the association requested in an association request frame.
  92. */
  93. #define IEEE80211_STYPE_ASSOC_RESP 0x0010
  94. /** Subtype value for reassociation-request management frames
  95. *
  96. * Reassociation request frames are sent by clients wishing to change
  97. * from one Access Point to another while roaming within the same
  98. * extended network (same ESSID).
  99. */
  100. #define IEEE80211_STYPE_REASSOC_REQ 0x0020
  101. /** Subtype value for reassociation-response management frames
  102. *
  103. * Reassociation response frames are sent by the Access Point to
  104. * confirm or deny the swap requested in a reassociation request
  105. * frame.
  106. */
  107. #define IEEE80211_STYPE_REASSOC_RESP 0x0030
  108. /** Subtype value for probe-request management frames
  109. *
  110. * Probe request frames are sent by clients to request that all Access
  111. * Points on the sending channel, or all belonging to a particular
  112. * ESSID, identify themselves by BSSID, supported transfer rates, RF
  113. * configuration, and other capabilities.
  114. */
  115. #define IEEE80211_STYPE_PROBE_REQ 0x0040
  116. /** Subtype value for probe-response management frames
  117. *
  118. * Probe response frames are sent by Access Points in response to
  119. * probe request frames, providing the requested information.
  120. */
  121. #define IEEE80211_STYPE_PROBE_RESP 0x0050
  122. /** Subtype value for beacon management frames
  123. *
  124. * Beacon frames are sent by Access Points at regular intervals,
  125. * usually ten per second, on the channel on which they communicate.
  126. * They can be used to probe passively for access points on a channel
  127. * where local regulatory restrictions prohibit active scanning, or
  128. * due to their regularity as a mechanism to determine the fraction of
  129. * packets that are being dropped.
  130. */
  131. #define IEEE80211_STYPE_BEACON 0x0080
  132. /** Subtype value for disassociation management frames
  133. *
  134. * Disassociation frames are sent by either a client or an Access
  135. * Point to unequivocally terminate the association between the two.
  136. * They may be sent by clients upon leaving the network, or by an
  137. * Access Point upon reconfiguration, among other reasons; they are
  138. * usually more "polite" than deauthentication frames.
  139. */
  140. #define IEEE80211_STYPE_DISASSOC 0x00A0
  141. /** Subtype value for authentication management frames
  142. *
  143. * Authentication frames are exchanged between a client and an Access
  144. * Point before association may be performed. Confusingly, in the most
  145. * common authentication method (Open System) no security tokens are
  146. * exchanged at all. Modern 802.11 security handshaking takes place
  147. * after association.
  148. */
  149. #define IEEE80211_STYPE_AUTH 0x00B0
  150. /** Subtype value for deauthentication management frames
  151. *
  152. * Deauthentication frames are sent by either a client or an Access
  153. * Point to terminate the authentication (and therefore also the
  154. * association) between the two. They are generally more forceful than
  155. * disassociation frames, sent for such reasons as a failure to
  156. * set up security properly after associating.
  157. */
  158. #define IEEE80211_STYPE_DEAUTH 0x00C0
  159. /** Subtype value for action management frames
  160. *
  161. * Action frames are used to implement spectrum management and QoS
  162. * features that gPXE currently does not support.
  163. */
  164. #define IEEE80211_STYPE_ACTION 0x00D0
  165. /** Subtype value for RTS (request to send) control frames */
  166. #define IEEE80211_STYPE_RTS 0x00B0
  167. /** Subtype value for CTS (clear to send) control frames */
  168. #define IEEE80211_STYPE_CTS 0x00C0
  169. /** Subtype value for ACK (acknowledgement) control frames */
  170. #define IEEE80211_STYPE_ACK 0x00D0
  171. /** Subtype value for ordinary data frames, with no QoS or CF add-ons */
  172. #define IEEE80211_STYPE_DATA 0x0000
  173. /** Subtype value for data frames containing no data */
  174. #define IEEE80211_STYPE_NODATA 0x0040
  175. /** 802.11 Frame Control field: To Data System flag
  176. *
  177. * This is set on data frames sent to an Access Point.
  178. */
  179. #define IEEE80211_FC_TODS 0x0100
  180. /** 802.11 Frame Control field: From Data System flag
  181. *
  182. * This is set on data frames sent from an Access Point. If both TODS
  183. * and FROMDS are set, the frame header is a 4-address format used for
  184. * inter-Access Point communication.
  185. */
  186. #define IEEE80211_FC_FROMDS 0x0200
  187. /** 802.11 Frame Control field: More Fragments flag */
  188. #define IEEE80211_FC_MORE_FRAG 0x0400
  189. /** 802.11 Frame Control field: Retransmission flag */
  190. #define IEEE80211_FC_RETRY 0x0800
  191. /** 802.11 Frame Control field: Power Managed flag
  192. *
  193. * This is set on any frame sent by a low-power station that will go
  194. * into a power-saving mode immediately after this frame. Access
  195. * Points are not allowed to act as low-power stations.
  196. */
  197. #define IEEE80211_FC_PWR_MGMT 0x1000
  198. /** 802.11 Frame Control field: More Data flag
  199. *
  200. * This is set on any frame sent by a station that has more data
  201. * queued to be sent than is in the frame.
  202. */
  203. #define IEEE80211_FC_MORE_DATA 0x2000
  204. /** 802.11 Frame Control field: Protected flag
  205. *
  206. * This is set on frames in which data is encrypted (by any method).
  207. */
  208. #define IEEE80211_FC_PROTECTED 0x4000
  209. /** 802.11 Frame Control field: Ordered flag [?] */
  210. #define IEEE80211_FC_ORDER 0x8000
  211. /** @} */
  212. /* ---------- Sequence Control defines ---------- */
  213. /**
  214. * @defgroup ieee80211_seq 802.11 Sequence Control field handling
  215. * @{
  216. */
  217. /** Extract sequence number from 802.11 Sequence Control field */
  218. #define IEEE80211_SEQNR( seq ) ( ( seq ) >> 4 )
  219. /** Extract fragment number from 802.11 Sequence Control field */
  220. #define IEEE80211_FRAG( seq ) ( ( seq ) & 0x000F )
  221. /** Make 802.11 Sequence Control field from sequence and fragment numbers */
  222. #define IEEE80211_MAKESEQ( seqnr, frag ) \
  223. ( ( ( ( seqnr ) & 0xFFF ) << 4 ) | ( ( frag ) & 0xF ) )
  224. /** @} */
  225. /* ---------- Frame header formats ---------- */
  226. /**
  227. * @defgroup ieee80211_hdr 802.11 frame header formats
  228. * @{
  229. */
  230. /** An 802.11 data or management frame without QoS or WDS header fields */
  231. struct ieee80211_frame
  232. {
  233. u16 fc; /**< 802.11 Frame Control field */
  234. u16 duration; /**< Microseconds to reserve link */
  235. u8 addr1[ETH_ALEN]; /**< Address 1 (immediate receiver) */
  236. u8 addr2[ETH_ALEN]; /**< Address 2 (immediate sender) */
  237. u8 addr3[ETH_ALEN]; /**< Address 3 (often "forward to") */
  238. u16 seq; /**< 802.11 Sequence Control field */
  239. u8 data[0]; /**< Beginning of frame data */
  240. } __attribute__((packed));
  241. /** The 802.2 LLC/SNAP header sent before actual data in a data frame
  242. *
  243. * This header is not acknowledged in the 802.11 standard at all; it
  244. * is treated just like data for MAC-layer purposes, including
  245. * fragmentation and encryption. It is actually two headers
  246. * concatenated: a three-byte 802.2 LLC header indicating Subnetwork
  247. * Accesss Protocol (SNAP) in both source and destination Service
  248. * Access Point (SAP) fields, and a five-byte SNAP header indicating a
  249. * zero OUI and two-byte Ethernet protocol type field.
  250. *
  251. * Thus, an eight-byte header in which six of the bytes are redundant.
  252. * Lovely, isn't it?
  253. */
  254. struct ieee80211_llc_snap_header
  255. {
  256. /* LLC part: */
  257. u8 dsap; /**< Destination SAP ID */
  258. u8 ssap; /**< Source SAP ID */
  259. u8 ctrl; /**< Control information */
  260. /* SNAP part: */
  261. u8 oui[3]; /**< Organization code, usually 0 */
  262. u16 ethertype; /**< Ethernet Type field */
  263. } __attribute__((packed));
  264. /** Value for DSAP field in 802.2 LLC header for 802.11 frames: SNAP */
  265. #define IEEE80211_LLC_DSAP 0xAA
  266. /** Value for SSAP field in 802.2 LLC header for 802.11 frames: SNAP */
  267. #define IEEE80211_LLC_SSAP 0xAA
  268. /** Value for control field in 802.2 LLC header for 802.11 frames
  269. *
  270. * "Unnumbered Information".
  271. */
  272. #define IEEE80211_LLC_CTRL 0x03
  273. /** 16-byte RTS frame format, with abbreviated header */
  274. struct ieee80211_rts
  275. {
  276. u16 fc; /**< 802.11 Frame Control field */
  277. u16 duration; /**< Microseconds to reserve link */
  278. u8 addr1[ETH_ALEN]; /**< Address 1 (immediate receiver) */
  279. u8 addr2[ETH_ALEN]; /**< Address 2 (immediate sender) */
  280. } __attribute__((packed));
  281. /** Length of 802.11 RTS control frame */
  282. #define IEEE80211_RTS_LEN 16
  283. /** 10-byte CTS or ACK frame format, with abbreviated header */
  284. struct ieee80211_cts_or_ack
  285. {
  286. u16 fc; /**< 802.11 Frame Control field */
  287. u16 duration; /**< Microseconds to reserve link */
  288. u8 addr1[ETH_ALEN]; /**< Address 1 (immediate receiver) */
  289. } __attribute__((packed));
  290. #define ieee80211_cts ieee80211_cts_or_ack
  291. #define ieee80211_ack ieee80211_cts_or_ack
  292. /** Length of 802.11 CTS control frame */
  293. #define IEEE80211_CTS_LEN 10
  294. /** Length of 802.11 ACK control frame */
  295. #define IEEE80211_ACK_LEN 10
  296. /** @} */
  297. /* ---------- Capability bits, status and reason codes ---------- */
  298. /**
  299. * @defgroup ieee80211_capab 802.11 management frame capability field bits
  300. * @{
  301. */
  302. /** Set if using an Access Point (managed mode) */
  303. #define IEEE80211_CAPAB_MANAGED 0x0001
  304. /** Set if operating in IBSS (no-AP, "Ad-Hoc") mode */
  305. #define IEEE80211_CAPAB_ADHOC 0x0002
  306. /** Set if we support Contention-Free Period operation */
  307. #define IEEE80211_CAPAB_CFPOLL 0x0004
  308. /** Set if we wish to be polled for Contention-Free operation */
  309. #define IEEE80211_CAPAB_CFPR 0x0008
  310. /** Set if the network is encrypted (by any method) */
  311. #define IEEE80211_CAPAB_PRIVACY 0x0010
  312. /** Set if PHY supports short preambles on 802.11b */
  313. #define IEEE80211_CAPAB_SHORT_PMBL 0x0020
  314. /** Set if PHY supports PBCC modulation */
  315. #define IEEE80211_CAPAB_PBCC 0x0040
  316. /** Set if we support Channel Agility */
  317. #define IEEE80211_CAPAB_CHAN_AGILITY 0x0080
  318. /** Set if we support spectrum management (DFS and TPC) on the 5GHz band */
  319. #define IEEE80211_CAPAB_SPECTRUM_MGMT 0x0100
  320. /** Set if we support Quality of Service enhancements */
  321. #define IEEE80211_CAPAB_QOS 0x0200
  322. /** Set if PHY supports short slot time on 802.11g */
  323. #define IEEE80211_CAPAB_SHORT_SLOT 0x0400
  324. /** Set if PHY supports APSD option */
  325. #define IEEE80211_CAPAB_APSD 0x0800
  326. /** Set if PHY supports DSSS/OFDM modulation (one way of 802.11 b/g mixing) */
  327. #define IEEE80211_CAPAB_DSSS_OFDM 0x2000
  328. /** Set if we support delayed block ACK */
  329. #define IEEE80211_CAPAB_DELAYED_BACK 0x4000
  330. /** Set if we support immediate block ACK */
  331. #define IEEE80211_CAPAB_IMMED_BACK 0x8000
  332. /** @} */
  333. /**
  334. * @defgroup ieee80211_status 802.11 status codes
  335. *
  336. * These are returned to indicate an immediate denial of
  337. * authentication or association. In gPXE, the lower 5 bits of the
  338. * status code are encoded into the file-unique portion of an error
  339. * code, the ERRFILE portion is always @c ERRFILE_net80211, and the
  340. * POSIX error code is @c ECONNREFUSED for status 0-31 or @c
  341. * EHOSTUNREACH for status 32-63.
  342. *
  343. * For a complete table with non-abbreviated error messages, see IEEE
  344. * Std 802.11-2007, Table 7-23, p.94.
  345. *
  346. * @{
  347. */
  348. #define IEEE80211_STATUS_SUCCESS 0
  349. #define IEEE80211_STATUS_FAILURE 1
  350. #define IEEE80211_STATUS_CAPAB_UNSUPP 10
  351. #define IEEE80211_STATUS_REASSOC_INVALID 11
  352. #define IEEE80211_STATUS_ASSOC_DENIED 12
  353. #define IEEE80211_STATUS_AUTH_ALGO_UNSUPP 13
  354. #define IEEE80211_STATUS_AUTH_SEQ_INVALID 14
  355. #define IEEE80211_STATUS_AUTH_CHALL_INVALID 15
  356. #define IEEE80211_STATUS_AUTH_TIMEOUT 16
  357. #define IEEE80211_STATUS_ASSOC_NO_ROOM 17
  358. #define IEEE80211_STATUS_ASSOC_NEED_RATE 18
  359. #define IEEE80211_STATUS_ASSOC_NEED_SHORT_PMBL 19
  360. #define IEEE80211_STATUS_ASSOC_NEED_PBCC 20
  361. #define IEEE80211_STATUS_ASSOC_NEED_CHAN_AGILITY 21
  362. #define IEEE80211_STATUS_ASSOC_NEED_SPECTRUM_MGMT 22
  363. #define IEEE80211_STATUS_ASSOC_BAD_POWER 23
  364. #define IEEE80211_STATUS_ASSOC_BAD_CHANNELS 24
  365. #define IEEE80211_STATUS_ASSOC_NEED_SHORT_SLOT 25
  366. #define IEEE80211_STATUS_ASSOC_NEED_DSSS_OFDM 26
  367. #define IEEE80211_STATUS_QOS_FAILURE 32
  368. #define IEEE80211_STATUS_QOS_NO_ROOM 33
  369. #define IEEE80211_STATUS_LINK_IS_HORRIBLE 34
  370. #define IEEE80211_STATUS_ASSOC_NEED_QOS 35
  371. #define IEEE80211_STATUS_REQUEST_DECLINED 37
  372. #define IEEE80211_STATUS_REQUEST_INVALID 38
  373. #define IEEE80211_STATUS_TS_NOT_CREATED_AGAIN 39
  374. #define IEEE80211_STATUS_INVALID_IE 40
  375. #define IEEE80211_STATUS_GROUP_CIPHER_INVALID 41
  376. #define IEEE80211_STATUS_PAIR_CIPHER_INVALID 42
  377. #define IEEE80211_STATUS_AKMP_INVALID 43
  378. #define IEEE80211_STATUS_RSN_VERSION_UNSUPP 44
  379. #define IEEE80211_STATUS_RSN_CAPAB_INVALID 45
  380. #define IEEE80211_STATUS_CIPHER_REJECTED 46
  381. #define IEEE80211_STATUS_TS_NOT_CREATED_WAIT 47
  382. #define IEEE80211_STATUS_DIRECT_LINK_FORBIDDEN 48
  383. #define IEEE80211_STATUS_DEST_NOT_PRESENT 49
  384. #define IEEE80211_STATUS_DEST_NOT_QOS 50
  385. #define IEEE80211_STATUS_ASSOC_LISTEN_TOO_HIGH 51
  386. /** @} */
  387. /**
  388. * @defgroup ieee80211_reason 802.11 reason codes
  389. *
  390. * These are returned to indicate the reason for a deauthentication or
  391. * disassociation sent (usually) after authentication or association
  392. * had succeeded. In gPXE, the lower 5 bits of the reason code are
  393. * encoded into the file-unique portion of an error code, the ERRFILE
  394. * portion is always @c ERRFILE_net80211, and the POSIX error code is
  395. * @c ECONNRESET for reason 0-31 or @c ENETRESET for reason 32-63.
  396. *
  397. * For a complete table with non-abbreviated error messages, see IEEE
  398. * Std 802.11-2007, Table 7-22, p.92.
  399. *
  400. * @{
  401. */
  402. #define IEEE80211_REASON_NONE 0
  403. #define IEEE80211_REASON_UNSPECIFIED 1
  404. #define IEEE80211_REASON_AUTH_NO_LONGER_VALID 2
  405. #define IEEE80211_REASON_LEAVING 3
  406. #define IEEE80211_REASON_INACTIVITY 4
  407. #define IEEE80211_REASON_OUT_OF_RESOURCES 5
  408. #define IEEE80211_REASON_NEED_AUTH 6
  409. #define IEEE80211_REASON_NEED_ASSOC 7
  410. #define IEEE80211_REASON_LEAVING_TO_ROAM 8
  411. #define IEEE80211_REASON_REASSOC_INVALID 9
  412. #define IEEE80211_REASON_BAD_POWER 10
  413. #define IEEE80211_REASON_BAD_CHANNELS 11
  414. #define IEEE80211_REASON_INVALID_IE 13
  415. #define IEEE80211_REASON_MIC_FAILURE 14
  416. #define IEEE80211_REASON_4WAY_TIMEOUT 15
  417. #define IEEE80211_REASON_GROUPKEY_TIMEOUT 16
  418. #define IEEE80211_REASON_4WAY_INVALID 17
  419. #define IEEE80211_REASON_GROUP_CIPHER_INVALID 18
  420. #define IEEE80211_REASON_PAIR_CIPHER_INVALID 19
  421. #define IEEE80211_REASON_AKMP_INVALID 20
  422. #define IEEE80211_REASON_RSN_VERSION_INVALID 21
  423. #define IEEE80211_REASON_RSN_CAPAB_INVALID 22
  424. #define IEEE80211_REASON_8021X_FAILURE 23
  425. #define IEEE80211_REASON_CIPHER_REJECTED 24
  426. #define IEEE80211_REASON_QOS_UNSPECIFIED 32
  427. #define IEEE80211_REASON_QOS_OUT_OF_RESOURCES 33
  428. #define IEEE80211_REASON_LINK_IS_HORRIBLE 34
  429. #define IEEE80211_REASON_INVALID_TXOP 35
  430. #define IEEE80211_REASON_REQUESTED_LEAVING 36
  431. #define IEEE80211_REASON_REQUESTED_NO_USE 37
  432. #define IEEE80211_REASON_REQUESTED_NEED_SETUP 38
  433. #define IEEE80211_REASON_REQUESTED_TIMEOUT 39
  434. #define IEEE80211_REASON_CIPHER_UNSUPPORTED 45
  435. /** @} */
  436. /* ---------- Information element declarations ---------- */
  437. /**
  438. * @defgroup ieee80211_ie 802.11 information elements
  439. *
  440. * Many management frames include a section that amounts to a
  441. * concatenation of these information elements, so that the sender can
  442. * choose which information to send and the receiver can ignore the
  443. * parts it doesn't understand. Each IE contains a two-byte header,
  444. * one byte ID and one byte length, followed by IE-specific data. The
  445. * length does not include the two-byte header. Information elements
  446. * are required to be sorted by ID, but gPXE does not require that in
  447. * those it receives.
  448. *
  449. * This group also includes a few inline functions to simplify common
  450. * tasks in IE processing.
  451. *
  452. * @{
  453. */
  454. /** Generic 802.11 information element header */
  455. struct ieee80211_ie_header {
  456. u8 id; /**< Information element ID */
  457. u8 len; /**< Information element length */
  458. } __attribute__ ((packed));
  459. /** 802.11 SSID information element */
  460. struct ieee80211_ie_ssid {
  461. u8 id; /**< SSID ID: 0 */
  462. u8 len; /**< SSID length */
  463. char ssid[0]; /**< SSID data, not NUL-terminated */
  464. } __attribute__ ((packed));
  465. /** Information element ID for SSID information element */
  466. #define IEEE80211_IE_SSID 0
  467. /** 802.11 rates information element
  468. *
  469. * The first 8 rates go in an IE of type RATES (1), and any more rates
  470. * go in one of type EXT_RATES (50). Each rate is a byte with the low
  471. * 7 bits equal to the rate in units of 500 kbps, and the high bit set
  472. * if and only if the rate is "basic" (must be supported by all
  473. * connected stations).
  474. */
  475. struct ieee80211_ie_rates {
  476. u8 id; /**< Rates ID: 1 or 50 */
  477. u8 len; /**< Number of rates */
  478. u8 rates[0]; /**< Rates data, one rate per byte */
  479. } __attribute__ ((packed));
  480. /** Information element ID for rates information element */
  481. #define IEEE80211_IE_RATES 1
  482. /** Information element ID for extended rates information element */
  483. #define IEEE80211_IE_EXT_RATES 50
  484. /** 802.11 Direct Spectrum parameter information element
  485. *
  486. * This just contains the channel number. It has the fancy name
  487. * because IEEE 802.11 also defines a frequency-hopping PHY that
  488. * changes channels at regular intervals following a predetermined
  489. * pattern; in practice nobody uses the FH PHY.
  490. */
  491. struct ieee80211_ie_ds_param {
  492. u8 id; /**< DS parameter ID: 3 */
  493. u8 len; /**< DS parameter length: 1 */
  494. u8 current_channel; /**< Current channel number, 1-14 */
  495. } __attribute__ ((packed));
  496. /** Information element ID for Direct Spectrum parameter information element */
  497. #define IEEE80211_IE_DS_PARAM 3
  498. /** 802.11 Country information element regulatory extension triplet */
  499. struct ieee80211_ie_country_ext_triplet {
  500. u8 reg_ext_id; /**< Regulatory extension ID */
  501. u8 reg_class_id; /**< Regulatory class ID */
  502. u8 coverage_class; /**< Coverage class */
  503. } __attribute__ ((packed));
  504. /** 802.11 Country information element regulatory band triplet */
  505. struct ieee80211_ie_country_band_triplet {
  506. u8 first_channel; /**< Channel number for first channel in band */
  507. u8 nr_channels; /**< Number of contiguous channels in band */
  508. u8 max_txpower; /**< Maximum TX power in dBm */
  509. } __attribute__ ((packed));
  510. /** 802.11 Country information element regulatory triplet
  511. *
  512. * It is a band triplet if the first byte is 200 or less, and a
  513. * regulatory extension triplet otherwise.
  514. */
  515. union ieee80211_ie_country_triplet {
  516. /** Differentiator between band and ext triplets */
  517. u8 first;
  518. /** Information about a band of channels */
  519. struct ieee80211_ie_country_band_triplet band;
  520. /** Regulatory extension information */
  521. struct ieee80211_ie_country_ext_triplet ext;
  522. };
  523. /** 802.11 Country information element
  524. *
  525. * This contains some data about RF regulations.
  526. */
  527. struct ieee80211_ie_country {
  528. u8 id; /**< Country information ID: 7 */
  529. u8 len; /**< Country information length: varies */
  530. char name[2]; /**< ISO Alpha2 country code */
  531. char in_out; /**< 'I' for indoor, 'O' for outdoor */
  532. /** List of regulatory triplets */
  533. union ieee80211_ie_country_triplet triplet[0];
  534. } __attribute__ ((packed));
  535. /** Information element ID for Country information element */
  536. #define IEEE80211_IE_COUNTRY 7
  537. /** 802.11 Request information element
  538. *
  539. * This contains a list of information element types we would like to
  540. * be included in probe response frames.
  541. */
  542. struct ieee80211_ie_request {
  543. u8 id; /**< Request ID: 10 */
  544. u8 len; /**< Number of IEs requested */
  545. u8 request[0]; /**< List of IEs requested */
  546. } __attribute__ ((packed));
  547. /** Information element ID for Request information element */
  548. #define IEEE80211_IE_REQUEST 10
  549. /** 802.11 Challenge Text information element
  550. *
  551. * This is used in authentication frames under Shared Key
  552. * authentication.
  553. */
  554. struct ieee80211_ie_challenge_text {
  555. u8 id; /**< Challenge Text ID: 16 */
  556. u8 len; /**< Challenge Text length: usually 128 */
  557. u8 challenge_text[0]; /**< Challenge Text data */
  558. } __attribute__ ((packed));
  559. /** Information element ID for Challenge Text information element */
  560. #define IEEE80211_IE_CHALLENGE_TEXT 16
  561. /** 802.11 Power Constraint information element
  562. *
  563. * This is used to specify an additional power limitation on top of
  564. * the Country requirements.
  565. */
  566. struct ieee80211_ie_power_constraint {
  567. u8 id; /**< Power Constraint ID: 52 */
  568. u8 len; /**< Power Constraint length: 1 */
  569. u8 power_constraint; /**< Decrease in allowed TX power, dBm */
  570. } __attribute__ ((packed));
  571. /** Information element ID for Power Constraint information element */
  572. #define IEEE80211_IE_POWER_CONSTRAINT 52
  573. /** 802.11 Power Capability information element
  574. *
  575. * This is used in association request frames to indicate the extremes
  576. * of our TX power abilities. It is required only if we indicate
  577. * support for spectrum management.
  578. */
  579. struct ieee80211_ie_power_capab {
  580. u8 id; /**< Power Capability ID: 33 */
  581. u8 len; /**< Power Capability length: 2 */
  582. u8 min_txpower; /**< Minimum possible TX power, dBm */
  583. u8 max_txpower; /**< Maximum possible TX power, dBm */
  584. } __attribute__ ((packed));
  585. /** Information element ID for Power Capability information element */
  586. #define IEEE80211_IE_POWER_CAPAB 33
  587. /** 802.11 Channels information element channel band tuple */
  588. struct ieee80211_ie_channels_channel_band {
  589. u8 first_channel; /**< Channel number of first channel in band */
  590. u8 nr_channels; /**< Number of channels in band */
  591. } __attribute__ ((packed));
  592. /** 802.11 Channels information element
  593. *
  594. * This is used in association frames to indicate the channels we can
  595. * use. It is required only if we indicate support for spectrum
  596. * management.
  597. */
  598. struct ieee80211_ie_channels {
  599. u8 id; /**< Channels ID: 36 */
  600. u8 len; /**< Channels length: 2 */
  601. /** List of (start, length) channel bands we can use */
  602. struct ieee80211_ie_channels_channel_band channels[0];
  603. } __attribute__ ((packed));
  604. /** Information element ID for Channels information element */
  605. #define IEEE80211_IE_CHANNELS 36
  606. /** 802.11 ERP Information information element
  607. *
  608. * This is used to communicate some PHY-level flags.
  609. */
  610. struct ieee80211_ie_erp_info {
  611. u8 id; /**< ERP Information ID: 42 */
  612. u8 len; /**< ERP Information length: 1 */
  613. u8 erp_info; /**< ERP flags */
  614. } __attribute__ ((packed));
  615. /** Information element ID for ERP Information information element */
  616. #define IEEE80211_IE_ERP_INFO 42
  617. /** ERP information element: Flag set if 802.11b stations are present */
  618. #define IEEE80211_ERP_NONERP_PRESENT 0x01
  619. /** ERP information element: Flag set if CTS protection must be used */
  620. #define IEEE80211_ERP_USE_PROTECTION 0x02
  621. /** ERP information element: Flag set if long preambles must be used */
  622. #define IEEE80211_ERP_BARKER_LONG 0x04
  623. /** 802.11 Robust Security Network ("WPA") information element
  624. *
  625. * Showing once again a striking clarity of design, the IEEE folks put
  626. * dynamically-sized data in the middle of this structure. As such,
  627. * the below structure definition is only a guideline; the
  628. * @c IEEE80211_RSN_FIELD, @c IEEE80211_RSN_CIPHER, and
  629. * @c IEEE80211_RSN_AUTHTYPE macros should be used to access any
  630. * data.
  631. *
  632. * Also inspired was IEEE's choice of 16-bit fields to count the
  633. * number of 4-byte elements in a structure with a maximum length of
  634. * 255 bytes.
  635. *
  636. * Many fields reference a cipher or authentication-type ID; this is a
  637. * three-byte OUI followed by one byte identifying the cipher with
  638. * respect to that OUI. For all standard ciphers the OUI is 00:0F:AC.
  639. *
  640. * The authentication types referenced in this structure have nothing
  641. * to do with 802.11 authentication frames or the @c algorithm field
  642. * within them.
  643. */
  644. struct ieee80211_ie_rsn {
  645. /** Information element ID */
  646. u8 id;
  647. /** Information element length */
  648. u8 len;
  649. /** RSN information element version */
  650. u16 version;
  651. /** Cipher ID for the cipher used in multicast/broadcast frames */
  652. u8 group_cipher[4];
  653. /** Number of unicast ciphers supported */
  654. u16 pairwise_count;
  655. /** List of cipher IDs for supported unicast frame ciphers */
  656. u8 pairwise_cipher[4];
  657. /** Number of authentication types supported */
  658. u16 akm_count;
  659. /** List of authentication type IDs for supported types */
  660. u8 akm_list[4];
  661. /** Security capabilities field. */
  662. u16 rsn_capab;
  663. /** Number of PMKIDs included (present only in association frames) */
  664. u16 pmkid_count;
  665. /** List of PMKIDs included, each a 16-byte SHA1 hash */
  666. u8 pmkid_list[0];
  667. } __attribute__((packed));
  668. /** Information element ID for Robust Security Network information element */
  669. #define IEEE80211_IE_RSN 48
  670. /** OUI for standard ciphers in RSN information element */
  671. #define IEEE80211_RSN_OUI "\x00\x0F\xAC"
  672. /** Extract RSN IE version field */
  673. #define IEEE80211_RSN_FIELD_version( rsnp ) ( (rsnp)->version )
  674. /** Extract RSN IE group_cipher field */
  675. #define IEEE80211_RSN_FIELD_group_cipher( rsnp ) ( (rsnp)->group_cipher )
  676. /** Extract RSN IE pairwise_count field */
  677. #define IEEE80211_RSN_FIELD_pairwise_count( rsnp ) ( (rsnp)->pairwise_count )
  678. /** Extract RSN IE akm_count field */
  679. #define IEEE80211_RSN_FIELD_akm_count( rsnp ) \
  680. ( ( ( struct ieee80211_ie_rsn * ) ( ( void * ) ( rsnp ) + \
  681. 4*( ( rsnp )->pairwise_count - 1 ) ) )->akm_count )
  682. /** Extract RSN IE rsn_capab field */
  683. #define IEEE80211_RSN_FIELD_rsn_capab( rsnp ) \
  684. ( ( ( struct ieee80211_ie_rsn * ) ( ( void * ) ( rsnp ) + \
  685. 4*( ( rsnp )->pairwise_count - 1 ) + \
  686. 4*( ( rsnp )->akm_count - 1 ) ) )->rsn_capab )
  687. /** Extract RSN IE pmkid_count field */
  688. #define IEEE80211_RSN_FIELD_pmkid_count( rsnp ) \
  689. ( ( ( struct ieee80211_ie_rsn * ) ( ( void * ) ( rsnp ) + \
  690. 4*( ( rsnp )->pairwise_count - 1 ) + \
  691. 4*( ( rsnp )->akm_count - 1 ) ) )->pmkid_count )
  692. /** Extract field from RSN information element
  693. *
  694. * @v rsnp Pointer to RSN information element
  695. * @v field Name of field to extract
  696. * @ret val Lvalue of the requested field
  697. *
  698. * You must fill the fields of the structure in order for this to work
  699. * properly.
  700. */
  701. #define IEEE80211_RSN_FIELD( rsnp, field ) \
  702. IEEE80211_RSN_FIELD_ ## field ( rsnp )
  703. /** Get pointer to pairwise cipher from RSN information element
  704. *
  705. * @v rsnp Pointer to RSN information element
  706. * @v cipher Index of pairwise cipher to extract
  707. * @ret ptr Pointer to requested cipher
  708. */
  709. #define IEEE80211_RSN_CIPHER( rsnp, cipher ) \
  710. ( ( rsnp )->pairwise_cipher + 4 * ( cipher ) )
  711. /** Get pointer to authentication type from RSN information element
  712. *
  713. * @v rsnp Pointer to RSN information element
  714. * @v akm Index of authentication type to extract
  715. * @ret ptr Pointer to requested authentication type
  716. *
  717. * The @c pairwise_count field must be correct.
  718. */
  719. #define IEEE80211_RSN_AUTHTYPE( rsnp, akm ) \
  720. ( ( rsnp )->akm_list + 4 * ( ( rsnp )->pairwise_count - 1 ) + 4 * ( akm ) )
  721. /** Get pointer to PMKID from RSN information element
  722. *
  723. * @v rsnp Pointer to RSN information element
  724. * @v idx Index of PMKID to extract
  725. * @ret ptr Pointer to requested PMKID
  726. *
  727. * The @c pairwise_count and @c akm_count fields must be correct.
  728. */
  729. #define IEEE80211_RSN_PMKID( rsnp, idx ) \
  730. ( ( rsnp )->pmkid_list + 4 * ( ( rsnp )->pairwise_count - 1 ) + \
  731. 4 * ( ( rsnp )->akm_count - 1 ) + 16 * ( idx ) )
  732. /** Verify size of RSN information element
  733. *
  734. * @v rsnp Pointer to RSN information element
  735. * @ret ok TRUE if count fields are consistent with length field
  736. *
  737. * It is important to drop any RSN IE that does not pass this function
  738. * before using the @c IEEE80211_RSN_FIELD, @c IEEE80211_RSN_CIPHER,
  739. * and @c IEEE80211_RSN_AUTHTYPE macros, to avoid potential security
  740. * compromise due to a malformed RSN IE.
  741. *
  742. * This function does not consider the possibility of some PMKIDs
  743. * included in the RSN IE, because PMKIDs are only included in RSN IEs
  744. * sent in association request frames, and we should never receive an
  745. * association request frame. An RSN IE that includes PMKIDs will
  746. * always fail this check.
  747. */
  748. static inline int ieee80211_rsn_check ( struct ieee80211_ie_rsn *rsnp ) {
  749. if ( rsnp->len < 12 + 4 * rsnp->pairwise_count )
  750. return 0;
  751. return ( rsnp->len == 12 + 4 * ( rsnp->pairwise_count +
  752. IEEE80211_RSN_FIELD ( rsnp, akm_count ) ) );
  753. }
  754. /** Calculate necessary size of RSN information element
  755. *
  756. * @v npair Number of pairwise ciphers supported
  757. * @v nauth Number of authentication types supported
  758. * @v npmkid Number of PMKIDs to include
  759. * @ret size Necessary size of RSN IE, including header bytes
  760. */
  761. static inline size_t ieee80211_rsn_size ( int npair, int nauth, int npmkid ) {
  762. return 16 + 4 * ( npair + nauth ) + 16 * npmkid;
  763. }
  764. /** 802.11 RSN IE: expected version number */
  765. #define IEEE80211_RSN_VERSION 1
  766. /** 802.11 RSN IE: fourth byte of cipher type for 40-bit WEP */
  767. #define IEEE80211_RSN_CTYPE_WEP40 1
  768. /** 802.11 RSN IE: fourth byte of cipher type for 104-bit WEP */
  769. #define IEEE80211_RSN_CTYPE_WEP104 5
  770. /** 802.11 RSN IE: fourth byte of cipher type for TKIP ("WPA") */
  771. #define IEEE80211_RSN_CTYPE_TKIP 2
  772. /** 802.11 RSN IE: fourth byte of cipher type for CCMP ("WPA2") */
  773. #define IEEE80211_RSN_CTYPE_CCMP 4
  774. /** 802.11 RSN IE: fourth byte of cipher type for "use group"
  775. *
  776. * This can only appear as a pairwise cipher, and means unicast frames
  777. * should be encrypted in the same way as broadcast/multicast frames.
  778. */
  779. #define IEEE80211_RSN_CTYPE_USEGROUP 0
  780. /** 802.11 RSN IE: fourth byte of auth method type for using an 802.1X server */
  781. #define IEEE80211_RSN_ATYPE_8021X 1
  782. /** 802.11 RSN IE: fourth byte of auth method type for using a pre-shared key */
  783. #define IEEE80211_RSN_ATYPE_PSK 2
  784. /** 802.11 RSN IE capabilities: AP supports pre-authentication */
  785. #define IEEE80211_RSN_CAPAB_PREAUTH 0x001
  786. /** 802.11 RSN IE capabilities: Node has conflict between TKIP and WEP
  787. *
  788. * This is a legacy issue; APs always set it to 0, and gPXE sets it to
  789. * 0.
  790. */
  791. #define IEEE80211_RSN_CAPAB_NO_PAIRWISE 0x002
  792. /** 802.11 RSN IE capabilities: Number of PTKSA replay counters
  793. *
  794. * A value of 0 means one replay counter, 1 means two, 2 means four,
  795. * and 3 means sixteen.
  796. */
  797. #define IEEE80211_RSN_CAPAB_PTKSA_REPLAY 0x00C
  798. /** 802.11 RSN IE capabilities: Number of GTKSA replay counters
  799. *
  800. * A value of 0 means one replay counter, 1 means two, 2 means four,
  801. * and 3 means sixteen.
  802. */
  803. #define IEEE80211_RSN_CAPAB_GTKSA_REPLAY 0x030
  804. /** 802.11 RSN IE capabilities: PeerKey Handshaking is suported */
  805. #define IEEE80211_RSN_CAPAB_PEERKEY 0x200
  806. /** Any 802.11 information element
  807. *
  808. * This is formatted for ease of use, so IEs with complex structures
  809. * get referenced in full, while those with only one byte of data or a
  810. * simple array are pulled in to avoid a layer of indirection like
  811. * ie->channels.channels[0].
  812. */
  813. union ieee80211_ie
  814. {
  815. /** Generic and simple information element info */
  816. struct {
  817. u8 id; /**< Information element ID */
  818. u8 len; /**< Information element data length */
  819. union {
  820. char ssid[0]; /**< SSID text */
  821. u8 rates[0]; /**< Rates data */
  822. u8 request[0]; /**< Request list */
  823. u8 challenge_text[0]; /**< Challenge text data */
  824. u8 power_constraint; /**< Power constraint, dBm */
  825. u8 erp_info; /**< ERP information flags */
  826. /** List of channels */
  827. struct ieee80211_ie_channels_channel_band channels[0];
  828. };
  829. };
  830. /** DS parameter set */
  831. struct ieee80211_ie_ds_param ds_param;
  832. /** Country information */
  833. struct ieee80211_ie_country country;
  834. /** Power capability */
  835. struct ieee80211_ie_power_capab power_capab;
  836. /** Security information */
  837. struct ieee80211_ie_rsn rsn;
  838. };
  839. /** Advance to next 802.11 information element
  840. *
  841. * @v ie Current information element pointer
  842. * @v end Pointer to first byte not in information element space
  843. * @ret next Pointer to next information element, or NULL if no more
  844. *
  845. * When processing received IEs, @a end should be set to the I/O
  846. * buffer tail pointer; when marshalling IEs for sending, @a end
  847. * should be NULL.
  848. */
  849. static inline union ieee80211_ie * ieee80211_next_ie ( union ieee80211_ie *ie,
  850. void *end )
  851. {
  852. void *next_ie_byte = ( void * ) ie + ie->len + 2;
  853. union ieee80211_ie *next_ie = next_ie_byte;
  854. if ( ! end )
  855. return next_ie;
  856. if ( next_ie_byte < end && next_ie_byte + next_ie->len <= end )
  857. return next_ie;
  858. return NULL;
  859. }
  860. /** @} */
  861. /* ---------- Management frame data formats ---------- */
  862. /**
  863. * @defgroup ieee80211_mgmt_data Management frame data payloads
  864. * @{
  865. */
  866. /** Beacon or probe response frame data */
  867. struct ieee80211_beacon_or_probe_resp
  868. {
  869. /** 802.11 TSFT value at frame send */
  870. u64 timestamp;
  871. /** Interval at which beacons are sent, in units of 1024 us */
  872. u16 beacon_interval;
  873. /** Capability flags */
  874. u16 capability;
  875. /** List of information elements */
  876. union ieee80211_ie info_element[0];
  877. } __attribute__((packed));
  878. #define ieee80211_beacon ieee80211_beacon_or_probe_resp
  879. #define ieee80211_probe_resp ieee80211_beacon_or_probe_resp
  880. /** Disassociation or deauthentication frame data */
  881. struct ieee80211_disassoc_or_deauth
  882. {
  883. /** Reason code */
  884. u16 reason;
  885. } __attribute__((packed));
  886. #define ieee80211_disassoc ieee80211_disassoc_or_deauth
  887. #define ieee80211_deauth ieee80211_disassoc_or_deauth
  888. /** Association request frame data */
  889. struct ieee80211_assoc_req
  890. {
  891. /** Capability flags */
  892. u16 capability;
  893. /** Interval at which we wake up, in units of the beacon interval */
  894. u16 listen_interval;
  895. /** List of information elements */
  896. union ieee80211_ie info_element[0];
  897. } __attribute__((packed));
  898. /** Association or reassociation response frame data */
  899. struct ieee80211_assoc_or_reassoc_resp
  900. {
  901. /** Capability flags */
  902. u16 capability;
  903. /** Status code */
  904. u16 status;
  905. /** Association ID */
  906. u16 aid;
  907. /** List of information elements */
  908. union ieee80211_ie info_element[0];
  909. } __attribute__((packed));
  910. #define ieee80211_assoc_resp ieee80211_assoc_or_reassoc_resp
  911. #define ieee80211_reassoc_resp ieee80211_assoc_or_reassoc_resp
  912. /** Reassociation request frame data */
  913. struct ieee80211_reassoc_req
  914. {
  915. /** Capability flags */
  916. u16 capability;
  917. /** Interval at which we wake up, in units of the beacon interval */
  918. u16 listen_interval;
  919. /** MAC address of current Access Point */
  920. u8 current_addr[ETH_ALEN];
  921. /** List of information elements */
  922. union ieee80211_ie info_element[0];
  923. } __attribute__((packed));
  924. /** Probe request frame data */
  925. struct ieee80211_probe_req
  926. {
  927. /** List of information elements */
  928. union ieee80211_ie info_element[0];
  929. } __attribute__((packed));
  930. /** Authentication frame data */
  931. struct ieee80211_auth
  932. {
  933. /** Authentication algorithm (Open System or Shared Key) */
  934. u16 algorithm;
  935. /** Sequence number of this frame; first from client to AP is 1 */
  936. u16 tx_seq;
  937. /** Status code */
  938. u16 status;
  939. /** List of information elements */
  940. union ieee80211_ie info_element[0];
  941. } __attribute__((packed));
  942. /** Open System authentication algorithm */
  943. #define IEEE80211_AUTH_OPEN_SYSTEM 0
  944. /** Shared Key authentication algorithm */
  945. #define IEEE80211_AUTH_SHARED_KEY 1
  946. /** @} */
  947. #endif