* Copyright (c) 2001 Atsushi Onoe
* Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD: src/sys/net80211/ieee80211_ioctl.h,v 1.5 2004/03/30 22:57:57 sam Exp $
*/
#ifndef _NET80211_IEEE80211_IOCTL_H_
#define _NET80211_IEEE80211_IOCTL_H_
* IEEE 802.11 ioctls.
*/
struct ieee80211_stats {
u_int32_t is_rx_badversion;
u_int32_t is_rx_tooshort;
u_int32_t is_rx_wrongbss;
u_int32_t is_rx_dup;
u_int32_t is_rx_wrongdir;
u_int32_t is_rx_mcastecho;
u_int32_t is_rx_notassoc;
u_int32_t is_rx_nowep;
u_int32_t is_rx_unencrypted;
u_int32_t is_rx_wepfail;
u_int32_t is_rx_decap;
u_int32_t is_rx_mgtdiscard;
u_int32_t is_rx_ctl;
u_int32_t is_rx_rstoobig;
u_int32_t is_rx_elem_missing;
u_int32_t is_rx_elem_toobig;
u_int32_t is_rx_elem_toosmall;
u_int32_t is_rx_badchan;
u_int32_t is_rx_chanmismatch;
u_int32_t is_rx_nodealloc;
u_int32_t is_rx_ssidmismatch;
u_int32_t is_rx_auth_unsupported;
u_int32_t is_rx_auth_fail;
u_int32_t is_rx_assoc_bss;
u_int32_t is_rx_assoc_notauth;
u_int32_t is_rx_assoc_capmismatch;
u_int32_t is_rx_assoc_norate;
u_int32_t is_rx_deauth;
u_int32_t is_rx_disassoc;
u_int32_t is_rx_badsubtype;
u_int32_t is_rx_nombuf;
u_int32_t is_rx_decryptcrc;
u_int32_t is_rx_ahdemo_mgt;
u_int32_t is_rx_bad_auth;
u_int32_t is_tx_nombuf;
u_int32_t is_tx_nonode;
u_int32_t is_tx_unknownmgt;
u_int32_t is_scan_active;
u_int32_t is_scan_passive;
u_int32_t is_node_timeout;
u_int32_t is_crypto_nomem;
u_int32_t is_rx_assoc_badrsnie;
u_int32_t is_rx_unauth;
u_int32_t is_tx_noauth;
u_int32_t is_rx_eapol_key;
u_int32_t is_rx_eapol_replay;
u_int32_t is_rx_eapol_badmic;
u_int32_t is_rx_remmicfail;
u_int32_t is_rx_locmicfail;
u_int32_t is_tkip_replays;
u_int32_t is_tkip_icv_errs;
u_int32_t is_ccmp_replays;
u_int32_t is_ccmp_dec_errs;
u_int32_t is_cmac_replays;
u_int32_t is_cmac_icv_errs;
u_int32_t is_pbac_errs;
u_int32_t is_ht_nego_no_mandatory_mcs;
u_int32_t is_ht_nego_no_basic_mcs;
u_int32_t is_ht_nego_bad_crypto;
u_int32_t is_ht_prot_change;
u_int32_t is_ht_rx_ba_agreements;
u_int32_t is_ht_tx_ba_agreements;
u_int32_t is_ht_rx_frame_below_ba_winstart;
u_int32_t is_ht_rx_frame_above_ba_winend;
u_int32_t is_ht_rx_ba_window_slide;
u_int32_t is_ht_rx_ba_window_jump;
u_int32_t is_ht_rx_ba_no_buf;
u_int32_t is_ht_rx_ba_frame_lost;
u_int32_t is_ht_rx_ba_window_gap_timeout;
u_int32_t is_ht_rx_ba_timeout;
u_int32_t is_ht_tx_ba_timeout;
u_int32_t is_vht_nego_no_mandatory_mcs;
u_int32_t is_vht_nego_no_basic_mcs;
};
#define SIOCG80211STATS _IOWR('i', 242, struct ifreq)
struct ieee80211_nwid {
u_int8_t i_len;
u_int8_t i_nwid[IEEE80211_NWID_LEN];
};
#define SIOCS80211NWID _IOWR('i', 230, struct ifreq)
#define SIOCG80211NWID _IOWR('i', 231, struct ifreq)
struct ieee80211_nwkey {
char i_name[IFNAMSIZ];
int i_wepon;
int i_defkid;
struct {
int i_keylen;
u_int8_t *i_keydat;
} i_key[IEEE80211_WEP_NKID];
};
#define IEEE80211_NWKEY_OPEN 0 /* No privacy */
#define IEEE80211_NWKEY_WEP 1 /* WEP enabled */
#define IEEE80211_NWKEY_EAP 2 /* EAP enabled */
#define IEEE80211_NWKEY_PERSIST 0x100 /* designate persist keyset */
#define SIOCS80211NWKEY _IOW('i', 232, struct ieee80211_nwkey)
#define SIOCG80211NWKEY _IOWR('i', 233, struct ieee80211_nwkey)
struct ieee80211_power {
char i_name[IFNAMSIZ];
int i_enabled;
int i_maxsleep;
};
#define SIOCS80211POWER _IOW('i', 234, struct ieee80211_power)
#define SIOCG80211POWER _IOWR('i', 235, struct ieee80211_power)
#define IEEE80211_AUTH_NONE 0
#define IEEE80211_AUTH_OPEN 1
#define IEEE80211_AUTH_SHARED 2
struct ieee80211chanreq {
char i_name[IFNAMSIZ];
u_int16_t i_channel;
};
* Channels are specified by frequency and attributes.
*/
struct ieee80211_chaninfo {
u_int16_t ic_freq;
u_int16_t ic_flags;
};
* Channel attributes.
*/
#define IEEE80211_CHANINFO_2GHZ 0x0080 /* 2 GHz spectrum channel */
#define IEEE80211_CHANINFO_5GHZ 0x0100 /* 5 GHz spectrum channel */
#define IEEE80211_CHANINFO_PASSIVE 0x0200 /* Only passive scan allowed */
struct ieee80211_chanreq_all {
char i_name[IFNAMSIZ];
struct ieee80211_chaninfo *i_chans;
};
#ifndef IEEE80211_CHAN_ANY
#define IEEE80211_CHAN_ANY 0xffff
#endif
#define SIOCS80211CHANNEL _IOW('i', 238, struct ieee80211chanreq)
#define SIOCG80211CHANNEL _IOWR('i', 239, struct ieee80211chanreq)
#define SIOCG80211ALLCHANS _IOWR('i', 215, struct ieee80211_chanreq_all)
struct ieee80211_bssid {
char i_name[IFNAMSIZ];
u_int8_t i_bssid[IEEE80211_ADDR_LEN];
};
#define SIOCS80211BSSID _IOW('i', 240, struct ieee80211_bssid)
#define SIOCG80211BSSID _IOWR('i', 241, struct ieee80211_bssid)
struct ieee80211_txpower {
char i_name[IFNAMSIZ];
int i_mode;
int16_t i_val;
};
#define SIOCS80211TXPOWER _IOW('i', 243, struct ieee80211_txpower)
#define SIOCG80211TXPOWER _IOWR('i', 244, struct ieee80211_txpower)
#define IEEE80211_TXPOWER_MODE_FIXED 0 /* fixed tx power value */
#define IEEE80211_TXPOWER_MODE_AUTO 1 /* auto level control */
struct ieee80211_wpapsk {
char i_name[IFNAMSIZ];
int i_enabled;
u_int8_t i_psk[32];
};
#define SIOCS80211WPAPSK _IOW('i', 245, struct ieee80211_wpapsk)
#define SIOCG80211WPAPSK _IOWR('i', 246, struct ieee80211_wpapsk)
#define IEEE80211_WPA_PROTO_WPA1 0x01
#define IEEE80211_WPA_PROTO_WPA2 0x02
#define IEEE80211_WPA_CIPHER_NONE 0x00
#define IEEE80211_WPA_CIPHER_USEGROUP 0x01
#define IEEE80211_WPA_CIPHER_WEP40 0x02
#define IEEE80211_WPA_CIPHER_TKIP 0x04
#define IEEE80211_WPA_CIPHER_CCMP 0x08
#define IEEE80211_WPA_CIPHER_WEP104 0x10
#define IEEE80211_WPA_CIPHER_BIP 0x20
#define IEEE80211_WPA_AKM_PSK 0x01
#define IEEE80211_WPA_AKM_8021X 0x02
#define IEEE80211_WPA_AKM_SHA256_PSK 0x04
#define IEEE80211_WPA_AKM_SHA256_8021X 0x08
struct ieee80211_wpaparams {
char i_name[IFNAMSIZ];
int i_enabled;
u_int i_protos;
u_int i_akms;
u_int i_ciphers;
u_int i_groupcipher;
};
#define SIOCS80211WPAPARMS _IOW('i', 247, struct ieee80211_wpaparams)
#define SIOCG80211WPAPARMS _IOWR('i', 248, struct ieee80211_wpaparams)
struct ieee80211_keyavail {
char i_name[IFNAMSIZ];
u_int8_t i_macaddr[IEEE80211_ADDR_LEN];
u_int8_t i_key[32];
u_int32_t i_lifetime;
};
struct ieee80211_keyrun {
char i_name[IFNAMSIZ];
u_int8_t i_macaddr[IEEE80211_ADDR_LEN];
};
#define SIOCS80211KEYAVAIL _IOW('i', 251, struct ieee80211_keyavail)
#define SIOCS80211KEYRUN _IOW('i', 252, struct ieee80211_keyrun)
#define IEEE80211_SCAN_TIMEOUT 30 /* timeout in seconds */
#define SIOCS80211SCAN _IOW('i', 210, struct ifreq)
#define SIOCG80211JOINALL _IOWR('i', 218, struct ieee80211_joinreq_all)
#define SIOCS80211JOIN _IOWR('i', 255, struct ifreq)
#define SIOCG80211JOIN _IOWR('i', 0, struct ifreq)
struct ieee80211_join {
u_int8_t i_len;
u_int8_t i_nwid[IEEE80211_NWID_LEN];
u_int32_t i_flags;
struct ieee80211_wpaparams i_wpaparams;
struct ieee80211_wpapsk i_wpapsk;
struct ieee80211_nwkey i_nwkey;
};
struct ieee80211_joinreq_all {
char ja_ifname[IFNAMSIZ];
int ja_nodes;
size_t ja_size;
struct ieee80211_join *ja_node;
};
#define IEEE80211_JOIN_SHOW 0x01
#define IEEE80211_JOIN_FOUND 0x02
#define IEEE80211_JOIN_DEL 0x04
#define IEEE80211_JOIN_NWKEY 0x08
#define IEEE80211_JOIN_WPA 0x10
#define IEEE80211_JOIN_WPAPSK 0x20
#define IEEE80211_JOIN_8021X 0x40
#define IEEE80211_JOIN_ANY 0x80
#define IEEE80211_JOIN_DEL_ALL 0x100
struct ieee80211_nodereq {
char nr_ifname[IFNAMSIZ];
u_int8_t nr_macaddr[IEEE80211_ADDR_LEN];
u_int8_t nr_bssid[IEEE80211_ADDR_LEN];
u_int8_t nr_nwid_len;
u_int8_t nr_nwid[IEEE80211_NWID_LEN];
u_int16_t nr_channel;
u_int16_t nr_chan_flags;
u_int8_t nr_nrates;
u_int8_t nr_rates[IEEE80211_RATE_MAXSIZE];
int8_t nr_rssi;
int8_t nr_max_rssi;
u_int8_t nr_tstamp[8];
u_int16_t nr_intval;
u_int16_t nr_capinfo;
u_int8_t nr_erp;
u_int8_t nr_pwrsave;
u_int16_t nr_associd;
u_int16_t nr_txseq;
u_int16_t nr_rxseq;
u_int32_t nr_fails;
u_int32_t nr_inact;
u_int8_t nr_txrate;
u_int16_t nr_state;
u_int nr_rsnprotos;
u_int nr_rsnciphers;
u_int nr_rsnakms;
#ifdef __FreeBSD_version
uint8_t nr_rsnie[257];
#endif
u_int8_t nr_flags;
uint16_t nr_htcaps;
uint8_t nr_rxmcs[howmany(80,NBBY)];
uint16_t nr_max_rxrate;
uint8_t nr_tx_mcs_set;
uint8_t nr_txmcs;
uint8_t nr_vht_ss;
u_int32_t nr_assoc_fail;
};
#define IEEE80211_NODEREQ_STATE(_s) (1 << _s)
#define IEEE80211_NODEREQ_STATE_BITS \
"\20\01CACHE\02BSS\03AUTH\04ASSOC\05COLLECT"
#define IEEE80211_NODEREQ_RSSI(_nr) \
((u_int)(((float)(_nr)->nr_rssi / (_nr)->nr_max_rssi) * 100))
#define IEEE80211_NODEREQ_STA 0x00 /* station */
#define IEEE80211_NODEREQ_AP 0x01 /* access point */
#define IEEE80211_NODEREQ_AP_BSS 0x02 /* current bss access point */
#define IEEE80211_NODEREQ_COPY 0x04 /* add node with flags */
#define IEEE80211_NODEREQ_HT 0x08 /* HT negotiated */
#define IEEE80211_NODEREQ_VHT 0x10 /* VHT negotiated */
#define SIOCG80211NODE _IOWR('i', 211, struct ieee80211_nodereq)
#define SIOCS80211NODE _IOW('i', 212, struct ieee80211_nodereq)
#define SIOCS80211DELNODE _IOW('i', 213, struct ieee80211_nodereq)
#define IEEE80211_NODEREQ_ASSOCFAIL_CHAN 0x01
#define IEEE80211_NODEREQ_ASSOCFAIL_IBSS 0x02
#define IEEE80211_NODEREQ_ASSOCFAIL_PRIVACY 0x04
#define IEEE80211_NODEREQ_ASSOCFAIL_BASIC_RATE 0x08
#define IEEE80211_NODEREQ_ASSOCFAIL_ESSID 0x10
#define IEEE80211_NODEREQ_ASSOCFAIL_BSSID 0x20
#define IEEE80211_NODEREQ_ASSOCFAIL_WPA_PROTO 0x40
#define IEEE80211_NODEREQ_ASSOCFAIL_WPA_KEY 0x80
#define IEEE80211_NODEREQ_ASSOCFAIL_BITS \
"\20\1!CHAN\2!IBSS\3!PRIVACY\4!BASICRATE\5!ESSID\6!BSSID\7!WPAPROTO" \
"\10!WPAKEY"
struct ieee80211_nodereq_all {
char na_ifname[IFNAMSIZ];
int na_nodes;
size_t na_size;
#ifdef __FreeBSD_version
int na_startnode;
#endif
struct ieee80211_nodereq *na_node;
u_int8_t na_flags;
};
#define SIOCG80211ALLNODES _IOWR('i', 214, struct ieee80211_nodereq_all)
#define IEEE80211_F_HIDENWID 0x00000001 /* CONF: hidden ssid mode */
#define IEEE80211_F_NOBRIDGE 0x00000002 /* CONF: no internal bridging */
#define IEEE80211_F_HOSTAPMASK 0x00000003
#define IEEE80211_F_STAYAUTH 0x00000004 /* CONF: ignore deauth */
#define IEEE80211_F_NOMIMO 0x00000008 /* CONF: disable MIMO */
#define IEEE80211_F_USERBITS "\20\01HIDENWID\02NOBRIDGE\03STAYAUTH\04NOMIMO"
struct ieee80211_flags {
const char *f_name;
u_int f_flag;
};
#define IEEE80211_FLAGS { \
{ "hidenwid", IEEE80211_F_HIDENWID }, \
{ "nobridge", IEEE80211_F_NOBRIDGE }, \
{ "stayauth", IEEE80211_F_STAYAUTH }, \
{ "nomimo", IEEE80211_F_NOMIMO } \
}
#define SIOCG80211FLAGS _IOWR('i', 216, struct ifreq)
#define SIOCS80211FLAGS _IOW('i', 217, struct ifreq)
#endif