xref: /freebsd/sys/net80211/ieee80211_ioctl.h (revision d1c85dae69c3f12f307aca8fe13f1e9cd5a5be38)
11a1e1d21SSam Leffler /*-
27535e66aSSam Leffler  * Copyright (c) 2001 Atsushi Onoe
31f1d7810SSam Leffler  * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
41a1e1d21SSam Leffler  * All rights reserved.
51a1e1d21SSam Leffler  *
61a1e1d21SSam Leffler  * Redistribution and use in source and binary forms, with or without
71a1e1d21SSam Leffler  * modification, are permitted provided that the following conditions
81a1e1d21SSam Leffler  * are met:
91a1e1d21SSam Leffler  * 1. Redistributions of source code must retain the above copyright
101a1e1d21SSam Leffler  *    notice, this list of conditions and the following disclaimer.
111a1e1d21SSam Leffler  * 2. Redistributions in binary form must reproduce the above copyright
121a1e1d21SSam Leffler  *    notice, this list of conditions and the following disclaimer in the
131a1e1d21SSam Leffler  *    documentation and/or other materials provided with the distribution.
147535e66aSSam Leffler  * 3. The name of the author may not be used to endorse or promote products
157535e66aSSam Leffler  *    derived from this software without specific prior written permission.
161a1e1d21SSam Leffler  *
177535e66aSSam Leffler  * Alternatively, this software may be distributed under the terms of the
187535e66aSSam Leffler  * GNU General Public License ("GPL") version 2 as published by the Free
197535e66aSSam Leffler  * Software Foundation.
207535e66aSSam Leffler  *
217535e66aSSam Leffler  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
227535e66aSSam Leffler  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
237535e66aSSam Leffler  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
247535e66aSSam Leffler  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
257535e66aSSam Leffler  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
267535e66aSSam Leffler  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
277535e66aSSam Leffler  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
287535e66aSSam Leffler  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
297535e66aSSam Leffler  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
307535e66aSSam Leffler  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
311a1e1d21SSam Leffler  *
321a1e1d21SSam Leffler  * $FreeBSD$
331a1e1d21SSam Leffler  */
341a1e1d21SSam Leffler #ifndef _NET80211_IEEE80211_IOCTL_H_
351a1e1d21SSam Leffler #define _NET80211_IEEE80211_IOCTL_H_
361a1e1d21SSam Leffler 
371a1e1d21SSam Leffler /*
381a1e1d21SSam Leffler  * IEEE 802.11 ioctls.
391a1e1d21SSam Leffler  */
408a1b9b6aSSam Leffler #include <net80211/_ieee80211.h>
418a1b9b6aSSam Leffler #include <net80211/ieee80211.h>
428a1b9b6aSSam Leffler #include <net80211/ieee80211_crypto.h>
431a1e1d21SSam Leffler 
448a1b9b6aSSam Leffler /*
45d1c85daeSSam Leffler  * Per/node (station) statistics.
468a1b9b6aSSam Leffler  */
478a1b9b6aSSam Leffler struct ieee80211_nodestats {
488a1b9b6aSSam Leffler 	u_int32_t	ns_rx_data;		/* rx data frames */
498a1b9b6aSSam Leffler 	u_int32_t	ns_rx_mgmt;		/* rx management frames */
508a1b9b6aSSam Leffler 	u_int32_t	ns_rx_ctrl;		/* rx control frames */
518a1b9b6aSSam Leffler 	u_int32_t	ns_rx_ucast;		/* rx unicast frames */
528a1b9b6aSSam Leffler 	u_int32_t	ns_rx_mcast;		/* rx multi/broadcast frames */
538a1b9b6aSSam Leffler 	u_int64_t	ns_rx_bytes;		/* rx data count (bytes) */
548a1b9b6aSSam Leffler 	u_int64_t	ns_rx_beacons;		/* rx beacon frames */
558a1b9b6aSSam Leffler 	u_int32_t	ns_rx_proberesp;	/* rx probe response frames */
568a1b9b6aSSam Leffler 
578a1b9b6aSSam Leffler 	u_int32_t	ns_rx_dup;		/* rx discard 'cuz dup */
588a1b9b6aSSam Leffler 	u_int32_t	ns_rx_noprivacy;	/* rx w/ wep but privacy off */
598a1b9b6aSSam Leffler 	u_int32_t	ns_rx_wepfail;		/* rx wep processing failed */
608a1b9b6aSSam Leffler 	u_int32_t	ns_rx_demicfail;	/* rx demic failed */
618a1b9b6aSSam Leffler 	u_int32_t	ns_rx_decap;		/* rx decapsulation failed */
628a1b9b6aSSam Leffler 	u_int32_t	ns_rx_defrag;		/* rx defragmentation failed */
638a1b9b6aSSam Leffler 	u_int32_t	ns_rx_disassoc;		/* rx disassociation */
648a1b9b6aSSam Leffler 	u_int32_t	ns_rx_deauth;		/* rx deauthentication */
658a1b9b6aSSam Leffler 	u_int32_t	ns_rx_decryptcrc;	/* rx decrypt failed on crc */
668a1b9b6aSSam Leffler 	u_int32_t	ns_rx_unauth;		/* rx on unauthorized port */
678a1b9b6aSSam Leffler 	u_int32_t	ns_rx_unencrypted;	/* rx unecrypted w/ privacy */
688a1b9b6aSSam Leffler 
698a1b9b6aSSam Leffler 	u_int32_t	ns_tx_data;		/* tx data frames */
708a1b9b6aSSam Leffler 	u_int32_t	ns_tx_mgmt;		/* tx management frames */
718a1b9b6aSSam Leffler 	u_int32_t	ns_tx_ucast;		/* tx unicast frames */
728a1b9b6aSSam Leffler 	u_int32_t	ns_tx_mcast;		/* tx multi/broadcast frames */
738a1b9b6aSSam Leffler 	u_int64_t	ns_tx_bytes;		/* tx data count (bytes) */
748a1b9b6aSSam Leffler 	u_int32_t	ns_tx_probereq;		/* tx probe request frames */
758a1b9b6aSSam Leffler 
768a1b9b6aSSam Leffler 	u_int32_t	ns_tx_novlantag;	/* tx discard 'cuz no tag */
778a1b9b6aSSam Leffler 	u_int32_t	ns_tx_vlanmismatch;	/* tx discard 'cuz bad tag */
788a1b9b6aSSam Leffler 
798a1b9b6aSSam Leffler 	u_int32_t	ns_ps_discard;		/* ps discard 'cuz of age */
808a1b9b6aSSam Leffler 
818a1b9b6aSSam Leffler 	/* MIB-related state */
828a1b9b6aSSam Leffler 	u_int32_t	ns_tx_assoc;		/* [re]associations */
838a1b9b6aSSam Leffler 	u_int32_t	ns_tx_assoc_fail;	/* [re]association failures */
848a1b9b6aSSam Leffler 	u_int32_t	ns_tx_auth;		/* [re]authentications */
858a1b9b6aSSam Leffler 	u_int32_t	ns_tx_auth_fail;	/* [re]authentication failures*/
868a1b9b6aSSam Leffler 	u_int32_t	ns_tx_deauth;		/* deauthentications */
878a1b9b6aSSam Leffler 	u_int32_t	ns_tx_deauth_code;	/* last deauth reason */
888a1b9b6aSSam Leffler 	u_int32_t	ns_tx_disassoc;		/* disassociations */
898a1b9b6aSSam Leffler 	u_int32_t	ns_tx_disassoc_code;	/* last disassociation reason */
908a1b9b6aSSam Leffler };
918a1b9b6aSSam Leffler 
928a1b9b6aSSam Leffler /*
938a1b9b6aSSam Leffler  * Summary statistics.
948a1b9b6aSSam Leffler  */
951be50176SSam Leffler struct ieee80211_stats {
961be50176SSam Leffler 	u_int32_t	is_rx_badversion;	/* rx frame with bad version */
971be50176SSam Leffler 	u_int32_t	is_rx_tooshort;		/* rx frame too short */
981be50176SSam Leffler 	u_int32_t	is_rx_wrongbss;		/* rx from wrong bssid */
991be50176SSam Leffler 	u_int32_t	is_rx_dup;		/* rx discard 'cuz dup */
1001be50176SSam Leffler 	u_int32_t	is_rx_wrongdir;		/* rx w/ wrong direction */
1011be50176SSam Leffler 	u_int32_t	is_rx_mcastecho;	/* rx discard 'cuz mcast echo */
1021be50176SSam Leffler 	u_int32_t	is_rx_notassoc;		/* rx discard 'cuz sta !assoc */
1038a1b9b6aSSam Leffler 	u_int32_t	is_rx_noprivacy;	/* rx w/ wep but privacy off */
1048a1b9b6aSSam Leffler 	u_int32_t	is_rx_unencrypted;	/* rx w/o wep and privacy on */
1051be50176SSam Leffler 	u_int32_t	is_rx_wepfail;		/* rx wep processing failed */
1061be50176SSam Leffler 	u_int32_t	is_rx_decap;		/* rx decapsulation failed */
1071be50176SSam Leffler 	u_int32_t	is_rx_mgtdiscard;	/* rx discard mgt frames */
1081be50176SSam Leffler 	u_int32_t	is_rx_ctl;		/* rx discard ctrl frames */
1098a1b9b6aSSam Leffler 	u_int32_t	is_rx_beacon;		/* rx beacon frames */
1101be50176SSam Leffler 	u_int32_t	is_rx_rstoobig;		/* rx rate set truncated */
1111be50176SSam Leffler 	u_int32_t	is_rx_elem_missing;	/* rx required element missing*/
1121be50176SSam Leffler 	u_int32_t	is_rx_elem_toobig;	/* rx element too big */
1131be50176SSam Leffler 	u_int32_t	is_rx_elem_toosmall;	/* rx element too small */
1141be50176SSam Leffler 	u_int32_t	is_rx_elem_unknown;	/* rx element unknown */
1151be50176SSam Leffler 	u_int32_t	is_rx_badchan;		/* rx frame w/ invalid chan */
1161be50176SSam Leffler 	u_int32_t	is_rx_chanmismatch;	/* rx frame chan mismatch */
1171be50176SSam Leffler 	u_int32_t	is_rx_nodealloc;	/* rx frame dropped */
1181be50176SSam Leffler 	u_int32_t	is_rx_ssidmismatch;	/* rx frame ssid mismatch  */
1191be50176SSam Leffler 	u_int32_t	is_rx_auth_unsupported;	/* rx w/ unsupported auth alg */
1201be50176SSam Leffler 	u_int32_t	is_rx_auth_fail;	/* rx sta auth failure */
1218a1b9b6aSSam Leffler 	u_int32_t	is_rx_auth_countermeasures;/* rx auth discard 'cuz CM */
1221be50176SSam Leffler 	u_int32_t	is_rx_assoc_bss;	/* rx assoc from wrong bssid */
1231be50176SSam Leffler 	u_int32_t	is_rx_assoc_notauth;	/* rx assoc w/o auth */
1241be50176SSam Leffler 	u_int32_t	is_rx_assoc_capmismatch;/* rx assoc w/ cap mismatch */
1251be50176SSam Leffler 	u_int32_t	is_rx_assoc_norate;	/* rx assoc w/ no rate match */
1268a1b9b6aSSam Leffler 	u_int32_t	is_rx_assoc_badwpaie;	/* rx assoc w/ bad WPA IE */
1271be50176SSam Leffler 	u_int32_t	is_rx_deauth;		/* rx deauthentication */
1281be50176SSam Leffler 	u_int32_t	is_rx_disassoc;		/* rx disassociation */
1291be50176SSam Leffler 	u_int32_t	is_rx_badsubtype;	/* rx frame w/ unknown subtype*/
1308a1b9b6aSSam Leffler 	u_int32_t	is_rx_nobuf;		/* rx failed for lack of buf */
1311be50176SSam Leffler 	u_int32_t	is_rx_decryptcrc;	/* rx decrypt failed on crc */
1321be50176SSam Leffler 	u_int32_t	is_rx_ahdemo_mgt;	/* rx discard ahdemo mgt frame*/
1331be50176SSam Leffler 	u_int32_t	is_rx_bad_auth;		/* rx bad auth request */
1348a1b9b6aSSam Leffler 	u_int32_t	is_rx_unauth;		/* rx on unauthorized port */
1358a1b9b6aSSam Leffler 	u_int32_t	is_rx_badkeyid;		/* rx w/ incorrect keyid */
1368a1b9b6aSSam Leffler 	u_int32_t	is_rx_ccmpreplay;	/* rx seq# violation (CCMP) */
1378a1b9b6aSSam Leffler 	u_int32_t	is_rx_ccmpformat;	/* rx format bad (CCMP) */
1388a1b9b6aSSam Leffler 	u_int32_t	is_rx_ccmpmic;		/* rx MIC check failed (CCMP) */
1398a1b9b6aSSam Leffler 	u_int32_t	is_rx_tkipreplay;	/* rx seq# violation (TKIP) */
1408a1b9b6aSSam Leffler 	u_int32_t	is_rx_tkipformat;	/* rx format bad (TKIP) */
1418a1b9b6aSSam Leffler 	u_int32_t	is_rx_tkipmic;		/* rx MIC check failed (TKIP) */
1428a1b9b6aSSam Leffler 	u_int32_t	is_rx_tkipicv;		/* rx ICV check failed (TKIP) */
1438a1b9b6aSSam Leffler 	u_int32_t	is_rx_badcipher;	/* rx failed 'cuz key type */
1448a1b9b6aSSam Leffler 	u_int32_t	is_rx_nocipherctx;	/* rx failed 'cuz key !setup */
1458a1b9b6aSSam Leffler 	u_int32_t	is_rx_acl;		/* rx discard 'cuz acl policy */
1468a1b9b6aSSam Leffler 	u_int32_t	is_tx_nobuf;		/* tx failed for lack of buf */
1471be50176SSam Leffler 	u_int32_t	is_tx_nonode;		/* tx failed for no node */
1481be50176SSam Leffler 	u_int32_t	is_tx_unknownmgt;	/* tx of unknown mgt frame */
1498a1b9b6aSSam Leffler 	u_int32_t	is_tx_badcipher;	/* tx failed 'cuz key type */
1508a1b9b6aSSam Leffler 	u_int32_t	is_tx_nodefkey;		/* tx failed 'cuz no defkey */
1518a1b9b6aSSam Leffler 	u_int32_t	is_tx_noheadroom;	/* tx failed 'cuz no space */
1520677adcdSSam Leffler 	u_int32_t	is_tx_fragframes;	/* tx frames fragmented */
1530677adcdSSam Leffler 	u_int32_t	is_tx_frags;		/* tx fragments created */
1541be50176SSam Leffler 	u_int32_t	is_scan_active;		/* active scans started */
1551be50176SSam Leffler 	u_int32_t	is_scan_passive;	/* passive scans started */
1561be50176SSam Leffler 	u_int32_t	is_node_timeout;	/* nodes timed out inactivity */
1571be50176SSam Leffler 	u_int32_t	is_crypto_nomem;	/* no memory for crypto ctx */
1588a1b9b6aSSam Leffler 	u_int32_t	is_crypto_tkip;		/* tkip crypto done in s/w */
1598a1b9b6aSSam Leffler 	u_int32_t	is_crypto_tkipenmic;	/* tkip en-MIC done in s/w */
1608a1b9b6aSSam Leffler 	u_int32_t	is_crypto_tkipdemic;	/* tkip de-MIC done in s/w */
1618a1b9b6aSSam Leffler 	u_int32_t	is_crypto_tkipcm;	/* tkip counter measures */
1628a1b9b6aSSam Leffler 	u_int32_t	is_crypto_ccmp;		/* ccmp crypto done in s/w */
1638a1b9b6aSSam Leffler 	u_int32_t	is_crypto_wep;		/* wep crypto done in s/w */
1648a1b9b6aSSam Leffler 	u_int32_t	is_crypto_setkey_cipher;/* cipher rejected key */
1658a1b9b6aSSam Leffler 	u_int32_t	is_crypto_setkey_nokey;	/* no key index for setkey */
1668a1b9b6aSSam Leffler 	u_int32_t	is_crypto_delkey;	/* driver key delete failed */
1678a1b9b6aSSam Leffler 	u_int32_t	is_crypto_badcipher;	/* unknown cipher */
1688a1b9b6aSSam Leffler 	u_int32_t	is_crypto_nocipher;	/* cipher not available */
1698a1b9b6aSSam Leffler 	u_int32_t	is_crypto_attachfail;	/* cipher attach failed */
1708a1b9b6aSSam Leffler 	u_int32_t	is_crypto_swfallback;	/* cipher fallback to s/w */
1718a1b9b6aSSam Leffler 	u_int32_t	is_crypto_keyfail;	/* driver key alloc failed */
1725e923d2eSSam Leffler 	u_int32_t	is_crypto_enmicfail;	/* en-MIC failed */
1738a1b9b6aSSam Leffler 	u_int32_t	is_ibss_capmismatch;	/* merge failed-cap mismatch */
1748a1b9b6aSSam Leffler 	u_int32_t	is_ibss_norate;		/* merge failed-rate mismatch */
1758a1b9b6aSSam Leffler 	u_int32_t	is_ps_unassoc;		/* ps-poll for unassoc. sta */
1768a1b9b6aSSam Leffler 	u_int32_t	is_ps_badaid;		/* ps-poll w/ incorrect aid */
1778a1b9b6aSSam Leffler 	u_int32_t	is_ps_qempty;		/* ps-poll w/ nothing to send */
1780677adcdSSam Leffler 	u_int32_t	is_ff_badhdr;		/* fast frame rx'd w/ bad hdr */
1790677adcdSSam Leffler 	u_int32_t	is_ff_tooshort;		/* fast frame rx decap error */
1800677adcdSSam Leffler 	u_int32_t	is_ff_split;		/* fast frame rx split error */
1810677adcdSSam Leffler 	u_int32_t	is_ff_decap;		/* fast frames decap'd */
1820677adcdSSam Leffler 	u_int32_t	is_ff_encap;		/* fast frames encap'd for tx */
183d365f9c7SSam Leffler 	u_int32_t	is_rx_badbintval;	/* rx frame w/ bogus bintval */
18406efa2f0SSam Leffler 	u_int32_t	is_rx_demicfail;	/* rx demic failed */
18506efa2f0SSam Leffler 	u_int32_t	is_rx_defrag;		/* rx defragmentation failed */
18606efa2f0SSam Leffler 	u_int32_t	is_rx_mgmt;		/* rx management frames */
18706efa2f0SSam Leffler 	u_int32_t	is_spare[6];
1881be50176SSam Leffler };
1891be50176SSam Leffler 
1908a1b9b6aSSam Leffler /*
1918a1b9b6aSSam Leffler  * Max size of optional information elements.  We artificially
1928a1b9b6aSSam Leffler  * constrain this; it's limited only by the max frame size (and
1938a1b9b6aSSam Leffler  * the max parameter size of the wireless extensions).
1948a1b9b6aSSam Leffler  */
1958a1b9b6aSSam Leffler #define	IEEE80211_MAX_OPT_IE	256
1968a1b9b6aSSam Leffler 
1978a1b9b6aSSam Leffler /*
1988a1b9b6aSSam Leffler  * WPA/RSN get/set key request.  Specify the key/cipher
1998a1b9b6aSSam Leffler  * type and whether the key is to be used for sending and/or
2008a1b9b6aSSam Leffler  * receiving.  The key index should be set only when working
2018a1b9b6aSSam Leffler  * with global keys (use IEEE80211_KEYIX_NONE for ``no index'').
2028a1b9b6aSSam Leffler  * Otherwise a unicast/pairwise key is specified by the bssid
2038a1b9b6aSSam Leffler  * (on a station) or mac address (on an ap).  They key length
2048a1b9b6aSSam Leffler  * must include any MIC key data; otherwise it should be no
2058a1b9b6aSSam Leffler  more than IEEE80211_KEYBUF_SIZE.
2068a1b9b6aSSam Leffler  */
2078a1b9b6aSSam Leffler struct ieee80211req_key {
2088a1b9b6aSSam Leffler 	u_int8_t	ik_type;	/* key/cipher type */
2098a1b9b6aSSam Leffler 	u_int8_t	ik_pad;
2108a1b9b6aSSam Leffler 	u_int16_t	ik_keyix;	/* key index */
2118a1b9b6aSSam Leffler 	u_int8_t	ik_keylen;	/* key length in bytes */
2128a1b9b6aSSam Leffler 	u_int8_t	ik_flags;
2138a1b9b6aSSam Leffler /* NB: IEEE80211_KEY_XMIT and IEEE80211_KEY_RECV defined elsewhere */
2148a1b9b6aSSam Leffler #define	IEEE80211_KEY_DEFAULT	0x80	/* default xmit key */
2158a1b9b6aSSam Leffler 	u_int8_t	ik_macaddr[IEEE80211_ADDR_LEN];
2168a1b9b6aSSam Leffler 	u_int64_t	ik_keyrsc;	/* key receive sequence counter */
2178a1b9b6aSSam Leffler 	u_int64_t	ik_keytsc;	/* key transmit sequence counter */
2188a1b9b6aSSam Leffler 	u_int8_t	ik_keydata[IEEE80211_KEYBUF_SIZE+IEEE80211_MICBUF_SIZE];
2198a1b9b6aSSam Leffler };
2208a1b9b6aSSam Leffler 
2218a1b9b6aSSam Leffler /*
2228a1b9b6aSSam Leffler  * Delete a key either by index or address.  Set the index
2238a1b9b6aSSam Leffler  * to IEEE80211_KEYIX_NONE when deleting a unicast key.
2248a1b9b6aSSam Leffler  */
2258a1b9b6aSSam Leffler struct ieee80211req_del_key {
2268a1b9b6aSSam Leffler 	u_int8_t	idk_keyix;	/* key index */
2278a1b9b6aSSam Leffler 	u_int8_t	idk_macaddr[IEEE80211_ADDR_LEN];
2288a1b9b6aSSam Leffler };
2298a1b9b6aSSam Leffler 
2308a1b9b6aSSam Leffler /*
2318a1b9b6aSSam Leffler  * MLME state manipulation request.  IEEE80211_MLME_ASSOC
2328a1b9b6aSSam Leffler  * only makes sense when operating as a station.  The other
2338a1b9b6aSSam Leffler  * requests can be used when operating as a station or an
2348a1b9b6aSSam Leffler  * ap (to effect a station).
2358a1b9b6aSSam Leffler  */
2368a1b9b6aSSam Leffler struct ieee80211req_mlme {
2378a1b9b6aSSam Leffler 	u_int8_t	im_op;		/* operation to perform */
2388a1b9b6aSSam Leffler #define	IEEE80211_MLME_ASSOC		1	/* associate station */
2398a1b9b6aSSam Leffler #define	IEEE80211_MLME_DISASSOC		2	/* disassociate station */
2408a1b9b6aSSam Leffler #define	IEEE80211_MLME_DEAUTH		3	/* deauthenticate station */
2418a1b9b6aSSam Leffler #define	IEEE80211_MLME_AUTHORIZE	4	/* authorize station */
2428a1b9b6aSSam Leffler #define	IEEE80211_MLME_UNAUTHORIZE	5	/* unauthorize station */
243f02a0bd2SSam Leffler 	u_int8_t	im_ssid_len;	/* length of optional ssid */
2448a1b9b6aSSam Leffler 	u_int16_t	im_reason;	/* 802.11 reason code */
2458a1b9b6aSSam Leffler 	u_int8_t	im_macaddr[IEEE80211_ADDR_LEN];
246f02a0bd2SSam Leffler 	u_int8_t	im_ssid[IEEE80211_NWID_LEN];
2478a1b9b6aSSam Leffler };
2488a1b9b6aSSam Leffler 
2498a1b9b6aSSam Leffler /*
2508a1b9b6aSSam Leffler  * MAC ACL operations.
2518a1b9b6aSSam Leffler  */
2528a1b9b6aSSam Leffler enum {
2538a1b9b6aSSam Leffler 	IEEE80211_MACCMD_POLICY_OPEN	= 0,	/* set policy: no ACL's */
2548a1b9b6aSSam Leffler 	IEEE80211_MACCMD_POLICY_ALLOW	= 1,	/* set policy: allow traffic */
2558a1b9b6aSSam Leffler 	IEEE80211_MACCMD_POLICY_DENY	= 2,	/* set policy: deny traffic */
2568a1b9b6aSSam Leffler 	IEEE80211_MACCMD_FLUSH		= 3,	/* flush ACL database */
2578a1b9b6aSSam Leffler 	IEEE80211_MACCMD_DETACH		= 4,	/* detach ACL policy */
258188757f5SSam Leffler 	IEEE80211_MACCMD_POLICY		= 5,	/* get ACL policy */
259188757f5SSam Leffler 	IEEE80211_MACCMD_LIST		= 6,	/* get ACL database */
260188757f5SSam Leffler };
261188757f5SSam Leffler 
262188757f5SSam Leffler struct ieee80211req_maclist {
263188757f5SSam Leffler 	u_int8_t	ml_macaddr[IEEE80211_ADDR_LEN];
2648a1b9b6aSSam Leffler };
2658a1b9b6aSSam Leffler 
2668a1b9b6aSSam Leffler /*
2678a1b9b6aSSam Leffler  * Set the active channel list.  Note this list is
2688a1b9b6aSSam Leffler  * intersected with the available channel list in
2698a1b9b6aSSam Leffler  * calculating the set of channels actually used in
2708a1b9b6aSSam Leffler  * scanning.
2718a1b9b6aSSam Leffler  */
2728a1b9b6aSSam Leffler struct ieee80211req_chanlist {
2738a1b9b6aSSam Leffler 	u_int8_t	ic_channels[IEEE80211_CHAN_BYTES];
2748a1b9b6aSSam Leffler };
2758a1b9b6aSSam Leffler 
2768a1b9b6aSSam Leffler /*
2778a1b9b6aSSam Leffler  * Get the active channel list info.
2788a1b9b6aSSam Leffler  */
2798a1b9b6aSSam Leffler struct ieee80211req_chaninfo {
2808a1b9b6aSSam Leffler 	u_int	ic_nchans;
2818a1b9b6aSSam Leffler 	struct ieee80211_channel ic_chans[IEEE80211_CHAN_MAX];
2828a1b9b6aSSam Leffler };
2838a1b9b6aSSam Leffler 
2848a1b9b6aSSam Leffler /*
2858a1b9b6aSSam Leffler  * Retrieve the WPA/RSN information element for an associated station.
2868a1b9b6aSSam Leffler  */
2878a1b9b6aSSam Leffler struct ieee80211req_wpaie {
2888a1b9b6aSSam Leffler 	u_int8_t	wpa_macaddr[IEEE80211_ADDR_LEN];
2898a1b9b6aSSam Leffler 	u_int8_t	wpa_ie[IEEE80211_MAX_OPT_IE];
2908a1b9b6aSSam Leffler };
2918a1b9b6aSSam Leffler 
2928a1b9b6aSSam Leffler /*
2938a1b9b6aSSam Leffler  * Retrieve per-node statistics.
2948a1b9b6aSSam Leffler  */
2958a1b9b6aSSam Leffler struct ieee80211req_sta_stats {
2968a1b9b6aSSam Leffler 	union {
2978a1b9b6aSSam Leffler 		/* NB: explicitly force 64-bit alignment */
2988a1b9b6aSSam Leffler 		u_int8_t	macaddr[IEEE80211_ADDR_LEN];
2998a1b9b6aSSam Leffler 		u_int64_t	pad;
3008a1b9b6aSSam Leffler 	} is_u;
3018a1b9b6aSSam Leffler 	struct ieee80211_nodestats is_stats;
3028a1b9b6aSSam Leffler };
3038a1b9b6aSSam Leffler 
3048a1b9b6aSSam Leffler /*
3058a1b9b6aSSam Leffler  * Station information block; the mac address is used
3068a1b9b6aSSam Leffler  * to retrieve other data like stats, unicast key, etc.
3078a1b9b6aSSam Leffler  */
3088a1b9b6aSSam Leffler struct ieee80211req_sta_info {
3098a1b9b6aSSam Leffler 	u_int16_t	isi_len;		/* length (mult of 4) */
3108a1b9b6aSSam Leffler 	u_int16_t	isi_freq;		/* MHz */
3118a1b9b6aSSam Leffler 	u_int16_t	isi_flags;		/* channel flags */
3128a1b9b6aSSam Leffler 	u_int16_t	isi_state;		/* state flags */
3138a1b9b6aSSam Leffler 	u_int8_t	isi_authmode;		/* authentication algorithm */
314d1c85daeSSam Leffler 	int8_t		isi_rssi;		/* receive signal strength */
3158a1b9b6aSSam Leffler 	u_int8_t	isi_capinfo;		/* capabilities */
3168a1b9b6aSSam Leffler 	u_int8_t	isi_erp;		/* ERP element */
3178a1b9b6aSSam Leffler 	u_int8_t	isi_macaddr[IEEE80211_ADDR_LEN];
3188a1b9b6aSSam Leffler 	u_int8_t	isi_nrates;
3198a1b9b6aSSam Leffler 						/* negotiated rates */
3208a1b9b6aSSam Leffler 	u_int8_t	isi_rates[IEEE80211_RATE_MAXSIZE];
3218a1b9b6aSSam Leffler 	u_int8_t	isi_txrate;		/* index to isi_rates[] */
322d1c85daeSSam Leffler 	int8_t		isi_noise;		/* noise floor */
3238a1b9b6aSSam Leffler 	u_int16_t	isi_ie_len;		/* IE length */
3248a1b9b6aSSam Leffler 	u_int16_t	isi_associd;		/* assoc response */
3258a1b9b6aSSam Leffler 	u_int16_t	isi_txpower;		/* current tx power */
3268a1b9b6aSSam Leffler 	u_int16_t	isi_vlan;		/* vlan tag */
3278a1b9b6aSSam Leffler 	u_int16_t	isi_txseqs[17];		/* seq to be transmitted */
3288a1b9b6aSSam Leffler 	u_int16_t	isi_rxseqs[17];		/* seq previous for qos frames*/
3298a1b9b6aSSam Leffler 	u_int16_t	isi_inact;		/* inactivity timer */
3308a1b9b6aSSam Leffler 	/* XXX frag state? */
3318a1b9b6aSSam Leffler 	/* variable length IE data */
3328a1b9b6aSSam Leffler };
3338a1b9b6aSSam Leffler 
3348a1b9b6aSSam Leffler /*
3358a1b9b6aSSam Leffler  * Retrieve per-station information; to retrieve all
3368a1b9b6aSSam Leffler  * specify a mac address of ff:ff:ff:ff:ff:ff.
3378a1b9b6aSSam Leffler  */
3388a1b9b6aSSam Leffler struct ieee80211req_sta_req {
3398a1b9b6aSSam Leffler 	union {
3408a1b9b6aSSam Leffler 		/* NB: explicitly force 64-bit alignment */
3418a1b9b6aSSam Leffler 		u_int8_t	macaddr[IEEE80211_ADDR_LEN];
3428a1b9b6aSSam Leffler 		u_int64_t	pad;
3438a1b9b6aSSam Leffler 	} is_u;
3448a1b9b6aSSam Leffler 	struct ieee80211req_sta_info info[1];	/* variable length */
3458a1b9b6aSSam Leffler };
3468a1b9b6aSSam Leffler 
3478a1b9b6aSSam Leffler /*
3488a1b9b6aSSam Leffler  * Get/set per-station tx power cap.
3498a1b9b6aSSam Leffler  */
3508a1b9b6aSSam Leffler struct ieee80211req_sta_txpow {
3518a1b9b6aSSam Leffler 	u_int8_t	it_macaddr[IEEE80211_ADDR_LEN];
3528a1b9b6aSSam Leffler 	u_int8_t	it_txpow;
3538a1b9b6aSSam Leffler };
3548a1b9b6aSSam Leffler 
3558a1b9b6aSSam Leffler /*
3568a1b9b6aSSam Leffler  * WME parameters are set and return using i_val and i_len.
3578a1b9b6aSSam Leffler  * i_val holds the value itself.  i_len specifies the AC
3588a1b9b6aSSam Leffler  * and, as appropriate, then high bit specifies whether the
3598a1b9b6aSSam Leffler  * operation is to be applied to the BSS or ourself.
3608a1b9b6aSSam Leffler  */
3618a1b9b6aSSam Leffler #define	IEEE80211_WMEPARAM_SELF	0x0000		/* parameter applies to self */
3628a1b9b6aSSam Leffler #define	IEEE80211_WMEPARAM_BSS	0x8000		/* parameter applies to BSS */
3638a1b9b6aSSam Leffler #define	IEEE80211_WMEPARAM_VAL	0x7fff		/* parameter value */
3648a1b9b6aSSam Leffler 
3651a1e1d21SSam Leffler #ifdef __FreeBSD__
3661a1e1d21SSam Leffler /*
3671a1e1d21SSam Leffler  * FreeBSD-style ioctls.
3681a1e1d21SSam Leffler  */
3691a1e1d21SSam Leffler /* the first member must be matched with struct ifreq */
3701a1e1d21SSam Leffler struct ieee80211req {
3711a1e1d21SSam Leffler 	char		i_name[IFNAMSIZ];	/* if_name, e.g. "wi0" */
3721a1e1d21SSam Leffler 	u_int16_t	i_type;			/* req type */
3731a1e1d21SSam Leffler 	int16_t		i_val;			/* Index or simple value */
3741a1e1d21SSam Leffler 	int16_t		i_len;			/* Index or simple value */
3751a1e1d21SSam Leffler 	void		*i_data;		/* Extra data */
3761a1e1d21SSam Leffler };
3771a1e1d21SSam Leffler #define	SIOCS80211		 _IOW('i', 234, struct ieee80211req)
3781a1e1d21SSam Leffler #define	SIOCG80211		_IOWR('i', 235, struct ieee80211req)
3791a1e1d21SSam Leffler 
3801a1e1d21SSam Leffler #define IEEE80211_IOC_SSID		1
3811a1e1d21SSam Leffler #define IEEE80211_IOC_NUMSSIDS		2
3821a1e1d21SSam Leffler #define IEEE80211_IOC_WEP		3
3831a1e1d21SSam Leffler #define 	IEEE80211_WEP_NOSUP	-1
3841a1e1d21SSam Leffler #define 	IEEE80211_WEP_OFF	0
3851a1e1d21SSam Leffler #define 	IEEE80211_WEP_ON	1
3861a1e1d21SSam Leffler #define 	IEEE80211_WEP_MIXED	2
3871a1e1d21SSam Leffler #define IEEE80211_IOC_WEPKEY		4
3881a1e1d21SSam Leffler #define IEEE80211_IOC_NUMWEPKEYS	5
3891a1e1d21SSam Leffler #define IEEE80211_IOC_WEPTXKEY		6
3901a1e1d21SSam Leffler #define IEEE80211_IOC_AUTHMODE		7
3911a1e1d21SSam Leffler #define IEEE80211_IOC_STATIONNAME	8
3921a1e1d21SSam Leffler #define IEEE80211_IOC_CHANNEL		9
3931a1e1d21SSam Leffler #define IEEE80211_IOC_POWERSAVE		10
3941a1e1d21SSam Leffler #define 	IEEE80211_POWERSAVE_NOSUP	-1
3951a1e1d21SSam Leffler #define 	IEEE80211_POWERSAVE_OFF		0
3961a1e1d21SSam Leffler #define 	IEEE80211_POWERSAVE_CAM		1
3971a1e1d21SSam Leffler #define 	IEEE80211_POWERSAVE_PSP		2
3981a1e1d21SSam Leffler #define 	IEEE80211_POWERSAVE_PSP_CAM	3
3991a1e1d21SSam Leffler #define 	IEEE80211_POWERSAVE_ON		IEEE80211_POWERSAVE_CAM
4001a1e1d21SSam Leffler #define IEEE80211_IOC_POWERSAVESLEEP	11
40113604e6bSSam Leffler #define	IEEE80211_IOC_RTSTHRESHOLD	12
4022e79ca97SSam Leffler #define IEEE80211_IOC_PROTMODE		13
4032e79ca97SSam Leffler #define 	IEEE80211_PROTMODE_OFF		0
4042e79ca97SSam Leffler #define 	IEEE80211_PROTMODE_CTS		1
4052e79ca97SSam Leffler #define 	IEEE80211_PROTMODE_RTSCTS	2
4068a1b9b6aSSam Leffler #define	IEEE80211_IOC_TXPOWER		14	/* global tx power limit */
4078a1b9b6aSSam Leffler #define	IEEE80211_IOC_BSSID		15
4088a1b9b6aSSam Leffler #define	IEEE80211_IOC_ROAMING		16	/* roaming mode */
4098a1b9b6aSSam Leffler #define	IEEE80211_IOC_PRIVACY		17	/* privacy invoked */
4108a1b9b6aSSam Leffler #define	IEEE80211_IOC_DROPUNENCRYPTED	18	/* discard unencrypted frames */
4118a1b9b6aSSam Leffler #define	IEEE80211_IOC_WPAKEY		19
4128a1b9b6aSSam Leffler #define	IEEE80211_IOC_DELKEY		20
4138a1b9b6aSSam Leffler #define	IEEE80211_IOC_MLME		21
4148a1b9b6aSSam Leffler #define	IEEE80211_IOC_OPTIE		22	/* optional info. element */
4158a1b9b6aSSam Leffler #define	IEEE80211_IOC_SCAN_REQ		23
416239cc3b6SSam Leffler /* 24 was IEEE80211_IOC_SCAN_RESULTS */
4178a1b9b6aSSam Leffler #define	IEEE80211_IOC_COUNTERMEASURES	25	/* WPA/TKIP countermeasures */
4188a1b9b6aSSam Leffler #define	IEEE80211_IOC_WPA		26	/* WPA mode (0,1,2) */
4198a1b9b6aSSam Leffler #define	IEEE80211_IOC_CHANLIST		27	/* channel list */
4208a1b9b6aSSam Leffler #define	IEEE80211_IOC_WME		28	/* WME mode (on, off) */
4218a1b9b6aSSam Leffler #define	IEEE80211_IOC_HIDESSID		29	/* hide SSID mode (on, off) */
4228a1b9b6aSSam Leffler #define	IEEE80211_IOC_APBRIDGE		30	/* AP inter-sta bridging */
4238a1b9b6aSSam Leffler #define	IEEE80211_IOC_MCASTCIPHER	31	/* multicast/default cipher */
4248a1b9b6aSSam Leffler #define	IEEE80211_IOC_MCASTKEYLEN	32	/* multicast key length */
4258a1b9b6aSSam Leffler #define	IEEE80211_IOC_UCASTCIPHERS	33	/* unicast cipher suites */
4268a1b9b6aSSam Leffler #define	IEEE80211_IOC_UCASTCIPHER	34	/* unicast cipher */
4278a1b9b6aSSam Leffler #define	IEEE80211_IOC_UCASTKEYLEN	35	/* unicast key length */
4288a1b9b6aSSam Leffler #define	IEEE80211_IOC_DRIVER_CAPS	36	/* driver capabilities */
4298a1b9b6aSSam Leffler #define	IEEE80211_IOC_KEYMGTALGS	37	/* key management algorithms */
4308a1b9b6aSSam Leffler #define	IEEE80211_IOC_RSNCAPS		38	/* RSN capabilities */
4318a1b9b6aSSam Leffler #define	IEEE80211_IOC_WPAIE		39	/* WPA information element */
4328a1b9b6aSSam Leffler #define	IEEE80211_IOC_STA_STATS		40	/* per-station statistics */
4338a1b9b6aSSam Leffler #define	IEEE80211_IOC_MACCMD		41	/* MAC ACL operation */
4348a1b9b6aSSam Leffler #define	IEEE80211_IOC_CHANINFO		42	/* channel info list */
4358a1b9b6aSSam Leffler #define	IEEE80211_IOC_TXPOWMAX		43	/* max tx power for channel */
4368a1b9b6aSSam Leffler #define	IEEE80211_IOC_STA_TXPOW		44	/* per-station tx power limit */
437d1c85daeSSam Leffler /* 45 was IEEE80211_IOC_STA_INFO */
4388a1b9b6aSSam Leffler #define	IEEE80211_IOC_WME_CWMIN		46	/* WME: ECWmin */
4398a1b9b6aSSam Leffler #define	IEEE80211_IOC_WME_CWMAX		47	/* WME: ECWmax */
4408a1b9b6aSSam Leffler #define	IEEE80211_IOC_WME_AIFS		48	/* WME: AIFSN */
4418a1b9b6aSSam Leffler #define	IEEE80211_IOC_WME_TXOPLIMIT	49	/* WME: txops limit */
4428a1b9b6aSSam Leffler #define	IEEE80211_IOC_WME_ACM		50	/* WME: ACM (bss only) */
4438a1b9b6aSSam Leffler #define	IEEE80211_IOC_WME_ACKPOLICY	51	/* WME: ACK policy (!bss only)*/
4448a1b9b6aSSam Leffler #define	IEEE80211_IOC_DTIM_PERIOD	52	/* DTIM period (beacons) */
4458a1b9b6aSSam Leffler #define	IEEE80211_IOC_BEACON_INTERVAL	53	/* beacon interval (ms) */
4468a1b9b6aSSam Leffler #define	IEEE80211_IOC_ADDMAC		54	/* add sta to MAC ACL table */
4478a1b9b6aSSam Leffler #define	IEEE80211_IOC_DELMAC		55	/* del sta from MAC ACL table */
448c4f040c3SSam Leffler #define	IEEE80211_IOC_PUREG		56	/* pure 11g (no 11b stations) */
44964353cb0SSam Leffler #define	IEEE80211_IOC_MCAST_RATE	72	/* tx rate for mcast frames */
45070231e3dSSam Leffler #define	IEEE80211_IOC_FRAGTHRESHOLD	73	/* tx fragmentation threshold */
451c27e4e31SSam Leffler #define	IEEE80211_IOC_BURST		75	/* packet bursting */
452239cc3b6SSam Leffler #define	IEEE80211_IOC_SCAN_RESULTS	76	/* get scan results */
453546786c9SSam Leffler #define	IEEE80211_IOC_BMISSTHRESHOLD	77	/* beacon miss threshold */
454d1c85daeSSam Leffler #define	IEEE80211_IOC_STA_INFO		78	/* station/neighbor info */
4551a1e1d21SSam Leffler 
4568a1b9b6aSSam Leffler /*
4578a1b9b6aSSam Leffler  * Scan result data returned for IEEE80211_IOC_SCAN_RESULTS.
458239cc3b6SSam Leffler  * Each result is a fixed size structure followed by a variable
459239cc3b6SSam Leffler  * length SSID and one or more variable length information elements.
460239cc3b6SSam Leffler  * The size of each variable length item is found in the fixed
461239cc3b6SSam Leffler  * size structure and the entire length of the record is specified
462239cc3b6SSam Leffler  * in isr_len.  Result records are rounded to a multiple of 4 bytes.
4638a1b9b6aSSam Leffler  */
4648a1b9b6aSSam Leffler struct ieee80211req_scan_result {
4658a1b9b6aSSam Leffler 	u_int16_t	isr_len;		/* length (mult of 4) */
466239cc3b6SSam Leffler 	u_int16_t	isr_ie_len;		/* IE length */
4678a1b9b6aSSam Leffler 	u_int16_t	isr_freq;		/* MHz */
4688a1b9b6aSSam Leffler 	u_int16_t	isr_flags;		/* channel flags */
469239cc3b6SSam Leffler 	int8_t		isr_noise;
470239cc3b6SSam Leffler 	int8_t		isr_rssi;
4718a1b9b6aSSam Leffler 	u_int8_t	isr_intval;		/* beacon interval */
4728a1b9b6aSSam Leffler 	u_int8_t	isr_capinfo;		/* capabilities */
4738a1b9b6aSSam Leffler 	u_int8_t	isr_erp;		/* ERP element */
4748a1b9b6aSSam Leffler 	u_int8_t	isr_bssid[IEEE80211_ADDR_LEN];
4758a1b9b6aSSam Leffler 	u_int8_t	isr_nrates;
4768a1b9b6aSSam Leffler 	u_int8_t	isr_rates[IEEE80211_RATE_MAXSIZE];
4778a1b9b6aSSam Leffler 	u_int8_t	isr_ssid_len;		/* SSID length */
478239cc3b6SSam Leffler 	u_int8_t	isr_pad[8];
4798a1b9b6aSSam Leffler 	/* variable length SSID followed by IE data */
4808a1b9b6aSSam Leffler };
4811be50176SSam Leffler 
4821be50176SSam Leffler #define	SIOCG80211STATS		_IOWR('i', 236, struct ifreq)
4831a1e1d21SSam Leffler #endif /* __FreeBSD__ */
4841a1e1d21SSam Leffler 
4851a1e1d21SSam Leffler #endif /* _NET80211_IEEE80211_IOCTL_H_ */
486