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