/*-1* SPDX-License-Identifier: BSD-2-Clause2*3* Copyright (c) 2001 Atsushi Onoe4* Copyright (c) 2002-2009 Sam Leffler, Errno Consulting5* All rights reserved.6*7* Redistribution and use in source and binary forms, with or without8* modification, are permitted provided that the following conditions9* are met:10* 1. Redistributions of source code must retain the above copyright11* notice, this list of conditions and the following disclaimer.12* 2. Redistributions in binary form must reproduce the above copyright13* notice, this list of conditions and the following disclaimer in the14* documentation and/or other materials provided with the distribution.15*16* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR17* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES18* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.19* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,20* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT21* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,22* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY23* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF25* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.26*/27#ifndef _NET80211_IEEE80211_IOCTL_H_28#define _NET80211_IEEE80211_IOCTL_H_2930/*31* IEEE 802.11 ioctls.32*/33#include <net80211/_ieee80211.h>34#include <net80211/ieee80211.h>35#include <net80211/ieee80211_crypto.h>3637/*38* Per/node (station) statistics.39*/40struct ieee80211_nodestats {41uint32_t ns_rx_data; /* rx data frames */42uint32_t ns_rx_mgmt; /* rx management frames */43uint32_t ns_rx_ctrl; /* rx control frames */44uint32_t ns_rx_ucast; /* rx unicast frames */45uint32_t ns_rx_mcast; /* rx multi/broadcast frames */46uint64_t ns_rx_bytes; /* rx data count (bytes) */47uint64_t ns_rx_beacons; /* rx beacon frames */48uint32_t ns_rx_proberesp; /* rx probe response frames */4950uint32_t ns_rx_dup; /* rx discard 'cuz dup */51uint32_t ns_rx_noprivacy; /* rx w/ wep but privacy off */52uint32_t ns_rx_wepfail; /* rx wep processing failed */53uint32_t ns_rx_demicfail; /* rx demic failed */54uint32_t ns_rx_decap; /* rx decapsulation failed */55uint32_t ns_rx_defrag; /* rx defragmentation failed */56uint32_t ns_rx_disassoc; /* rx disassociation */57uint32_t ns_rx_deauth; /* rx deauthentication */58uint32_t ns_rx_action; /* rx action */59uint32_t ns_rx_decryptcrc; /* rx decrypt failed on crc */60uint32_t ns_rx_unauth; /* rx on unauthorized port */61uint32_t ns_rx_unencrypted; /* rx unecrypted w/ privacy */62uint32_t ns_rx_drop; /* rx discard other reason */6364uint32_t ns_tx_data; /* tx data frames */65uint32_t ns_tx_mgmt; /* tx management frames */66uint32_t ns_tx_ctrl; /* tx control frames */67uint32_t ns_tx_ucast; /* tx unicast frames */68uint32_t ns_tx_mcast; /* tx multi/broadcast frames */69uint64_t ns_tx_bytes; /* tx data count (bytes) */70uint32_t ns_tx_probereq; /* tx probe request frames */7172uint32_t ns_tx_novlantag; /* tx discard 'cuz no tag */73uint32_t ns_tx_vlanmismatch; /* tx discard 'cuz bad tag */7475uint32_t ns_ps_discard; /* ps discard 'cuz of age */7677/* MIB-related state */78uint32_t ns_tx_assoc; /* [re]associations */79uint32_t ns_tx_assoc_fail; /* [re]association failures */80uint32_t ns_tx_auth; /* [re]authentications */81uint32_t ns_tx_auth_fail; /* [re]authentication failures*/82uint32_t ns_tx_deauth; /* deauthentications */83uint32_t ns_tx_deauth_code; /* last deauth reason */84uint32_t ns_tx_disassoc; /* disassociations */85uint32_t ns_tx_disassoc_code; /* last disassociation reason */8687/* Hardware A-MSDU decode */88uint32_t ns_rx_amsdu_more; /* RX decap A-MSDU, more coming from A-MSDU */89uint32_t ns_rx_amsdu_more_end; /* RX decap A-MSDU (or any other frame), no more coming */90uint32_t ns_spare[6];91};9293/*94* Summary statistics.95*/96struct ieee80211_stats {97uint32_t is_rx_badversion; /* rx frame with bad version */98uint32_t is_rx_tooshort; /* rx frame too short */99uint32_t is_rx_wrongbss; /* rx from wrong bssid */100uint32_t is_rx_dup; /* rx discard 'cuz dup */101uint32_t is_rx_wrongdir; /* rx w/ wrong direction */102uint32_t is_rx_mcastecho; /* rx discard 'cuz mcast echo */103uint32_t is_rx_notassoc; /* rx discard 'cuz sta !assoc */104uint32_t is_rx_noprivacy; /* rx w/ wep but privacy off */105uint32_t is_rx_unencrypted; /* rx w/o wep and privacy on */106uint32_t is_rx_wepfail; /* rx wep processing failed */107uint32_t is_rx_decap; /* rx decapsulation failed */108uint32_t is_rx_mgtdiscard; /* rx discard mgt frames */109uint32_t is_rx_ctl; /* rx ctrl frames */110uint32_t is_rx_beacon; /* rx beacon frames */111uint32_t is_rx_rstoobig; /* rx rate set truncated */112uint32_t is_rx_elem_missing; /* rx required element missing*/113uint32_t is_rx_elem_toobig; /* rx element too big */114uint32_t is_rx_elem_toosmall; /* rx element too small */115uint32_t is_rx_elem_unknown; /* rx element unknown */116uint32_t is_rx_badchan; /* rx frame w/ invalid chan */117uint32_t is_rx_chanmismatch; /* rx frame chan mismatch */118uint32_t is_rx_nodealloc; /* rx frame dropped */119uint32_t is_rx_ssidmismatch; /* rx frame ssid mismatch */120uint32_t is_rx_auth_unsupported; /* rx w/ unsupported auth alg */121uint32_t is_rx_auth_fail; /* rx sta auth failure */122uint32_t is_rx_auth_countermeasures;/* rx auth discard 'cuz CM */123uint32_t is_rx_assoc_bss; /* rx assoc from wrong bssid */124uint32_t is_rx_assoc_notauth; /* rx assoc w/o auth */125uint32_t is_rx_assoc_capmismatch;/* rx assoc w/ cap mismatch */126uint32_t is_rx_assoc_norate; /* rx assoc w/ no rate match */127uint32_t is_rx_assoc_badwpaie; /* rx assoc w/ bad WPA IE */128uint32_t is_rx_deauth; /* rx deauthentication */129uint32_t is_rx_disassoc; /* rx disassociation */130uint32_t is_rx_badsubtype; /* rx frame w/ unknown subtype*/131uint32_t is_rx_nobuf; /* rx failed for lack of buf */132uint32_t is_rx_decryptcrc; /* rx decrypt failed on crc */133uint32_t is_rx_ahdemo_mgt; /* rx discard ahdemo mgt frame*/134uint32_t is_rx_bad_auth; /* rx bad auth request */135uint32_t is_rx_unauth; /* rx on unauthorized port */136uint32_t is_rx_badkeyid; /* rx w/ incorrect keyid */137uint32_t is_rx_ccmpreplay; /* rx seq# violation (CCMP) */138uint32_t is_rx_ccmpformat; /* rx format bad (CCMP) */139uint32_t is_rx_ccmpmic; /* rx MIC check failed (CCMP) */140uint32_t is_rx_tkipreplay; /* rx seq# violation (TKIP) */141uint32_t is_rx_tkipformat; /* rx format bad (TKIP) */142uint32_t is_rx_tkipmic; /* rx MIC check failed (TKIP) */143uint32_t is_rx_tkipicv; /* rx ICV check failed (TKIP) */144uint32_t is_rx_badcipher; /* rx failed 'cuz key type */145uint32_t is_rx_nocipherctx; /* rx failed 'cuz key !setup */146uint32_t is_rx_acl; /* rx discard 'cuz acl policy */147uint32_t is_tx_nobuf; /* tx failed for lack of buf */148uint32_t is_tx_nonode; /* tx failed for no node */149uint32_t is_tx_unknownmgt; /* tx of unknown mgt frame */150uint32_t is_tx_badcipher; /* tx failed 'cuz key type */151uint32_t is_tx_nodefkey; /* tx failed 'cuz no defkey */152uint32_t is_tx_noheadroom; /* tx failed 'cuz no space */153uint32_t is_tx_fragframes; /* tx frames fragmented */154uint32_t is_tx_frags; /* tx fragments created */155uint32_t is_scan_active; /* active scans started */156uint32_t is_scan_passive; /* passive scans started */157uint32_t is_node_timeout; /* nodes timed out inactivity */158uint32_t is_crypto_nomem; /* no memory for crypto ctx */159uint32_t is_crypto_tkip; /* tkip crypto done in s/w */160uint32_t is_crypto_tkipenmic; /* tkip en-MIC done in s/w */161uint32_t is_crypto_tkipdemic; /* tkip de-MIC done in s/w */162uint32_t is_crypto_tkipcm; /* tkip counter measures */163uint32_t is_crypto_ccmp; /* ccmp crypto done in s/w */164uint32_t is_crypto_wep; /* wep crypto done in s/w */165uint32_t is_crypto_setkey_cipher;/* cipher rejected key */166uint32_t is_crypto_setkey_nokey; /* no key index for setkey */167uint32_t is_crypto_delkey; /* driver key delete failed */168uint32_t is_crypto_badcipher; /* unknown cipher */169uint32_t is_crypto_nocipher; /* cipher not available */170uint32_t is_crypto_attachfail; /* cipher attach failed */171uint32_t is_crypto_swfallback; /* cipher fallback to s/w */172uint32_t is_crypto_keyfail; /* driver key alloc failed */173uint32_t is_crypto_enmicfail; /* en-MIC failed */174uint32_t is_ibss_capmismatch; /* merge failed-cap mismatch */175uint32_t is_ibss_norate; /* merge failed-rate mismatch */176uint32_t is_ps_unassoc; /* ps-poll for unassoc. sta */177uint32_t is_ps_badaid; /* ps-poll w/ incorrect aid */178uint32_t is_ps_qempty; /* ps-poll w/ nothing to send */179uint32_t is_ff_badhdr; /* fast frame rx'd w/ bad hdr */180uint32_t is_ff_tooshort; /* fast frame rx decap error */181uint32_t is_ff_split; /* fast frame rx split error */182uint32_t is_ff_decap; /* fast frames decap'd */183uint32_t is_ff_encap; /* fast frames encap'd for tx */184uint32_t is_rx_badbintval; /* rx frame w/ bogus bintval */185uint32_t is_rx_demicfail; /* rx demic failed */186uint32_t is_rx_defrag; /* rx defragmentation failed */187uint32_t is_rx_mgmt; /* rx management frames */188uint32_t is_rx_action; /* rx action mgt frames */189uint32_t is_amsdu_tooshort; /* A-MSDU rx decap error */190uint32_t is_amsdu_split; /* A-MSDU rx split error */191uint32_t is_amsdu_decap; /* A-MSDU decap'd */192uint32_t is_amsdu_encap; /* A-MSDU encap'd for tx */193uint32_t is_ampdu_bar_bad; /* A-MPDU BAR out of window */194uint32_t is_ampdu_bar_oow; /* A-MPDU BAR before ADDBA */195uint32_t is_ampdu_bar_move; /* A-MPDU BAR moved window */196uint32_t is_ampdu_bar_rx; /* A-MPDU BAR frames handled */197uint32_t is_ampdu_rx_flush; /* A-MPDU frames flushed */198uint32_t is_ampdu_rx_oor; /* A-MPDU frames out-of-order */199uint32_t is_ampdu_rx_copy; /* A-MPDU frames copied down */200uint32_t is_ampdu_rx_drop; /* A-MPDU frames dropped */201uint32_t is_tx_badstate; /* tx discard state != RUN */202uint32_t is_tx_notassoc; /* tx failed, sta not assoc */203uint32_t is_tx_classify; /* tx classification failed */204uint32_t is_dwds_mcast; /* discard mcast over dwds */205uint32_t is_dwds_qdrop; /* dwds pending frame q full */206uint32_t is_ht_assoc_nohtcap; /* non-HT sta rejected */207uint32_t is_ht_assoc_downgrade; /* HT sta forced to legacy */208uint32_t is_ht_assoc_norate; /* HT assoc w/ rate mismatch */209uint32_t is_ampdu_rx_age; /* A-MPDU sent up 'cuz of age */210uint32_t is_ampdu_rx_move; /* A-MPDU MSDU moved window */211uint32_t is_addba_reject; /* ADDBA reject 'cuz disabled */212uint32_t is_addba_norequest; /* ADDBA response w/o ADDBA */213uint32_t is_addba_badtoken; /* ADDBA response w/ wrong214dialogtoken */215uint32_t is_addba_badpolicy; /* ADDBA resp w/ wrong policy */216uint32_t is_ampdu_stop; /* A-MPDU stream stopped */217uint32_t is_ampdu_stop_failed; /* A-MPDU stream not running */218uint32_t is_ampdu_rx_reorder; /* A-MPDU held for rx reorder */219uint32_t is_scan_bg; /* background scans started */220uint8_t is_rx_deauth_code; /* last rx'd deauth reason */221uint8_t is_rx_disassoc_code; /* last rx'd disassoc reason */222uint8_t is_rx_authfail_code; /* last rx'd auth fail reason */223uint32_t is_beacon_miss; /* beacon miss notification */224uint32_t is_rx_badstate; /* rx discard state != RUN */225uint32_t is_ff_flush; /* ff's flush'd from stageq */226uint32_t is_tx_ctl; /* tx ctrl frames */227uint32_t is_ampdu_rexmt; /* A-MPDU frames rexmt ok */228uint32_t is_ampdu_rexmt_fail; /* A-MPDU frames rexmt fail */229230uint32_t is_mesh_wrongmesh; /* dropped 'cuz not mesh sta*/231uint32_t is_mesh_nolink; /* dropped 'cuz link not estab*/232uint32_t is_mesh_fwd_ttl; /* mesh not fwd'd 'cuz ttl 0 */233uint32_t is_mesh_fwd_nobuf; /* mesh not fwd'd 'cuz no mbuf*/234uint32_t is_mesh_fwd_tooshort; /* mesh not fwd'd 'cuz no hdr */235uint32_t is_mesh_fwd_disabled; /* mesh not fwd'd 'cuz disabled */236uint32_t is_mesh_fwd_nopath; /* mesh not fwd'd 'cuz path unknown */237238uint32_t is_hwmp_wrongseq; /* wrong hwmp seq no. */239uint32_t is_hwmp_rootreqs; /* root PREQs sent */240uint32_t is_hwmp_rootrann; /* root RANNs sent */241242uint32_t is_mesh_badae; /* dropped 'cuz invalid AE */243uint32_t is_mesh_rtaddfailed; /* route add failed */244uint32_t is_mesh_notproxy; /* dropped 'cuz not proxying */245uint32_t is_rx_badalign; /* dropped 'cuz misaligned */246uint32_t is_hwmp_proxy; /* PREP for proxy route */247uint32_t is_beacon_bad; /* Number of bad beacons */248uint32_t is_ampdu_bar_tx; /* A-MPDU BAR frames TXed */249uint32_t is_ampdu_bar_tx_retry; /* A-MPDU BAR frames TX rtry */250uint32_t is_ampdu_bar_tx_fail; /* A-MPDU BAR frames TX fail */251252uint32_t is_ff_encapfail; /* failed FF encap */253uint32_t is_amsdu_encapfail; /* failed A-MSDU encap */254255uint32_t is_crypto_gcmp; /* gcmp crypto done in s/w */256uint32_t is_rx_gcmpreplay; /* rx seq# violation (GCMP) */257uint32_t is_rx_gcmpformat; /* rx format bad (GCMP) */258uint32_t is_rx_gcmpmic; /* rx MIC check failed (GCMP) */259uint32_t is_crypto_gcmp_nomem; /* gcmp crypto failed; no mem */260uint32_t is_crypto_gcmp_nospc; /* gcmp crypto failed; no mbuf space */261uint32_t is_crypto_swcipherfail; /* no support for SW cipher */262263uint32_t is_spare[5];264};265266/*267* Max size of optional information elements. We artificially268* constrain this; it's limited only by the max frame size (and269* the max parameter size of the wireless extensions).270*/271#define IEEE80211_MAX_OPT_IE 256272273/*274* WPA/RSN get/set key request. Specify the key/cipher275* type and whether the key is to be used for sending and/or276* receiving. The key index should be set only when working277* with global keys (use IEEE80211_KEYIX_NONE for ``no index'').278* Otherwise a unicast/pairwise key is specified by the bssid279* (on a station) or mac address (on an ap). They key length280* must include any MIC key data; otherwise it should be no281* more than IEEE80211_KEYBUF_SIZE.282*/283struct ieee80211req_key {284uint8_t ik_type; /* key/cipher type */285uint8_t ik_pad;286uint16_t ik_keyix; /* key index */287uint8_t ik_keylen; /* key length in bytes */288uint8_t ik_flags;289/* NB: IEEE80211_KEY_XMIT and IEEE80211_KEY_RECV defined elsewhere */290#define IEEE80211_KEY_DEFAULT 0x80 /* default xmit key */291uint8_t ik_macaddr[IEEE80211_ADDR_LEN];292uint64_t ik_keyrsc; /* key receive sequence counter */293uint64_t ik_keytsc; /* key transmit sequence counter */294uint8_t ik_keydata[IEEE80211_KEYBUF_SIZE+IEEE80211_MICBUF_SIZE];295};296297/*298* Delete a key either by index or address. Set the index299* to IEEE80211_KEYIX_NONE when deleting a unicast key.300*/301struct ieee80211req_del_key {302uint8_t idk_keyix; /* key index */303uint8_t idk_macaddr[IEEE80211_ADDR_LEN];304};305306/*307* MLME state manipulation request. IEEE80211_MLME_ASSOC308* only makes sense when operating as a station. The other309* requests can be used when operating as a station or an310* ap (to effect a station).311*/312struct ieee80211req_mlme {313uint8_t im_op; /* operation to perform */314#define IEEE80211_MLME_ASSOC 1 /* associate station */315#define IEEE80211_MLME_DISASSOC 2 /* disassociate station */316#define IEEE80211_MLME_DEAUTH 3 /* deauthenticate station */317#define IEEE80211_MLME_AUTHORIZE 4 /* authorize station */318#define IEEE80211_MLME_UNAUTHORIZE 5 /* unauthorize station */319#define IEEE80211_MLME_AUTH 6 /* authenticate station */320uint8_t im_ssid_len; /* length of optional ssid */321uint16_t im_reason; /* 802.11 reason code */322uint8_t im_macaddr[IEEE80211_ADDR_LEN];323uint8_t im_ssid[IEEE80211_NWID_LEN];324};325326/*327* MAC ACL operations.328*/329enum {330IEEE80211_MACCMD_POLICY_OPEN = 0, /* set policy: no ACL's */331IEEE80211_MACCMD_POLICY_ALLOW = 1, /* set policy: allow traffic */332IEEE80211_MACCMD_POLICY_DENY = 2, /* set policy: deny traffic */333IEEE80211_MACCMD_FLUSH = 3, /* flush ACL database */334IEEE80211_MACCMD_DETACH = 4, /* detach ACL policy */335IEEE80211_MACCMD_POLICY = 5, /* get ACL policy */336IEEE80211_MACCMD_LIST = 6, /* get ACL database */337IEEE80211_MACCMD_POLICY_RADIUS = 7, /* set policy: RADIUS managed */338};339340struct ieee80211req_maclist {341uint8_t ml_macaddr[IEEE80211_ADDR_LEN];342} __packed;343344/*345* Mesh Routing Table Operations.346*/347enum {348IEEE80211_MESH_RTCMD_LIST = 0, /* list HWMP routing table */349IEEE80211_MESH_RTCMD_FLUSH = 1, /* flush HWMP routing table */350IEEE80211_MESH_RTCMD_ADD = 2, /* add entry to the table */351IEEE80211_MESH_RTCMD_DELETE = 3, /* delete an entry from the table */352};353354struct ieee80211req_mesh_route {355uint8_t imr_flags;356#define IEEE80211_MESHRT_FLAGS_DISCOVER 0x01357#define IEEE80211_MESHRT_FLAGS_VALID 0x02358#define IEEE80211_MESHRT_FLAGS_PROXY 0x04359#define IEEE80211_MESHRT_FLAGS_GATE 0x08360uint8_t imr_dest[IEEE80211_ADDR_LEN];361uint8_t imr_nexthop[IEEE80211_ADDR_LEN];362uint16_t imr_nhops;363uint8_t imr_pad;364uint32_t imr_metric;365uint32_t imr_lifetime;366uint32_t imr_lastmseq;367};368369/*370* HWMP root modes371*/372enum {373IEEE80211_HWMP_ROOTMODE_DISABLED = 0, /* disabled */374IEEE80211_HWMP_ROOTMODE_NORMAL = 1, /* normal PREPs */375IEEE80211_HWMP_ROOTMODE_PROACTIVE = 2, /* proactive PREPS */376IEEE80211_HWMP_ROOTMODE_RANN = 3, /* use RANN elemid */377};378379/*380* Set the active channel list by IEEE channel #: each channel381* to be marked active is set in a bit vector. Note this list is382* intersected with the available channel list in calculating383* the set of channels actually used in scanning.384*/385struct ieee80211req_chanlist {386uint8_t ic_channels[32]; /* NB: can be variable length */387};388389/*390* Get the active channel list info.391*/392struct ieee80211req_chaninfo {393u_int ic_nchans;394struct ieee80211_channel ic_chans[1]; /* NB: variable length */395};396#define IEEE80211_CHANINFO_SIZE(_nchan) \397(sizeof(struct ieee80211req_chaninfo) + \398(((_nchan)-1) * sizeof(struct ieee80211_channel)))399#define IEEE80211_CHANINFO_SPACE(_ci) \400IEEE80211_CHANINFO_SIZE((_ci)->ic_nchans)401402/*403* Retrieve the WPA/RSN information element for an associated station.404*/405struct ieee80211req_wpaie { /* old version w/ only one ie */406uint8_t wpa_macaddr[IEEE80211_ADDR_LEN];407uint8_t wpa_ie[IEEE80211_MAX_OPT_IE];408};409struct ieee80211req_wpaie2 {410uint8_t wpa_macaddr[IEEE80211_ADDR_LEN];411uint8_t wpa_ie[IEEE80211_MAX_OPT_IE];412uint8_t rsn_ie[IEEE80211_MAX_OPT_IE];413};414415/*416* Retrieve per-node statistics.417*/418struct ieee80211req_sta_stats {419union {420/* NB: explicitly force 64-bit alignment */421uint8_t macaddr[IEEE80211_ADDR_LEN];422uint64_t pad;423} is_u;424struct ieee80211_nodestats is_stats;425};426427/*428* Station information block; the mac address is used429* to retrieve other data like stats, unicast key, etc.430*/431struct ieee80211req_sta_info {432uint16_t isi_len; /* total length (mult of 4) */433uint16_t isi_ie_off; /* offset to IE data */434uint16_t isi_ie_len; /* IE length */435uint16_t isi_freq; /* MHz */436uint32_t isi_flags; /* channel flags */437uint32_t isi_state; /* state flags */438uint8_t isi_authmode; /* authentication algorithm */439int8_t isi_rssi; /* receive signal strength */440int8_t isi_noise; /* noise floor */441uint8_t isi_capinfo; /* capabilities */442uint8_t isi_erp; /* ERP element */443uint8_t isi_macaddr[IEEE80211_ADDR_LEN];444uint8_t isi_nrates;445/* negotiated rates */446uint8_t isi_rates[IEEE80211_RATE_MAXSIZE];447uint8_t isi_txrate; /* legacy/IEEE rate or MCS */448uint16_t isi_associd; /* assoc response */449uint16_t isi_txpower; /* current tx power */450uint16_t isi_vlan; /* vlan tag */451/* NB: [IEEE80211_NONQOS_TID] holds seq#'s for non-QoS stations */452uint16_t isi_txseqs[IEEE80211_TID_SIZE];/* tx seq #/TID */453uint16_t isi_rxseqs[IEEE80211_TID_SIZE];/* rx seq#/TID */454uint16_t isi_inact; /* inactivity timer */455uint16_t isi_txmbps; /* current tx rate in .5 Mb/s */456uint16_t isi_pad;457uint32_t isi_jointime; /* time of assoc/join */458struct ieee80211_mimo_info isi_mimo; /* MIMO info for 11n sta's */459/* 11s info */460uint16_t isi_peerid;461uint16_t isi_localid;462uint8_t isi_peerstate;463/* XXX frag state? */464/* variable length IE data */465};466467/*468* Retrieve per-station information; to retrieve all469* specify a mac address of ff:ff:ff:ff:ff:ff.470*/471struct ieee80211req_sta_req {472union {473/* NB: explicitly force 64-bit alignment */474uint8_t macaddr[IEEE80211_ADDR_LEN];475uint64_t pad;476} is_u;477struct ieee80211req_sta_info info[1]; /* variable length */478};479480/*481* Get/set per-station tx power cap.482*/483struct ieee80211req_sta_txpow {484uint8_t it_macaddr[IEEE80211_ADDR_LEN];485uint8_t it_txpow;486};487488/*489* WME parameters manipulated with IEEE80211_IOC_WME_CWMIN490* through IEEE80211_IOC_WME_ACKPOLICY are set and return491* using i_val and i_len. i_val holds the value itself.492* i_len specifies the AC and, as appropriate, then high bit493* specifies whether the operation is to be applied to the494* BSS or ourself.495*/496#define IEEE80211_WMEPARAM_SELF 0x0000 /* parameter applies to self */497#define IEEE80211_WMEPARAM_BSS 0x8000 /* parameter applies to BSS */498#define IEEE80211_WMEPARAM_VAL 0x7fff /* parameter value */499500/*501* Application Information Elements can be appended to a variety502* of frames with the IEE80211_IOC_APPIE request. This request503* piggybacks on a normal ieee80211req; the frame type is passed504* in i_val as the 802.11 FC0 bytes and the length of the IE data505* is passed in i_len. The data is referenced in i_data. If i_len506* is zero then any previously configured IE data is removed. At507* most IEEE80211_MAX_APPIE data be appened. Note that multiple508* IE's can be supplied; the data is treated opaquely.509*/510#define IEEE80211_MAX_APPIE 1024 /* max app IE data */511/*512* Hack: the WPA authenticator uses this mechanism to specify WPA513* ie's that are used instead of the ones normally constructed using514* the cipher state setup with separate ioctls. This avoids issues515* like the authenticator ordering ie data differently than the516* net80211 layer and needing to keep separate state for WPA and RSN.517*/518#define IEEE80211_APPIE_WPA \519(IEEE80211_FC0_TYPE_MGT | IEEE80211_FC0_SUBTYPE_BEACON | \520IEEE80211_FC0_SUBTYPE_PROBE_RESP)521522/*523* Station mode roaming parameters. These are maintained524* per band/mode and control the roaming algorithm.525*/526struct ieee80211_roamparams_req {527struct ieee80211_roamparam params[IEEE80211_MODE_MAX];528};529530/*531* Transmit parameters. These can be used to set fixed transmit532* rate for each operating mode when operating as client or on a533* per-client basis according to the capabilities of the client534* (e.g. an 11b client associated to an 11g ap) when operating as535* an ap.536*537* MCS are distinguished from legacy rates by or'ing in 0x80.538*/539struct ieee80211_txparams_req {540struct ieee80211_txparam params[IEEE80211_MODE_MAX];541};542543/*544* Set regulatory domain state with IEEE80211_IOC_REGDOMAIN.545* Note this is both the regulatory description and the channel546* list. The get request for IEEE80211_IOC_REGDOMAIN returns547* only the regdomain info; the channel list is obtained548* separately with IEEE80211_IOC_CHANINFO.549*/550struct ieee80211_regdomain_req {551struct ieee80211_regdomain rd;552struct ieee80211req_chaninfo chaninfo;553};554#define IEEE80211_REGDOMAIN_SIZE(_nchan) \555(sizeof(struct ieee80211_regdomain_req) + \556(((_nchan)-1) * sizeof(struct ieee80211_channel)))557#define IEEE80211_REGDOMAIN_SPACE(_req) \558IEEE80211_REGDOMAIN_SIZE((_req)->chaninfo.ic_nchans)559560/*561* Get driver capabilities. Driver, hardware/software crypto, and562* HT/802.11n capabilities, and a table that describes what563* the radio can do.564*/565struct ieee80211_devcaps_req {566uint32_t dc_drivercaps; /* general driver caps */567uint32_t dc_cryptocaps; /* software + hardware crypto support */568uint32_t dc_htcaps; /* HT/802.11n support */569uint32_t dc_vhtcaps; /* VHT/802.11ac capabilities */570struct ieee80211req_chaninfo dc_chaninfo;571};572#define IEEE80211_DEVCAPS_SIZE(_nchan) \573(sizeof(struct ieee80211_devcaps_req) + \574(((_nchan)-1) * sizeof(struct ieee80211_channel)))575#define IEEE80211_DEVCAPS_SPACE(_dc) \576IEEE80211_DEVCAPS_SIZE((_dc)->dc_chaninfo.ic_nchans)577578struct ieee80211_chanswitch_req {579struct ieee80211_channel csa_chan; /* new channel */580int csa_mode; /* CSA mode */581int csa_count; /* beacon count to switch */582};583584/*585* Get/set per-station vlan tag.586*/587struct ieee80211req_sta_vlan {588uint8_t sv_macaddr[IEEE80211_ADDR_LEN];589uint16_t sv_vlan;590};591592#ifdef __FreeBSD__593/*594* FreeBSD-style ioctls.595*/596/* the first member must be matched with struct ifreq */597struct ieee80211req {598char i_name[IFNAMSIZ]; /* if_name, e.g. "wi0" */599uint16_t i_type; /* req type */600int16_t i_val; /* Index or simple value */601uint16_t i_len; /* Index or simple value */602void *i_data; /* Extra data */603};604#define SIOCS80211 _IOW('i', 234, struct ieee80211req)605#define SIOCG80211 _IOWR('i', 235, struct ieee80211req)606#define SIOCG80211STATS _IOWR('i', 236, struct ifreq)607608#define IEEE80211_IOC_SSID 1609#define IEEE80211_IOC_NUMSSIDS 2610#define IEEE80211_IOC_WEP 3611#define IEEE80211_WEP_NOSUP -1612#define IEEE80211_WEP_OFF 0613#define IEEE80211_WEP_ON 1614#define IEEE80211_WEP_MIXED 2615#define IEEE80211_IOC_WEPKEY 4616#define IEEE80211_IOC_NUMWEPKEYS 5617#define IEEE80211_IOC_WEPTXKEY 6618#define IEEE80211_IOC_AUTHMODE 7619#define IEEE80211_IOC_STATIONNAME 8620#define IEEE80211_IOC_CHANNEL 9621#define IEEE80211_IOC_POWERSAVE 10622#define IEEE80211_POWERSAVE_NOSUP -1623#define IEEE80211_POWERSAVE_OFF 0624#define IEEE80211_POWERSAVE_CAM 1625#define IEEE80211_POWERSAVE_PSP 2626#define IEEE80211_POWERSAVE_PSP_CAM 3627#define IEEE80211_POWERSAVE_ON IEEE80211_POWERSAVE_CAM628#define IEEE80211_IOC_POWERSAVESLEEP 11629#define IEEE80211_IOC_RTSTHRESHOLD 12630#define IEEE80211_IOC_PROTMODE 13631#define IEEE80211_PROTMODE_OFF 0632#define IEEE80211_PROTMODE_CTS 1633#define IEEE80211_PROTMODE_RTSCTS 2634#define IEEE80211_IOC_TXPOWER 14 /* global tx power limit */635#define IEEE80211_IOC_BSSID 15636#define IEEE80211_IOC_ROAMING 16 /* roaming mode */637#define IEEE80211_IOC_PRIVACY 17 /* privacy invoked */638#define IEEE80211_IOC_DROPUNENCRYPTED 18 /* discard unencrypted frames */639#define IEEE80211_IOC_WPAKEY 19640#define IEEE80211_IOC_DELKEY 20641#define IEEE80211_IOC_MLME 21642/* 22 was IEEE80211_IOC_OPTIE, replaced by IEEE80211_IOC_APPIE */643/* 23 was IEEE80211_IOC_SCAN_REQ */644/* 24 was IEEE80211_IOC_SCAN_RESULTS */645#define IEEE80211_IOC_COUNTERMEASURES 25 /* WPA/TKIP countermeasures */646#define IEEE80211_IOC_WPA 26 /* WPA mode (0,1,2) */647#define IEEE80211_IOC_CHANLIST 27 /* channel list */648#define IEEE80211_IOC_WME 28 /* WME mode (on, off) */649#define IEEE80211_IOC_HIDESSID 29 /* hide SSID mode (on, off) */650#define IEEE80211_IOC_APBRIDGE 30 /* AP inter-sta bridging */651/* 31-35,37-38 were for WPA authenticator settings */652/* 36 was IEEE80211_IOC_DRIVER_CAPS */653#define IEEE80211_IOC_WPAIE 39 /* WPA information element */654#define IEEE80211_IOC_STA_STATS 40 /* per-station statistics */655#define IEEE80211_IOC_MACCMD 41 /* MAC ACL operation */656#define IEEE80211_IOC_CHANINFO 42 /* channel info list */657#define IEEE80211_IOC_TXPOWMAX 43 /* max tx power for channel */658#define IEEE80211_IOC_STA_TXPOW 44 /* per-station tx power limit */659/* 45 was IEEE80211_IOC_STA_INFO */660#define IEEE80211_IOC_WME_CWMIN 46 /* WME: ECWmin */661#define IEEE80211_IOC_WME_CWMAX 47 /* WME: ECWmax */662#define IEEE80211_IOC_WME_AIFS 48 /* WME: AIFSN */663#define IEEE80211_IOC_WME_TXOPLIMIT 49 /* WME: txops limit */664#define IEEE80211_IOC_WME_ACM 50 /* WME: ACM (bss only) */665#define IEEE80211_IOC_WME_ACKPOLICY 51 /* WME: ACK policy (!bss only)*/666#define IEEE80211_IOC_DTIM_PERIOD 52 /* DTIM period (beacons) */667#define IEEE80211_IOC_BEACON_INTERVAL 53 /* beacon interval (ms) */668#define IEEE80211_IOC_ADDMAC 54 /* add sta to MAC ACL table */669#define IEEE80211_IOC_DELMAC 55 /* del sta from MAC ACL table */670#define IEEE80211_IOC_PUREG 56 /* pure 11g (no 11b stations) */671#define IEEE80211_IOC_FF 57 /* ATH fast frames (on, off) */672#define IEEE80211_IOC_TURBOP 58 /* ATH turbo' (on, off) */673#define IEEE80211_IOC_BGSCAN 59 /* bg scanning (on, off) */674#define IEEE80211_IOC_BGSCAN_IDLE 60 /* bg scan idle threshold */675#define IEEE80211_IOC_BGSCAN_INTERVAL 61 /* bg scan interval */676#define IEEE80211_IOC_SCANVALID 65 /* scan cache valid threshold */677/* 66-72 were IEEE80211_IOC_ROAM_* and IEEE80211_IOC_MCAST_RATE */678#define IEEE80211_IOC_FRAGTHRESHOLD 73 /* tx fragmentation threshold */679#define IEEE80211_IOC_BURST 75 /* packet bursting */680#define IEEE80211_IOC_SCAN_RESULTS 76 /* get scan results */681#define IEEE80211_IOC_BMISSTHRESHOLD 77 /* beacon miss threshold */682#define IEEE80211_IOC_STA_INFO 78 /* station/neighbor info */683#define IEEE80211_IOC_WPAIE2 79 /* WPA+RSN info elements */684#define IEEE80211_IOC_CURCHAN 80 /* current channel */685#define IEEE80211_IOC_SHORTGI 81 /* 802.11n half GI */686#define IEEE80211_IOC_AMPDU 82 /* 802.11n A-MPDU (on, off) */687#define IEEE80211_IOC_AMPDU_LIMIT 83 /* A-MPDU length limit */688#define IEEE80211_IOC_AMPDU_DENSITY 84 /* A-MPDU density */689#define IEEE80211_IOC_AMSDU 85 /* 802.11n A-MSDU (on, off) */690#define IEEE80211_IOC_AMSDU_LIMIT 86 /* A-MSDU length limit */691#define IEEE80211_IOC_PUREN 87 /* pure 11n (no legacy sta's) */692#define IEEE80211_IOC_DOTH 88 /* 802.11h (on, off) */693/* 89-91 were regulatory items */694#define IEEE80211_IOC_HTCOMPAT 92 /* support pre-D1.10 HT ie's */695#define IEEE80211_IOC_DWDS 93 /* DWDS/4-address handling */696#define IEEE80211_IOC_INACTIVITY 94 /* sta inactivity handling */697#define IEEE80211_IOC_APPIE 95 /* application IE's */698#define IEEE80211_IOC_WPS 96 /* WPS operation */699#define IEEE80211_IOC_TSN 97 /* TSN operation */700#define IEEE80211_IOC_DEVCAPS 98 /* driver+device capabilities */701#define IEEE80211_IOC_CHANSWITCH 99 /* start 11h channel switch */702#define IEEE80211_IOC_DFS 100 /* DFS (on, off) */703#define IEEE80211_IOC_DOTD 101 /* 802.11d (on, off) */704#define IEEE80211_IOC_HTPROTMODE 102 /* HT protection (off, rts) */705#define IEEE80211_IOC_SCAN_REQ 103 /* scan w/ specified params */706#define IEEE80211_IOC_SCAN_CANCEL 104 /* cancel ongoing scan */707#define IEEE80211_IOC_HTCONF 105 /* HT config (off, HT20, HT40)*/708#define IEEE80211_IOC_REGDOMAIN 106 /* regulatory domain info */709#define IEEE80211_IOC_ROAM 107 /* roaming params en masse */710#define IEEE80211_IOC_TXPARAMS 108 /* tx parameters */711#define IEEE80211_IOC_STA_VLAN 109 /* per-station vlan tag */712#define IEEE80211_IOC_SMPS 110 /* MIMO power save */713#define IEEE80211_IOC_RIFS 111 /* RIFS config (on, off) */714#define IEEE80211_IOC_GREENFIELD 112 /* Greenfield (on, off) */715#define IEEE80211_IOC_STBC 113 /* STBC Tx/RX (on, off) */716#define IEEE80211_IOC_LDPC 114 /* LDPC Tx/RX (on, off) */717#define IEEE80211_IOC_UAPSD 115 /* UAPSD (on, off) */718#define IEEE80211_IOC_UAPSD_INFO 116 /* UAPSD (SP, per-AC enable) */719720/* VHT */721#define IEEE80211_IOC_VHTCONF 130 /* VHT config (off, on; widths) */722723#define IEEE80211_IOC_MESH_ID 170 /* mesh identifier */724#define IEEE80211_IOC_MESH_AP 171 /* accepting peerings */725#define IEEE80211_IOC_MESH_FWRD 172 /* forward frames */726#define IEEE80211_IOC_MESH_PROTO 173 /* mesh protocols */727#define IEEE80211_IOC_MESH_TTL 174 /* mesh TTL */728#define IEEE80211_IOC_MESH_RTCMD 175 /* mesh routing table commands*/729#define IEEE80211_IOC_MESH_PR_METRIC 176 /* mesh metric protocol */730#define IEEE80211_IOC_MESH_PR_PATH 177 /* mesh path protocol */731#define IEEE80211_IOC_MESH_PR_SIG 178 /* mesh sig protocol */732#define IEEE80211_IOC_MESH_PR_CC 179 /* mesh congestion protocol */733#define IEEE80211_IOC_MESH_PR_AUTH 180 /* mesh auth protocol */734#define IEEE80211_IOC_MESH_GATE 181 /* mesh gate XXX: 173? */735736#define IEEE80211_IOC_HWMP_ROOTMODE 190 /* HWMP root mode */737#define IEEE80211_IOC_HWMP_MAXHOPS 191 /* number of hops before drop */738#define IEEE80211_IOC_HWMP_TTL 192 /* HWMP TTL */739740#define IEEE80211_IOC_TDMA_SLOT 201 /* TDMA: assigned slot */741#define IEEE80211_IOC_TDMA_SLOTCNT 202 /* TDMA: slots in bss */742#define IEEE80211_IOC_TDMA_SLOTLEN 203 /* TDMA: slot length (usecs) */743#define IEEE80211_IOC_TDMA_BINTERVAL 204 /* TDMA: beacon intvl (slots) */744745#define IEEE80211_IOC_QUIET 205 /* Quiet Enable/Disable */746#define IEEE80211_IOC_QUIET_PERIOD 206 /* Quiet Period */747#define IEEE80211_IOC_QUIET_OFFSET 207 /* Quiet Offset */748#define IEEE80211_IOC_QUIET_DUR 208 /* Quiet Duration */749#define IEEE80211_IOC_QUIET_COUNT 209 /* Quiet Count */750751#define IEEE80211_IOC_IC_NAME 210 /* HW device name. */752753/*754* Parameters for controlling a scan requested with755* IEEE80211_IOC_SCAN_REQ.756*757* Active scans cause ProbeRequest frames to be issued for each758* specified ssid and, by default, a broadcast ProbeRequest frame.759* The set of ssid's is specified in the request.760*761* By default the scan will cause a BSS to be joined (in station/adhoc762* mode) or a channel to be selected for operation (hostap mode).763* To disable that specify IEEE80211_IOC_SCAN_NOPICK and if the764*765* If the station is currently associated to an AP then a scan request766* will cause the station to leave the current channel and potentially767* miss frames from the AP. Alternatively the station may notify the768* AP that it is going into power save mode before it leaves the channel.769* This ensures frames for the station are buffered by the AP. This is770* termed a ``bg scan'' and is requested with the IEEE80211_IOC_SCAN_BGSCAN771* flag. Background scans may take longer than foreground scans and may772* be preempted by traffic. If a station is not associated to an AP773* then a request for a background scan is automatically done in the774* foreground.775*776* The results of the scan request are cached by the system. This777* information is aged out and/or invalidated based on events like not778* being able to associated to an AP. To flush the current cache779* contents before doing a scan the IEEE80211_IOC_SCAN_FLUSH flag may780* be specified.781*782* By default the scan will be done until a suitable AP is located783* or a channel is found for use. A scan can also be constrained784* to be done once (IEEE80211_IOC_SCAN_ONCE) or to last for no more785* than a specified duration.786*/787struct ieee80211_scan_req {788int sr_flags;789#define IEEE80211_IOC_SCAN_NOPICK 0x00001 /* scan only, no selection */790#define IEEE80211_IOC_SCAN_ACTIVE 0x00002 /* active scan (probe req) */791#define IEEE80211_IOC_SCAN_PICK1ST 0x00004 /* ``hey sailor'' mode */792#define IEEE80211_IOC_SCAN_BGSCAN 0x00008 /* bg scan, exit ps at end */793#define IEEE80211_IOC_SCAN_ONCE 0x00010 /* do one complete pass */794#define IEEE80211_IOC_SCAN_NOBCAST 0x00020 /* don't send bcast probe req */795#define IEEE80211_IOC_SCAN_NOJOIN 0x00040 /* no auto-sequencing */796#define IEEE80211_IOC_SCAN_FLUSH 0x10000 /* flush scan cache first */797#define IEEE80211_IOC_SCAN_CHECK 0x20000 /* check scan cache first */798u_int sr_duration; /* duration (ms) */799#define IEEE80211_IOC_SCAN_DURATION_MIN 1800#define IEEE80211_IOC_SCAN_DURATION_MAX 0x7fffffff801#define IEEE80211_IOC_SCAN_FOREVER IEEE80211_IOC_SCAN_DURATION_MAX802u_int sr_mindwell; /* min channel dwelltime (ms) */803u_int sr_maxdwell; /* max channel dwelltime (ms) */804int sr_nssid;805#define IEEE80211_IOC_SCAN_MAX_SSID 3806struct {807int len; /* length in bytes */808uint8_t ssid[IEEE80211_NWID_LEN]; /* ssid contents */809} sr_ssid[IEEE80211_IOC_SCAN_MAX_SSID];810};811812/*813* Scan result data returned for IEEE80211_IOC_SCAN_RESULTS.814* Each result is a fixed size structure followed by a variable815* length SSID and one or more variable length information elements.816* The size of each variable length item is found in the fixed817* size structure and the entire length of the record is specified818* in isr_len. Result records are rounded to a multiple of 4 bytes.819*/820struct ieee80211req_scan_result {821uint16_t isr_len; /* total length (mult of 4) */822uint16_t isr_ie_off; /* offset to SSID+IE data */823uint16_t isr_ie_len; /* IE length */824uint16_t isr_freq; /* MHz */825uint16_t isr_flags; /* channel flags */826int8_t isr_noise;827int8_t isr_rssi;828uint16_t isr_intval; /* beacon interval */829uint8_t isr_capinfo; /* capabilities */830uint8_t isr_erp; /* ERP element */831uint8_t isr_bssid[IEEE80211_ADDR_LEN];832uint8_t isr_nrates;833uint8_t isr_rates[IEEE80211_RATE_MAXSIZE];834uint8_t isr_ssid_len; /* SSID length */835uint8_t isr_meshid_len; /* MESH ID length */836/* variable length SSID, followed by variable length MESH ID,837followed by IE data */838};839840/*841* Virtual AP cloning parameters. The parent device must842* be a vap-capable device. All parameters specified with843* the clone request are fixed for the lifetime of the vap.844*845* There are two flavors of WDS vaps: legacy and dynamic.846* Legacy WDS operation implements a static binding between847* two stations encapsulating traffic in 4-address frames.848* Dynamic WDS vaps are created when a station associates to849* an AP and sends a 4-address frame. If the AP vap is850* configured to support WDS then this will generate an851* event to user programs listening on the routing socket852* and a Dynamic WDS vap will be created to handle traffic853* to/from that station. In both cases the bssid of the854* peer must be specified when creating the vap.855*856* By default a vap will inherit the mac address/bssid of857* the underlying device. To request a unique address the858* IEEE80211_CLONE_BSSID flag should be supplied. This is859* meaningless for WDS vaps as they share the bssid of an860* AP vap that must otherwise exist. Note that some devices861* may not be able to support multiple addresses.862*863* Station mode vap's normally depend on the device to notice864* when the AP stops sending beacon frames. If IEEE80211_CLONE_NOBEACONS865* is specified the net80211 layer will do this in s/w. This866* is mostly useful when setting up a WDS repeater/extender where867* an AP vap is combined with a sta vap and the device isn't able868* to track beacon frames in hardware.869*/870struct ieee80211_clone_params {871char icp_parent[IFNAMSIZ]; /* parent device */872uint16_t icp_opmode; /* operating mode */873uint16_t icp_flags; /* see below */874uint8_t icp_bssid[IEEE80211_ADDR_LEN]; /* for WDS links */875uint8_t icp_macaddr[IEEE80211_ADDR_LEN];/* local address */876};877#define IEEE80211_CLONE_BSSID 0x0001 /* allocate unique mac/bssid */878#define IEEE80211_CLONE_NOBEACONS 0x0002 /* don't setup beacon timers */879#define IEEE80211_CLONE_WDSLEGACY 0x0004 /* legacy WDS processing */880#define IEEE80211_CLONE_MACADDR 0x0008 /* use specified mac addr */881#define IEEE80211_CLONE_TDMA 0x0010 /* operate in TDMA mode */882#endif /* __FreeBSD__ */883884#endif /* _NET80211_IEEE80211_IOCTL_H_ */885886887