104171cfcSAugustin Cavalier /* $OpenBSD: ieee80211_ioctl.h,v 1.43 2022/03/14 15:07:24 stsp Exp $ */ 204171cfcSAugustin Cavalier /* $NetBSD: ieee80211_ioctl.h,v 1.7 2004/04/30 22:51:04 dyoung Exp $ */ 304171cfcSAugustin Cavalier 404171cfcSAugustin Cavalier /*- 504171cfcSAugustin Cavalier * Copyright (c) 2001 Atsushi Onoe 604171cfcSAugustin Cavalier * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting 704171cfcSAugustin Cavalier * All rights reserved. 804171cfcSAugustin Cavalier * 904171cfcSAugustin Cavalier * Redistribution and use in source and binary forms, with or without 1004171cfcSAugustin Cavalier * modification, are permitted provided that the following conditions 1104171cfcSAugustin Cavalier * are met: 1204171cfcSAugustin Cavalier * 1. Redistributions of source code must retain the above copyright 1304171cfcSAugustin Cavalier * notice, this list of conditions and the following disclaimer. 1404171cfcSAugustin Cavalier * 2. Redistributions in binary form must reproduce the above copyright 1504171cfcSAugustin Cavalier * notice, this list of conditions and the following disclaimer in the 1604171cfcSAugustin Cavalier * documentation and/or other materials provided with the distribution. 1704171cfcSAugustin Cavalier * 3. The name of the author may not be used to endorse or promote products 1804171cfcSAugustin Cavalier * derived from this software without specific prior written permission. 1904171cfcSAugustin Cavalier * 2004171cfcSAugustin Cavalier * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 2104171cfcSAugustin Cavalier * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 2204171cfcSAugustin Cavalier * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 2304171cfcSAugustin Cavalier * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 2404171cfcSAugustin Cavalier * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 2504171cfcSAugustin Cavalier * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2604171cfcSAugustin Cavalier * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2704171cfcSAugustin Cavalier * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2804171cfcSAugustin Cavalier * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 2904171cfcSAugustin Cavalier * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 3004171cfcSAugustin Cavalier * 3104171cfcSAugustin Cavalier * $FreeBSD: src/sys/net80211/ieee80211_ioctl.h,v 1.5 2004/03/30 22:57:57 sam Exp $ 3204171cfcSAugustin Cavalier */ 3304171cfcSAugustin Cavalier #ifndef _NET80211_IEEE80211_IOCTL_H_ 3404171cfcSAugustin Cavalier #define _NET80211_IEEE80211_IOCTL_H_ 3504171cfcSAugustin Cavalier 3604171cfcSAugustin Cavalier /* 3704171cfcSAugustin Cavalier * IEEE 802.11 ioctls. 3804171cfcSAugustin Cavalier */ 3904171cfcSAugustin Cavalier 4004171cfcSAugustin Cavalier /* per-interface statistics */ 4104171cfcSAugustin Cavalier struct ieee80211_stats { 4204171cfcSAugustin Cavalier u_int32_t is_rx_badversion; /* rx frame with bad version */ 4304171cfcSAugustin Cavalier u_int32_t is_rx_tooshort; /* rx frame too short */ 4404171cfcSAugustin Cavalier u_int32_t is_rx_wrongbss; /* rx from wrong bssid */ 4504171cfcSAugustin Cavalier u_int32_t is_rx_dup; /* rx discard 'cuz dup */ 4604171cfcSAugustin Cavalier u_int32_t is_rx_wrongdir; /* rx w/ wrong direction */ 4704171cfcSAugustin Cavalier u_int32_t is_rx_mcastecho; /* rx discard 'cuz mcast echo */ 4804171cfcSAugustin Cavalier u_int32_t is_rx_notassoc; /* rx discard 'cuz sta !assoc */ 4904171cfcSAugustin Cavalier u_int32_t is_rx_nowep; /* rx w/ wep but wep !config */ 5004171cfcSAugustin Cavalier u_int32_t is_rx_unencrypted; /* rx w/o wep but wep config */ 5104171cfcSAugustin Cavalier u_int32_t is_rx_wepfail; /* rx wep processing failed */ 5204171cfcSAugustin Cavalier u_int32_t is_rx_decap; /* rx decapsulation failed */ 5304171cfcSAugustin Cavalier u_int32_t is_rx_mgtdiscard; /* rx discard mgt frames */ 5404171cfcSAugustin Cavalier u_int32_t is_rx_ctl; /* rx discard ctrl frames */ 5504171cfcSAugustin Cavalier u_int32_t is_rx_rstoobig; /* rx rate set truncated */ 5604171cfcSAugustin Cavalier u_int32_t is_rx_elem_missing; /* rx required element missing*/ 5704171cfcSAugustin Cavalier u_int32_t is_rx_elem_toobig; /* rx element too big */ 5804171cfcSAugustin Cavalier u_int32_t is_rx_elem_toosmall; /* rx element too small */ 5904171cfcSAugustin Cavalier u_int32_t is_rx_badchan; /* rx frame w/ invalid chan */ 6004171cfcSAugustin Cavalier u_int32_t is_rx_chanmismatch; /* rx frame chan mismatch */ 6104171cfcSAugustin Cavalier u_int32_t is_rx_nodealloc; /* rx frame dropped */ 6204171cfcSAugustin Cavalier u_int32_t is_rx_ssidmismatch; /* rx frame ssid mismatch */ 6304171cfcSAugustin Cavalier u_int32_t is_rx_auth_unsupported; /* rx w/ unsupported auth alg */ 6404171cfcSAugustin Cavalier u_int32_t is_rx_auth_fail; /* rx sta auth failure */ 6504171cfcSAugustin Cavalier u_int32_t is_rx_assoc_bss; /* rx assoc from wrong bssid */ 6604171cfcSAugustin Cavalier u_int32_t is_rx_assoc_notauth; /* rx assoc w/o auth */ 6704171cfcSAugustin Cavalier u_int32_t is_rx_assoc_capmismatch;/* rx assoc w/ cap mismatch */ 6804171cfcSAugustin Cavalier u_int32_t is_rx_assoc_norate; /* rx assoc w/ no rate match */ 6904171cfcSAugustin Cavalier u_int32_t is_rx_deauth; /* rx deauthentication */ 7004171cfcSAugustin Cavalier u_int32_t is_rx_disassoc; /* rx disassociation */ 7104171cfcSAugustin Cavalier u_int32_t is_rx_badsubtype; /* rx frame w/ unknown subtype*/ 7204171cfcSAugustin Cavalier u_int32_t is_rx_nombuf; /* rx failed for lack of mbuf */ 7304171cfcSAugustin Cavalier u_int32_t is_rx_decryptcrc; /* rx decrypt failed on crc */ 7404171cfcSAugustin Cavalier u_int32_t is_rx_ahdemo_mgt; /* rx discard ahdemo mgt frame*/ 7504171cfcSAugustin Cavalier u_int32_t is_rx_bad_auth; /* rx bad auth request */ 7604171cfcSAugustin Cavalier u_int32_t is_tx_nombuf; /* tx failed for lack of mbuf */ 7704171cfcSAugustin Cavalier u_int32_t is_tx_nonode; /* tx failed for no node */ 7804171cfcSAugustin Cavalier u_int32_t is_tx_unknownmgt; /* tx of unknown mgt frame */ 7904171cfcSAugustin Cavalier u_int32_t is_scan_active; /* active scans started */ 8004171cfcSAugustin Cavalier u_int32_t is_scan_passive; /* passive scans started */ 8104171cfcSAugustin Cavalier u_int32_t is_node_timeout; /* nodes timed out inactivity */ 8204171cfcSAugustin Cavalier u_int32_t is_crypto_nomem; /* no memory for crypto ctx */ 8304171cfcSAugustin Cavalier u_int32_t is_rx_assoc_badrsnie; /* rx assoc w/ bad RSN IE */ 8404171cfcSAugustin Cavalier u_int32_t is_rx_unauth; /* rx port not valid */ 8504171cfcSAugustin Cavalier u_int32_t is_tx_noauth; /* tx port not valid */ 8604171cfcSAugustin Cavalier u_int32_t is_rx_eapol_key; /* rx eapol-key frames */ 8704171cfcSAugustin Cavalier u_int32_t is_rx_eapol_replay; /* rx replayed eapol frames */ 8804171cfcSAugustin Cavalier u_int32_t is_rx_eapol_badmic; /* rx eapol frames w/ bad mic */ 8904171cfcSAugustin Cavalier u_int32_t is_rx_remmicfail; /* rx tkip remote mic fails */ 9004171cfcSAugustin Cavalier u_int32_t is_rx_locmicfail; /* rx tkip local mic fails */ 9104171cfcSAugustin Cavalier u_int32_t is_tkip_replays; 9204171cfcSAugustin Cavalier u_int32_t is_tkip_icv_errs; 9304171cfcSAugustin Cavalier u_int32_t is_ccmp_replays; 9404171cfcSAugustin Cavalier u_int32_t is_ccmp_dec_errs; 9504171cfcSAugustin Cavalier u_int32_t is_cmac_replays; 9604171cfcSAugustin Cavalier u_int32_t is_cmac_icv_errs; 9704171cfcSAugustin Cavalier u_int32_t is_pbac_errs; 9804171cfcSAugustin Cavalier u_int32_t is_ht_nego_no_mandatory_mcs; 9904171cfcSAugustin Cavalier u_int32_t is_ht_nego_no_basic_mcs; 10004171cfcSAugustin Cavalier u_int32_t is_ht_nego_bad_crypto; 10104171cfcSAugustin Cavalier u_int32_t is_ht_prot_change; 10204171cfcSAugustin Cavalier u_int32_t is_ht_rx_ba_agreements; 10304171cfcSAugustin Cavalier u_int32_t is_ht_tx_ba_agreements; 10404171cfcSAugustin Cavalier u_int32_t is_ht_rx_frame_below_ba_winstart; 10504171cfcSAugustin Cavalier u_int32_t is_ht_rx_frame_above_ba_winend; 10604171cfcSAugustin Cavalier u_int32_t is_ht_rx_ba_window_slide; 10704171cfcSAugustin Cavalier u_int32_t is_ht_rx_ba_window_jump; 10804171cfcSAugustin Cavalier u_int32_t is_ht_rx_ba_no_buf; 10904171cfcSAugustin Cavalier u_int32_t is_ht_rx_ba_frame_lost; 11004171cfcSAugustin Cavalier u_int32_t is_ht_rx_ba_window_gap_timeout; 11104171cfcSAugustin Cavalier u_int32_t is_ht_rx_ba_timeout; 11204171cfcSAugustin Cavalier u_int32_t is_ht_tx_ba_timeout; 11304171cfcSAugustin Cavalier u_int32_t is_vht_nego_no_mandatory_mcs; 11404171cfcSAugustin Cavalier u_int32_t is_vht_nego_no_basic_mcs; 11504171cfcSAugustin Cavalier }; 11604171cfcSAugustin Cavalier 11704171cfcSAugustin Cavalier #define SIOCG80211STATS _IOWR('i', 242, struct ifreq) 11804171cfcSAugustin Cavalier 11904171cfcSAugustin Cavalier /* network identifier (ESSID), nwid is pointed at by ifr.ifr_data */ 12004171cfcSAugustin Cavalier struct ieee80211_nwid { 12104171cfcSAugustin Cavalier u_int8_t i_len; 12204171cfcSAugustin Cavalier u_int8_t i_nwid[IEEE80211_NWID_LEN]; 12304171cfcSAugustin Cavalier }; 12404171cfcSAugustin Cavalier 12504171cfcSAugustin Cavalier #define SIOCS80211NWID _IOWR('i', 230, struct ifreq) 12604171cfcSAugustin Cavalier #define SIOCG80211NWID _IOWR('i', 231, struct ifreq) 12704171cfcSAugustin Cavalier 12804171cfcSAugustin Cavalier /* network key (WEP), the first member must be matched with struct ifreq */ 12904171cfcSAugustin Cavalier struct ieee80211_nwkey { 13004171cfcSAugustin Cavalier char i_name[IFNAMSIZ]; /* if_name, e.g. "wi0" */ 13104171cfcSAugustin Cavalier int i_wepon; /* wep enabled flag */ 13204171cfcSAugustin Cavalier int i_defkid; /* default encrypt key id */ 13304171cfcSAugustin Cavalier struct { 13404171cfcSAugustin Cavalier int i_keylen; 13504171cfcSAugustin Cavalier u_int8_t *i_keydat; 13604171cfcSAugustin Cavalier } i_key[IEEE80211_WEP_NKID]; 13704171cfcSAugustin Cavalier }; 13804171cfcSAugustin Cavalier 13904171cfcSAugustin Cavalier #define IEEE80211_NWKEY_OPEN 0 /* No privacy */ 14004171cfcSAugustin Cavalier #define IEEE80211_NWKEY_WEP 1 /* WEP enabled */ 14104171cfcSAugustin Cavalier #define IEEE80211_NWKEY_EAP 2 /* EAP enabled */ 14204171cfcSAugustin Cavalier #define IEEE80211_NWKEY_PERSIST 0x100 /* designate persist keyset */ 14304171cfcSAugustin Cavalier 14404171cfcSAugustin Cavalier #define SIOCS80211NWKEY _IOW('i', 232, struct ieee80211_nwkey) 14504171cfcSAugustin Cavalier #define SIOCG80211NWKEY _IOWR('i', 233, struct ieee80211_nwkey) 14604171cfcSAugustin Cavalier 14704171cfcSAugustin Cavalier /* power management parameters */ 14804171cfcSAugustin Cavalier struct ieee80211_power { 14904171cfcSAugustin Cavalier char i_name[IFNAMSIZ]; /* if_name, e.g. "wi0" */ 15004171cfcSAugustin Cavalier int i_enabled; /* 1 == on, 0 == off */ 15104171cfcSAugustin Cavalier int i_maxsleep; /* max sleep in ms */ 15204171cfcSAugustin Cavalier }; 15304171cfcSAugustin Cavalier #define SIOCS80211POWER _IOW('i', 234, struct ieee80211_power) 15404171cfcSAugustin Cavalier #define SIOCG80211POWER _IOWR('i', 235, struct ieee80211_power) 15504171cfcSAugustin Cavalier 15604171cfcSAugustin Cavalier #define IEEE80211_AUTH_NONE 0 15704171cfcSAugustin Cavalier #define IEEE80211_AUTH_OPEN 1 15804171cfcSAugustin Cavalier #define IEEE80211_AUTH_SHARED 2 15904171cfcSAugustin Cavalier 16004171cfcSAugustin Cavalier /* channel request */ 16104171cfcSAugustin Cavalier struct ieee80211chanreq { 16204171cfcSAugustin Cavalier char i_name[IFNAMSIZ]; /* if_name, e.g. "wi0" */ 16304171cfcSAugustin Cavalier u_int16_t i_channel; 16404171cfcSAugustin Cavalier }; 16504171cfcSAugustin Cavalier 16604171cfcSAugustin Cavalier /* 16704171cfcSAugustin Cavalier * Channels are specified by frequency and attributes. 16804171cfcSAugustin Cavalier */ 16904171cfcSAugustin Cavalier struct ieee80211_chaninfo { 17004171cfcSAugustin Cavalier u_int16_t ic_freq; /* setting in MHz */ 17104171cfcSAugustin Cavalier u_int16_t ic_flags; /* see below */ 17204171cfcSAugustin Cavalier }; 17304171cfcSAugustin Cavalier 17404171cfcSAugustin Cavalier /* 17504171cfcSAugustin Cavalier * Channel attributes. 17604171cfcSAugustin Cavalier */ 17704171cfcSAugustin Cavalier #define IEEE80211_CHANINFO_2GHZ 0x0080 /* 2 GHz spectrum channel */ 17804171cfcSAugustin Cavalier #define IEEE80211_CHANINFO_5GHZ 0x0100 /* 5 GHz spectrum channel */ 17904171cfcSAugustin Cavalier #define IEEE80211_CHANINFO_PASSIVE 0x0200 /* Only passive scan allowed */ 18004171cfcSAugustin Cavalier 18104171cfcSAugustin Cavalier struct ieee80211_chanreq_all { 18204171cfcSAugustin Cavalier char i_name[IFNAMSIZ]; /* if_name, e.g. "wi0" */ 18304171cfcSAugustin Cavalier struct ieee80211_chaninfo *i_chans; /* array of 256 elements */ 18404171cfcSAugustin Cavalier }; 18504171cfcSAugustin Cavalier 18604171cfcSAugustin Cavalier #ifndef IEEE80211_CHAN_ANY 18704171cfcSAugustin Cavalier #define IEEE80211_CHAN_ANY 0xffff 18804171cfcSAugustin Cavalier #endif 18904171cfcSAugustin Cavalier 19004171cfcSAugustin Cavalier #define SIOCS80211CHANNEL _IOW('i', 238, struct ieee80211chanreq) 19104171cfcSAugustin Cavalier #define SIOCG80211CHANNEL _IOWR('i', 239, struct ieee80211chanreq) 19204171cfcSAugustin Cavalier #define SIOCG80211ALLCHANS _IOWR('i', 215, struct ieee80211_chanreq_all) 19304171cfcSAugustin Cavalier 19404171cfcSAugustin Cavalier /* BSS identifier */ 19504171cfcSAugustin Cavalier struct ieee80211_bssid { 19604171cfcSAugustin Cavalier char i_name[IFNAMSIZ]; /* if_name, e.g. "wi0" */ 19704171cfcSAugustin Cavalier u_int8_t i_bssid[IEEE80211_ADDR_LEN]; 19804171cfcSAugustin Cavalier }; 19904171cfcSAugustin Cavalier 20004171cfcSAugustin Cavalier #define SIOCS80211BSSID _IOW('i', 240, struct ieee80211_bssid) 20104171cfcSAugustin Cavalier #define SIOCG80211BSSID _IOWR('i', 241, struct ieee80211_bssid) 20204171cfcSAugustin Cavalier 20304171cfcSAugustin Cavalier /* transmit power */ 20404171cfcSAugustin Cavalier struct ieee80211_txpower { 20504171cfcSAugustin Cavalier char i_name[IFNAMSIZ]; /* if_name, e.g. "wi0" */ 20604171cfcSAugustin Cavalier int i_mode; /* auto, manual */ 20704171cfcSAugustin Cavalier int16_t i_val; /* dBm */ 20804171cfcSAugustin Cavalier }; 20904171cfcSAugustin Cavalier 21004171cfcSAugustin Cavalier #define SIOCS80211TXPOWER _IOW('i', 243, struct ieee80211_txpower) 21104171cfcSAugustin Cavalier #define SIOCG80211TXPOWER _IOWR('i', 244, struct ieee80211_txpower) 21204171cfcSAugustin Cavalier 21304171cfcSAugustin Cavalier #define IEEE80211_TXPOWER_MODE_FIXED 0 /* fixed tx power value */ 21404171cfcSAugustin Cavalier #define IEEE80211_TXPOWER_MODE_AUTO 1 /* auto level control */ 21504171cfcSAugustin Cavalier 21604171cfcSAugustin Cavalier struct ieee80211_wpapsk { 21704171cfcSAugustin Cavalier char i_name[IFNAMSIZ]; /* if_name, e.g. "wi0" */ 21804171cfcSAugustin Cavalier int i_enabled; 21904171cfcSAugustin Cavalier u_int8_t i_psk[32]; 22004171cfcSAugustin Cavalier }; 22104171cfcSAugustin Cavalier 22204171cfcSAugustin Cavalier #define SIOCS80211WPAPSK _IOW('i', 245, struct ieee80211_wpapsk) 22304171cfcSAugustin Cavalier #define SIOCG80211WPAPSK _IOWR('i', 246, struct ieee80211_wpapsk) 22404171cfcSAugustin Cavalier 22504171cfcSAugustin Cavalier #define IEEE80211_WPA_PROTO_WPA1 0x01 22604171cfcSAugustin Cavalier #define IEEE80211_WPA_PROTO_WPA2 0x02 22704171cfcSAugustin Cavalier 22804171cfcSAugustin Cavalier #define IEEE80211_WPA_CIPHER_NONE 0x00 22904171cfcSAugustin Cavalier #define IEEE80211_WPA_CIPHER_USEGROUP 0x01 23004171cfcSAugustin Cavalier #define IEEE80211_WPA_CIPHER_WEP40 0x02 23104171cfcSAugustin Cavalier #define IEEE80211_WPA_CIPHER_TKIP 0x04 23204171cfcSAugustin Cavalier #define IEEE80211_WPA_CIPHER_CCMP 0x08 23304171cfcSAugustin Cavalier #define IEEE80211_WPA_CIPHER_WEP104 0x10 23404171cfcSAugustin Cavalier #define IEEE80211_WPA_CIPHER_BIP 0x20 23504171cfcSAugustin Cavalier 23604171cfcSAugustin Cavalier #define IEEE80211_WPA_AKM_PSK 0x01 23704171cfcSAugustin Cavalier #define IEEE80211_WPA_AKM_8021X 0x02 23804171cfcSAugustin Cavalier #define IEEE80211_WPA_AKM_SHA256_PSK 0x04 23904171cfcSAugustin Cavalier #define IEEE80211_WPA_AKM_SHA256_8021X 0x08 24004171cfcSAugustin Cavalier 24104171cfcSAugustin Cavalier struct ieee80211_wpaparams { 24204171cfcSAugustin Cavalier char i_name[IFNAMSIZ]; /* if_name, e.g. "wi0" */ 24304171cfcSAugustin Cavalier int i_enabled; 24404171cfcSAugustin Cavalier u_int i_protos; 24504171cfcSAugustin Cavalier u_int i_akms; 24604171cfcSAugustin Cavalier u_int i_ciphers; 24704171cfcSAugustin Cavalier u_int i_groupcipher; 24804171cfcSAugustin Cavalier }; 24904171cfcSAugustin Cavalier 25004171cfcSAugustin Cavalier #define SIOCS80211WPAPARMS _IOW('i', 247, struct ieee80211_wpaparams) 25104171cfcSAugustin Cavalier #define SIOCG80211WPAPARMS _IOWR('i', 248, struct ieee80211_wpaparams) 25204171cfcSAugustin Cavalier 25304171cfcSAugustin Cavalier struct ieee80211_keyavail { 25404171cfcSAugustin Cavalier char i_name[IFNAMSIZ]; /* if_name, e.g. "wi0" */ 25504171cfcSAugustin Cavalier u_int8_t i_macaddr[IEEE80211_ADDR_LEN]; 25604171cfcSAugustin Cavalier u_int8_t i_key[32]; 25704171cfcSAugustin Cavalier u_int32_t i_lifetime; 25804171cfcSAugustin Cavalier }; 25904171cfcSAugustin Cavalier 26004171cfcSAugustin Cavalier struct ieee80211_keyrun { 26104171cfcSAugustin Cavalier char i_name[IFNAMSIZ]; /* if_name, e.g. "wi0" */ 26204171cfcSAugustin Cavalier u_int8_t i_macaddr[IEEE80211_ADDR_LEN]; 26304171cfcSAugustin Cavalier }; 26404171cfcSAugustin Cavalier 26504171cfcSAugustin Cavalier #define SIOCS80211KEYAVAIL _IOW('i', 251, struct ieee80211_keyavail) 26604171cfcSAugustin Cavalier #define SIOCS80211KEYRUN _IOW('i', 252, struct ieee80211_keyrun) 26704171cfcSAugustin Cavalier 26804171cfcSAugustin Cavalier /* scan request (will block) */ 26904171cfcSAugustin Cavalier #define IEEE80211_SCAN_TIMEOUT 30 /* timeout in seconds */ 27004171cfcSAugustin Cavalier 27104171cfcSAugustin Cavalier #define SIOCS80211SCAN _IOW('i', 210, struct ifreq) 27204171cfcSAugustin Cavalier 27304171cfcSAugustin Cavalier #define SIOCG80211JOINALL _IOWR('i', 218, struct ieee80211_joinreq_all) 27404171cfcSAugustin Cavalier #define SIOCS80211JOIN _IOWR('i', 255, struct ifreq) 27504171cfcSAugustin Cavalier #define SIOCG80211JOIN _IOWR('i', 0, struct ifreq) 27604171cfcSAugustin Cavalier 27704171cfcSAugustin Cavalier /* join is pointed at by ifr.ifr_data */ 27804171cfcSAugustin Cavalier struct ieee80211_join { 27904171cfcSAugustin Cavalier u_int8_t i_len; /* length of i_nwid */ 28004171cfcSAugustin Cavalier u_int8_t i_nwid[IEEE80211_NWID_LEN]; 28104171cfcSAugustin Cavalier u_int32_t i_flags; 28204171cfcSAugustin Cavalier 28304171cfcSAugustin Cavalier struct ieee80211_wpaparams i_wpaparams; 28404171cfcSAugustin Cavalier struct ieee80211_wpapsk i_wpapsk; 28504171cfcSAugustin Cavalier struct ieee80211_nwkey i_nwkey; 28604171cfcSAugustin Cavalier }; 28704171cfcSAugustin Cavalier 28804171cfcSAugustin Cavalier struct ieee80211_joinreq_all { 28904171cfcSAugustin Cavalier char ja_ifname[IFNAMSIZ]; 29004171cfcSAugustin Cavalier int ja_nodes; /* returned count */ 29104171cfcSAugustin Cavalier size_t ja_size; /* size of node buffer */ 29204171cfcSAugustin Cavalier struct ieee80211_join *ja_node; /* allocated node buffer */ 29304171cfcSAugustin Cavalier }; 29404171cfcSAugustin Cavalier 29504171cfcSAugustin Cavalier 29604171cfcSAugustin Cavalier #define IEEE80211_JOIN_SHOW 0x01 29704171cfcSAugustin Cavalier #define IEEE80211_JOIN_FOUND 0x02 29804171cfcSAugustin Cavalier #define IEEE80211_JOIN_DEL 0x04 29904171cfcSAugustin Cavalier #define IEEE80211_JOIN_NWKEY 0x08 30004171cfcSAugustin Cavalier #define IEEE80211_JOIN_WPA 0x10 30104171cfcSAugustin Cavalier #define IEEE80211_JOIN_WPAPSK 0x20 30204171cfcSAugustin Cavalier #define IEEE80211_JOIN_8021X 0x40 30304171cfcSAugustin Cavalier #define IEEE80211_JOIN_ANY 0x80 30404171cfcSAugustin Cavalier #define IEEE80211_JOIN_DEL_ALL 0x100 30504171cfcSAugustin Cavalier 30604171cfcSAugustin Cavalier /* node and requests */ 30704171cfcSAugustin Cavalier struct ieee80211_nodereq { 30804171cfcSAugustin Cavalier char nr_ifname[IFNAMSIZ]; /* e.g. "ath0" */ 30904171cfcSAugustin Cavalier 31004171cfcSAugustin Cavalier /* Node address and name information */ 31104171cfcSAugustin Cavalier u_int8_t nr_macaddr[IEEE80211_ADDR_LEN]; /* node lladdr */ 31204171cfcSAugustin Cavalier u_int8_t nr_bssid[IEEE80211_ADDR_LEN]; /* bssid */ 31304171cfcSAugustin Cavalier u_int8_t nr_nwid_len; /* ESSID length */ 31404171cfcSAugustin Cavalier u_int8_t nr_nwid[IEEE80211_NWID_LEN]; /* ESSID */ 31504171cfcSAugustin Cavalier 31604171cfcSAugustin Cavalier /* Channel and rates */ 31704171cfcSAugustin Cavalier u_int16_t nr_channel; /* last channel */ 31804171cfcSAugustin Cavalier u_int16_t nr_chan_flags; /* channel flags */ 31904171cfcSAugustin Cavalier u_int8_t nr_nrates; /* rate count */ 32004171cfcSAugustin Cavalier u_int8_t nr_rates[IEEE80211_RATE_MAXSIZE]; /* rate set */ 32104171cfcSAugustin Cavalier 32204171cfcSAugustin Cavalier /* Node status information */ 32304171cfcSAugustin Cavalier int8_t nr_rssi; /* received signal strength */ 32404171cfcSAugustin Cavalier int8_t nr_max_rssi; /* maximum rssi */ 32504171cfcSAugustin Cavalier u_int8_t nr_tstamp[8]; /* from last received beacon */ 32604171cfcSAugustin Cavalier u_int16_t nr_intval; /* beacon interval */ 32704171cfcSAugustin Cavalier u_int16_t nr_capinfo; /* capabilities */ 32804171cfcSAugustin Cavalier u_int8_t nr_erp; /* 11g only */ 32904171cfcSAugustin Cavalier u_int8_t nr_pwrsave; /* power saving mode */ 33004171cfcSAugustin Cavalier u_int16_t nr_associd; /* assoc response */ 33104171cfcSAugustin Cavalier u_int16_t nr_txseq; /* seq to be transmitted */ 33204171cfcSAugustin Cavalier u_int16_t nr_rxseq; /* seq previous received */ 33304171cfcSAugustin Cavalier u_int32_t nr_fails; /* failure count to associate */ 33404171cfcSAugustin Cavalier u_int32_t nr_inact; /* inactivity mark count */ 33504171cfcSAugustin Cavalier u_int8_t nr_txrate; /* index to nr_rates[] */ 33604171cfcSAugustin Cavalier u_int16_t nr_state; /* node state in the cache */ 33704171cfcSAugustin Cavalier 33804171cfcSAugustin Cavalier /* RSN */ 33904171cfcSAugustin Cavalier u_int nr_rsnprotos; 34004171cfcSAugustin Cavalier u_int nr_rsnciphers; 34104171cfcSAugustin Cavalier u_int nr_rsnakms; 342*bcb089f6SAugustin Cavalier #ifdef __FreeBSD_version 343*bcb089f6SAugustin Cavalier uint8_t nr_rsnie[257]; 344*bcb089f6SAugustin Cavalier #endif 34504171cfcSAugustin Cavalier 34604171cfcSAugustin Cavalier /* Node flags */ 34704171cfcSAugustin Cavalier u_int8_t nr_flags; 34804171cfcSAugustin Cavalier 34904171cfcSAugustin Cavalier /* HT */ 35004171cfcSAugustin Cavalier uint16_t nr_htcaps; 35104171cfcSAugustin Cavalier uint8_t nr_rxmcs[howmany(80,NBBY)]; 35204171cfcSAugustin Cavalier uint16_t nr_max_rxrate; /* in Mb/s, 0 <= rate <= 1023 */ 35304171cfcSAugustin Cavalier uint8_t nr_tx_mcs_set; 35404171cfcSAugustin Cavalier 35504171cfcSAugustin Cavalier /* HT / VHT */ 35604171cfcSAugustin Cavalier uint8_t nr_txmcs; 35704171cfcSAugustin Cavalier 35804171cfcSAugustin Cavalier /* VHT */ 35904171cfcSAugustin Cavalier uint8_t nr_vht_ss; 36004171cfcSAugustin Cavalier 36104171cfcSAugustin Cavalier u_int32_t nr_assoc_fail; /* association failure reasons */ 36204171cfcSAugustin Cavalier }; 36304171cfcSAugustin Cavalier 36404171cfcSAugustin Cavalier #define IEEE80211_NODEREQ_STATE(_s) (1 << _s) 36504171cfcSAugustin Cavalier #define IEEE80211_NODEREQ_STATE_BITS \ 36604171cfcSAugustin Cavalier "\20\01CACHE\02BSS\03AUTH\04ASSOC\05COLLECT" 36704171cfcSAugustin Cavalier 36804171cfcSAugustin Cavalier #define IEEE80211_NODEREQ_RSSI(_nr) \ 36904171cfcSAugustin Cavalier ((u_int)(((float)(_nr)->nr_rssi / (_nr)->nr_max_rssi) * 100)) 37004171cfcSAugustin Cavalier 37104171cfcSAugustin Cavalier #define IEEE80211_NODEREQ_STA 0x00 /* station */ 37204171cfcSAugustin Cavalier #define IEEE80211_NODEREQ_AP 0x01 /* access point */ 37304171cfcSAugustin Cavalier #define IEEE80211_NODEREQ_AP_BSS 0x02 /* current bss access point */ 37404171cfcSAugustin Cavalier #define IEEE80211_NODEREQ_COPY 0x04 /* add node with flags */ 37504171cfcSAugustin Cavalier #define IEEE80211_NODEREQ_HT 0x08 /* HT negotiated */ 37604171cfcSAugustin Cavalier #define IEEE80211_NODEREQ_VHT 0x10 /* VHT negotiated */ 37704171cfcSAugustin Cavalier 37804171cfcSAugustin Cavalier #define SIOCG80211NODE _IOWR('i', 211, struct ieee80211_nodereq) 37904171cfcSAugustin Cavalier #define SIOCS80211NODE _IOW('i', 212, struct ieee80211_nodereq) 38004171cfcSAugustin Cavalier #define SIOCS80211DELNODE _IOW('i', 213, struct ieee80211_nodereq) 38104171cfcSAugustin Cavalier 38204171cfcSAugustin Cavalier #define IEEE80211_NODEREQ_ASSOCFAIL_CHAN 0x01 38304171cfcSAugustin Cavalier #define IEEE80211_NODEREQ_ASSOCFAIL_IBSS 0x02 38404171cfcSAugustin Cavalier #define IEEE80211_NODEREQ_ASSOCFAIL_PRIVACY 0x04 38504171cfcSAugustin Cavalier #define IEEE80211_NODEREQ_ASSOCFAIL_BASIC_RATE 0x08 38604171cfcSAugustin Cavalier #define IEEE80211_NODEREQ_ASSOCFAIL_ESSID 0x10 38704171cfcSAugustin Cavalier #define IEEE80211_NODEREQ_ASSOCFAIL_BSSID 0x20 38804171cfcSAugustin Cavalier #define IEEE80211_NODEREQ_ASSOCFAIL_WPA_PROTO 0x40 38904171cfcSAugustin Cavalier #define IEEE80211_NODEREQ_ASSOCFAIL_WPA_KEY 0x80 39004171cfcSAugustin Cavalier #define IEEE80211_NODEREQ_ASSOCFAIL_BITS \ 39104171cfcSAugustin Cavalier "\20\1!CHAN\2!IBSS\3!PRIVACY\4!BASICRATE\5!ESSID\6!BSSID\7!WPAPROTO" \ 39204171cfcSAugustin Cavalier "\10!WPAKEY" 39304171cfcSAugustin Cavalier 39404171cfcSAugustin Cavalier /* get the entire node cache */ 39504171cfcSAugustin Cavalier struct ieee80211_nodereq_all { 39604171cfcSAugustin Cavalier char na_ifname[IFNAMSIZ]; /* e.g. "ath0" */ 39704171cfcSAugustin Cavalier 39804171cfcSAugustin Cavalier int na_nodes; /* returned count */ 39904171cfcSAugustin Cavalier size_t na_size; /* size of node buffer */ 400*bcb089f6SAugustin Cavalier #ifdef __FreeBSD_version 401*bcb089f6SAugustin Cavalier int na_startnode; 402*bcb089f6SAugustin Cavalier #endif 40304171cfcSAugustin Cavalier struct ieee80211_nodereq *na_node; /* allocated node buffer */ 40404171cfcSAugustin Cavalier 40504171cfcSAugustin Cavalier /* Match nodes by flag */ 40604171cfcSAugustin Cavalier u_int8_t na_flags; /* IEEE80211_NODEREQ_* */ 40704171cfcSAugustin Cavalier }; 40804171cfcSAugustin Cavalier 40904171cfcSAugustin Cavalier #define SIOCG80211ALLNODES _IOWR('i', 214, struct ieee80211_nodereq_all) 41004171cfcSAugustin Cavalier 41104171cfcSAugustin Cavalier /* net80211 specific interface flags */ 41204171cfcSAugustin Cavalier #define IEEE80211_F_HIDENWID 0x00000001 /* CONF: hidden ssid mode */ 41304171cfcSAugustin Cavalier #define IEEE80211_F_NOBRIDGE 0x00000002 /* CONF: no internal bridging */ 41404171cfcSAugustin Cavalier #define IEEE80211_F_HOSTAPMASK 0x00000003 41504171cfcSAugustin Cavalier #define IEEE80211_F_STAYAUTH 0x00000004 /* CONF: ignore deauth */ 41604171cfcSAugustin Cavalier #define IEEE80211_F_NOMIMO 0x00000008 /* CONF: disable MIMO */ 41704171cfcSAugustin Cavalier #define IEEE80211_F_USERBITS "\20\01HIDENWID\02NOBRIDGE\03STAYAUTH\04NOMIMO" 41804171cfcSAugustin Cavalier 41904171cfcSAugustin Cavalier struct ieee80211_flags { 42004171cfcSAugustin Cavalier const char *f_name; 42104171cfcSAugustin Cavalier u_int f_flag; 42204171cfcSAugustin Cavalier }; 42304171cfcSAugustin Cavalier 42404171cfcSAugustin Cavalier #define IEEE80211_FLAGS { \ 42504171cfcSAugustin Cavalier { "hidenwid", IEEE80211_F_HIDENWID }, \ 42604171cfcSAugustin Cavalier { "nobridge", IEEE80211_F_NOBRIDGE }, \ 42704171cfcSAugustin Cavalier { "stayauth", IEEE80211_F_STAYAUTH }, \ 42804171cfcSAugustin Cavalier { "nomimo", IEEE80211_F_NOMIMO } \ 42904171cfcSAugustin Cavalier } 43004171cfcSAugustin Cavalier 43104171cfcSAugustin Cavalier #define SIOCG80211FLAGS _IOWR('i', 216, struct ifreq) 43204171cfcSAugustin Cavalier #define SIOCS80211FLAGS _IOW('i', 217, struct ifreq) 43304171cfcSAugustin Cavalier 43404171cfcSAugustin Cavalier #endif /* _NET80211_IEEE80211_IOCTL_H_ */ 435