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