1*03f9172cSAndroid Build Coastguard Workerwpa_supplicant 2*03f9172cSAndroid Build Coastguard Worker============== 3*03f9172cSAndroid Build Coastguard Worker 4*03f9172cSAndroid Build Coastguard WorkerCopyright (c) 2003-2024, Jouni Malinen <[email protected]> and contributors 5*03f9172cSAndroid Build Coastguard WorkerAll Rights Reserved. 6*03f9172cSAndroid Build Coastguard Worker 7*03f9172cSAndroid Build Coastguard WorkerThis program is licensed under the BSD license (the one with 8*03f9172cSAndroid Build Coastguard Workeradvertisement clause removed). 9*03f9172cSAndroid Build Coastguard Worker 10*03f9172cSAndroid Build Coastguard WorkerIf you are submitting changes to the project, please see CONTRIBUTIONS 11*03f9172cSAndroid Build Coastguard Workerfile for more instructions. 12*03f9172cSAndroid Build Coastguard Worker 13*03f9172cSAndroid Build Coastguard Worker 14*03f9172cSAndroid Build Coastguard Worker 15*03f9172cSAndroid Build Coastguard WorkerLicense 16*03f9172cSAndroid Build Coastguard Worker------- 17*03f9172cSAndroid Build Coastguard Worker 18*03f9172cSAndroid Build Coastguard WorkerThis software may be distributed, used, and modified under the terms of 19*03f9172cSAndroid Build Coastguard WorkerBSD license: 20*03f9172cSAndroid Build Coastguard Worker 21*03f9172cSAndroid Build Coastguard WorkerRedistribution and use in source and binary forms, with or without 22*03f9172cSAndroid Build Coastguard Workermodification, are permitted provided that the following conditions are 23*03f9172cSAndroid Build Coastguard Workermet: 24*03f9172cSAndroid Build Coastguard Worker 25*03f9172cSAndroid Build Coastguard Worker1. Redistributions of source code must retain the above copyright 26*03f9172cSAndroid Build Coastguard Worker notice, this list of conditions and the following disclaimer. 27*03f9172cSAndroid Build Coastguard Worker 28*03f9172cSAndroid Build Coastguard Worker2. Redistributions in binary form must reproduce the above copyright 29*03f9172cSAndroid Build Coastguard Worker notice, this list of conditions and the following disclaimer in the 30*03f9172cSAndroid Build Coastguard Worker documentation and/or other materials provided with the distribution. 31*03f9172cSAndroid Build Coastguard Worker 32*03f9172cSAndroid Build Coastguard Worker3. Neither the name(s) of the above-listed copyright holder(s) nor the 33*03f9172cSAndroid Build Coastguard Worker names of its contributors may be used to endorse or promote products 34*03f9172cSAndroid Build Coastguard Worker derived from this software without specific prior written permission. 35*03f9172cSAndroid Build Coastguard Worker 36*03f9172cSAndroid Build Coastguard WorkerTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 37*03f9172cSAndroid Build Coastguard Worker"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 38*03f9172cSAndroid Build Coastguard WorkerLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 39*03f9172cSAndroid Build Coastguard WorkerA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 40*03f9172cSAndroid Build Coastguard WorkerOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 41*03f9172cSAndroid Build Coastguard WorkerSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 42*03f9172cSAndroid Build Coastguard WorkerLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 43*03f9172cSAndroid Build Coastguard WorkerDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 44*03f9172cSAndroid Build Coastguard WorkerTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 45*03f9172cSAndroid Build Coastguard Worker(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 46*03f9172cSAndroid Build Coastguard WorkerOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 47*03f9172cSAndroid Build Coastguard Worker 48*03f9172cSAndroid Build Coastguard Worker 49*03f9172cSAndroid Build Coastguard Worker 50*03f9172cSAndroid Build Coastguard WorkerFeatures 51*03f9172cSAndroid Build Coastguard Worker-------- 52*03f9172cSAndroid Build Coastguard Worker 53*03f9172cSAndroid Build Coastguard WorkerSupported WPA/IEEE 802.11i features: 54*03f9172cSAndroid Build Coastguard Worker- WPA-PSK ("WPA-Personal") 55*03f9172cSAndroid Build Coastguard Worker- WPA with EAP (e.g., with RADIUS authentication server) ("WPA-Enterprise") 56*03f9172cSAndroid Build Coastguard Worker Following authentication methods are supported with an integrate IEEE 802.1X 57*03f9172cSAndroid Build Coastguard Worker Supplicant: 58*03f9172cSAndroid Build Coastguard Worker * EAP-TLS 59*03f9172cSAndroid Build Coastguard Worker * EAP-PEAP/MSCHAPv2 (both PEAPv0 and PEAPv1) 60*03f9172cSAndroid Build Coastguard Worker * EAP-PEAP/TLS (both PEAPv0 and PEAPv1) 61*03f9172cSAndroid Build Coastguard Worker * EAP-PEAP/GTC (both PEAPv0 and PEAPv1) 62*03f9172cSAndroid Build Coastguard Worker * EAP-PEAP/OTP (both PEAPv0 and PEAPv1) 63*03f9172cSAndroid Build Coastguard Worker * EAP-PEAP/MD5-Challenge (both PEAPv0 and PEAPv1) 64*03f9172cSAndroid Build Coastguard Worker * EAP-TTLS/EAP-MD5-Challenge 65*03f9172cSAndroid Build Coastguard Worker * EAP-TTLS/EAP-GTC 66*03f9172cSAndroid Build Coastguard Worker * EAP-TTLS/EAP-OTP 67*03f9172cSAndroid Build Coastguard Worker * EAP-TTLS/EAP-MSCHAPv2 68*03f9172cSAndroid Build Coastguard Worker * EAP-TTLS/EAP-TLS 69*03f9172cSAndroid Build Coastguard Worker * EAP-TTLS/MSCHAPv2 70*03f9172cSAndroid Build Coastguard Worker * EAP-TTLS/MSCHAP 71*03f9172cSAndroid Build Coastguard Worker * EAP-TTLS/PAP 72*03f9172cSAndroid Build Coastguard Worker * EAP-TTLS/CHAP 73*03f9172cSAndroid Build Coastguard Worker * EAP-SIM 74*03f9172cSAndroid Build Coastguard Worker * EAP-AKA 75*03f9172cSAndroid Build Coastguard Worker * EAP-AKA' 76*03f9172cSAndroid Build Coastguard Worker * EAP-PSK 77*03f9172cSAndroid Build Coastguard Worker * EAP-PAX 78*03f9172cSAndroid Build Coastguard Worker * EAP-SAKE 79*03f9172cSAndroid Build Coastguard Worker * EAP-IKEv2 80*03f9172cSAndroid Build Coastguard Worker * EAP-GPSK 81*03f9172cSAndroid Build Coastguard Worker * EAP-pwd 82*03f9172cSAndroid Build Coastguard Worker * LEAP (note: requires special support from the driver for IEEE 802.11 83*03f9172cSAndroid Build Coastguard Worker authentication) 84*03f9172cSAndroid Build Coastguard Worker (following methods are supported, but since they do not generate keying 85*03f9172cSAndroid Build Coastguard Worker material, they cannot be used with WPA or IEEE 802.1X WEP keying) 86*03f9172cSAndroid Build Coastguard Worker * EAP-MD5-Challenge 87*03f9172cSAndroid Build Coastguard Worker * EAP-MSCHAPv2 88*03f9172cSAndroid Build Coastguard Worker * EAP-GTC 89*03f9172cSAndroid Build Coastguard Worker * EAP-OTP 90*03f9172cSAndroid Build Coastguard Worker- key management for CCMP, TKIP, WEP104, WEP40 91*03f9172cSAndroid Build Coastguard Worker- RSN/WPA2 (IEEE 802.11i) 92*03f9172cSAndroid Build Coastguard Worker * pre-authentication 93*03f9172cSAndroid Build Coastguard Worker * PMKSA caching 94*03f9172cSAndroid Build Coastguard Worker 95*03f9172cSAndroid Build Coastguard WorkerSupported TLS/crypto libraries: 96*03f9172cSAndroid Build Coastguard Worker- OpenSSL (default) 97*03f9172cSAndroid Build Coastguard Worker- GnuTLS 98*03f9172cSAndroid Build Coastguard Worker 99*03f9172cSAndroid Build Coastguard WorkerInternal TLS/crypto implementation (optional): 100*03f9172cSAndroid Build Coastguard Worker- can be used in place of an external TLS/crypto library 101*03f9172cSAndroid Build Coastguard Worker- TLSv1 102*03f9172cSAndroid Build Coastguard Worker- X.509 certificate processing 103*03f9172cSAndroid Build Coastguard Worker- PKCS #1 104*03f9172cSAndroid Build Coastguard Worker- ASN.1 105*03f9172cSAndroid Build Coastguard Worker- RSA 106*03f9172cSAndroid Build Coastguard Worker- bignum 107*03f9172cSAndroid Build Coastguard Worker- minimal size (ca. 50 kB binary, parts of which are already needed for WPA; 108*03f9172cSAndroid Build Coastguard Worker TLSv1/X.509/ASN.1/RSA/bignum parts are about 25 kB on x86) 109*03f9172cSAndroid Build Coastguard Worker 110*03f9172cSAndroid Build Coastguard Worker 111*03f9172cSAndroid Build Coastguard WorkerRequirements 112*03f9172cSAndroid Build Coastguard Worker------------ 113*03f9172cSAndroid Build Coastguard Worker 114*03f9172cSAndroid Build Coastguard WorkerCurrent hardware/software requirements: 115*03f9172cSAndroid Build Coastguard Worker- Linux kernel 2.4.x or 2.6.x with Linux Wireless Extensions v15 or newer 116*03f9172cSAndroid Build Coastguard Worker- FreeBSD 6-CURRENT 117*03f9172cSAndroid Build Coastguard Worker- NetBSD-current 118*03f9172cSAndroid Build Coastguard Worker- Microsoft Windows with WinPcap (at least WinXP, may work with other versions) 119*03f9172cSAndroid Build Coastguard Worker- drivers: 120*03f9172cSAndroid Build Coastguard Worker Linux drivers that support cfg80211/nl80211. Even though there are 121*03f9172cSAndroid Build Coastguard Worker number of driver specific interface included in wpa_supplicant, please 122*03f9172cSAndroid Build Coastguard Worker note that Linux drivers are moving to use generic wireless configuration 123*03f9172cSAndroid Build Coastguard Worker interface driver_nl80211 (-Dnl80211 on wpa_supplicant command line) 124*03f9172cSAndroid Build Coastguard Worker should be the default option to start with before falling back to driver 125*03f9172cSAndroid Build Coastguard Worker specific interface. 126*03f9172cSAndroid Build Coastguard Worker 127*03f9172cSAndroid Build Coastguard Worker Linux drivers that support WPA/WPA2 configuration with the generic 128*03f9172cSAndroid Build Coastguard Worker Linux wireless extensions (WE-18 or newer). Obsoleted by nl80211. 129*03f9172cSAndroid Build Coastguard Worker 130*03f9172cSAndroid Build Coastguard Worker In theory, any driver that supports Linux wireless extensions can be 131*03f9172cSAndroid Build Coastguard Worker used with IEEE 802.1X (i.e., not WPA) when using ap_scan=0 option in 132*03f9172cSAndroid Build Coastguard Worker configuration file. 133*03f9172cSAndroid Build Coastguard Worker 134*03f9172cSAndroid Build Coastguard Worker Wired Ethernet drivers (with ap_scan=0) 135*03f9172cSAndroid Build Coastguard Worker 136*03f9172cSAndroid Build Coastguard Worker BSD net80211 layer (e.g., Atheros driver) 137*03f9172cSAndroid Build Coastguard Worker At the moment, this is for FreeBSD 6-CURRENT branch and NetBSD-current. 138*03f9172cSAndroid Build Coastguard Worker 139*03f9172cSAndroid Build Coastguard Worker Windows NDIS 140*03f9172cSAndroid Build Coastguard Worker The current Windows port requires WinPcap (http://winpcap.polito.it/). 141*03f9172cSAndroid Build Coastguard Worker See README-Windows.txt for more information. 142*03f9172cSAndroid Build Coastguard Worker 143*03f9172cSAndroid Build Coastguard Workerwpa_supplicant was designed to be portable for different drivers and 144*03f9172cSAndroid Build Coastguard Workeroperating systems. Hopefully, support for more wlan cards and OSes will be 145*03f9172cSAndroid Build Coastguard Workeradded in the future. See developer's documentation 146*03f9172cSAndroid Build Coastguard Worker(http://hostap.epitest.fi/wpa_supplicant/devel/) for more information about the 147*03f9172cSAndroid Build Coastguard Workerdesign of wpa_supplicant and porting to other drivers. One main goal 148*03f9172cSAndroid Build Coastguard Workeris to add full WPA/WPA2 support to Linux wireless extensions to allow 149*03f9172cSAndroid Build Coastguard Workernew drivers to be supported without having to implement new 150*03f9172cSAndroid Build Coastguard Workerdriver-specific interface code in wpa_supplicant. 151*03f9172cSAndroid Build Coastguard Worker 152*03f9172cSAndroid Build Coastguard WorkerOptional libraries for layer2 packet processing: 153*03f9172cSAndroid Build Coastguard Worker- libpcap (tested with 0.7.2, most relatively recent versions assumed to work, 154*03f9172cSAndroid Build Coastguard Worker this is likely to be available with most distributions, 155*03f9172cSAndroid Build Coastguard Worker http://tcpdump.org/) 156*03f9172cSAndroid Build Coastguard Worker- libdnet (tested with v1.4, most versions assumed to work, 157*03f9172cSAndroid Build Coastguard Worker http://libdnet.sourceforge.net/) 158*03f9172cSAndroid Build Coastguard Worker 159*03f9172cSAndroid Build Coastguard WorkerThese libraries are _not_ used in the default Linux build. Instead, 160*03f9172cSAndroid Build Coastguard Workerinternal Linux specific implementation is used. libpcap/libdnet are 161*03f9172cSAndroid Build Coastguard Workermore portable and they can be used by adding CONFIG_L2_PACKET=pcap into 162*03f9172cSAndroid Build Coastguard Worker.config. They may also be selected automatically for other operating 163*03f9172cSAndroid Build Coastguard Workersystems. In case of Windows builds, WinPcap is used by default 164*03f9172cSAndroid Build Coastguard Worker(CONFIG_L2_PACKET=winpcap). 165*03f9172cSAndroid Build Coastguard Worker 166*03f9172cSAndroid Build Coastguard Worker 167*03f9172cSAndroid Build Coastguard WorkerOptional libraries for EAP-TLS, EAP-PEAP, and EAP-TTLS: 168*03f9172cSAndroid Build Coastguard Worker- OpenSSL (tested with 1.0.1 and 1.0.2 versions; assumed to 169*03f9172cSAndroid Build Coastguard Worker work with most relatively recent versions; this is likely to be 170*03f9172cSAndroid Build Coastguard Worker available with most distributions, http://www.openssl.org/) 171*03f9172cSAndroid Build Coastguard Worker- GnuTLS 172*03f9172cSAndroid Build Coastguard Worker- internal TLSv1 implementation 173*03f9172cSAndroid Build Coastguard Worker 174*03f9172cSAndroid Build Coastguard WorkerOne of these libraries is needed when EAP-TLS, EAP-PEAP, EAP-TTLS, or 175*03f9172cSAndroid Build Coastguard WorkerEAP-FAST support is enabled. WPA-PSK mode does not require this or EAPOL/EAP 176*03f9172cSAndroid Build Coastguard Workerimplementation. A configuration file, .config, for compilation is 177*03f9172cSAndroid Build Coastguard Workerneeded to enable IEEE 802.1X/EAPOL and EAP methods. Note that EAP-MD5, 178*03f9172cSAndroid Build Coastguard WorkerEAP-GTC, EAP-OTP, and EAP-MSCHAPV2 cannot be used alone with WPA, so 179*03f9172cSAndroid Build Coastguard Workerthey should only be enabled if testing the EAPOL/EAP state 180*03f9172cSAndroid Build Coastguard Workermachines. However, there can be used as inner authentication 181*03f9172cSAndroid Build Coastguard Workeralgorithms with EAP-PEAP and EAP-TTLS. 182*03f9172cSAndroid Build Coastguard Worker 183*03f9172cSAndroid Build Coastguard WorkerSee Building and installing section below for more detailed 184*03f9172cSAndroid Build Coastguard Workerinformation about the wpa_supplicant build time configuration. 185*03f9172cSAndroid Build Coastguard Worker 186*03f9172cSAndroid Build Coastguard Worker 187*03f9172cSAndroid Build Coastguard Worker 188*03f9172cSAndroid Build Coastguard WorkerWPA 189*03f9172cSAndroid Build Coastguard Worker--- 190*03f9172cSAndroid Build Coastguard Worker 191*03f9172cSAndroid Build Coastguard WorkerThe original security mechanism of IEEE 802.11 standard was not 192*03f9172cSAndroid Build Coastguard Workerdesigned to be strong and has proven to be insufficient for most 193*03f9172cSAndroid Build Coastguard Workernetworks that require some kind of security. Task group I (Security) 194*03f9172cSAndroid Build Coastguard Workerof IEEE 802.11 working group (http://www.ieee802.org/11/) has worked 195*03f9172cSAndroid Build Coastguard Workerto address the flaws of the base standard and has in practice 196*03f9172cSAndroid Build Coastguard Workercompleted its work in May 2004. The IEEE 802.11i amendment to the IEEE 197*03f9172cSAndroid Build Coastguard Worker802.11 standard was approved in June 2004 and published in July 2004. 198*03f9172cSAndroid Build Coastguard Worker 199*03f9172cSAndroid Build Coastguard WorkerWi-Fi Alliance (http://www.wi-fi.org/) used a draft version of the 200*03f9172cSAndroid Build Coastguard WorkerIEEE 802.11i work (draft 3.0) to define a subset of the security 201*03f9172cSAndroid Build Coastguard Workerenhancements that can be implemented with existing wlan hardware. This 202*03f9172cSAndroid Build Coastguard Workeris called Wi-Fi Protected Access<TM> (WPA). This has now become a 203*03f9172cSAndroid Build Coastguard Workermandatory component of interoperability testing and certification done 204*03f9172cSAndroid Build Coastguard Workerby Wi-Fi Alliance. Wi-Fi provides information about WPA at its web 205*03f9172cSAndroid Build Coastguard Workersite (http://www.wi-fi.org/OpenSection/protected_access.asp). 206*03f9172cSAndroid Build Coastguard Worker 207*03f9172cSAndroid Build Coastguard WorkerIEEE 802.11 standard defined wired equivalent privacy (WEP) algorithm 208*03f9172cSAndroid Build Coastguard Workerfor protecting wireless networks. WEP uses RC4 with 40-bit keys, 209*03f9172cSAndroid Build Coastguard Worker24-bit initialization vector (IV), and CRC32 to protect against packet 210*03f9172cSAndroid Build Coastguard Workerforgery. All these choices have proven to be insufficient: key space is 211*03f9172cSAndroid Build Coastguard Workertoo small against current attacks, RC4 key scheduling is insufficient 212*03f9172cSAndroid Build Coastguard Worker(beginning of the pseudorandom stream should be skipped), IV space is 213*03f9172cSAndroid Build Coastguard Workertoo small and IV reuse makes attacks easier, there is no replay 214*03f9172cSAndroid Build Coastguard Workerprotection, and non-keyed authentication does not protect against bit 215*03f9172cSAndroid Build Coastguard Workerflipping packet data. 216*03f9172cSAndroid Build Coastguard Worker 217*03f9172cSAndroid Build Coastguard WorkerWPA is an intermediate solution for the security issues. It uses 218*03f9172cSAndroid Build Coastguard WorkerTemporal Key Integrity Protocol (TKIP) to replace WEP. TKIP is a 219*03f9172cSAndroid Build Coastguard Workercompromise on strong security and possibility to use existing 220*03f9172cSAndroid Build Coastguard Workerhardware. It still uses RC4 for the encryption like WEP, but with 221*03f9172cSAndroid Build Coastguard Workerper-packet RC4 keys. In addition, it implements replay protection, 222*03f9172cSAndroid Build Coastguard Workerkeyed packet authentication mechanism (Michael MIC). 223*03f9172cSAndroid Build Coastguard Worker 224*03f9172cSAndroid Build Coastguard WorkerKeys can be managed using two different mechanisms. WPA can either use 225*03f9172cSAndroid Build Coastguard Workeran external authentication server (e.g., RADIUS) and EAP just like 226*03f9172cSAndroid Build Coastguard WorkerIEEE 802.1X is using or pre-shared keys without need for additional 227*03f9172cSAndroid Build Coastguard Workerservers. Wi-Fi calls these "WPA-Enterprise" and "WPA-Personal", 228*03f9172cSAndroid Build Coastguard Workerrespectively. Both mechanisms will generate a master session key for 229*03f9172cSAndroid Build Coastguard Workerthe Authenticator (AP) and Supplicant (client station). 230*03f9172cSAndroid Build Coastguard Worker 231*03f9172cSAndroid Build Coastguard WorkerWPA implements a new key handshake (4-Way Handshake and Group Key 232*03f9172cSAndroid Build Coastguard WorkerHandshake) for generating and exchanging data encryption keys between 233*03f9172cSAndroid Build Coastguard Workerthe Authenticator and Supplicant. This handshake is also used to 234*03f9172cSAndroid Build Coastguard Workerverify that both Authenticator and Supplicant know the master session 235*03f9172cSAndroid Build Coastguard Workerkey. These handshakes are identical regardless of the selected key 236*03f9172cSAndroid Build Coastguard Workermanagement mechanism (only the method for generating master session 237*03f9172cSAndroid Build Coastguard Workerkey changes). 238*03f9172cSAndroid Build Coastguard Worker 239*03f9172cSAndroid Build Coastguard Worker 240*03f9172cSAndroid Build Coastguard Worker 241*03f9172cSAndroid Build Coastguard WorkerIEEE 802.11i / WPA2 242*03f9172cSAndroid Build Coastguard Worker------------------- 243*03f9172cSAndroid Build Coastguard Worker 244*03f9172cSAndroid Build Coastguard WorkerThe design for parts of IEEE 802.11i that were not included in WPA has 245*03f9172cSAndroid Build Coastguard Workerfinished (May 2004) and this amendment to IEEE 802.11 was approved in 246*03f9172cSAndroid Build Coastguard WorkerJune 2004. Wi-Fi Alliance is using the final IEEE 802.11i as a new 247*03f9172cSAndroid Build Coastguard Workerversion of WPA called WPA2. This includes, e.g., support for more 248*03f9172cSAndroid Build Coastguard Workerrobust encryption algorithm (CCMP: AES in Counter mode with CBC-MAC) 249*03f9172cSAndroid Build Coastguard Workerto replace TKIP and optimizations for handoff (reduced number of 250*03f9172cSAndroid Build Coastguard Workermessages in initial key handshake, pre-authentication, and PMKSA caching). 251*03f9172cSAndroid Build Coastguard Worker 252*03f9172cSAndroid Build Coastguard Worker 253*03f9172cSAndroid Build Coastguard Worker 254*03f9172cSAndroid Build Coastguard Workerwpa_supplicant 255*03f9172cSAndroid Build Coastguard Worker-------------- 256*03f9172cSAndroid Build Coastguard Worker 257*03f9172cSAndroid Build Coastguard Workerwpa_supplicant is an implementation of the WPA Supplicant component, 258*03f9172cSAndroid Build Coastguard Workeri.e., the part that runs in the client stations. It implements WPA key 259*03f9172cSAndroid Build Coastguard Workernegotiation with a WPA Authenticator and EAP authentication with 260*03f9172cSAndroid Build Coastguard WorkerAuthentication Server. In addition, it controls the roaming and IEEE 261*03f9172cSAndroid Build Coastguard Worker802.11 authentication/association of the wlan driver. 262*03f9172cSAndroid Build Coastguard Worker 263*03f9172cSAndroid Build Coastguard Workerwpa_supplicant is designed to be a "daemon" program that runs in the 264*03f9172cSAndroid Build Coastguard Workerbackground and acts as the backend component controlling the wireless 265*03f9172cSAndroid Build Coastguard Workerconnection. wpa_supplicant supports separate frontend programs and an 266*03f9172cSAndroid Build Coastguard Workerexample text-based frontend, wpa_cli, is included with wpa_supplicant. 267*03f9172cSAndroid Build Coastguard Worker 268*03f9172cSAndroid Build Coastguard WorkerFollowing steps are used when associating with an AP using WPA: 269*03f9172cSAndroid Build Coastguard Worker 270*03f9172cSAndroid Build Coastguard Worker- wpa_supplicant requests the kernel driver to scan neighboring BSSes 271*03f9172cSAndroid Build Coastguard Worker- wpa_supplicant selects a BSS based on its configuration 272*03f9172cSAndroid Build Coastguard Worker- wpa_supplicant requests the kernel driver to associate with the chosen 273*03f9172cSAndroid Build Coastguard Worker BSS 274*03f9172cSAndroid Build Coastguard Worker- If WPA-EAP: integrated IEEE 802.1X Supplicant completes EAP 275*03f9172cSAndroid Build Coastguard Worker authentication with the authentication server (proxied by the 276*03f9172cSAndroid Build Coastguard Worker Authenticator in the AP) 277*03f9172cSAndroid Build Coastguard Worker- If WPA-EAP: master key is received from the IEEE 802.1X Supplicant 278*03f9172cSAndroid Build Coastguard Worker- If WPA-PSK: wpa_supplicant uses PSK as the master session key 279*03f9172cSAndroid Build Coastguard Worker- wpa_supplicant completes WPA 4-Way Handshake and Group Key Handshake 280*03f9172cSAndroid Build Coastguard Worker with the Authenticator (AP) 281*03f9172cSAndroid Build Coastguard Worker- wpa_supplicant configures encryption keys for unicast and broadcast 282*03f9172cSAndroid Build Coastguard Worker- normal data packets can be transmitted and received 283*03f9172cSAndroid Build Coastguard Worker 284*03f9172cSAndroid Build Coastguard Worker 285*03f9172cSAndroid Build Coastguard Worker 286*03f9172cSAndroid Build Coastguard WorkerBuilding and installing 287*03f9172cSAndroid Build Coastguard Worker----------------------- 288*03f9172cSAndroid Build Coastguard Worker 289*03f9172cSAndroid Build Coastguard WorkerIn order to be able to build wpa_supplicant, you will first need to 290*03f9172cSAndroid Build Coastguard Workerselect which parts of it will be included. This is done by creating a 291*03f9172cSAndroid Build Coastguard Workerbuild time configuration file, .config, in the wpa_supplicant root 292*03f9172cSAndroid Build Coastguard Workerdirectory. Configuration options are text lines using following 293*03f9172cSAndroid Build Coastguard Workerformat: CONFIG_<option>=y. Lines starting with # are considered 294*03f9172cSAndroid Build Coastguard Workercomments and are ignored. See defconfig file for an example configuration 295*03f9172cSAndroid Build Coastguard Workerand a list of available options and additional notes. 296*03f9172cSAndroid Build Coastguard Worker 297*03f9172cSAndroid Build Coastguard WorkerThe build time configuration can be used to select only the needed 298*03f9172cSAndroid Build Coastguard Workerfeatures and limit the binary size and requirements for external 299*03f9172cSAndroid Build Coastguard Workerlibraries. The main configuration parts are the selection of which 300*03f9172cSAndroid Build Coastguard Workerdriver interfaces (e.g., nl80211, wext, ..) and which authentication 301*03f9172cSAndroid Build Coastguard Workermethods (e.g., EAP-TLS, EAP-PEAP, ..) are included. 302*03f9172cSAndroid Build Coastguard Worker 303*03f9172cSAndroid Build Coastguard WorkerFollowing build time configuration options are used to control IEEE 304*03f9172cSAndroid Build Coastguard Worker802.1X/EAPOL and EAP state machines and all EAP methods. Including 305*03f9172cSAndroid Build Coastguard WorkerTLS, PEAP, or TTLS will require linking wpa_supplicant with OpenSSL 306*03f9172cSAndroid Build Coastguard Workerlibrary for TLS implementation. Alternatively, GnuTLS or the internal 307*03f9172cSAndroid Build Coastguard WorkerTLSv1 implementation can be used for TLS functionality. 308*03f9172cSAndroid Build Coastguard Worker 309*03f9172cSAndroid Build Coastguard WorkerCONFIG_IEEE8021X_EAPOL=y 310*03f9172cSAndroid Build Coastguard WorkerCONFIG_EAP_MD5=y 311*03f9172cSAndroid Build Coastguard WorkerCONFIG_EAP_MSCHAPV2=y 312*03f9172cSAndroid Build Coastguard WorkerCONFIG_EAP_TLS=y 313*03f9172cSAndroid Build Coastguard WorkerCONFIG_EAP_PEAP=y 314*03f9172cSAndroid Build Coastguard WorkerCONFIG_EAP_TTLS=y 315*03f9172cSAndroid Build Coastguard WorkerCONFIG_EAP_GTC=y 316*03f9172cSAndroid Build Coastguard WorkerCONFIG_EAP_OTP=y 317*03f9172cSAndroid Build Coastguard WorkerCONFIG_EAP_SIM=y 318*03f9172cSAndroid Build Coastguard WorkerCONFIG_EAP_AKA=y 319*03f9172cSAndroid Build Coastguard WorkerCONFIG_EAP_AKA_PRIME=y 320*03f9172cSAndroid Build Coastguard WorkerCONFIG_EAP_PSK=y 321*03f9172cSAndroid Build Coastguard WorkerCONFIG_EAP_SAKE=y 322*03f9172cSAndroid Build Coastguard WorkerCONFIG_EAP_GPSK=y 323*03f9172cSAndroid Build Coastguard WorkerCONFIG_EAP_PAX=y 324*03f9172cSAndroid Build Coastguard WorkerCONFIG_EAP_LEAP=y 325*03f9172cSAndroid Build Coastguard WorkerCONFIG_EAP_IKEV2=y 326*03f9172cSAndroid Build Coastguard WorkerCONFIG_EAP_PWD=y 327*03f9172cSAndroid Build Coastguard Worker 328*03f9172cSAndroid Build Coastguard WorkerFollowing option can be used to include GSM SIM/USIM interface for GSM/UMTS 329*03f9172cSAndroid Build Coastguard Workerauthentication algorithm (for EAP-SIM/EAP-AKA/EAP-AKA'). This requires pcsc-lite 330*03f9172cSAndroid Build Coastguard Worker(http://www.linuxnet.com/) for smart card access. 331*03f9172cSAndroid Build Coastguard Worker 332*03f9172cSAndroid Build Coastguard WorkerCONFIG_PCSC=y 333*03f9172cSAndroid Build Coastguard Worker 334*03f9172cSAndroid Build Coastguard WorkerFollowing options can be added to .config to select which driver 335*03f9172cSAndroid Build Coastguard Workerinterfaces are included. 336*03f9172cSAndroid Build Coastguard Worker 337*03f9172cSAndroid Build Coastguard WorkerCONFIG_DRIVER_NL80211=y 338*03f9172cSAndroid Build Coastguard WorkerCONFIG_DRIVER_WEXT=y 339*03f9172cSAndroid Build Coastguard WorkerCONFIG_DRIVER_BSD=y 340*03f9172cSAndroid Build Coastguard WorkerCONFIG_DRIVER_NDIS=y 341*03f9172cSAndroid Build Coastguard Worker 342*03f9172cSAndroid Build Coastguard WorkerFollowing example includes some more features and driver interfaces that 343*03f9172cSAndroid Build Coastguard Workerare included in the wpa_supplicant package: 344*03f9172cSAndroid Build Coastguard Worker 345*03f9172cSAndroid Build Coastguard WorkerCONFIG_DRIVER_NL80211=y 346*03f9172cSAndroid Build Coastguard WorkerCONFIG_DRIVER_WEXT=y 347*03f9172cSAndroid Build Coastguard WorkerCONFIG_DRIVER_BSD=y 348*03f9172cSAndroid Build Coastguard WorkerCONFIG_DRIVER_NDIS=y 349*03f9172cSAndroid Build Coastguard WorkerCONFIG_IEEE8021X_EAPOL=y 350*03f9172cSAndroid Build Coastguard WorkerCONFIG_EAP_MD5=y 351*03f9172cSAndroid Build Coastguard WorkerCONFIG_EAP_MSCHAPV2=y 352*03f9172cSAndroid Build Coastguard WorkerCONFIG_EAP_TLS=y 353*03f9172cSAndroid Build Coastguard WorkerCONFIG_EAP_PEAP=y 354*03f9172cSAndroid Build Coastguard WorkerCONFIG_EAP_TTLS=y 355*03f9172cSAndroid Build Coastguard WorkerCONFIG_EAP_GTC=y 356*03f9172cSAndroid Build Coastguard WorkerCONFIG_EAP_OTP=y 357*03f9172cSAndroid Build Coastguard WorkerCONFIG_EAP_SIM=y 358*03f9172cSAndroid Build Coastguard WorkerCONFIG_EAP_AKA=y 359*03f9172cSAndroid Build Coastguard WorkerCONFIG_EAP_PSK=y 360*03f9172cSAndroid Build Coastguard WorkerCONFIG_EAP_SAKE=y 361*03f9172cSAndroid Build Coastguard WorkerCONFIG_EAP_GPSK=y 362*03f9172cSAndroid Build Coastguard WorkerCONFIG_EAP_PAX=y 363*03f9172cSAndroid Build Coastguard WorkerCONFIG_EAP_LEAP=y 364*03f9172cSAndroid Build Coastguard WorkerCONFIG_EAP_IKEV2=y 365*03f9172cSAndroid Build Coastguard WorkerCONFIG_PCSC=y 366*03f9172cSAndroid Build Coastguard Worker 367*03f9172cSAndroid Build Coastguard WorkerEAP-PEAP and EAP-TTLS will automatically include configured EAP 368*03f9172cSAndroid Build Coastguard Workermethods (MD5, OTP, GTC, MSCHAPV2) for inner authentication selection. 369*03f9172cSAndroid Build Coastguard Worker 370*03f9172cSAndroid Build Coastguard Worker 371*03f9172cSAndroid Build Coastguard WorkerAfter you have created a configuration file, you can build 372*03f9172cSAndroid Build Coastguard Workerwpa_supplicant and wpa_cli with 'make' command. You may then install 373*03f9172cSAndroid Build Coastguard Workerthe binaries to a suitable system directory, e.g., /usr/local/bin. 374*03f9172cSAndroid Build Coastguard Worker 375*03f9172cSAndroid Build Coastguard WorkerExample commands: 376*03f9172cSAndroid Build Coastguard Worker 377*03f9172cSAndroid Build Coastguard Worker# build wpa_supplicant and wpa_cli 378*03f9172cSAndroid Build Coastguard Workermake 379*03f9172cSAndroid Build Coastguard Worker# install binaries (this may need root privileges) 380*03f9172cSAndroid Build Coastguard Workercp wpa_cli wpa_supplicant /usr/local/bin 381*03f9172cSAndroid Build Coastguard Worker 382*03f9172cSAndroid Build Coastguard Worker 383*03f9172cSAndroid Build Coastguard WorkerYou will need to make a configuration file, e.g., 384*03f9172cSAndroid Build Coastguard Worker/etc/wpa_supplicant.conf, with network configuration for the networks 385*03f9172cSAndroid Build Coastguard Workeryou are going to use. Configuration file section below includes 386*03f9172cSAndroid Build Coastguard Workerexplanation of the configuration file format and includes various 387*03f9172cSAndroid Build Coastguard Workerexamples. Once the configuration is ready, you can test whether the 388*03f9172cSAndroid Build Coastguard Workerconfiguration work by first running wpa_supplicant with following 389*03f9172cSAndroid Build Coastguard Workercommand to start it on foreground with debugging enabled: 390*03f9172cSAndroid Build Coastguard Worker 391*03f9172cSAndroid Build Coastguard Workerwpa_supplicant -iwlan0 -c/etc/wpa_supplicant.conf -d 392*03f9172cSAndroid Build Coastguard Worker 393*03f9172cSAndroid Build Coastguard WorkerAssuming everything goes fine, you can start using following command 394*03f9172cSAndroid Build Coastguard Workerto start wpa_supplicant on background without debugging: 395*03f9172cSAndroid Build Coastguard Worker 396*03f9172cSAndroid Build Coastguard Workerwpa_supplicant -iwlan0 -c/etc/wpa_supplicant.conf -B 397*03f9172cSAndroid Build Coastguard Worker 398*03f9172cSAndroid Build Coastguard WorkerPlease note that if you included more than one driver interface in the 399*03f9172cSAndroid Build Coastguard Workerbuild time configuration (.config), you may need to specify which 400*03f9172cSAndroid Build Coastguard Workerinterface to use by including -D<driver name> option on the command 401*03f9172cSAndroid Build Coastguard Workerline. See following section for more details on command line options 402*03f9172cSAndroid Build Coastguard Workerfor wpa_supplicant. 403*03f9172cSAndroid Build Coastguard Worker 404*03f9172cSAndroid Build Coastguard Worker 405*03f9172cSAndroid Build Coastguard Worker 406*03f9172cSAndroid Build Coastguard WorkerCommand line options 407*03f9172cSAndroid Build Coastguard Worker-------------------- 408*03f9172cSAndroid Build Coastguard Worker 409*03f9172cSAndroid Build Coastguard Workerusage: 410*03f9172cSAndroid Build Coastguard Worker wpa_supplicant [-BddfhKLqqtuvW] [-P<pid file>] [-g<global ctrl>] \ 411*03f9172cSAndroid Build Coastguard Worker [-G<group>] \ 412*03f9172cSAndroid Build Coastguard Worker -i<ifname> -c<config file> [-C<ctrl>] [-D<driver>] [-p<driver_param>] \ 413*03f9172cSAndroid Build Coastguard Worker [-b<br_ifname> [-MN -i<ifname> -c<conf> [-C<ctrl>] [-D<driver>] \ 414*03f9172cSAndroid Build Coastguard Worker [-p<driver_param>] [-b<br_ifname>] [-m<P2P Device config file>] ... 415*03f9172cSAndroid Build Coastguard Worker 416*03f9172cSAndroid Build Coastguard Workeroptions: 417*03f9172cSAndroid Build Coastguard Worker -b = optional bridge interface name 418*03f9172cSAndroid Build Coastguard Worker -B = run daemon in the background 419*03f9172cSAndroid Build Coastguard Worker -c = Configuration file 420*03f9172cSAndroid Build Coastguard Worker -C = ctrl_interface parameter (only used if -c is not) 421*03f9172cSAndroid Build Coastguard Worker -i = interface name 422*03f9172cSAndroid Build Coastguard Worker -d = increase debugging verbosity (-dd even more) 423*03f9172cSAndroid Build Coastguard Worker -D = driver name (can be multiple drivers: nl80211,wext) 424*03f9172cSAndroid Build Coastguard Worker -f = Log output to default log location (normally /tmp) 425*03f9172cSAndroid Build Coastguard Worker -g = global ctrl_interface 426*03f9172cSAndroid Build Coastguard Worker -G = global ctrl_interface group 427*03f9172cSAndroid Build Coastguard Worker -K = include keys (passwords, etc.) in debug output 428*03f9172cSAndroid Build Coastguard Worker -t = include timestamp in debug messages 429*03f9172cSAndroid Build Coastguard Worker -h = show this help text 430*03f9172cSAndroid Build Coastguard Worker -L = show license (BSD) 431*03f9172cSAndroid Build Coastguard Worker -p = driver parameters 432*03f9172cSAndroid Build Coastguard Worker -P = PID file 433*03f9172cSAndroid Build Coastguard Worker -q = decrease debugging verbosity (-qq even less) 434*03f9172cSAndroid Build Coastguard Worker -u = enable DBus control interface 435*03f9172cSAndroid Build Coastguard Worker -v = show version 436*03f9172cSAndroid Build Coastguard Worker -W = wait for a control interface monitor before starting 437*03f9172cSAndroid Build Coastguard Worker -M = start describing matching interface 438*03f9172cSAndroid Build Coastguard Worker -N = start describing new interface 439*03f9172cSAndroid Build Coastguard Worker -m = Configuration file for the P2P Device 440*03f9172cSAndroid Build Coastguard Worker 441*03f9172cSAndroid Build Coastguard Workerdrivers: 442*03f9172cSAndroid Build Coastguard Worker nl80211 = Linux nl80211/cfg80211 443*03f9172cSAndroid Build Coastguard Worker wext = Linux wireless extensions (generic) 444*03f9172cSAndroid Build Coastguard Worker wired = wpa_supplicant wired Ethernet driver 445*03f9172cSAndroid Build Coastguard Worker macsec_linux = MACsec Ethernet driver for Linux 446*03f9172cSAndroid Build Coastguard Worker roboswitch = wpa_supplicant Broadcom switch driver 447*03f9172cSAndroid Build Coastguard Worker none = no driver (RADIUS server/WPS ER only) 448*03f9172cSAndroid Build Coastguard Worker bsd = BSD 802.11 support (Atheros, etc.) 449*03f9172cSAndroid Build Coastguard Worker ndis = Windows NDIS driver 450*03f9172cSAndroid Build Coastguard Worker 451*03f9172cSAndroid Build Coastguard WorkerIn most common cases, wpa_supplicant is started with 452*03f9172cSAndroid Build Coastguard Worker 453*03f9172cSAndroid Build Coastguard Workerwpa_supplicant -B -c/etc/wpa_supplicant.conf -iwlan0 454*03f9172cSAndroid Build Coastguard Worker 455*03f9172cSAndroid Build Coastguard WorkerThis makes the process fork into background. 456*03f9172cSAndroid Build Coastguard Worker 457*03f9172cSAndroid Build Coastguard WorkerThe easiest way to debug problems, and to get debug log for bug 458*03f9172cSAndroid Build Coastguard Workerreports, is to start wpa_supplicant on foreground with debugging 459*03f9172cSAndroid Build Coastguard Workerenabled: 460*03f9172cSAndroid Build Coastguard Worker 461*03f9172cSAndroid Build Coastguard Workerwpa_supplicant -c/etc/wpa_supplicant.conf -iwlan0 -d 462*03f9172cSAndroid Build Coastguard Worker 463*03f9172cSAndroid Build Coastguard WorkerIf the specific driver wrapper is not known beforehand, it is possible 464*03f9172cSAndroid Build Coastguard Workerto specify multiple comma separated driver wrappers on the command 465*03f9172cSAndroid Build Coastguard Workerline. wpa_supplicant will use the first driver wrapper that is able to 466*03f9172cSAndroid Build Coastguard Workerinitialize the interface. 467*03f9172cSAndroid Build Coastguard Worker 468*03f9172cSAndroid Build Coastguard Workerwpa_supplicant -Dnl80211,wext -c/etc/wpa_supplicant.conf -iwlan0 469*03f9172cSAndroid Build Coastguard Worker 470*03f9172cSAndroid Build Coastguard Worker 471*03f9172cSAndroid Build Coastguard Workerwpa_supplicant can control multiple interfaces (radios) either by 472*03f9172cSAndroid Build Coastguard Workerrunning one process for each interface separately or by running just 473*03f9172cSAndroid Build Coastguard Workerone process and list of options at command line. Each interface is 474*03f9172cSAndroid Build Coastguard Workerseparated with -N argument. As an example, following command would 475*03f9172cSAndroid Build Coastguard Workerstart wpa_supplicant for two interfaces: 476*03f9172cSAndroid Build Coastguard Worker 477*03f9172cSAndroid Build Coastguard Workerwpa_supplicant \ 478*03f9172cSAndroid Build Coastguard Worker -c wpa1.conf -i wlan0 -D nl80211 -N \ 479*03f9172cSAndroid Build Coastguard Worker -c wpa2.conf -i wlan1 -D wext 480*03f9172cSAndroid Build Coastguard Worker 481*03f9172cSAndroid Build Coastguard Worker 482*03f9172cSAndroid Build Coastguard WorkerIf the interfaces on which wpa_supplicant is to run are not known or do 483*03f9172cSAndroid Build Coastguard Workernot exist, wpa_supplicant can match an interface when it arrives. Each 484*03f9172cSAndroid Build Coastguard Workermatched interface is separated with -M argument and the -i argument now 485*03f9172cSAndroid Build Coastguard Workerallows for pattern matching. 486*03f9172cSAndroid Build Coastguard Worker 487*03f9172cSAndroid Build Coastguard WorkerAs an example, the following command would start wpa_supplicant for a 488*03f9172cSAndroid Build Coastguard Workerspecific wired interface called lan0, any interface starting with wlan 489*03f9172cSAndroid Build Coastguard Workerand lastly any other interface. Each match has its own configuration 490*03f9172cSAndroid Build Coastguard Workerfile, and for the wired interface a specific driver has also been given. 491*03f9172cSAndroid Build Coastguard Worker 492*03f9172cSAndroid Build Coastguard Workerwpa_supplicant \ 493*03f9172cSAndroid Build Coastguard Worker -M -c wpa_wired.conf -ilan0 -D wired \ 494*03f9172cSAndroid Build Coastguard Worker -M -c wpa1.conf -iwlan* \ 495*03f9172cSAndroid Build Coastguard Worker -M -c wpa2.conf 496*03f9172cSAndroid Build Coastguard Worker 497*03f9172cSAndroid Build Coastguard Worker 498*03f9172cSAndroid Build Coastguard WorkerIf the interface is added in a Linux bridge (e.g., br0), the bridge 499*03f9172cSAndroid Build Coastguard Workerinterface needs to be configured to wpa_supplicant in addition to the 500*03f9172cSAndroid Build Coastguard Workermain interface: 501*03f9172cSAndroid Build Coastguard Worker 502*03f9172cSAndroid Build Coastguard Workerwpa_supplicant -cw.conf -Dnl80211 -iwlan0 -bbr0 503*03f9172cSAndroid Build Coastguard Worker 504*03f9172cSAndroid Build Coastguard Worker 505*03f9172cSAndroid Build Coastguard WorkerConfiguration file 506*03f9172cSAndroid Build Coastguard Worker------------------ 507*03f9172cSAndroid Build Coastguard Worker 508*03f9172cSAndroid Build Coastguard Workerwpa_supplicant is configured using a text file that lists all accepted 509*03f9172cSAndroid Build Coastguard Workernetworks and security policies, including pre-shared keys. See 510*03f9172cSAndroid Build Coastguard Workerexample configuration file, wpa_supplicant.conf, for detailed 511*03f9172cSAndroid Build Coastguard Workerinformation about the configuration format and supported fields. 512*03f9172cSAndroid Build Coastguard Worker 513*03f9172cSAndroid Build Coastguard WorkerChanges to configuration file can be reloaded be sending SIGHUP signal 514*03f9172cSAndroid Build Coastguard Workerto wpa_supplicant ('killall -HUP wpa_supplicant'). Similarly, 515*03f9172cSAndroid Build Coastguard Workerreloading can be triggered with 'wpa_cli reconfigure' command. 516*03f9172cSAndroid Build Coastguard Worker 517*03f9172cSAndroid Build Coastguard WorkerConfiguration file can include one or more network blocks, e.g., one 518*03f9172cSAndroid Build Coastguard Workerfor each used SSID. wpa_supplicant will automatically select the best 519*03f9172cSAndroid Build Coastguard Workernetwork based on the order of network blocks in the configuration 520*03f9172cSAndroid Build Coastguard Workerfile, network security level (WPA/WPA2 is preferred), and signal 521*03f9172cSAndroid Build Coastguard Workerstrength. 522*03f9172cSAndroid Build Coastguard Worker 523*03f9172cSAndroid Build Coastguard WorkerExample configuration files for some common configurations: 524*03f9172cSAndroid Build Coastguard Worker 525*03f9172cSAndroid Build Coastguard Worker1) WPA-Personal (PSK) as home network and WPA-Enterprise with EAP-TLS as work 526*03f9172cSAndroid Build Coastguard Worker network 527*03f9172cSAndroid Build Coastguard Worker 528*03f9172cSAndroid Build Coastguard Worker# allow frontend (e.g., wpa_cli) to be used by all users in 'wheel' group 529*03f9172cSAndroid Build Coastguard Workerctrl_interface=/var/run/wpa_supplicant 530*03f9172cSAndroid Build Coastguard Workerctrl_interface_group=wheel 531*03f9172cSAndroid Build Coastguard Worker# 532*03f9172cSAndroid Build Coastguard Worker# home network; allow all valid ciphers 533*03f9172cSAndroid Build Coastguard Workernetwork={ 534*03f9172cSAndroid Build Coastguard Worker ssid="home" 535*03f9172cSAndroid Build Coastguard Worker scan_ssid=1 536*03f9172cSAndroid Build Coastguard Worker key_mgmt=WPA-PSK 537*03f9172cSAndroid Build Coastguard Worker psk="very secret passphrase" 538*03f9172cSAndroid Build Coastguard Worker} 539*03f9172cSAndroid Build Coastguard Worker# 540*03f9172cSAndroid Build Coastguard Worker# work network; use EAP-TLS with WPA; allow only CCMP and TKIP ciphers 541*03f9172cSAndroid Build Coastguard Workernetwork={ 542*03f9172cSAndroid Build Coastguard Worker ssid="work" 543*03f9172cSAndroid Build Coastguard Worker scan_ssid=1 544*03f9172cSAndroid Build Coastguard Worker key_mgmt=WPA-EAP 545*03f9172cSAndroid Build Coastguard Worker pairwise=CCMP TKIP 546*03f9172cSAndroid Build Coastguard Worker group=CCMP TKIP 547*03f9172cSAndroid Build Coastguard Worker eap=TLS 548*03f9172cSAndroid Build Coastguard Worker identity="[email protected]" 549*03f9172cSAndroid Build Coastguard Worker ca_cert="/etc/cert/ca.pem" 550*03f9172cSAndroid Build Coastguard Worker client_cert="/etc/cert/user.pem" 551*03f9172cSAndroid Build Coastguard Worker private_key="/etc/cert/user.prv" 552*03f9172cSAndroid Build Coastguard Worker private_key_passwd="password" 553*03f9172cSAndroid Build Coastguard Worker} 554*03f9172cSAndroid Build Coastguard Worker 555*03f9172cSAndroid Build Coastguard Worker 556*03f9172cSAndroid Build Coastguard Worker2) WPA-RADIUS/EAP-PEAP/MSCHAPv2 with RADIUS servers that use old peaplabel 557*03f9172cSAndroid Build Coastguard Worker (e.g., Funk Odyssey and SBR, Meetinghouse Aegis, Interlink RAD-Series) 558*03f9172cSAndroid Build Coastguard Worker 559*03f9172cSAndroid Build Coastguard Workerctrl_interface=/var/run/wpa_supplicant 560*03f9172cSAndroid Build Coastguard Workerctrl_interface_group=wheel 561*03f9172cSAndroid Build Coastguard Workernetwork={ 562*03f9172cSAndroid Build Coastguard Worker ssid="example" 563*03f9172cSAndroid Build Coastguard Worker scan_ssid=1 564*03f9172cSAndroid Build Coastguard Worker key_mgmt=WPA-EAP 565*03f9172cSAndroid Build Coastguard Worker eap=PEAP 566*03f9172cSAndroid Build Coastguard Worker identity="[email protected]" 567*03f9172cSAndroid Build Coastguard Worker password="foobar" 568*03f9172cSAndroid Build Coastguard Worker ca_cert="/etc/cert/ca.pem" 569*03f9172cSAndroid Build Coastguard Worker phase1="peaplabel=0" 570*03f9172cSAndroid Build Coastguard Worker phase2="auth=MSCHAPV2" 571*03f9172cSAndroid Build Coastguard Worker} 572*03f9172cSAndroid Build Coastguard Worker 573*03f9172cSAndroid Build Coastguard Worker 574*03f9172cSAndroid Build Coastguard Worker3) EAP-TTLS/EAP-MD5-Challenge configuration with anonymous identity for the 575*03f9172cSAndroid Build Coastguard Worker unencrypted use. Real identity is sent only within an encrypted TLS tunnel. 576*03f9172cSAndroid Build Coastguard Worker 577*03f9172cSAndroid Build Coastguard Workerctrl_interface=/var/run/wpa_supplicant 578*03f9172cSAndroid Build Coastguard Workerctrl_interface_group=wheel 579*03f9172cSAndroid Build Coastguard Workernetwork={ 580*03f9172cSAndroid Build Coastguard Worker ssid="example" 581*03f9172cSAndroid Build Coastguard Worker scan_ssid=1 582*03f9172cSAndroid Build Coastguard Worker key_mgmt=WPA-EAP 583*03f9172cSAndroid Build Coastguard Worker eap=TTLS 584*03f9172cSAndroid Build Coastguard Worker identity="[email protected]" 585*03f9172cSAndroid Build Coastguard Worker anonymous_identity="[email protected]" 586*03f9172cSAndroid Build Coastguard Worker password="foobar" 587*03f9172cSAndroid Build Coastguard Worker ca_cert="/etc/cert/ca.pem" 588*03f9172cSAndroid Build Coastguard Worker phase2="auth=MD5" 589*03f9172cSAndroid Build Coastguard Worker} 590*03f9172cSAndroid Build Coastguard Worker 591*03f9172cSAndroid Build Coastguard Worker 592*03f9172cSAndroid Build Coastguard Worker4) IEEE 802.1X (i.e., no WPA) with dynamic WEP keys (require both unicast and 593*03f9172cSAndroid Build Coastguard Worker broadcast); use EAP-TLS for authentication 594*03f9172cSAndroid Build Coastguard Worker 595*03f9172cSAndroid Build Coastguard Workerctrl_interface=/var/run/wpa_supplicant 596*03f9172cSAndroid Build Coastguard Workerctrl_interface_group=wheel 597*03f9172cSAndroid Build Coastguard Workernetwork={ 598*03f9172cSAndroid Build Coastguard Worker ssid="1x-test" 599*03f9172cSAndroid Build Coastguard Worker scan_ssid=1 600*03f9172cSAndroid Build Coastguard Worker key_mgmt=IEEE8021X 601*03f9172cSAndroid Build Coastguard Worker eap=TLS 602*03f9172cSAndroid Build Coastguard Worker identity="[email protected]" 603*03f9172cSAndroid Build Coastguard Worker ca_cert="/etc/cert/ca.pem" 604*03f9172cSAndroid Build Coastguard Worker client_cert="/etc/cert/user.pem" 605*03f9172cSAndroid Build Coastguard Worker private_key="/etc/cert/user.prv" 606*03f9172cSAndroid Build Coastguard Worker private_key_passwd="password" 607*03f9172cSAndroid Build Coastguard Worker eapol_flags=3 608*03f9172cSAndroid Build Coastguard Worker} 609*03f9172cSAndroid Build Coastguard Worker 610*03f9172cSAndroid Build Coastguard Worker 611*03f9172cSAndroid Build Coastguard Worker5) Catch all example that allows more or less all configuration modes. The 612*03f9172cSAndroid Build Coastguard Worker configuration options are used based on what security policy is used in the 613*03f9172cSAndroid Build Coastguard Worker selected SSID. This is mostly for testing and is not recommended for normal 614*03f9172cSAndroid Build Coastguard Worker use. 615*03f9172cSAndroid Build Coastguard Worker 616*03f9172cSAndroid Build Coastguard Workerctrl_interface=/var/run/wpa_supplicant 617*03f9172cSAndroid Build Coastguard Workerctrl_interface_group=wheel 618*03f9172cSAndroid Build Coastguard Workernetwork={ 619*03f9172cSAndroid Build Coastguard Worker ssid="example" 620*03f9172cSAndroid Build Coastguard Worker scan_ssid=1 621*03f9172cSAndroid Build Coastguard Worker key_mgmt=WPA-EAP WPA-PSK IEEE8021X NONE 622*03f9172cSAndroid Build Coastguard Worker pairwise=CCMP TKIP 623*03f9172cSAndroid Build Coastguard Worker group=CCMP TKIP WEP104 WEP40 624*03f9172cSAndroid Build Coastguard Worker psk="very secret passphrase" 625*03f9172cSAndroid Build Coastguard Worker eap=TTLS PEAP TLS 626*03f9172cSAndroid Build Coastguard Worker identity="[email protected]" 627*03f9172cSAndroid Build Coastguard Worker password="foobar" 628*03f9172cSAndroid Build Coastguard Worker ca_cert="/etc/cert/ca.pem" 629*03f9172cSAndroid Build Coastguard Worker client_cert="/etc/cert/user.pem" 630*03f9172cSAndroid Build Coastguard Worker private_key="/etc/cert/user.prv" 631*03f9172cSAndroid Build Coastguard Worker private_key_passwd="password" 632*03f9172cSAndroid Build Coastguard Worker phase1="peaplabel=0" 633*03f9172cSAndroid Build Coastguard Worker ca_cert2="/etc/cert/ca2.pem" 634*03f9172cSAndroid Build Coastguard Worker client_cert2="/etc/cer/user.pem" 635*03f9172cSAndroid Build Coastguard Worker private_key2="/etc/cer/user.prv" 636*03f9172cSAndroid Build Coastguard Worker private_key2_passwd="password" 637*03f9172cSAndroid Build Coastguard Worker} 638*03f9172cSAndroid Build Coastguard Worker 639*03f9172cSAndroid Build Coastguard Worker 640*03f9172cSAndroid Build Coastguard Worker6) Authentication for wired Ethernet. This can be used with 'wired' or 641*03f9172cSAndroid Build Coastguard Worker 'roboswitch' interface (-Dwired or -Droboswitch on command line). 642*03f9172cSAndroid Build Coastguard Worker 643*03f9172cSAndroid Build Coastguard Workerctrl_interface=/var/run/wpa_supplicant 644*03f9172cSAndroid Build Coastguard Workerctrl_interface_group=wheel 645*03f9172cSAndroid Build Coastguard Workerap_scan=0 646*03f9172cSAndroid Build Coastguard Workernetwork={ 647*03f9172cSAndroid Build Coastguard Worker key_mgmt=IEEE8021X 648*03f9172cSAndroid Build Coastguard Worker eap=MD5 649*03f9172cSAndroid Build Coastguard Worker identity="user" 650*03f9172cSAndroid Build Coastguard Worker password="password" 651*03f9172cSAndroid Build Coastguard Worker eapol_flags=0 652*03f9172cSAndroid Build Coastguard Worker} 653*03f9172cSAndroid Build Coastguard Worker 654*03f9172cSAndroid Build Coastguard Worker 655*03f9172cSAndroid Build Coastguard Worker 656*03f9172cSAndroid Build Coastguard WorkerCertificates 657*03f9172cSAndroid Build Coastguard Worker------------ 658*03f9172cSAndroid Build Coastguard Worker 659*03f9172cSAndroid Build Coastguard WorkerSome EAP authentication methods require use of certificates. EAP-TLS 660*03f9172cSAndroid Build Coastguard Workeruses both server side and client certificates whereas EAP-PEAP and 661*03f9172cSAndroid Build Coastguard WorkerEAP-TTLS only require the server side certificate. When client 662*03f9172cSAndroid Build Coastguard Workercertificate is used, a matching private key file has to also be 663*03f9172cSAndroid Build Coastguard Workerincluded in configuration. If the private key uses a passphrase, this 664*03f9172cSAndroid Build Coastguard Workerhas to be configured in wpa_supplicant.conf ("private_key_passwd"). 665*03f9172cSAndroid Build Coastguard Worker 666*03f9172cSAndroid Build Coastguard Workerwpa_supplicant supports X.509 certificates in PEM and DER 667*03f9172cSAndroid Build Coastguard Workerformats. User certificate and private key can be included in the same 668*03f9172cSAndroid Build Coastguard Workerfile. 669*03f9172cSAndroid Build Coastguard Worker 670*03f9172cSAndroid Build Coastguard WorkerIf the user certificate and private key is received in PKCS#12/PFX 671*03f9172cSAndroid Build Coastguard Workerformat, they need to be converted to suitable PEM/DER format for 672*03f9172cSAndroid Build Coastguard Workerwpa_supplicant. This can be done, e.g., with following commands: 673*03f9172cSAndroid Build Coastguard Worker 674*03f9172cSAndroid Build Coastguard Worker# convert client certificate and private key to PEM format 675*03f9172cSAndroid Build Coastguard Workeropenssl pkcs12 -in example.pfx -out user.pem -clcerts 676*03f9172cSAndroid Build Coastguard Worker# convert CA certificate (if included in PFX file) to PEM format 677*03f9172cSAndroid Build Coastguard Workeropenssl pkcs12 -in example.pfx -out ca.pem -cacerts -nokeys 678*03f9172cSAndroid Build Coastguard Worker 679*03f9172cSAndroid Build Coastguard Worker 680*03f9172cSAndroid Build Coastguard Worker 681*03f9172cSAndroid Build Coastguard Workerwpa_cli 682*03f9172cSAndroid Build Coastguard Worker------- 683*03f9172cSAndroid Build Coastguard Worker 684*03f9172cSAndroid Build Coastguard Workerwpa_cli is a text-based frontend program for interacting with 685*03f9172cSAndroid Build Coastguard Workerwpa_supplicant. It is used to query current status, change 686*03f9172cSAndroid Build Coastguard Workerconfiguration, trigger events, and request interactive user input. 687*03f9172cSAndroid Build Coastguard Worker 688*03f9172cSAndroid Build Coastguard Workerwpa_cli can show the current authentication status, selected security 689*03f9172cSAndroid Build Coastguard Workermode, dot11 and dot1x MIBs, etc. In addition, it can configure some 690*03f9172cSAndroid Build Coastguard Workervariables like EAPOL state machine parameters and trigger events like 691*03f9172cSAndroid Build Coastguard Workerreassociation and IEEE 802.1X logoff/logon. wpa_cli provides a user 692*03f9172cSAndroid Build Coastguard Workerinterface to request authentication information, like username and 693*03f9172cSAndroid Build Coastguard Workerpassword, if these are not included in the configuration. This can be 694*03f9172cSAndroid Build Coastguard Workerused to implement, e.g., one-time-passwords or generic token card 695*03f9172cSAndroid Build Coastguard Workerauthentication where the authentication is based on a 696*03f9172cSAndroid Build Coastguard Workerchallenge-response that uses an external device for generating the 697*03f9172cSAndroid Build Coastguard Workerresponse. 698*03f9172cSAndroid Build Coastguard Worker 699*03f9172cSAndroid Build Coastguard WorkerThe control interface of wpa_supplicant can be configured to allow 700*03f9172cSAndroid Build Coastguard Workernon-root user access (ctrl_interface_group in the configuration 701*03f9172cSAndroid Build Coastguard Workerfile). This makes it possible to run wpa_cli with a normal user 702*03f9172cSAndroid Build Coastguard Workeraccount. 703*03f9172cSAndroid Build Coastguard Worker 704*03f9172cSAndroid Build Coastguard Workerwpa_cli supports two modes: interactive and command line. Both modes 705*03f9172cSAndroid Build Coastguard Workershare the same command set and the main difference is in interactive 706*03f9172cSAndroid Build Coastguard Workermode providing access to unsolicited messages (event messages, 707*03f9172cSAndroid Build Coastguard Workerusername/password requests). 708*03f9172cSAndroid Build Coastguard Worker 709*03f9172cSAndroid Build Coastguard WorkerInteractive mode is started when wpa_cli is executed without including 710*03f9172cSAndroid Build Coastguard Workerthe command as a command line parameter. Commands are then entered on 711*03f9172cSAndroid Build Coastguard Workerthe wpa_cli prompt. In command line mode, the same commands are 712*03f9172cSAndroid Build Coastguard Workerentered as command line arguments for wpa_cli. 713*03f9172cSAndroid Build Coastguard Worker 714*03f9172cSAndroid Build Coastguard Worker 715*03f9172cSAndroid Build Coastguard WorkerInteractive authentication parameters request 716*03f9172cSAndroid Build Coastguard Worker 717*03f9172cSAndroid Build Coastguard WorkerWhen wpa_supplicant need authentication parameters, like username and 718*03f9172cSAndroid Build Coastguard Workerpassword, which are not present in the configuration file, it sends a 719*03f9172cSAndroid Build Coastguard Workerrequest message to all attached frontend programs, e.g., wpa_cli in 720*03f9172cSAndroid Build Coastguard Workerinteractive mode. wpa_cli shows these requests with 721*03f9172cSAndroid Build Coastguard Worker"CTRL-REQ-<type>-<id>:<text>" prefix. <type> is IDENTITY, PASSWORD, or 722*03f9172cSAndroid Build Coastguard WorkerOTP (one-time-password). <id> is a unique identifier for the current 723*03f9172cSAndroid Build Coastguard Workernetwork. <text> is description of the request. In case of OTP request, 724*03f9172cSAndroid Build Coastguard Workerit includes the challenge from the authentication server. 725*03f9172cSAndroid Build Coastguard Worker 726*03f9172cSAndroid Build Coastguard WorkerThe reply to these requests can be given with 'identity', 'password', 727*03f9172cSAndroid Build Coastguard Workerand 'otp' commands. <id> needs to be copied from the the matching 728*03f9172cSAndroid Build Coastguard Workerrequest. 'password' and 'otp' commands can be used regardless of 729*03f9172cSAndroid Build Coastguard Workerwhether the request was for PASSWORD or OTP. The main difference 730*03f9172cSAndroid Build Coastguard Workerbetween these two commands is that values given with 'password' are 731*03f9172cSAndroid Build Coastguard Workerremembered as long as wpa_supplicant is running whereas values given 732*03f9172cSAndroid Build Coastguard Workerwith 'otp' are used only once and then forgotten, i.e., wpa_supplicant 733*03f9172cSAndroid Build Coastguard Workerwill ask frontend for a new value for every use. This can be used to 734*03f9172cSAndroid Build Coastguard Workerimplement one-time-password lists and generic token card -based 735*03f9172cSAndroid Build Coastguard Workerauthentication. 736*03f9172cSAndroid Build Coastguard Worker 737*03f9172cSAndroid Build Coastguard WorkerExample request for password and a matching reply: 738*03f9172cSAndroid Build Coastguard Worker 739*03f9172cSAndroid Build Coastguard WorkerCTRL-REQ-PASSWORD-1:Password needed for SSID foobar 740*03f9172cSAndroid Build Coastguard Worker> password 1 mysecretpassword 741*03f9172cSAndroid Build Coastguard Worker 742*03f9172cSAndroid Build Coastguard WorkerExample request for generic token card challenge-response: 743*03f9172cSAndroid Build Coastguard Worker 744*03f9172cSAndroid Build Coastguard WorkerCTRL-REQ-OTP-2:Challenge 1235663 needed for SSID foobar 745*03f9172cSAndroid Build Coastguard Worker> otp 2 9876 746*03f9172cSAndroid Build Coastguard Worker 747*03f9172cSAndroid Build Coastguard Worker 748*03f9172cSAndroid Build Coastguard Workerwpa_cli commands 749*03f9172cSAndroid Build Coastguard Worker 750*03f9172cSAndroid Build Coastguard Worker status = get current WPA/EAPOL/EAP status 751*03f9172cSAndroid Build Coastguard Worker mib = get MIB variables (dot1x, dot11) 752*03f9172cSAndroid Build Coastguard Worker help = show this usage help 753*03f9172cSAndroid Build Coastguard Worker interface [ifname] = show interfaces/select interface 754*03f9172cSAndroid Build Coastguard Worker level <debug level> = change debug level 755*03f9172cSAndroid Build Coastguard Worker license = show full wpa_cli license 756*03f9172cSAndroid Build Coastguard Worker logoff = IEEE 802.1X EAPOL state machine logoff 757*03f9172cSAndroid Build Coastguard Worker logon = IEEE 802.1X EAPOL state machine logon 758*03f9172cSAndroid Build Coastguard Worker set = set variables (shows list of variables when run without arguments) 759*03f9172cSAndroid Build Coastguard Worker pmksa = show PMKSA cache 760*03f9172cSAndroid Build Coastguard Worker reassociate = force reassociation 761*03f9172cSAndroid Build Coastguard Worker reconfigure = force wpa_supplicant to re-read its configuration file 762*03f9172cSAndroid Build Coastguard Worker preauthenticate <BSSID> = force preauthentication 763*03f9172cSAndroid Build Coastguard Worker identity <network id> <identity> = configure identity for an SSID 764*03f9172cSAndroid Build Coastguard Worker password <network id> <password> = configure password for an SSID 765*03f9172cSAndroid Build Coastguard Worker pin <network id> <pin> = configure pin for an SSID 766*03f9172cSAndroid Build Coastguard Worker otp <network id> <password> = configure one-time-password for an SSID 767*03f9172cSAndroid Build Coastguard Worker passphrase <network id> <passphrase> = configure private key passphrase 768*03f9172cSAndroid Build Coastguard Worker for an SSID 769*03f9172cSAndroid Build Coastguard Worker bssid <network id> <BSSID> = set preferred BSSID for an SSID 770*03f9172cSAndroid Build Coastguard Worker list_networks = list configured networks 771*03f9172cSAndroid Build Coastguard Worker select_network <network id> = select a network (disable others) 772*03f9172cSAndroid Build Coastguard Worker enable_network <network id> = enable a network 773*03f9172cSAndroid Build Coastguard Worker disable_network <network id> = disable a network 774*03f9172cSAndroid Build Coastguard Worker add_network = add a network 775*03f9172cSAndroid Build Coastguard Worker remove_network <network id> = remove a network 776*03f9172cSAndroid Build Coastguard Worker set_network <network id> <variable> <value> = set network variables (shows 777*03f9172cSAndroid Build Coastguard Worker list of variables when run without arguments) 778*03f9172cSAndroid Build Coastguard Worker get_network <network id> <variable> = get network variables 779*03f9172cSAndroid Build Coastguard Worker save_config = save the current configuration 780*03f9172cSAndroid Build Coastguard Worker disconnect = disconnect and wait for reassociate command before connecting 781*03f9172cSAndroid Build Coastguard Worker scan = request new BSS scan 782*03f9172cSAndroid Build Coastguard Worker scan_results = get latest scan results 783*03f9172cSAndroid Build Coastguard Worker get_capability <eap/pairwise/group/key_mgmt/proto/auth_alg> = get capabilities 784*03f9172cSAndroid Build Coastguard Worker terminate = terminate wpa_supplicant 785*03f9172cSAndroid Build Coastguard Worker quit = exit wpa_cli 786*03f9172cSAndroid Build Coastguard Worker 787*03f9172cSAndroid Build Coastguard Worker 788*03f9172cSAndroid Build Coastguard Workerwpa_cli command line options 789*03f9172cSAndroid Build Coastguard Worker 790*03f9172cSAndroid Build Coastguard Workerwpa_cli [-p<path to ctrl sockets>] [-i<ifname>] [-hvB] [-a<action file>] \ 791*03f9172cSAndroid Build Coastguard Worker [-P<pid file>] [-g<global ctrl>] [command..] 792*03f9172cSAndroid Build Coastguard Worker -h = help (show this usage text) 793*03f9172cSAndroid Build Coastguard Worker -v = shown version information 794*03f9172cSAndroid Build Coastguard Worker -a = run in daemon mode executing the action file based on events from 795*03f9172cSAndroid Build Coastguard Worker wpa_supplicant 796*03f9172cSAndroid Build Coastguard Worker -B = run a daemon in the background 797*03f9172cSAndroid Build Coastguard Worker default path: /var/run/wpa_supplicant 798*03f9172cSAndroid Build Coastguard Worker default interface: first interface found in socket path 799*03f9172cSAndroid Build Coastguard Worker 800*03f9172cSAndroid Build Coastguard Worker 801*03f9172cSAndroid Build Coastguard WorkerUsing wpa_cli to run external program on connect/disconnect 802*03f9172cSAndroid Build Coastguard Worker----------------------------------------------------------- 803*03f9172cSAndroid Build Coastguard Worker 804*03f9172cSAndroid Build Coastguard Workerwpa_cli can used to run external programs whenever wpa_supplicant 805*03f9172cSAndroid Build Coastguard Workerconnects or disconnects from a network. This can be used, e.g., to 806*03f9172cSAndroid Build Coastguard Workerupdate network configuration and/or trigget DHCP client to update IP 807*03f9172cSAndroid Build Coastguard Workeraddresses, etc. 808*03f9172cSAndroid Build Coastguard Worker 809*03f9172cSAndroid Build Coastguard WorkerOne wpa_cli process in "action" mode needs to be started for each 810*03f9172cSAndroid Build Coastguard Workerinterface. For example, the following command starts wpa_cli for the 811*03f9172cSAndroid Build Coastguard Workerdefault interface (-i can be used to select the interface in case of 812*03f9172cSAndroid Build Coastguard Workermore than one interface being used at the same time): 813*03f9172cSAndroid Build Coastguard Worker 814*03f9172cSAndroid Build Coastguard Workerwpa_cli -a/sbin/wpa_action.sh -B 815*03f9172cSAndroid Build Coastguard Worker 816*03f9172cSAndroid Build Coastguard WorkerThe action file (-a option, /sbin/wpa_action.sh in this example) will 817*03f9172cSAndroid Build Coastguard Workerbe executed whenever wpa_supplicant completes authentication (connect 818*03f9172cSAndroid Build Coastguard Workerevent) or detects disconnection). The action script will be called 819*03f9172cSAndroid Build Coastguard Workerwith two command line arguments: interface name and event (CONNECTED 820*03f9172cSAndroid Build Coastguard Workeror DISCONNECTED). If the action script needs to get more information 821*03f9172cSAndroid Build Coastguard Workerabout the current network, it can use 'wpa_cli status' to query 822*03f9172cSAndroid Build Coastguard Workerwpa_supplicant for more information. 823*03f9172cSAndroid Build Coastguard Worker 824*03f9172cSAndroid Build Coastguard WorkerFollowing example can be used as a simple template for an action 825*03f9172cSAndroid Build Coastguard Workerscript: 826*03f9172cSAndroid Build Coastguard Worker 827*03f9172cSAndroid Build Coastguard Worker#!/bin/sh 828*03f9172cSAndroid Build Coastguard Worker 829*03f9172cSAndroid Build Coastguard WorkerIFNAME=$1 830*03f9172cSAndroid Build Coastguard WorkerCMD=$2 831*03f9172cSAndroid Build Coastguard Worker 832*03f9172cSAndroid Build Coastguard Workerif [ "$CMD" = "CONNECTED" ]; then 833*03f9172cSAndroid Build Coastguard Worker SSID=`wpa_cli -i$IFNAME status | grep ^ssid= | cut -f2- -d=` 834*03f9172cSAndroid Build Coastguard Worker # configure network, signal DHCP client, etc. 835*03f9172cSAndroid Build Coastguard Workerfi 836*03f9172cSAndroid Build Coastguard Worker 837*03f9172cSAndroid Build Coastguard Workerif [ "$CMD" = "DISCONNECTED" ]; then 838*03f9172cSAndroid Build Coastguard Worker # remove network configuration, if needed 839*03f9172cSAndroid Build Coastguard Worker SSID= 840*03f9172cSAndroid Build Coastguard Workerfi 841*03f9172cSAndroid Build Coastguard Worker 842*03f9172cSAndroid Build Coastguard Worker 843*03f9172cSAndroid Build Coastguard Worker 844*03f9172cSAndroid Build Coastguard WorkerIntegrating with pcmcia-cs/cardmgr scripts 845*03f9172cSAndroid Build Coastguard Worker------------------------------------------ 846*03f9172cSAndroid Build Coastguard Worker 847*03f9172cSAndroid Build Coastguard Workerwpa_supplicant needs to be running when using a wireless network with 848*03f9172cSAndroid Build Coastguard WorkerWPA. It can be started either from system startup scripts or from 849*03f9172cSAndroid Build Coastguard Workerpcmcia-cs/cardmgr scripts (when using PC Cards). WPA handshake must be 850*03f9172cSAndroid Build Coastguard Workercompleted before data frames can be exchanged, so wpa_supplicant 851*03f9172cSAndroid Build Coastguard Workershould be started before DHCP client. 852*03f9172cSAndroid Build Coastguard Worker 853*03f9172cSAndroid Build Coastguard WorkerFor example, following small changes to pcmcia-cs scripts can be used 854*03f9172cSAndroid Build Coastguard Workerto enable WPA support: 855*03f9172cSAndroid Build Coastguard Worker 856*03f9172cSAndroid Build Coastguard WorkerAdd MODE="Managed" and WPA="y" to the network scheme in 857*03f9172cSAndroid Build Coastguard Worker/etc/pcmcia/wireless.opts. 858*03f9172cSAndroid Build Coastguard Worker 859*03f9172cSAndroid Build Coastguard WorkerAdd the following block to the end of 'start' action handler in 860*03f9172cSAndroid Build Coastguard Worker/etc/pcmcia/wireless: 861*03f9172cSAndroid Build Coastguard Worker 862*03f9172cSAndroid Build Coastguard Worker if [ "$WPA" = "y" -a -x /usr/local/bin/wpa_supplicant ]; then 863*03f9172cSAndroid Build Coastguard Worker /usr/local/bin/wpa_supplicant -B -c/etc/wpa_supplicant.conf \ 864*03f9172cSAndroid Build Coastguard Worker -i$DEVICE 865*03f9172cSAndroid Build Coastguard Worker fi 866*03f9172cSAndroid Build Coastguard Worker 867*03f9172cSAndroid Build Coastguard WorkerAdd the following block to the end of 'stop' action handler (may need 868*03f9172cSAndroid Build Coastguard Workerto be separated from other actions) in /etc/pcmcia/wireless: 869*03f9172cSAndroid Build Coastguard Worker 870*03f9172cSAndroid Build Coastguard Worker if [ "$WPA" = "y" -a -x /usr/local/bin/wpa_supplicant ]; then 871*03f9172cSAndroid Build Coastguard Worker killall wpa_supplicant 872*03f9172cSAndroid Build Coastguard Worker fi 873*03f9172cSAndroid Build Coastguard Worker 874*03f9172cSAndroid Build Coastguard WorkerThis will make cardmgr start wpa_supplicant when the card is plugged 875*03f9172cSAndroid Build Coastguard Workerin. 876*03f9172cSAndroid Build Coastguard Worker 877*03f9172cSAndroid Build Coastguard Worker 878*03f9172cSAndroid Build Coastguard Worker 879*03f9172cSAndroid Build Coastguard WorkerDynamic interface add and operation without configuration files 880*03f9172cSAndroid Build Coastguard Worker--------------------------------------------------------------- 881*03f9172cSAndroid Build Coastguard Worker 882*03f9172cSAndroid Build Coastguard Workerwpa_supplicant can be started without any configuration files or 883*03f9172cSAndroid Build Coastguard Workernetwork interfaces. When used in this way, a global (i.e., per 884*03f9172cSAndroid Build Coastguard Workerwpa_supplicant process) control interface is used to add and remove 885*03f9172cSAndroid Build Coastguard Workernetwork interfaces. Each network interface can then be configured 886*03f9172cSAndroid Build Coastguard Workerthrough a per-network interface control interface. For example, 887*03f9172cSAndroid Build Coastguard Workerfollowing commands show how to start wpa_supplicant without any 888*03f9172cSAndroid Build Coastguard Workernetwork interfaces and then add a network interface and configure a 889*03f9172cSAndroid Build Coastguard Workernetwork (SSID): 890*03f9172cSAndroid Build Coastguard Worker 891*03f9172cSAndroid Build Coastguard Worker# Start wpa_supplicant in the background 892*03f9172cSAndroid Build Coastguard Workerwpa_supplicant -g/var/run/wpa_supplicant-global -B 893*03f9172cSAndroid Build Coastguard Worker 894*03f9172cSAndroid Build Coastguard Worker# Add a new interface (wlan0, no configuration file, driver=nl80211, and 895*03f9172cSAndroid Build Coastguard Worker# enable control interface) 896*03f9172cSAndroid Build Coastguard Workerwpa_cli -g/var/run/wpa_supplicant-global interface_add wlan0 \ 897*03f9172cSAndroid Build Coastguard Worker "" nl80211 /var/run/wpa_supplicant 898*03f9172cSAndroid Build Coastguard Worker 899*03f9172cSAndroid Build Coastguard Worker# Configure a network using the newly added network interface: 900*03f9172cSAndroid Build Coastguard Workerwpa_cli -iwlan0 add_network 901*03f9172cSAndroid Build Coastguard Workerwpa_cli -iwlan0 set_network 0 ssid '"test"' 902*03f9172cSAndroid Build Coastguard Workerwpa_cli -iwlan0 set_network 0 key_mgmt WPA-PSK 903*03f9172cSAndroid Build Coastguard Workerwpa_cli -iwlan0 set_network 0 psk '"12345678"' 904*03f9172cSAndroid Build Coastguard Workerwpa_cli -iwlan0 set_network 0 pairwise TKIP 905*03f9172cSAndroid Build Coastguard Workerwpa_cli -iwlan0 set_network 0 group TKIP 906*03f9172cSAndroid Build Coastguard Workerwpa_cli -iwlan0 set_network 0 proto WPA 907*03f9172cSAndroid Build Coastguard Workerwpa_cli -iwlan0 enable_network 0 908*03f9172cSAndroid Build Coastguard Worker 909*03f9172cSAndroid Build Coastguard Worker# At this point, the new network interface should start trying to associate 910*03f9172cSAndroid Build Coastguard Worker# with the WPA-PSK network using SSID test. 911*03f9172cSAndroid Build Coastguard Worker 912*03f9172cSAndroid Build Coastguard Worker# Remove network interface 913*03f9172cSAndroid Build Coastguard Workerwpa_cli -g/var/run/wpa_supplicant-global interface_remove wlan0 914*03f9172cSAndroid Build Coastguard Worker 915*03f9172cSAndroid Build Coastguard Worker 916*03f9172cSAndroid Build Coastguard WorkerPrivilege separation 917*03f9172cSAndroid Build Coastguard Worker-------------------- 918*03f9172cSAndroid Build Coastguard Worker 919*03f9172cSAndroid Build Coastguard WorkerTo minimize the size of code that needs to be run with root privileges 920*03f9172cSAndroid Build Coastguard Worker(e.g., to control wireless interface operation), wpa_supplicant 921*03f9172cSAndroid Build Coastguard Workersupports optional privilege separation. If enabled, this separates the 922*03f9172cSAndroid Build Coastguard Workerprivileged operations into a separate process (wpa_priv) while leaving 923*03f9172cSAndroid Build Coastguard Workerrest of the code (e.g., EAP authentication and WPA handshakes) into an 924*03f9172cSAndroid Build Coastguard Workerunprivileged process (wpa_supplicant) that can be run as non-root 925*03f9172cSAndroid Build Coastguard Workeruser. Privilege separation restricts the effects of potential software 926*03f9172cSAndroid Build Coastguard Workererrors by containing the majority of the code in an unprivileged 927*03f9172cSAndroid Build Coastguard Workerprocess to avoid full system compromise. 928*03f9172cSAndroid Build Coastguard Worker 929*03f9172cSAndroid Build Coastguard WorkerPrivilege separation is not enabled by default and it can be enabled 930*03f9172cSAndroid Build Coastguard Workerby adding CONFIG_PRIVSEP=y to the build configuration (.config). When 931*03f9172cSAndroid Build Coastguard Workerenabled, the privileged operations (driver wrapper and l2_packet) are 932*03f9172cSAndroid Build Coastguard Workerlinked into a separate daemon program, wpa_priv. The unprivileged 933*03f9172cSAndroid Build Coastguard Workerprogram, wpa_supplicant, will be built with a special driver/l2_packet 934*03f9172cSAndroid Build Coastguard Workerwrappers that communicate with the privileged wpa_priv process to 935*03f9172cSAndroid Build Coastguard Workerperform the needed operations. wpa_priv can control what privileged 936*03f9172cSAndroid Build Coastguard Workerare allowed. 937*03f9172cSAndroid Build Coastguard Worker 938*03f9172cSAndroid Build Coastguard Workerwpa_priv needs to be run with network admin privileges (usually, root 939*03f9172cSAndroid Build Coastguard Workeruser). It opens a UNIX domain socket for each interface that is 940*03f9172cSAndroid Build Coastguard Workerincluded on the command line; any other interface will be off limits 941*03f9172cSAndroid Build Coastguard Workerfor wpa_supplicant in this kind of configuration. After this, 942*03f9172cSAndroid Build Coastguard Workerwpa_supplicant can be run as a non-root user (e.g., all standard users 943*03f9172cSAndroid Build Coastguard Workeron a laptop or as a special non-privileged user account created just 944*03f9172cSAndroid Build Coastguard Workerfor this purpose to limit access to user files even further). 945*03f9172cSAndroid Build Coastguard Worker 946*03f9172cSAndroid Build Coastguard Worker 947*03f9172cSAndroid Build Coastguard WorkerExample configuration: 948*03f9172cSAndroid Build Coastguard Worker- create user group for users that are allowed to use wpa_supplicant 949*03f9172cSAndroid Build Coastguard Worker ('wpapriv' in this example) and assign users that should be able to 950*03f9172cSAndroid Build Coastguard Worker use wpa_supplicant into that group 951*03f9172cSAndroid Build Coastguard Worker- create /var/run/wpa_priv directory for UNIX domain sockets and control 952*03f9172cSAndroid Build Coastguard Worker user access by setting it accessible only for the wpapriv group: 953*03f9172cSAndroid Build Coastguard Worker mkdir /var/run/wpa_priv 954*03f9172cSAndroid Build Coastguard Worker chown root:wpapriv /var/run/wpa_priv 955*03f9172cSAndroid Build Coastguard Worker chmod 0750 /var/run/wpa_priv 956*03f9172cSAndroid Build Coastguard Worker- start wpa_priv as root (e.g., from system startup scripts) with the 957*03f9172cSAndroid Build Coastguard Worker enabled interfaces configured on the command line: 958*03f9172cSAndroid Build Coastguard Worker wpa_priv -B -P /var/run/wpa_priv.pid nl80211:wlan0 959*03f9172cSAndroid Build Coastguard Worker- run wpa_supplicant as non-root with a user that is in wpapriv group: 960*03f9172cSAndroid Build Coastguard Worker wpa_supplicant -i ath0 -c wpa_supplicant.conf 961*03f9172cSAndroid Build Coastguard Worker 962*03f9172cSAndroid Build Coastguard Workerwpa_priv does not use the network interface before wpa_supplicant is 963*03f9172cSAndroid Build Coastguard Workerstarted, so it is fine to include network interfaces that are not 964*03f9172cSAndroid Build Coastguard Workeravailable at the time wpa_priv is started. As an alternative, wpa_priv 965*03f9172cSAndroid Build Coastguard Workercan be started when an interface is added (hotplug/udev/etc. scripts). 966*03f9172cSAndroid Build Coastguard Workerwpa_priv can control multiple interface with one process, but it is 967*03f9172cSAndroid Build Coastguard Workeralso possible to run multiple wpa_priv processes at the same time, if 968*03f9172cSAndroid Build Coastguard Workerdesired. 969*03f9172cSAndroid Build Coastguard Worker 970*03f9172cSAndroid Build Coastguard WorkerIt should be noted that the interface used between wpa_supplicant and 971*03f9172cSAndroid Build Coastguard Workerwpa_priv does not include all the capabilities of the wpa_supplicant 972*03f9172cSAndroid Build Coastguard Workerdriver interface and at times, this interface lacks update especially 973*03f9172cSAndroid Build Coastguard Workerfor recent addition. Consequently, use of wpa_priv does come with the 974*03f9172cSAndroid Build Coastguard Workerprice of somewhat reduced available functionality. The next section 975*03f9172cSAndroid Build Coastguard Workerdescribing how wpa_supplicant can be used with reduced privileges 976*03f9172cSAndroid Build Coastguard Workerwithout having to handle the complexity of separate wpa_priv. While that 977*03f9172cSAndroid Build Coastguard Workerapprove does not provide separation for network admin capabilities, it 978*03f9172cSAndroid Build Coastguard Workerdoes allow other root privileges to be dropped without the drawbacks of 979*03f9172cSAndroid Build Coastguard Workerthe wpa_priv process. 980*03f9172cSAndroid Build Coastguard Worker 981*03f9172cSAndroid Build Coastguard Worker 982*03f9172cSAndroid Build Coastguard WorkerLinux capabilities instead of privileged process 983*03f9172cSAndroid Build Coastguard Worker------------------------------------------------ 984*03f9172cSAndroid Build Coastguard Worker 985*03f9172cSAndroid Build Coastguard Workerwpa_supplicant performs operations that need special permissions, e.g., 986*03f9172cSAndroid Build Coastguard Workerto control the network connection. Traditionally this has been achieved 987*03f9172cSAndroid Build Coastguard Workerby running wpa_supplicant as a privileged process with effective user id 988*03f9172cSAndroid Build Coastguard Worker0 (root). Linux capabilities can be used to provide restricted set of 989*03f9172cSAndroid Build Coastguard Workercapabilities to match the functions needed by wpa_supplicant. The 990*03f9172cSAndroid Build Coastguard Workerminimum set of capabilities needed for the operations is CAP_NET_ADMIN 991*03f9172cSAndroid Build Coastguard Workerand CAP_NET_RAW. 992*03f9172cSAndroid Build Coastguard Worker 993*03f9172cSAndroid Build Coastguard Workersetcap(8) can be used to set file capabilities. For example: 994*03f9172cSAndroid Build Coastguard Worker 995*03f9172cSAndroid Build Coastguard Workersudo setcap cap_net_raw,cap_net_admin+ep wpa_supplicant 996*03f9172cSAndroid Build Coastguard Worker 997*03f9172cSAndroid Build Coastguard WorkerPlease note that this would give anyone being able to run that 998*03f9172cSAndroid Build Coastguard Workerwpa_supplicant binary access to the additional capabilities. This can 999*03f9172cSAndroid Build Coastguard Workerfurther be limited by file owner/group and mode bits. For example: 1000*03f9172cSAndroid Build Coastguard Worker 1001*03f9172cSAndroid Build Coastguard Workersudo chown wpas wpa_supplicant 1002*03f9172cSAndroid Build Coastguard Workersudo chmod 0100 wpa_supplicant 1003*03f9172cSAndroid Build Coastguard Worker 1004*03f9172cSAndroid Build Coastguard WorkerThis combination of setcap, chown, and chmod commands would allow wpas 1005*03f9172cSAndroid Build Coastguard Workeruser to execute wpa_supplicant with additional network admin/raw 1006*03f9172cSAndroid Build Coastguard Workercapabilities. 1007*03f9172cSAndroid Build Coastguard Worker 1008*03f9172cSAndroid Build Coastguard WorkerCommon way style of creating a control interface socket in 1009*03f9172cSAndroid Build Coastguard Worker/var/run/wpa_supplicant could not be done by this user, but this 1010*03f9172cSAndroid Build Coastguard Workerdirectory could be created before starting the wpa_supplicant and set to 1011*03f9172cSAndroid Build Coastguard Workersuitable mode to allow wpa_supplicant to create sockets 1012*03f9172cSAndroid Build Coastguard Workerthere. Alternatively, other directory or abstract socket namespace could 1013*03f9172cSAndroid Build Coastguard Workerbe used for the control interface. 1014*03f9172cSAndroid Build Coastguard Worker 1015*03f9172cSAndroid Build Coastguard Worker 1016*03f9172cSAndroid Build Coastguard WorkerExternal requests for radio control 1017*03f9172cSAndroid Build Coastguard Worker----------------------------------- 1018*03f9172cSAndroid Build Coastguard Worker 1019*03f9172cSAndroid Build Coastguard WorkerExternal programs can request wpa_supplicant to not start offchannel 1020*03f9172cSAndroid Build Coastguard Workeroperations during other tasks that may need exclusive control of the 1021*03f9172cSAndroid Build Coastguard Workerradio. The RADIO_WORK control interface command can be used for this. 1022*03f9172cSAndroid Build Coastguard Worker 1023*03f9172cSAndroid Build Coastguard Worker"RADIO_WORK add <name> [freq=<MHz>] [timeout=<seconds>]" command can be 1024*03f9172cSAndroid Build Coastguard Workerused to reserve a slot for radio access. If freq is specified, other 1025*03f9172cSAndroid Build Coastguard Workerradio work items on the same channel may be completed in 1026*03f9172cSAndroid Build Coastguard Workerparallel. Otherwise, all other radio work items are blocked during 1027*03f9172cSAndroid Build Coastguard Workerexecution. Timeout is set to 10 seconds by default to avoid blocking 1028*03f9172cSAndroid Build Coastguard Workerwpa_supplicant operations for excessive time. If a longer (or shorter) 1029*03f9172cSAndroid Build Coastguard Workersafety timeout is needed, that can be specified with the optional 1030*03f9172cSAndroid Build Coastguard Workertimeout parameter. This command returns an identifier for the radio work 1031*03f9172cSAndroid Build Coastguard Workeritem. 1032*03f9172cSAndroid Build Coastguard Worker 1033*03f9172cSAndroid Build Coastguard WorkerOnce the radio work item has been started, "EXT-RADIO-WORK-START <id>" 1034*03f9172cSAndroid Build Coastguard Workerevent message is indicated that the external processing can start. Once 1035*03f9172cSAndroid Build Coastguard Workerthe operation has been completed, "RADIO_WORK done <id>" is used to 1036*03f9172cSAndroid Build Coastguard Workerindicate that to wpa_supplicant. This allows other radio works to be 1037*03f9172cSAndroid Build Coastguard Workerperformed. If this command is forgotten (e.g., due to the external 1038*03f9172cSAndroid Build Coastguard Workerprogram terminating), wpa_supplicant will time out the radio work item 1039*03f9172cSAndroid Build Coastguard Workerand send "EXT-RADIO-WORK-TIMEOUT <id>" event to indicate that this has 1040*03f9172cSAndroid Build Coastguard Workerhappened. "RADIO_WORK done <id>" can also be used to cancel items that 1041*03f9172cSAndroid Build Coastguard Workerhave not yet been started. 1042*03f9172cSAndroid Build Coastguard Worker 1043*03f9172cSAndroid Build Coastguard WorkerFor example, in wpa_cli interactive mode: 1044*03f9172cSAndroid Build Coastguard Worker 1045*03f9172cSAndroid Build Coastguard Worker> radio_work add test 1046*03f9172cSAndroid Build Coastguard Worker1 1047*03f9172cSAndroid Build Coastguard Worker<3>EXT-RADIO-WORK-START 1 1048*03f9172cSAndroid Build Coastguard Worker> radio_work show 1049*03f9172cSAndroid Build Coastguard Workerext:test@wlan0:0:1:2.487797 1050*03f9172cSAndroid Build Coastguard Worker> radio_work done 1 1051*03f9172cSAndroid Build Coastguard WorkerOK 1052*03f9172cSAndroid Build Coastguard Worker> radio_work show 1053*03f9172cSAndroid Build Coastguard Worker 1054*03f9172cSAndroid Build Coastguard Worker 1055*03f9172cSAndroid Build Coastguard Worker> radio_work done 3 1056*03f9172cSAndroid Build Coastguard WorkerOK 1057*03f9172cSAndroid Build Coastguard Worker> radio_work show 1058*03f9172cSAndroid Build Coastguard Workerext:test freq=2412 timeout=30@wlan0:2412:1:28.583483 1059*03f9172cSAndroid Build Coastguard Worker<3>EXT-RADIO-WORK-TIMEOUT 2 1060*03f9172cSAndroid Build Coastguard Worker 1061*03f9172cSAndroid Build Coastguard Worker 1062*03f9172cSAndroid Build Coastguard Worker> radio_work add test2 freq=2412 timeout=60 1063*03f9172cSAndroid Build Coastguard Worker5 1064*03f9172cSAndroid Build Coastguard Worker<3>EXT-RADIO-WORK-START 5 1065*03f9172cSAndroid Build Coastguard Worker> radio_work add test3 1066*03f9172cSAndroid Build Coastguard Worker6 1067*03f9172cSAndroid Build Coastguard Worker> radio_work add test4 1068*03f9172cSAndroid Build Coastguard Worker7 1069*03f9172cSAndroid Build Coastguard Worker> radio_work show 1070*03f9172cSAndroid Build Coastguard Workerext:test2 freq=2412 timeout=60@wlan0:2412:1:9.751844 1071*03f9172cSAndroid Build Coastguard Workerext:test3@wlan0:0:0:5.071812 1072*03f9172cSAndroid Build Coastguard Workerext:test4@wlan0:0:0:3.143870 1073*03f9172cSAndroid Build Coastguard Worker> radio_work done 6 1074*03f9172cSAndroid Build Coastguard WorkerOK 1075*03f9172cSAndroid Build Coastguard Worker> radio_work show 1076*03f9172cSAndroid Build Coastguard Workerext:test2 freq=2412 timeout=60@wlan0:2412:1:16.287869 1077*03f9172cSAndroid Build Coastguard Workerext:test4@wlan0:0:0:9.679895 1078*03f9172cSAndroid Build Coastguard Worker> radio_work done 5 1079*03f9172cSAndroid Build Coastguard WorkerOK 1080*03f9172cSAndroid Build Coastguard Worker<3>EXT-RADIO-WORK-START 7 1081*03f9172cSAndroid Build Coastguard Worker<3>EXT-RADIO-WORK-TIMEOUT 7 1082*03f9172cSAndroid Build Coastguard Worker 1083*03f9172cSAndroid Build Coastguard Worker 1084*03f9172cSAndroid Build Coastguard WorkerDSCP policy procedures 1085*03f9172cSAndroid Build Coastguard Worker---------------------- 1086*03f9172cSAndroid Build Coastguard Worker 1087*03f9172cSAndroid Build Coastguard WorkerDSCP policy procedures defined in WFA QoS Management-R2 program 1088*03f9172cSAndroid Build Coastguard Workerfacilitates AP devices to configure DSCP settings for specific uplink 1089*03f9172cSAndroid Build Coastguard Workerdata streams. 1090*03f9172cSAndroid Build Coastguard Worker 1091*03f9172cSAndroid Build Coastguard WorkerAn AP may transmit a DSCP Policy Request frame containing zero or more 1092*03f9172cSAndroid Build Coastguard WorkerQoS Management IEs to an associated STA which supports DSCP policy 1093*03f9172cSAndroid Build Coastguard Workerprocedures. Each QoS Management element in a DSCP Policy Request frame 1094*03f9172cSAndroid Build Coastguard Workerrepresents one DSCP policy, and shall include one DSCP Policy attribute 1095*03f9172cSAndroid Build Coastguard Workerincluding a DSCP Policy ID, Request type, and a DSCP value. 1096*03f9172cSAndroid Build Coastguard Worker 1097*03f9172cSAndroid Build Coastguard Workerwpa_supplicant sends control interface event messages consisting details 1098*03f9172cSAndroid Build Coastguard Workerof DSCP policies requested by the AP through a DSCP Policy Request frame 1099*03f9172cSAndroid Build Coastguard Workerto external programs. The format of the control interface event messages 1100*03f9172cSAndroid Build Coastguard Workeris as shown below: 1101*03f9172cSAndroid Build Coastguard Worker 1102*03f9172cSAndroid Build Coastguard Worker- Control interface event message format to indicate DSCP request start 1103*03f9172cSAndroid Build Coastguard Worker 1104*03f9172cSAndroid Build Coastguard Worker <3>CTRL-EVENT-DSCP-POLICY request_start [clear_all] [more] 1105*03f9172cSAndroid Build Coastguard Worker 1106*03f9172cSAndroid Build Coastguard Worker clear_all - AP requested to clear all DSCP policies configured earlier 1107*03f9172cSAndroid Build Coastguard Worker more - AP may request to configure more DSCP policies with new DSCP 1108*03f9172cSAndroid Build Coastguard Worker request 1109*03f9172cSAndroid Build Coastguard Worker 1110*03f9172cSAndroid Build Coastguard Worker- Control interface event message format to add new policy 1111*03f9172cSAndroid Build Coastguard Worker 1112*03f9172cSAndroid Build Coastguard Worker <3>CTRL-EVENT-DSCP-POLICY add <policy_id> <dscp_value> <ip_version=0|4|6> 1113*03f9172cSAndroid Build Coastguard Worker [protocol] [source ip] [destination_ip]/[domain name] [source port] 1114*03f9172cSAndroid Build Coastguard Worker [[<start_port> <end_port>]/destination port] 1115*03f9172cSAndroid Build Coastguard Worker 1116*03f9172cSAndroid Build Coastguard Worker ip_version = 0: Both IPv4 and IPv6 1117*03f9172cSAndroid Build Coastguard Worker = 4: IPv4 1118*03f9172cSAndroid Build Coastguard Worker = 6: IPv6 1119*03f9172cSAndroid Build Coastguard Worker protocol: Internet Protocol Numbers as per IETF RFCs 1120*03f9172cSAndroid Build Coastguard Worker = 6: TCP 1121*03f9172cSAndroid Build Coastguard Worker = 17: UDP 1122*03f9172cSAndroid Build Coastguard Worker = 50: ESP 1123*03f9172cSAndroid Build Coastguard Worker 1124*03f9172cSAndroid Build Coastguard Worker- Control interface event message format to remove a particular policy, 1125*03f9172cSAndroid Build Coastguard Worker identified by the policy_id attribute. 1126*03f9172cSAndroid Build Coastguard Worker 1127*03f9172cSAndroid Build Coastguard Worker <3>CTRL-EVENT-DSCP-POLICY remove <policy_id> 1128*03f9172cSAndroid Build Coastguard Worker 1129*03f9172cSAndroid Build Coastguard Worker- DSCP policy may get rejected due to invalid policy parameters. Ccontrol 1130*03f9172cSAndroid Build Coastguard Worker interface event message format for rejected policy. 1131*03f9172cSAndroid Build Coastguard Worker 1132*03f9172cSAndroid Build Coastguard Worker <3>CTRL-EVENT-DSCP-POLICY reject <policy_id> 1133*03f9172cSAndroid Build Coastguard Worker 1134*03f9172cSAndroid Build Coastguard Worker- Control interface event message format to indicate end of DSCP request. 1135*03f9172cSAndroid Build Coastguard Worker 1136*03f9172cSAndroid Build Coastguard Worker <3>CTRL-EVENT-DSCP-POLICY request_end 1137*03f9172cSAndroid Build Coastguard Worker 1138*03f9172cSAndroid Build Coastguard Worker- External applications shall clear active DSCP policies upon receiving 1139*03f9172cSAndroid Build Coastguard Worker "CTRL-EVENT-DISCONNECTED" or "CTRL-EVENT-DSCP-POLICY clear_all" events. 1140*03f9172cSAndroid Build Coastguard Worker 1141*03f9172cSAndroid Build Coastguard Worker- Control interface event message format to indicate wpa_supplicant started 1142*03f9172cSAndroid Build Coastguard Worker a timer to wait until the unsolicited DSCP request from the AP. 1143*03f9172cSAndroid Build Coastguard Worker 1144*03f9172cSAndroid Build Coastguard Worker <3>CTRL-EVENT-DSCP-POLICY request_wait start 1145*03f9172cSAndroid Build Coastguard Worker 1146*03f9172cSAndroid Build Coastguard Worker- Control interface event message format to indicate timeout to receive the 1147*03f9172cSAndroid Build Coastguard Worker unsolicited DSCP request. This event is expected only when an unsolicited 1148*03f9172cSAndroid Build Coastguard Worker DSCP request is not received from the AP before timeout. 1149*03f9172cSAndroid Build Coastguard Worker 1150*03f9172cSAndroid Build Coastguard Worker <3>CTRL-EVENT-DSCP-POLICY request_wait end 1151*03f9172cSAndroid Build Coastguard Worker 1152*03f9172cSAndroid Build Coastguard WorkerDSCP Response: 1153*03f9172cSAndroid Build Coastguard WorkerA QoS Management STA that enables DSCP Policy capability shall respond 1154*03f9172cSAndroid Build Coastguard Workerwith DSCP response on receipt of a successful DSCP request from its 1155*03f9172cSAndroid Build Coastguard Workerassociated AP. wpa_supplicant sends DSCP policy response based on the 1156*03f9172cSAndroid Build Coastguard Workercontrol interface command received from the user is as below: 1157*03f9172cSAndroid Build Coastguard Worker 1158*03f9172cSAndroid Build Coastguard WorkerDSCP_RESP <[reset]>/<[solicited] [policy_id=1 status=0...]> [more] 1159*03f9172cSAndroid Build Coastguard Worker 1160*03f9172cSAndroid Build Coastguard WorkerDSCP Query: 1161*03f9172cSAndroid Build Coastguard WorkerDSCP Policy Query enables a STA to query its associated AP for DSCP 1162*03f9172cSAndroid Build Coastguard Workerpolicies applicable to the STA. Currently, this includes support to send 1163*03f9172cSAndroid Build Coastguard Workera wildcard DSCP query or a DSCP query with a single domain name 1164*03f9172cSAndroid Build Coastguard Workerattribute. The command format for the DSCP query command is as follows: 1165*03f9172cSAndroid Build Coastguard WorkerDSCP_QUERY <wildcard>/<domain_name=<string>> 1166