1.\" $NetBSD: ieee80211.4,v 1.5 2017/07/03 21:30:58 wiz Exp $ 2.\" 3.\" Copyright (c) 2001 4.\" The Aerospace Corporation. All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 3. Neither the name of the University nor the names of its contributors 15.\" may be used to endorse or promote products derived from this software 16.\" without specific prior written permission. 17.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE AEROSPACE CORPORATION ``AS IS'' AND 19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AEROSPACE CORPORATION BE LIABLE 22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28.\" SUCH DAMAGE. 29.\" 30.\" $FreeBSD: src/share/man/man4/ieee80211.4,v 1.9 2005/02/13 23:45:49 ru Exp $ 31.\" 32.Dd February 23, 2001 33.Dt IEEE80211 4 34.Os 35.Sh NAME 36.Nm ieee80211 37.Nd standard interface to IEEE 802.11 devices 38.Sh SYNOPSIS 39.In sys/types.h 40.In sys/socket.h 41.In net/if.h 42.In net/ethernet.h 43.In net/if_ieee80211.h 44.Sh DESCRIPTION 45This section describes the standard interface to configuration 46and status information on IEEE 802.11 devices. 47Most devices support options not configurable by this interface. 48They must be set by their respective, specific control program. 49The interface is via one 50of the following 51.Xr ioctl 2 52calls on a socket: 53.Bl -tag -width ".Dv SIOCG80211" 54.It Dv SIOCG80211 55Get configuration or status information. 56.It Dv SIOCS80211 57Set configuration information. 58.El 59.Pp 60These requests are made via a modified 61.Vt ifreq 62structure. 63This structure is defined as follows: 64.Bd -literal 65struct ieee80211req { 66 char i_name[IFNAMSIZ]; /* if_name, e.g. "wi0" */ 67 uint16_t i_type; /* req type */ 68 int16_t i_val; /* Index or simple value */ 69 int16_t i_len; /* Index or simple value */ 70 void *i_data; /* Extra data */ 71}; 72.Ed 73.Pp 74For 75.Dv SIOCG80211 76the following values of 77.Va i_type 78are valid: 79.Bl -tag -width indent 80.It Dv IEEE80211_IOC_SSID 81Returns the requested SSID by copying it into the buffer pointed to by 82.Va i_data 83and setting 84.Va i_len 85to the length. 86If 87.Va i_val 88is >= 0 then the request refers to the configured value for that slot. 89Generally, 0 is the only valid value, but some interfaces support more 90SSIDs. 91If 92.Va i_val 93is \-1 then the request refers to the currently active value. 94.It Dv IEEE80211_IOC_NUMSSIDS 95Returns the number of SSIDs this card supports. 96In most cases, this is 971, but some devices such as 98.Xr an 4 99support more. 100.It Dv IEEE80211_IOC_WEP 101Returns the current WEP status in 102.Va i_val . 103Valid values are 104.Dv IEEE80211_WEP_NOSUP , IEEE80211_WEP_ON , IEEE80211_WEP_OFF , 105and 106.Dv IEEE80211_WEP_MIXED . 107Respectively, these values mean unsupported, mandatory for all devices, 108off, and on, but not required for all devices. 109.It Dv IEEE80211_IOC_WEPKEY 110Returns the requested WEP key via 111.Va i_data 112and its length via 113.Va i_len . 114If the device does not support returning the WEP key or the user is not 115root then the key may be returned as all zeros. 116Technically this is a 117valid key, but it is the kind of key an idiot would put on his luggage so 118we use it as a special value. 119Generally, only four WEP keys are allowed, but some devices support more. 120If so, the first four (0-3) are 121the standard keys stored in volatile storage and the others are device 122specific. 123.It Dv IEEE80211_IOC_NUMWEPKEYS 124Returns the number of WEP keys supported by this device, generally 4. 125A device that does not support WEP may either report 0 or simply return 126.Er EINVAL . 127.It Dv IEEE80211_IOC_WEPTXKEY 128Returns the WEP key used for transmission. 129.It Dv IEEE80211_IOC_AUTHMODE 130Returns the current authentication mode in 131.Va i_val . 132Valid values are 133.Dv IEEE80211_AUTH_NONE , IEEE80211_AUTH_OPEN , 134and 135.Dv IEEE80211_AUTH_SHARED . 136.It Dv IEEE80211_IOC_STATIONNAME 137Returns the station name via 138.Va i_data 139and its length via 140.Va i_len . 141While all known devices seem to support this in some way or another, 142they all do it differently and it appears to not have anything to do 143with the actual IEEE 802.11 standard so making up an answer may be 144necessary for future devices. 145.It Dv IEEE80211_IOC_CHANNEL 146Returns the current direct sequence spread spectrum channel in use. 147.It Dv IEEE80211_IOC_POWERSAVE 148Returns the current powersaving mode. 149Valid values are 150.Dv IEEE80211_POWERSAVE_NOSUP , IEEE80211_POWERSAVE_OFF , 151.Dv IEEE80211_POWERSAVE_ON , IEEE80211_POWERSAVE_CAM , 152.Dv IEEE80211_POWERSAVE_PSP , 153and 154.Dv IEEE80211_POWERSAVE_PSP_CAM . 155Currently, 156.Dv IEEE80211_POWERSAVE_ON 157is defined to be equal to 158.Dv IEEE80211_POWERSAVE_CAM , 159but this may be incorrect. 160.It Dv IEEE80211_IOC_POWERSAVESLEEP 161Returns the powersave sleep time in msec in 162.Va i_val . 163.El 164.Pp 165For 166.Dv SIOCS80211 167the following values of 168.Va i_type 169are valid: 170.Bl -tag -width indent 171.It Dv IEEE80211_IOC_SSID 172Set the desired SSID for infrastructure and ad-hoc modes to value given 173by 174.Va i_data 175and 176.Va i_len . 177The length should be no longer than 32 characters. 178.It Dv IEEE80211_IOC_WEP 179Set the current WEP mode to the value given in 180.Va i_val . 181Valid values are the same as those for this value above. 182Devices which 183do not support all modes may choose to either return 184.Er EINVAL 185or choose a reasonable alternate (supported) setting. 186.It Dv IEEE80211_IOC_WEPKEY 187Set the WEP key indicated by 188.Va i_val 189to the value given by 190.Va i_data 191and 192.Va i_len . 193Generally, valid values of 194.Va i_len 195are 0, 5, and 13 though not all devices with WEP support have support 196for 13-byte keys. 197.It Dv IEEE80211_IOC_WEPTXKEY 198Set the WEP key used for transmission to the value in 199.Va i_val . 200Not all values which are valid for setting keys may be valid for setting 201transmit keys due to strange device interfaces. 202.It Dv IEEE80211_IOC_AUTHMODE 203Set the current authorization mode to the value given in 204.Va i_val . 205Valid values are given above. 206Not all devices support this. 207.It Dv IEEE80211_IOC_STATIONNAME 208Set the station name to the value given by 209.Va i_data 210and 211.Va i_len . 212The standard does not appear to deal with this feature so the range of 213valid values may vary from device to device. 214.It Dv IEEE80211_IOC_CHANNEL 215Set the desired ad-hoc channel to the value given by 216.Va i_val . 217On some devices this has an impact on infrastructure mode as well. 218Valid values are 1-14, but 0 should be allowed and should return the 219device to the default value. 220May devices support this directly by 221converting any invalid value to the default value. 222.It Dv IEEE80211_IOC_POWERSAVE 223Set the current powersaving mode to the value given in 224.Va i_val . 225Valid values are the same as those for this value above. 226Devices which 227do not support all modes may choose to either return 228.Er EINVAL 229or choose a reasonable alternate (supported) setting. 230Most devices only 231support CAM mode. 232.It Dv IEEE80211_IOC_POWERSAVESLEEP 233Set the powersave sleep time in msec to the value in 234.Va i_val . 235.El 236.Sh SEE ALSO 237.Xr ioctl 2 , 238.Xr an 4 , 239.Xr ray 4 , 240.Xr wi 4 , 241.Xr ifconfig 8 242.Sh HISTORY 243The 244.Nm 245manual appeared in 246.Fx 4.3 . 247