1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause 3 * 4 * Copyright (c) 2001 Atsushi Onoe 5 * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 #ifndef _NET80211_IEEE80211_IOCTL_H_ 29 #define _NET80211_IEEE80211_IOCTL_H_ 30 31 #ifndef IEEE80211_IOCTLS_ABBREVIATED 32 /* 33 * IEEE 802.11 ioctls. 34 */ 35 #include <net80211/_ieee80211.h> 36 #include <net80211/ieee80211.h> 37 #include <net80211/ieee80211_crypto.h> 38 39 /* 40 * Per/node (station) statistics. 41 */ 42 struct ieee80211_nodestats { 43 uint32_t ns_rx_data; /* rx data frames */ 44 uint32_t ns_rx_mgmt; /* rx management frames */ 45 uint32_t ns_rx_ctrl; /* rx control frames */ 46 uint32_t ns_rx_ucast; /* rx unicast frames */ 47 uint32_t ns_rx_mcast; /* rx multi/broadcast frames */ 48 uint64_t ns_rx_bytes; /* rx data count (bytes) */ 49 uint64_t ns_rx_beacons; /* rx beacon frames */ 50 uint32_t ns_rx_proberesp; /* rx probe response frames */ 51 52 uint32_t ns_rx_dup; /* rx discard 'cuz dup */ 53 uint32_t ns_rx_noprivacy; /* rx w/ wep but privacy off */ 54 uint32_t ns_rx_wepfail; /* rx wep processing failed */ 55 uint32_t ns_rx_demicfail; /* rx demic failed */ 56 uint32_t ns_rx_decap; /* rx decapsulation failed */ 57 uint32_t ns_rx_defrag; /* rx defragmentation failed */ 58 uint32_t ns_rx_disassoc; /* rx disassociation */ 59 uint32_t ns_rx_deauth; /* rx deauthentication */ 60 uint32_t ns_rx_action; /* rx action */ 61 uint32_t ns_rx_decryptcrc; /* rx decrypt failed on crc */ 62 uint32_t ns_rx_unauth; /* rx on unauthorized port */ 63 uint32_t ns_rx_unencrypted; /* rx unecrypted w/ privacy */ 64 uint32_t ns_rx_drop; /* rx discard other reason */ 65 66 uint32_t ns_tx_data; /* tx data frames */ 67 uint32_t ns_tx_mgmt; /* tx management frames */ 68 uint32_t ns_tx_ctrl; /* tx control frames */ 69 uint32_t ns_tx_ucast; /* tx unicast frames */ 70 uint32_t ns_tx_mcast; /* tx multi/broadcast frames */ 71 uint64_t ns_tx_bytes; /* tx data count (bytes) */ 72 uint32_t ns_tx_probereq; /* tx probe request frames */ 73 74 uint32_t ns_tx_novlantag; /* tx discard 'cuz no tag */ 75 uint32_t ns_tx_vlanmismatch; /* tx discard 'cuz bad tag */ 76 77 uint32_t ns_ps_discard; /* ps discard 'cuz of age */ 78 79 /* MIB-related state */ 80 uint32_t ns_tx_assoc; /* [re]associations */ 81 uint32_t ns_tx_assoc_fail; /* [re]association failures */ 82 uint32_t ns_tx_auth; /* [re]authentications */ 83 uint32_t ns_tx_auth_fail; /* [re]authentication failures*/ 84 uint32_t ns_tx_deauth; /* deauthentications */ 85 uint32_t ns_tx_deauth_code; /* last deauth reason */ 86 uint32_t ns_tx_disassoc; /* disassociations */ 87 uint32_t ns_tx_disassoc_code; /* last disassociation reason */ 88 89 /* Hardware A-MSDU decode */ 90 uint32_t ns_rx_amsdu_more; /* RX decap A-MSDU, more coming from A-MSDU */ 91 uint32_t ns_rx_amsdu_more_end; /* RX decap A-MSDU (or any other frame), no more coming */ 92 uint32_t ns_spare[6]; 93 }; 94 95 /* 96 * Summary statistics. 97 */ 98 struct ieee80211_stats { 99 uint32_t is_rx_badversion; /* rx frame with bad version */ 100 uint32_t is_rx_tooshort; /* rx frame too short */ 101 uint32_t is_rx_wrongbss; /* rx from wrong bssid */ 102 uint32_t is_rx_dup; /* rx discard 'cuz dup */ 103 uint32_t is_rx_wrongdir; /* rx w/ wrong direction */ 104 uint32_t is_rx_mcastecho; /* rx discard 'cuz mcast echo */ 105 uint32_t is_rx_notassoc; /* rx discard 'cuz sta !assoc */ 106 uint32_t is_rx_noprivacy; /* rx w/ wep but privacy off */ 107 uint32_t is_rx_unencrypted; /* rx w/o wep and privacy on */ 108 uint32_t is_rx_wepfail; /* rx wep processing failed */ 109 uint32_t is_rx_decap; /* rx decapsulation failed */ 110 uint32_t is_rx_mgtdiscard; /* rx discard mgt frames */ 111 uint32_t is_rx_ctl; /* rx ctrl frames */ 112 uint32_t is_rx_beacon; /* rx beacon frames */ 113 uint32_t is_rx_rstoobig; /* rx rate set truncated */ 114 uint32_t is_rx_elem_missing; /* rx required element missing*/ 115 uint32_t is_rx_elem_toobig; /* rx element too big */ 116 uint32_t is_rx_elem_toosmall; /* rx element too small */ 117 uint32_t is_rx_elem_unknown; /* rx element unknown */ 118 uint32_t is_rx_badchan; /* rx frame w/ invalid chan */ 119 uint32_t is_rx_chanmismatch; /* rx frame chan mismatch */ 120 uint32_t is_rx_nodealloc; /* rx frame dropped */ 121 uint32_t is_rx_ssidmismatch; /* rx frame ssid mismatch */ 122 uint32_t is_rx_auth_unsupported; /* rx w/ unsupported auth alg */ 123 uint32_t is_rx_auth_fail; /* rx sta auth failure */ 124 uint32_t is_rx_auth_countermeasures;/* rx auth discard 'cuz CM */ 125 uint32_t is_rx_assoc_bss; /* rx assoc from wrong bssid */ 126 uint32_t is_rx_assoc_notauth; /* rx assoc w/o auth */ 127 uint32_t is_rx_assoc_capmismatch;/* rx assoc w/ cap mismatch */ 128 uint32_t is_rx_assoc_norate; /* rx assoc w/ no rate match */ 129 uint32_t is_rx_assoc_badwpaie; /* rx assoc w/ bad WPA IE */ 130 uint32_t is_rx_deauth; /* rx deauthentication */ 131 uint32_t is_rx_disassoc; /* rx disassociation */ 132 uint32_t is_rx_badsubtype; /* rx frame w/ unknown subtype*/ 133 uint32_t is_rx_nobuf; /* rx failed for lack of buf */ 134 uint32_t is_rx_decryptcrc; /* rx decrypt failed on crc */ 135 uint32_t is_rx_ahdemo_mgt; /* rx discard ahdemo mgt frame*/ 136 uint32_t is_rx_bad_auth; /* rx bad auth request */ 137 uint32_t is_rx_unauth; /* rx on unauthorized port */ 138 uint32_t is_rx_badkeyid; /* rx w/ incorrect keyid */ 139 uint32_t is_rx_ccmpreplay; /* rx seq# violation (CCMP) */ 140 uint32_t is_rx_ccmpformat; /* rx format bad (CCMP) */ 141 uint32_t is_rx_ccmpmic; /* rx MIC check failed (CCMP) */ 142 uint32_t is_rx_tkipreplay; /* rx seq# violation (TKIP) */ 143 uint32_t is_rx_tkipformat; /* rx format bad (TKIP) */ 144 uint32_t is_rx_tkipmic; /* rx MIC check failed (TKIP) */ 145 uint32_t is_rx_tkipicv; /* rx ICV check failed (TKIP) */ 146 uint32_t is_rx_badcipher; /* rx failed 'cuz key type */ 147 uint32_t is_rx_nocipherctx; /* rx failed 'cuz key !setup */ 148 uint32_t is_rx_acl; /* rx discard 'cuz acl policy */ 149 uint32_t is_tx_nobuf; /* tx failed for lack of buf */ 150 uint32_t is_tx_nonode; /* tx failed for no node */ 151 uint32_t is_tx_unknownmgt; /* tx of unknown mgt frame */ 152 uint32_t is_tx_badcipher; /* tx failed 'cuz key type */ 153 uint32_t is_tx_nodefkey; /* tx failed 'cuz no defkey */ 154 uint32_t is_tx_noheadroom; /* tx failed 'cuz no space */ 155 uint32_t is_tx_fragframes; /* tx frames fragmented */ 156 uint32_t is_tx_frags; /* tx fragments created */ 157 uint32_t is_scan_active; /* active scans started */ 158 uint32_t is_scan_passive; /* passive scans started */ 159 uint32_t is_node_timeout; /* nodes timed out inactivity */ 160 uint32_t is_crypto_nomem; /* no memory for crypto ctx */ 161 uint32_t is_crypto_tkip; /* tkip crypto done in s/w */ 162 uint32_t is_crypto_tkipenmic; /* tkip en-MIC done in s/w */ 163 uint32_t is_crypto_tkipdemic; /* tkip de-MIC done in s/w */ 164 uint32_t is_crypto_tkipcm; /* tkip counter measures */ 165 uint32_t is_crypto_ccmp; /* ccmp crypto done in s/w */ 166 uint32_t is_crypto_wep; /* wep crypto done in s/w */ 167 uint32_t is_crypto_setkey_cipher;/* cipher rejected key */ 168 uint32_t is_crypto_setkey_nokey; /* no key index for setkey */ 169 uint32_t is_crypto_delkey; /* driver key delete failed */ 170 uint32_t is_crypto_badcipher; /* unknown cipher */ 171 uint32_t is_crypto_nocipher; /* cipher not available */ 172 uint32_t is_crypto_attachfail; /* cipher attach failed */ 173 uint32_t is_crypto_swfallback; /* cipher fallback to s/w */ 174 uint32_t is_crypto_keyfail; /* driver key alloc failed */ 175 uint32_t is_crypto_enmicfail; /* en-MIC failed */ 176 uint32_t is_ibss_capmismatch; /* merge failed-cap mismatch */ 177 uint32_t is_ibss_norate; /* merge failed-rate mismatch */ 178 uint32_t is_ps_unassoc; /* ps-poll for unassoc. sta */ 179 uint32_t is_ps_badaid; /* ps-poll w/ incorrect aid */ 180 uint32_t is_ps_qempty; /* ps-poll w/ nothing to send */ 181 uint32_t is_ff_badhdr; /* fast frame rx'd w/ bad hdr */ 182 uint32_t is_ff_tooshort; /* fast frame rx decap error */ 183 uint32_t is_ff_split; /* fast frame rx split error */ 184 uint32_t is_ff_decap; /* fast frames decap'd */ 185 uint32_t is_ff_encap; /* fast frames encap'd for tx */ 186 uint32_t is_rx_badbintval; /* rx frame w/ bogus bintval */ 187 uint32_t is_rx_demicfail; /* rx demic failed */ 188 uint32_t is_rx_defrag; /* rx defragmentation failed */ 189 uint32_t is_rx_mgmt; /* rx management frames */ 190 uint32_t is_rx_action; /* rx action mgt frames */ 191 uint32_t is_amsdu_tooshort; /* A-MSDU rx decap error */ 192 uint32_t is_amsdu_split; /* A-MSDU rx split error */ 193 uint32_t is_amsdu_decap; /* A-MSDU decap'd */ 194 uint32_t is_amsdu_encap; /* A-MSDU encap'd for tx */ 195 uint32_t is_ampdu_bar_bad; /* A-MPDU BAR out of window */ 196 uint32_t is_ampdu_bar_oow; /* A-MPDU BAR before ADDBA */ 197 uint32_t is_ampdu_bar_move; /* A-MPDU BAR moved window */ 198 uint32_t is_ampdu_bar_rx; /* A-MPDU BAR frames handled */ 199 uint32_t is_ampdu_rx_flush; /* A-MPDU frames flushed */ 200 uint32_t is_ampdu_rx_oor; /* A-MPDU frames out-of-order */ 201 uint32_t is_ampdu_rx_copy; /* A-MPDU frames copied down */ 202 uint32_t is_ampdu_rx_drop; /* A-MPDU frames dropped */ 203 uint32_t is_tx_badstate; /* tx discard state != RUN */ 204 uint32_t is_tx_notassoc; /* tx failed, sta not assoc */ 205 uint32_t is_tx_classify; /* tx classification failed */ 206 uint32_t is_dwds_mcast; /* discard mcast over dwds */ 207 uint32_t is_dwds_qdrop; /* dwds pending frame q full */ 208 uint32_t is_ht_assoc_nohtcap; /* non-HT sta rejected */ 209 uint32_t is_ht_assoc_downgrade; /* HT sta forced to legacy */ 210 uint32_t is_ht_assoc_norate; /* HT assoc w/ rate mismatch */ 211 uint32_t is_ampdu_rx_age; /* A-MPDU sent up 'cuz of age */ 212 uint32_t is_ampdu_rx_move; /* A-MPDU MSDU moved window */ 213 uint32_t is_addba_reject; /* ADDBA reject 'cuz disabled */ 214 uint32_t is_addba_norequest; /* ADDBA response w/o ADDBA */ 215 uint32_t is_addba_badtoken; /* ADDBA response w/ wrong 216 dialogtoken */ 217 uint32_t is_addba_badpolicy; /* ADDBA resp w/ wrong policy */ 218 uint32_t is_ampdu_stop; /* A-MPDU stream stopped */ 219 uint32_t is_ampdu_stop_failed; /* A-MPDU stream not running */ 220 uint32_t is_ampdu_rx_reorder; /* A-MPDU held for rx reorder */ 221 uint32_t is_scan_bg; /* background scans started */ 222 uint8_t is_rx_deauth_code; /* last rx'd deauth reason */ 223 uint8_t is_rx_disassoc_code; /* last rx'd disassoc reason */ 224 uint8_t is_rx_authfail_code; /* last rx'd auth fail reason */ 225 uint32_t is_beacon_miss; /* beacon miss notification */ 226 uint32_t is_rx_badstate; /* rx discard state != RUN */ 227 uint32_t is_ff_flush; /* ff's flush'd from stageq */ 228 uint32_t is_tx_ctl; /* tx ctrl frames */ 229 uint32_t is_ampdu_rexmt; /* A-MPDU frames rexmt ok */ 230 uint32_t is_ampdu_rexmt_fail; /* A-MPDU frames rexmt fail */ 231 232 uint32_t is_mesh_wrongmesh; /* dropped 'cuz not mesh sta*/ 233 uint32_t is_mesh_nolink; /* dropped 'cuz link not estab*/ 234 uint32_t is_mesh_fwd_ttl; /* mesh not fwd'd 'cuz ttl 0 */ 235 uint32_t is_mesh_fwd_nobuf; /* mesh not fwd'd 'cuz no mbuf*/ 236 uint32_t is_mesh_fwd_tooshort; /* mesh not fwd'd 'cuz no hdr */ 237 uint32_t is_mesh_fwd_disabled; /* mesh not fwd'd 'cuz disabled */ 238 uint32_t is_mesh_fwd_nopath; /* mesh not fwd'd 'cuz path unknown */ 239 240 uint32_t is_hwmp_wrongseq; /* wrong hwmp seq no. */ 241 uint32_t is_hwmp_rootreqs; /* root PREQs sent */ 242 uint32_t is_hwmp_rootrann; /* root RANNs sent */ 243 244 uint32_t is_mesh_badae; /* dropped 'cuz invalid AE */ 245 uint32_t is_mesh_rtaddfailed; /* route add failed */ 246 uint32_t is_mesh_notproxy; /* dropped 'cuz not proxying */ 247 uint32_t is_rx_badalign; /* dropped 'cuz misaligned */ 248 uint32_t is_hwmp_proxy; /* PREP for proxy route */ 249 uint32_t is_beacon_bad; /* Number of bad beacons */ 250 uint32_t is_ampdu_bar_tx; /* A-MPDU BAR frames TXed */ 251 uint32_t is_ampdu_bar_tx_retry; /* A-MPDU BAR frames TX rtry */ 252 uint32_t is_ampdu_bar_tx_fail; /* A-MPDU BAR frames TX fail */ 253 254 uint32_t is_ff_encapfail; /* failed FF encap */ 255 uint32_t is_amsdu_encapfail; /* failed A-MSDU encap */ 256 257 uint32_t is_spare[5]; 258 }; 259 260 /* 261 * Max size of optional information elements. We artificially 262 * constrain this; it's limited only by the max frame size (and 263 * the max parameter size of the wireless extensions). 264 */ 265 #define IEEE80211_MAX_OPT_IE 256 266 267 /* 268 * WPA/RSN get/set key request. Specify the key/cipher 269 * type and whether the key is to be used for sending and/or 270 * receiving. The key index should be set only when working 271 * with global keys (use IEEE80211_KEYIX_NONE for ``no index''). 272 * Otherwise a unicast/pairwise key is specified by the bssid 273 * (on a station) or mac address (on an ap). They key length 274 * must include any MIC key data; otherwise it should be no 275 * more than IEEE80211_KEYBUF_SIZE. 276 */ 277 struct ieee80211req_key { 278 uint8_t ik_type; /* key/cipher type */ 279 uint8_t ik_pad; 280 uint16_t ik_keyix; /* key index */ 281 uint8_t ik_keylen; /* key length in bytes */ 282 uint8_t ik_flags; 283 /* NB: IEEE80211_KEY_XMIT and IEEE80211_KEY_RECV defined elsewhere */ 284 #define IEEE80211_KEY_DEFAULT 0x80 /* default xmit key */ 285 uint8_t ik_macaddr[IEEE80211_ADDR_LEN]; 286 uint64_t ik_keyrsc; /* key receive sequence counter */ 287 uint64_t ik_keytsc; /* key transmit sequence counter */ 288 uint8_t ik_keydata[IEEE80211_KEYBUF_SIZE+IEEE80211_MICBUF_SIZE]; 289 }; 290 291 /* 292 * Delete a key either by index or address. Set the index 293 * to IEEE80211_KEYIX_NONE when deleting a unicast key. 294 */ 295 struct ieee80211req_del_key { 296 uint8_t idk_keyix; /* key index */ 297 uint8_t idk_macaddr[IEEE80211_ADDR_LEN]; 298 }; 299 300 #endif /* IEEE80211_IOCTLS_ABBREVIATED */ 301 302 /* 303 * MLME state manipulation request. IEEE80211_MLME_ASSOC 304 * only makes sense when operating as a station. The other 305 * requests can be used when operating as a station or an 306 * ap (to effect a station). 307 */ 308 struct ieee80211req_mlme { 309 uint8_t im_op; /* operation to perform */ 310 #define IEEE80211_MLME_ASSOC 1 /* associate station */ 311 #define IEEE80211_MLME_DISASSOC 2 /* disassociate station */ 312 #define IEEE80211_MLME_DEAUTH 3 /* deauthenticate station */ 313 #define IEEE80211_MLME_AUTHORIZE 4 /* authorize station */ 314 #define IEEE80211_MLME_UNAUTHORIZE 5 /* unauthorize station */ 315 #define IEEE80211_MLME_AUTH 6 /* authenticate station */ 316 uint8_t im_ssid_len; /* length of optional ssid */ 317 uint16_t im_reason; /* 802.11 reason code */ 318 uint8_t im_macaddr[IEEE80211_ADDR_LEN]; 319 uint8_t im_ssid[IEEE80211_NWID_LEN]; 320 }; 321 322 #ifndef IEEE80211_IOCTLS_ABBREVIATED 323 324 /* 325 * MAC ACL operations. 326 */ 327 enum { 328 IEEE80211_MACCMD_POLICY_OPEN = 0, /* set policy: no ACL's */ 329 IEEE80211_MACCMD_POLICY_ALLOW = 1, /* set policy: allow traffic */ 330 IEEE80211_MACCMD_POLICY_DENY = 2, /* set policy: deny traffic */ 331 IEEE80211_MACCMD_FLUSH = 3, /* flush ACL database */ 332 IEEE80211_MACCMD_DETACH = 4, /* detach ACL policy */ 333 IEEE80211_MACCMD_POLICY = 5, /* get ACL policy */ 334 IEEE80211_MACCMD_LIST = 6, /* get ACL database */ 335 IEEE80211_MACCMD_POLICY_RADIUS = 7, /* set policy: RADIUS managed */ 336 }; 337 338 struct ieee80211req_maclist { 339 uint8_t ml_macaddr[IEEE80211_ADDR_LEN]; 340 } __packed; 341 342 /* 343 * Mesh Routing Table Operations. 344 */ 345 enum { 346 IEEE80211_MESH_RTCMD_LIST = 0, /* list HWMP routing table */ 347 IEEE80211_MESH_RTCMD_FLUSH = 1, /* flush HWMP routing table */ 348 IEEE80211_MESH_RTCMD_ADD = 2, /* add entry to the table */ 349 IEEE80211_MESH_RTCMD_DELETE = 3, /* delete an entry from the table */ 350 }; 351 352 struct ieee80211req_mesh_route { 353 uint8_t imr_flags; 354 #define IEEE80211_MESHRT_FLAGS_DISCOVER 0x01 355 #define IEEE80211_MESHRT_FLAGS_VALID 0x02 356 #define IEEE80211_MESHRT_FLAGS_PROXY 0x04 357 #define IEEE80211_MESHRT_FLAGS_GATE 0x08 358 uint8_t imr_dest[IEEE80211_ADDR_LEN]; 359 uint8_t imr_nexthop[IEEE80211_ADDR_LEN]; 360 uint16_t imr_nhops; 361 uint8_t imr_pad; 362 uint32_t imr_metric; 363 uint32_t imr_lifetime; 364 uint32_t imr_lastmseq; 365 }; 366 367 /* 368 * HWMP root modes 369 */ 370 enum { 371 IEEE80211_HWMP_ROOTMODE_DISABLED = 0, /* disabled */ 372 IEEE80211_HWMP_ROOTMODE_NORMAL = 1, /* normal PREPs */ 373 IEEE80211_HWMP_ROOTMODE_PROACTIVE = 2, /* proactive PREPS */ 374 IEEE80211_HWMP_ROOTMODE_RANN = 3, /* use RANN elemid */ 375 }; 376 377 /* 378 * Set the active channel list by IEEE channel #: each channel 379 * to be marked active is set in a bit vector. Note this list is 380 * intersected with the available channel list in calculating 381 * the set of channels actually used in scanning. 382 */ 383 struct ieee80211req_chanlist { 384 uint8_t ic_channels[32]; /* NB: can be variable length */ 385 }; 386 387 /* 388 * Get the active channel list info. 389 */ 390 struct ieee80211req_chaninfo { 391 u_int ic_nchans; 392 struct ieee80211_channel ic_chans[1]; /* NB: variable length */ 393 }; 394 #define IEEE80211_CHANINFO_SIZE(_nchan) \ 395 (sizeof(struct ieee80211req_chaninfo) + \ 396 (((_nchan)-1) * sizeof(struct ieee80211_channel))) 397 #define IEEE80211_CHANINFO_SPACE(_ci) \ 398 IEEE80211_CHANINFO_SIZE((_ci)->ic_nchans) 399 400 /* 401 * Retrieve the WPA/RSN information element for an associated station. 402 */ 403 struct ieee80211req_wpaie { /* old version w/ only one ie */ 404 uint8_t wpa_macaddr[IEEE80211_ADDR_LEN]; 405 uint8_t wpa_ie[IEEE80211_MAX_OPT_IE]; 406 }; 407 struct ieee80211req_wpaie2 { 408 uint8_t wpa_macaddr[IEEE80211_ADDR_LEN]; 409 uint8_t wpa_ie[IEEE80211_MAX_OPT_IE]; 410 uint8_t rsn_ie[IEEE80211_MAX_OPT_IE]; 411 }; 412 413 /* 414 * Retrieve per-node statistics. 415 */ 416 struct ieee80211req_sta_stats { 417 union { 418 /* NB: explicitly force 64-bit alignment */ 419 uint8_t macaddr[IEEE80211_ADDR_LEN]; 420 uint64_t pad; 421 } is_u; 422 struct ieee80211_nodestats is_stats; 423 }; 424 #endif 425 426 /* 427 * Station information block; the mac address is used 428 * to retrieve other data like stats, unicast key, etc. 429 */ 430 struct ieee80211req_sta_info { 431 uint16_t isi_len; /* total length (mult of 4) */ 432 uint16_t isi_ie_off; /* offset to IE data */ 433 uint16_t isi_ie_len; /* IE length */ 434 uint16_t isi_freq; /* MHz */ 435 uint32_t isi_flags; /* channel flags */ 436 uint32_t isi_state; /* state flags */ 437 uint8_t isi_authmode; /* authentication algorithm */ 438 int8_t isi_rssi; /* receive signal strength */ 439 int8_t isi_noise; /* noise floor */ 440 uint8_t isi_capinfo; /* capabilities */ 441 uint8_t isi_erp; /* ERP element */ 442 uint8_t isi_macaddr[IEEE80211_ADDR_LEN]; 443 uint8_t isi_nrates; 444 /* negotiated rates */ 445 uint8_t isi_rates[IEEE80211_RATE_MAXSIZE]; 446 uint8_t isi_txrate; /* legacy/IEEE rate or MCS */ 447 uint16_t isi_associd; /* assoc response */ 448 uint16_t isi_txpower; /* current tx power */ 449 uint16_t isi_vlan; /* vlan tag */ 450 #ifndef IEEE80211_IOCTLS_ABBREVIATED 451 /* NB: [IEEE80211_NONQOS_TID] holds seq#'s for non-QoS stations */ 452 uint16_t isi_txseqs[IEEE80211_TID_SIZE];/* tx seq #/TID */ 453 uint16_t isi_rxseqs[IEEE80211_TID_SIZE];/* rx seq#/TID */ 454 uint16_t isi_inact; /* inactivity timer */ 455 uint16_t isi_txmbps; /* current tx rate in .5 Mb/s */ 456 uint16_t isi_pad; 457 uint32_t isi_jointime; /* time of assoc/join */ 458 struct ieee80211_mimo_info isi_mimo; /* MIMO info for 11n sta's */ 459 /* 11s info */ 460 uint16_t isi_peerid; 461 uint16_t isi_localid; 462 uint8_t isi_peerstate; 463 /* XXX frag state? */ 464 #endif 465 /* variable length IE data */ 466 }; 467 468 /* 469 * Retrieve per-station information; to retrieve all 470 * specify a mac address of ff:ff:ff:ff:ff:ff. 471 */ 472 struct ieee80211req_sta_req { 473 union { 474 /* NB: explicitly force 64-bit alignment */ 475 uint8_t macaddr[IEEE80211_ADDR_LEN]; 476 uint64_t pad; 477 } is_u; 478 struct ieee80211req_sta_info info[1]; /* variable length */ 479 }; 480 481 /* 482 * Get/set per-station tx power cap. 483 */ 484 struct ieee80211req_sta_txpow { 485 uint8_t it_macaddr[IEEE80211_ADDR_LEN]; 486 uint8_t it_txpow; 487 }; 488 489 /* 490 * WME parameters manipulated with IEEE80211_IOC_WME_CWMIN 491 * through IEEE80211_IOC_WME_ACKPOLICY are set and return 492 * using i_val and i_len. i_val holds the value itself. 493 * i_len specifies the AC and, as appropriate, then high bit 494 * specifies whether the operation is to be applied to the 495 * BSS or ourself. 496 */ 497 #define IEEE80211_WMEPARAM_SELF 0x0000 /* parameter applies to self */ 498 #define IEEE80211_WMEPARAM_BSS 0x8000 /* parameter applies to BSS */ 499 #define IEEE80211_WMEPARAM_VAL 0x7fff /* parameter value */ 500 501 /* 502 * Application Information Elements can be appended to a variety 503 * of frames with the IEE80211_IOC_APPIE request. This request 504 * piggybacks on a normal ieee80211req; the frame type is passed 505 * in i_val as the 802.11 FC0 bytes and the length of the IE data 506 * is passed in i_len. The data is referenced in i_data. If i_len 507 * is zero then any previously configured IE data is removed. At 508 * most IEEE80211_MAX_APPIE data be appened. Note that multiple 509 * IE's can be supplied; the data is treated opaquely. 510 */ 511 #define IEEE80211_MAX_APPIE 1024 /* max app IE data */ 512 /* 513 * Hack: the WPA authenticator uses this mechanism to specify WPA 514 * ie's that are used instead of the ones normally constructed using 515 * the cipher state setup with separate ioctls. This avoids issues 516 * like the authenticator ordering ie data differently than the 517 * net80211 layer and needing to keep separate state for WPA and RSN. 518 */ 519 #define IEEE80211_APPIE_WPA \ 520 (IEEE80211_FC0_TYPE_MGT | IEEE80211_FC0_SUBTYPE_BEACON | \ 521 IEEE80211_FC0_SUBTYPE_PROBE_RESP) 522 523 #ifndef IEEE80211_IOCTLS_ABBREVIATED 524 /* 525 * Station mode roaming parameters. These are maintained 526 * per band/mode and control the roaming algorithm. 527 */ 528 struct ieee80211_roamparams_req { 529 struct ieee80211_roamparam params[IEEE80211_MODE_MAX]; 530 }; 531 532 /* 533 * Transmit parameters. These can be used to set fixed transmit 534 * rate for each operating mode when operating as client or on a 535 * per-client basis according to the capabilities of the client 536 * (e.g. an 11b client associated to an 11g ap) when operating as 537 * an ap. 538 * 539 * MCS are distinguished from legacy rates by or'ing in 0x80. 540 */ 541 struct ieee80211_txparams_req { 542 struct ieee80211_txparam params[IEEE80211_MODE_MAX]; 543 }; 544 545 /* 546 * Set regulatory domain state with IEEE80211_IOC_REGDOMAIN. 547 * Note this is both the regulatory description and the channel 548 * list. The get request for IEEE80211_IOC_REGDOMAIN returns 549 * only the regdomain info; the channel list is obtained 550 * separately with IEEE80211_IOC_CHANINFO. 551 */ 552 struct ieee80211_regdomain_req { 553 struct ieee80211_regdomain rd; 554 struct ieee80211req_chaninfo chaninfo; 555 }; 556 #define IEEE80211_REGDOMAIN_SIZE(_nchan) \ 557 (sizeof(struct ieee80211_regdomain_req) + \ 558 (((_nchan)-1) * sizeof(struct ieee80211_channel))) 559 #define IEEE80211_REGDOMAIN_SPACE(_req) \ 560 IEEE80211_REGDOMAIN_SIZE((_req)->chaninfo.ic_nchans) 561 562 /* 563 * Get driver capabilities. Driver, hardware/software crypto, and 564 * HT/802.11n capabilities, and a table that describes what 565 * the radio can do. 566 */ 567 struct ieee80211_devcaps_req { 568 uint32_t dc_drivercaps; /* general driver caps */ 569 uint32_t dc_cryptocaps; /* software + hardware crypto support */ 570 uint32_t dc_htcaps; /* HT/802.11n support */ 571 uint32_t dc_vhtcaps; /* VHT/802.11ac capabilities */ 572 struct ieee80211req_chaninfo dc_chaninfo; 573 }; 574 #define IEEE80211_DEVCAPS_SIZE(_nchan) \ 575 (sizeof(struct ieee80211_devcaps_req) + \ 576 (((_nchan)-1) * sizeof(struct ieee80211_channel))) 577 #define IEEE80211_DEVCAPS_SPACE(_dc) \ 578 IEEE80211_DEVCAPS_SIZE((_dc)->dc_chaninfo.ic_nchans) 579 #endif 580 581 struct ieee80211_chanswitch_req { 582 struct ieee80211_channel csa_chan; /* new channel */ 583 int csa_mode; /* CSA mode */ 584 int csa_count; /* beacon count to switch */ 585 }; 586 587 /* 588 * Get/set per-station vlan tag. 589 */ 590 struct ieee80211req_sta_vlan { 591 uint8_t sv_macaddr[IEEE80211_ADDR_LEN]; 592 uint16_t sv_vlan; 593 }; 594 595 #if defined(__FreeBSD__) || defined(__HAIKU__) 596 /* 597 * FreeBSD-style ioctls. 598 */ 599 /* the first member must be matched with struct ifreq */ 600 struct ieee80211req { 601 char i_name[IFNAMSIZ]; /* if_name, e.g. "wi0" */ 602 uint16_t i_type; /* req type */ 603 int16_t i_val; /* Index or simple value */ 604 uint16_t i_len; /* Index or simple value */ 605 void *i_data; /* Extra data */ 606 }; 607 #define SIOCS80211 _IOW('i', 234, struct ieee80211req) 608 #define SIOCG80211 _IOWR('i', 235, struct ieee80211req) 609 #define SIOCG80211STATS _IOWR('i', 236, struct ifreq) 610 611 #define IEEE80211_IOC_SSID 1 612 #define IEEE80211_IOC_NUMSSIDS 2 613 #define IEEE80211_IOC_WEP 3 614 #define IEEE80211_WEP_NOSUP -1 615 #define IEEE80211_WEP_OFF 0 616 #define IEEE80211_WEP_ON 1 617 #define IEEE80211_WEP_MIXED 2 618 #define IEEE80211_IOC_WEPKEY 4 619 #define IEEE80211_IOC_NUMWEPKEYS 5 620 #define IEEE80211_IOC_WEPTXKEY 6 621 #define IEEE80211_IOC_AUTHMODE 7 622 #define IEEE80211_IOC_STATIONNAME 8 623 #define IEEE80211_IOC_CHANNEL 9 624 #define IEEE80211_IOC_POWERSAVE 10 625 #define IEEE80211_POWERSAVE_NOSUP -1 626 #define IEEE80211_POWERSAVE_OFF 0 627 #define IEEE80211_POWERSAVE_CAM 1 628 #define IEEE80211_POWERSAVE_PSP 2 629 #define IEEE80211_POWERSAVE_PSP_CAM 3 630 #define IEEE80211_POWERSAVE_ON IEEE80211_POWERSAVE_CAM 631 #define IEEE80211_IOC_POWERSAVESLEEP 11 632 #define IEEE80211_IOC_RTSTHRESHOLD 12 633 #define IEEE80211_IOC_PROTMODE 13 634 #define IEEE80211_PROTMODE_OFF 0 635 #define IEEE80211_PROTMODE_CTS 1 636 #define IEEE80211_PROTMODE_RTSCTS 2 637 #define IEEE80211_IOC_TXPOWER 14 /* global tx power limit */ 638 #define IEEE80211_IOC_BSSID 15 639 #define IEEE80211_IOC_ROAMING 16 /* roaming mode */ 640 #define IEEE80211_IOC_PRIVACY 17 /* privacy invoked */ 641 #define IEEE80211_IOC_DROPUNENCRYPTED 18 /* discard unencrypted frames */ 642 #define IEEE80211_IOC_WPAKEY 19 643 #define IEEE80211_IOC_DELKEY 20 644 #define IEEE80211_IOC_MLME 21 645 /* 22 was IEEE80211_IOC_OPTIE, replaced by IEEE80211_IOC_APPIE */ 646 /* 23 was IEEE80211_IOC_SCAN_REQ */ 647 /* 24 was IEEE80211_IOC_SCAN_RESULTS */ 648 #define IEEE80211_IOC_COUNTERMEASURES 25 /* WPA/TKIP countermeasures */ 649 #define IEEE80211_IOC_WPA 26 /* WPA mode (0,1,2) */ 650 #define IEEE80211_IOC_CHANLIST 27 /* channel list */ 651 #define IEEE80211_IOC_WME 28 /* WME mode (on, off) */ 652 #define IEEE80211_IOC_HIDESSID 29 /* hide SSID mode (on, off) */ 653 #define IEEE80211_IOC_APBRIDGE 30 /* AP inter-sta bridging */ 654 /* 31-35,37-38 were for WPA authenticator settings */ 655 /* 36 was IEEE80211_IOC_DRIVER_CAPS */ 656 #define IEEE80211_IOC_WPAIE 39 /* WPA information element */ 657 #define IEEE80211_IOC_STA_STATS 40 /* per-station statistics */ 658 #define IEEE80211_IOC_MACCMD 41 /* MAC ACL operation */ 659 #define IEEE80211_IOC_CHANINFO 42 /* channel info list */ 660 #define IEEE80211_IOC_TXPOWMAX 43 /* max tx power for channel */ 661 #define IEEE80211_IOC_STA_TXPOW 44 /* per-station tx power limit */ 662 /* 45 was IEEE80211_IOC_STA_INFO */ 663 #define IEEE80211_IOC_WME_CWMIN 46 /* WME: ECWmin */ 664 #define IEEE80211_IOC_WME_CWMAX 47 /* WME: ECWmax */ 665 #define IEEE80211_IOC_WME_AIFS 48 /* WME: AIFSN */ 666 #define IEEE80211_IOC_WME_TXOPLIMIT 49 /* WME: txops limit */ 667 #define IEEE80211_IOC_WME_ACM 50 /* WME: ACM (bss only) */ 668 #define IEEE80211_IOC_WME_ACKPOLICY 51 /* WME: ACK policy (!bss only)*/ 669 #define IEEE80211_IOC_DTIM_PERIOD 52 /* DTIM period (beacons) */ 670 #define IEEE80211_IOC_BEACON_INTERVAL 53 /* beacon interval (ms) */ 671 #define IEEE80211_IOC_ADDMAC 54 /* add sta to MAC ACL table */ 672 #define IEEE80211_IOC_DELMAC 55 /* del sta from MAC ACL table */ 673 #define IEEE80211_IOC_PUREG 56 /* pure 11g (no 11b stations) */ 674 #define IEEE80211_IOC_FF 57 /* ATH fast frames (on, off) */ 675 #define IEEE80211_IOC_TURBOP 58 /* ATH turbo' (on, off) */ 676 #define IEEE80211_IOC_BGSCAN 59 /* bg scanning (on, off) */ 677 #define IEEE80211_IOC_BGSCAN_IDLE 60 /* bg scan idle threshold */ 678 #define IEEE80211_IOC_BGSCAN_INTERVAL 61 /* bg scan interval */ 679 #define IEEE80211_IOC_SCANVALID 65 /* scan cache valid threshold */ 680 /* 66-72 were IEEE80211_IOC_ROAM_* and IEEE80211_IOC_MCAST_RATE */ 681 #define IEEE80211_IOC_FRAGTHRESHOLD 73 /* tx fragmentation threshold */ 682 #define IEEE80211_IOC_BURST 75 /* packet bursting */ 683 #define IEEE80211_IOC_SCAN_RESULTS 76 /* get scan results */ 684 #define IEEE80211_IOC_BMISSTHRESHOLD 77 /* beacon miss threshold */ 685 #define IEEE80211_IOC_STA_INFO 78 /* station/neighbor info */ 686 #define IEEE80211_IOC_WPAIE2 79 /* WPA+RSN info elements */ 687 #define IEEE80211_IOC_CURCHAN 80 /* current channel */ 688 #define IEEE80211_IOC_SHORTGI 81 /* 802.11n half GI */ 689 #define IEEE80211_IOC_AMPDU 82 /* 802.11n A-MPDU (on, off) */ 690 #define IEEE80211_IOC_AMPDU_LIMIT 83 /* A-MPDU length limit */ 691 #define IEEE80211_IOC_AMPDU_DENSITY 84 /* A-MPDU density */ 692 #define IEEE80211_IOC_AMSDU 85 /* 802.11n A-MSDU (on, off) */ 693 #define IEEE80211_IOC_AMSDU_LIMIT 86 /* A-MSDU length limit */ 694 #define IEEE80211_IOC_PUREN 87 /* pure 11n (no legacy sta's) */ 695 #define IEEE80211_IOC_DOTH 88 /* 802.11h (on, off) */ 696 /* 89-91 were regulatory items */ 697 #define IEEE80211_IOC_HTCOMPAT 92 /* support pre-D1.10 HT ie's */ 698 #define IEEE80211_IOC_DWDS 93 /* DWDS/4-address handling */ 699 #define IEEE80211_IOC_INACTIVITY 94 /* sta inactivity handling */ 700 #define IEEE80211_IOC_APPIE 95 /* application IE's */ 701 #define IEEE80211_IOC_WPS 96 /* WPS operation */ 702 #define IEEE80211_IOC_TSN 97 /* TSN operation */ 703 #define IEEE80211_IOC_DEVCAPS 98 /* driver+device capabilities */ 704 #define IEEE80211_IOC_CHANSWITCH 99 /* start 11h channel switch */ 705 #define IEEE80211_IOC_DFS 100 /* DFS (on, off) */ 706 #define IEEE80211_IOC_DOTD 101 /* 802.11d (on, off) */ 707 #define IEEE80211_IOC_HTPROTMODE 102 /* HT protection (off, rts) */ 708 #define IEEE80211_IOC_SCAN_REQ 103 /* scan w/ specified params */ 709 #define IEEE80211_IOC_SCAN_CANCEL 104 /* cancel ongoing scan */ 710 #define IEEE80211_IOC_HTCONF 105 /* HT config (off, HT20, HT40)*/ 711 #define IEEE80211_IOC_REGDOMAIN 106 /* regulatory domain info */ 712 #define IEEE80211_IOC_ROAM 107 /* roaming params en masse */ 713 #define IEEE80211_IOC_TXPARAMS 108 /* tx parameters */ 714 #define IEEE80211_IOC_STA_VLAN 109 /* per-station vlan tag */ 715 #define IEEE80211_IOC_SMPS 110 /* MIMO power save */ 716 #define IEEE80211_IOC_RIFS 111 /* RIFS config (on, off) */ 717 #define IEEE80211_IOC_GREENFIELD 112 /* Greenfield (on, off) */ 718 #define IEEE80211_IOC_STBC 113 /* STBC Tx/RX (on, off) */ 719 #define IEEE80211_IOC_LDPC 114 /* LDPC Tx/RX (on, off) */ 720 #define IEEE80211_IOC_UAPSD 115 /* UAPSD (on, off) */ 721 #define IEEE80211_IOC_UAPSD_INFO 116 /* UAPSD (SP, per-AC enable) */ 722 723 /* VHT */ 724 #define IEEE80211_IOC_VHTCONF 130 /* VHT config (off, on; widths) */ 725 726 #define IEEE80211_IOC_MESH_ID 170 /* mesh identifier */ 727 #define IEEE80211_IOC_MESH_AP 171 /* accepting peerings */ 728 #define IEEE80211_IOC_MESH_FWRD 172 /* forward frames */ 729 #define IEEE80211_IOC_MESH_PROTO 173 /* mesh protocols */ 730 #define IEEE80211_IOC_MESH_TTL 174 /* mesh TTL */ 731 #define IEEE80211_IOC_MESH_RTCMD 175 /* mesh routing table commands*/ 732 #define IEEE80211_IOC_MESH_PR_METRIC 176 /* mesh metric protocol */ 733 #define IEEE80211_IOC_MESH_PR_PATH 177 /* mesh path protocol */ 734 #define IEEE80211_IOC_MESH_PR_SIG 178 /* mesh sig protocol */ 735 #define IEEE80211_IOC_MESH_PR_CC 179 /* mesh congestion protocol */ 736 #define IEEE80211_IOC_MESH_PR_AUTH 180 /* mesh auth protocol */ 737 #define IEEE80211_IOC_MESH_GATE 181 /* mesh gate XXX: 173? */ 738 739 #define IEEE80211_IOC_HWMP_ROOTMODE 190 /* HWMP root mode */ 740 #define IEEE80211_IOC_HWMP_MAXHOPS 191 /* number of hops before drop */ 741 #define IEEE80211_IOC_HWMP_TTL 192 /* HWMP TTL */ 742 743 #define IEEE80211_IOC_TDMA_SLOT 201 /* TDMA: assigned slot */ 744 #define IEEE80211_IOC_TDMA_SLOTCNT 202 /* TDMA: slots in bss */ 745 #define IEEE80211_IOC_TDMA_SLOTLEN 203 /* TDMA: slot length (usecs) */ 746 #define IEEE80211_IOC_TDMA_BINTERVAL 204 /* TDMA: beacon intvl (slots) */ 747 748 #define IEEE80211_IOC_QUIET 205 /* Quiet Enable/Disable */ 749 #define IEEE80211_IOC_QUIET_PERIOD 206 /* Quiet Period */ 750 #define IEEE80211_IOC_QUIET_OFFSET 207 /* Quiet Offset */ 751 #define IEEE80211_IOC_QUIET_DUR 208 /* Quiet Duration */ 752 #define IEEE80211_IOC_QUIET_COUNT 209 /* Quiet Count */ 753 754 #define IEEE80211_IOC_IC_NAME 210 /* HW device name. */ 755 756 757 #ifdef __HAIKU__ 758 /* 759 These are here to allow overcoming a difference between Haiku and 760 FreeBSD drivers. In FreeBSD a device can be set into the down state 761 but is still fully configurable using the ioctl interface. The Haiku 762 network stack on the other hand opens and closes the driver on the 763 transition form up to down and vice versa. This difference can become 764 problematic with ported software that depends on the original behaviour. 765 Therefore IEEE80211_IOC_HAIKU_COMPAT_WLAN_{UP|DOWN} provide a way to 766 achieve the behaviour of setting and clearing IFF_UP without opening 767 or closing the driver itself. 768 */ 769 #define IEEE80211_IOC_HAIKU_COMPAT_WLAN_UP 0x6000 770 #define IEEE80211_IOC_HAIKU_COMPAT_WLAN_DOWN 0x6001 771 772 /* 773 Haiku extension: initiate join of network, potentially encrypted. 774 */ 775 #define IEEE80211_IOC_HAIKU_JOIN 0x6002 776 struct ieee80211_haiku_join_req { 777 uint8 i_nwid[IEEE80211_NWID_LEN]; 778 uint8 i_nwid_len; 779 780 uint32 i_authentication_mode; 781 uint32 i_ciphers; 782 uint32 i_group_ciphers; 783 uint32 i_key_mode; 784 785 uint32 i_key_len; 786 #if __GNUC__ == 2 787 uint8 i_key[0]; 788 #else 789 uint8 i_key[]; 790 #endif 791 }; 792 #endif /* __HAIKU__ */ 793 794 /* 795 * Parameters for controlling a scan requested with 796 * IEEE80211_IOC_SCAN_REQ. 797 * 798 * Active scans cause ProbeRequest frames to be issued for each 799 * specified ssid and, by default, a broadcast ProbeRequest frame. 800 * The set of ssid's is specified in the request. 801 * 802 * By default the scan will cause a BSS to be joined (in station/adhoc 803 * mode) or a channel to be selected for operation (hostap mode). 804 * To disable that specify IEEE80211_IOC_SCAN_NOPICK and if the 805 * 806 * If the station is currently associated to an AP then a scan request 807 * will cause the station to leave the current channel and potentially 808 * miss frames from the AP. Alternatively the station may notify the 809 * AP that it is going into power save mode before it leaves the channel. 810 * This ensures frames for the station are buffered by the AP. This is 811 * termed a ``bg scan'' and is requested with the IEEE80211_IOC_SCAN_BGSCAN 812 * flag. Background scans may take longer than foreground scans and may 813 * be preempted by traffic. If a station is not associated to an AP 814 * then a request for a background scan is automatically done in the 815 * foreground. 816 * 817 * The results of the scan request are cached by the system. This 818 * information is aged out and/or invalidated based on events like not 819 * being able to associated to an AP. To flush the current cache 820 * contents before doing a scan the IEEE80211_IOC_SCAN_FLUSH flag may 821 * be specified. 822 * 823 * By default the scan will be done until a suitable AP is located 824 * or a channel is found for use. A scan can also be constrained 825 * to be done once (IEEE80211_IOC_SCAN_ONCE) or to last for no more 826 * than a specified duration. 827 */ 828 struct ieee80211_scan_req { 829 int sr_flags; 830 #define IEEE80211_IOC_SCAN_NOPICK 0x00001 /* scan only, no selection */ 831 #define IEEE80211_IOC_SCAN_ACTIVE 0x00002 /* active scan (probe req) */ 832 #define IEEE80211_IOC_SCAN_PICK1ST 0x00004 /* ``hey sailor'' mode */ 833 #define IEEE80211_IOC_SCAN_BGSCAN 0x00008 /* bg scan, exit ps at end */ 834 #define IEEE80211_IOC_SCAN_ONCE 0x00010 /* do one complete pass */ 835 #define IEEE80211_IOC_SCAN_NOBCAST 0x00020 /* don't send bcast probe req */ 836 #define IEEE80211_IOC_SCAN_NOJOIN 0x00040 /* no auto-sequencing */ 837 #define IEEE80211_IOC_SCAN_FLUSH 0x10000 /* flush scan cache first */ 838 #define IEEE80211_IOC_SCAN_CHECK 0x20000 /* check scan cache first */ 839 u_int sr_duration; /* duration (ms) */ 840 #define IEEE80211_IOC_SCAN_DURATION_MIN 1 841 #define IEEE80211_IOC_SCAN_DURATION_MAX 0x7fffffff 842 #define IEEE80211_IOC_SCAN_FOREVER IEEE80211_IOC_SCAN_DURATION_MAX 843 u_int sr_mindwell; /* min channel dwelltime (ms) */ 844 u_int sr_maxdwell; /* max channel dwelltime (ms) */ 845 int sr_nssid; 846 #define IEEE80211_IOC_SCAN_MAX_SSID 3 847 struct { 848 int len; /* length in bytes */ 849 uint8_t ssid[IEEE80211_NWID_LEN]; /* ssid contents */ 850 } sr_ssid[IEEE80211_IOC_SCAN_MAX_SSID]; 851 }; 852 853 /* 854 * Scan result data returned for IEEE80211_IOC_SCAN_RESULTS. 855 * Each result is a fixed size structure followed by a variable 856 * length SSID and one or more variable length information elements. 857 * The size of each variable length item is found in the fixed 858 * size structure and the entire length of the record is specified 859 * in isr_len. Result records are rounded to a multiple of 4 bytes. 860 */ 861 struct ieee80211req_scan_result { 862 uint16_t isr_len; /* total length (mult of 4) */ 863 uint16_t isr_ie_off; /* offset to SSID+IE data */ 864 uint16_t isr_ie_len; /* IE length */ 865 uint16_t isr_freq; /* MHz */ 866 uint16_t isr_flags; /* channel flags */ 867 int8_t isr_noise; 868 int8_t isr_rssi; 869 uint16_t isr_intval; /* beacon interval */ 870 uint8_t isr_capinfo; /* capabilities */ 871 uint8_t isr_erp; /* ERP element */ 872 uint8_t isr_bssid[IEEE80211_ADDR_LEN]; 873 uint8_t isr_nrates; 874 uint8_t isr_rates[IEEE80211_RATE_MAXSIZE]; 875 #if defined(__HAIKU__) && defined(_KERNEL_MODE) 876 STATIC_ASSERT(IEEE80211_RATE_MAXSIZE == 15); 877 #endif 878 uint8_t isr_ssid_len; /* SSID length */ 879 uint8_t isr_meshid_len; /* MESH ID length */ 880 /* variable length SSID, followed by variable length MESH ID, 881 followed by IE data */ 882 }; 883 884 /* 885 * Virtual AP cloning parameters. The parent device must 886 * be a vap-capable device. All parameters specified with 887 * the clone request are fixed for the lifetime of the vap. 888 * 889 * There are two flavors of WDS vaps: legacy and dynamic. 890 * Legacy WDS operation implements a static binding between 891 * two stations encapsulating traffic in 4-address frames. 892 * Dynamic WDS vaps are created when a station associates to 893 * an AP and sends a 4-address frame. If the AP vap is 894 * configured to support WDS then this will generate an 895 * event to user programs listening on the routing socket 896 * and a Dynamic WDS vap will be created to handle traffic 897 * to/from that station. In both cases the bssid of the 898 * peer must be specified when creating the vap. 899 * 900 * By default a vap will inherit the mac address/bssid of 901 * the underlying device. To request a unique address the 902 * IEEE80211_CLONE_BSSID flag should be supplied. This is 903 * meaningless for WDS vaps as they share the bssid of an 904 * AP vap that must otherwise exist. Note that some devices 905 * may not be able to support multiple addresses. 906 * 907 * Station mode vap's normally depend on the device to notice 908 * when the AP stops sending beacon frames. If IEEE80211_CLONE_NOBEACONS 909 * is specified the net80211 layer will do this in s/w. This 910 * is mostly useful when setting up a WDS repeater/extender where 911 * an AP vap is combined with a sta vap and the device isn't able 912 * to track beacon frames in hardware. 913 */ 914 struct ieee80211_clone_params { 915 char icp_parent[IFNAMSIZ]; /* parent device */ 916 uint16_t icp_opmode; /* operating mode */ 917 uint16_t icp_flags; /* see below */ 918 uint8_t icp_bssid[IEEE80211_ADDR_LEN]; /* for WDS links */ 919 uint8_t icp_macaddr[IEEE80211_ADDR_LEN];/* local address */ 920 }; 921 #define IEEE80211_CLONE_BSSID 0x0001 /* allocate unique mac/bssid */ 922 #define IEEE80211_CLONE_NOBEACONS 0x0002 /* don't setup beacon timers */ 923 #define IEEE80211_CLONE_WDSLEGACY 0x0004 /* legacy WDS processing */ 924 #define IEEE80211_CLONE_MACADDR 0x0008 /* use specified mac addr */ 925 #define IEEE80211_CLONE_TDMA 0x0010 /* operate in TDMA mode */ 926 #endif /* __FreeBSD__ */ 927 928 #endif /* _NET80211_IEEE80211_IOCTL_H_ */ 929