Home | History | Annotate | only in /external/wpa_supplicant_8/wpa_supplicant
Up to higher level directory
NameDateSize
.gitignore08-Oct-201510
android.config08-Oct-201517.3K
Android.mk08-Oct-201533.6K
ap.c08-Oct-201535K
ap.h08-Oct-20154K
autoscan.c08-Oct-20153K
autoscan.h08-Oct-20151.1K
autoscan_exponential.c08-Oct-20152K
autoscan_periodic.c08-Oct-20151.6K
bgscan.c08-Oct-20152.7K
bgscan.h08-Oct-20151.8K
bgscan_learn.c08-Oct-201514.5K
bgscan_simple.c08-Oct-20158.2K
blacklist.c08-Oct-20153.4K
blacklist.h08-Oct-2015660
bss.c08-Oct-201532.3K
bss.h08-Oct-20154.9K
ChangeLog08-Oct-2015109.4K
config.c08-Oct-2015102.3K
config.h08-Oct-201539.6K
config_file.c08-Oct-201535.1K
config_none.c08-Oct-20151.3K
config_ssid.h08-Oct-201519.2K
config_winreg.c08-Oct-201524K
ctrl_iface.c08-Oct-2015218.1K
ctrl_iface.h08-Oct-20155.3K
ctrl_iface_named_pipe.c08-Oct-201519.7K
ctrl_iface_udp.c08-Oct-201517.6K
ctrl_iface_unix.c08-Oct-201528.4K
dbus/08-Oct-2015
defconfig08-Oct-201517.9K
doc/08-Oct-2015
driver_i.h08-Oct-201523.3K
eap_proxy_dummy.mak08-Oct-20150
eap_proxy_dummy.mk08-Oct-20150
eap_register.c08-Oct-20155.1K
eap_testing.txt08-Oct-201514.4K
eapol_test.c08-Oct-201537.1K
events.c08-Oct-2015102.6K
examples/08-Oct-2015
gas_query.c08-Oct-201519.1K
gas_query.h08-Oct-20151.4K
hs20_supplicant.c08-Oct-201524.3K
hs20_supplicant.h08-Oct-20151.7K
ibss_rsn.c08-Oct-201522.6K
ibss_rsn.h08-Oct-20151.7K
interworking.c08-Oct-201577.2K
interworking.h08-Oct-20151.3K
main.c08-Oct-20158.4K
main_none.c08-Oct-2015844
main_winmain.c08-Oct-20151.7K
main_winsvc.c08-Oct-201511.2K
Makefile08-Oct-201538.3K
mesh.c08-Oct-201513.9K
mesh.h08-Oct-20151.2K
mesh_mpm.c08-Oct-201526.8K
mesh_mpm.h08-Oct-20151.3K
mesh_rsn.c08-Oct-201514.1K
mesh_rsn.h08-Oct-20151.2K
nfc_pw_token.c08-Oct-20151.7K
nmake.mak08-Oct-20156.6K
notify.c08-Oct-201518.1K
notify.h08-Oct-20156.1K
offchannel.c08-Oct-201514.5K
offchannel.h08-Oct-20151.4K
p2p_supplicant.c08-Oct-2015229.3K
p2p_supplicant.h08-Oct-201511.8K
p2p_supplicant_sd.c08-Oct-201530.8K
preauth_test.c08-Oct-20158.4K
README08-Oct-201538.1K
README-HS2008-Oct-201519.1K
README-P2P08-Oct-201532.4K
README-Windows.txt08-Oct-201512.1K
README-WPS08-Oct-201515.9K
scan.c08-Oct-201564.3K
scan.h08-Oct-20152.5K
sme.c08-Oct-201546.1K
sme.h08-Oct-20153.1K
src/08-Oct-2015
systemd/08-Oct-2015
tests/08-Oct-2015
todo.txt08-Oct-20154.4K
utils/08-Oct-2015
wifi_display.c08-Oct-201510K
wifi_display.h08-Oct-2015904
win_if_list.c08-Oct-20153.7K
wmm_ac.c08-Oct-201523.8K
wmm_ac.h08-Oct-20154.8K
wnm_sta.c08-Oct-201530.2K
wnm_sta.h08-Oct-20152K
wpa_cli.c08-Oct-2015108.5K
wpa_gui-qt4/08-Oct-2015
wpa_passphrase.c08-Oct-20151.3K
wpa_priv.c08-Oct-201523.4K
wpa_supplicant.c08-Oct-2015155.4K
wpa_supplicant.conf08-Oct-201559.4K
wpa_supplicant_conf.mk08-Oct-20151.3K
wpa_supplicant_conf.sh08-Oct-2015458
wpa_supplicant_i.h08-Oct-201534K
wpa_supplicant_template.conf08-Oct-2015117
wpas_glue.c08-Oct-201529.5K
wpas_glue.h08-Oct-2015888
wpas_kay.c08-Oct-20158.8K
wpas_kay.h08-Oct-2015922
wpas_module_tests.c08-Oct-20152.6K
wps_supplicant.c08-Oct-201576.4K
wps_supplicant.h08-Oct-20154.8K

README

      1 WPA Supplicant
      2 ==============
      3 
      4 Copyright (c) 2003-2015, Jouni Malinen <j (a] w1.fi> and contributors
      5 All Rights Reserved.
      6 
      7 This program is licensed under the BSD license (the one with
      8 advertisement clause removed).
      9 
     10 If you are submitting changes to the project, please see CONTRIBUTIONS
     11 file for more instructions.
     12 
     13 
     14 
     15 License
     16 -------
     17 
     18 This software may be distributed, used, and modified under the terms of
     19 BSD license:
     20 
     21 Redistribution and use in source and binary forms, with or without
     22 modification, are permitted provided that the following conditions are
     23 met:
     24 
     25 1. Redistributions of source code must retain the above copyright
     26    notice, this list of conditions and the following disclaimer.
     27 
     28 2. Redistributions in binary form must reproduce the above copyright
     29    notice, this list of conditions and the following disclaimer in the
     30    documentation and/or other materials provided with the distribution.
     31 
     32 3. Neither the name(s) of the above-listed copyright holder(s) nor the
     33    names of its contributors may be used to endorse or promote products
     34    derived from this software without specific prior written permission.
     35 
     36 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     37 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     38 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     39 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     40 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     41 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     42 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     43 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     44 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     45 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     46 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     47 
     48 
     49 
     50 Features
     51 --------
     52 
     53 Supported WPA/IEEE 802.11i features:
     54 - WPA-PSK ("WPA-Personal")
     55 - WPA with EAP (e.g., with RADIUS authentication server) ("WPA-Enterprise")
     56   Following authentication methods are supported with an integrate IEEE 802.1X
     57   Supplicant:
     58   * EAP-TLS
     59   * EAP-PEAP/MSCHAPv2 (both PEAPv0 and PEAPv1)
     60   * EAP-PEAP/TLS (both PEAPv0 and PEAPv1)
     61   * EAP-PEAP/GTC (both PEAPv0 and PEAPv1)
     62   * EAP-PEAP/OTP (both PEAPv0 and PEAPv1)
     63   * EAP-PEAP/MD5-Challenge (both PEAPv0 and PEAPv1)
     64   * EAP-TTLS/EAP-MD5-Challenge
     65   * EAP-TTLS/EAP-GTC
     66   * EAP-TTLS/EAP-OTP
     67   * EAP-TTLS/EAP-MSCHAPv2
     68   * EAP-TTLS/EAP-TLS
     69   * EAP-TTLS/MSCHAPv2
     70   * EAP-TTLS/MSCHAP
     71   * EAP-TTLS/PAP
     72   * EAP-TTLS/CHAP
     73   * EAP-SIM
     74   * EAP-AKA
     75   * EAP-PSK
     76   * EAP-PAX
     77   * EAP-SAKE
     78   * EAP-IKEv2
     79   * EAP-GPSK
     80   * LEAP (note: requires special support from the driver for IEEE 802.11
     81 	  authentication)
     82   (following methods are supported, but since they do not generate keying
     83    material, they cannot be used with WPA or IEEE 802.1X WEP keying)
     84   * EAP-MD5-Challenge 
     85   * EAP-MSCHAPv2
     86   * EAP-GTC
     87   * EAP-OTP
     88 - key management for CCMP, TKIP, WEP104, WEP40
     89 - RSN/WPA2 (IEEE 802.11i)
     90   * pre-authentication
     91   * PMKSA caching
     92 
     93 Supported TLS/crypto libraries:
     94 - OpenSSL (default)
     95 - GnuTLS
     96 
     97 Internal TLS/crypto implementation (optional):
     98 - can be used in place of an external TLS/crypto library
     99 - TLSv1
    100 - X.509 certificate processing
    101 - PKCS #1
    102 - ASN.1
    103 - RSA
    104 - bignum
    105 - minimal size (ca. 50 kB binary, parts of which are already needed for WPA;
    106   TLSv1/X.509/ASN.1/RSA/bignum parts are about 25 kB on x86)
    107 
    108 
    109 Requirements
    110 ------------
    111 
    112 Current hardware/software requirements:
    113 - Linux kernel 2.4.x or 2.6.x with Linux Wireless Extensions v15 or newer
    114 - FreeBSD 6-CURRENT
    115 - NetBSD-current
    116 - Microsoft Windows with WinPcap (at least WinXP, may work with other versions)
    117 - drivers:
    118 	Linux drivers that support cfg80211/nl80211. Even though there are
    119 	number of driver specific interface included in wpa_supplicant, please
    120 	note that Linux drivers are moving to use generic wireless configuration
    121 	interface driver_nl80211 (-Dnl80211 on wpa_supplicant command line)
    122 	should be the default option to start with before falling back to driver
    123 	specific interface.
    124 
    125 	Linux drivers that support WPA/WPA2 configuration with the generic
    126 	Linux wireless extensions (WE-18 or newer). Obsoleted by nl80211.
    127 
    128 	In theory, any driver that supports Linux wireless extensions can be
    129 	used with IEEE 802.1X (i.e., not WPA) when using ap_scan=0 option in
    130 	configuration file.
    131 
    132 	Wired Ethernet drivers (with ap_scan=0)
    133 
    134 	BSD net80211 layer (e.g., Atheros driver)
    135 	At the moment, this is for FreeBSD 6-CURRENT branch and NetBSD-current.
    136 
    137 	Windows NDIS
    138 	The current Windows port requires WinPcap (http://winpcap.polito.it/).
    139 	See README-Windows.txt for more information.
    140 
    141 wpa_supplicant was designed to be portable for different drivers and
    142 operating systems. Hopefully, support for more wlan cards and OSes will be
    143 added in the future. See developer's documentation
    144 (http://hostap.epitest.fi/wpa_supplicant/devel/) for more information about the
    145 design of wpa_supplicant and porting to other drivers. One main goal
    146 is to add full WPA/WPA2 support to Linux wireless extensions to allow
    147 new drivers to be supported without having to implement new
    148 driver-specific interface code in wpa_supplicant.
    149 
    150 Optional libraries for layer2 packet processing:
    151 - libpcap (tested with 0.7.2, most relatively recent versions assumed to work,
    152 	this is likely to be available with most distributions,
    153 	http://tcpdump.org/)
    154 - libdnet (tested with v1.4, most versions assumed to work,
    155 	http://libdnet.sourceforge.net/)
    156 
    157 These libraries are _not_ used in the default Linux build. Instead,
    158 internal Linux specific implementation is used. libpcap/libdnet are
    159 more portable and they can be used by adding CONFIG_L2_PACKET=pcap into
    160 .config. They may also be selected automatically for other operating
    161 systems. In case of Windows builds, WinPcap is used by default
    162 (CONFIG_L2_PACKET=winpcap).
    163 
    164 
    165 Optional libraries for EAP-TLS, EAP-PEAP, and EAP-TTLS:
    166 - OpenSSL (tested with 0.9.7c and 0.9.7d, and 0.9.8 versions; assumed to
    167   work with most relatively recent versions; this is likely to be
    168   available with most distributions, http://www.openssl.org/)
    169 - GnuTLS
    170 - internal TLSv1 implementation
    171 
    172 TLS options for EAP-FAST:
    173 - OpenSSL 0.9.8d _with_ openssl-0.9.8d-tls-extensions.patch applied
    174   (i.e., the default OpenSSL package does not include support for
    175   extensions needed for EAP-FAST)
    176 - internal TLSv1 implementation
    177 
    178 One of these libraries is needed when EAP-TLS, EAP-PEAP, EAP-TTLS, or
    179 EAP-FAST support is enabled. WPA-PSK mode does not require this or EAPOL/EAP
    180 implementation. A configuration file, .config, for compilation is
    181 needed to enable IEEE 802.1X/EAPOL and EAP methods. Note that EAP-MD5,
    182 EAP-GTC, EAP-OTP, and EAP-MSCHAPV2 cannot be used alone with WPA, so
    183 they should only be enabled if testing the EAPOL/EAP state
    184 machines. However, there can be used as inner authentication
    185 algorithms with EAP-PEAP and EAP-TTLS.
    186 
    187 See Building and installing section below for more detailed
    188 information about the wpa_supplicant build time configuration.
    189 
    190 
    191 
    192 WPA
    193 ---
    194 
    195 The original security mechanism of IEEE 802.11 standard was not
    196 designed to be strong and has proven to be insufficient for most
    197 networks that require some kind of security. Task group I (Security)
    198 of IEEE 802.11 working group (http://www.ieee802.org/11/) has worked
    199 to address the flaws of the base standard and has in practice
    200 completed its work in May 2004. The IEEE 802.11i amendment to the IEEE
    201 802.11 standard was approved in June 2004 and published in July 2004.
    202 
    203 Wi-Fi Alliance (http://www.wi-fi.org/) used a draft version of the
    204 IEEE 802.11i work (draft 3.0) to define a subset of the security
    205 enhancements that can be implemented with existing wlan hardware. This
    206 is called Wi-Fi Protected Access<TM> (WPA). This has now become a
    207 mandatory component of interoperability testing and certification done
    208 by Wi-Fi Alliance. Wi-Fi provides information about WPA at its web
    209 site (http://www.wi-fi.org/OpenSection/protected_access.asp).
    210 
    211 IEEE 802.11 standard defined wired equivalent privacy (WEP) algorithm
    212 for protecting wireless networks. WEP uses RC4 with 40-bit keys,
    213 24-bit initialization vector (IV), and CRC32 to protect against packet
    214 forgery. All these choices have proven to be insufficient: key space is
    215 too small against current attacks, RC4 key scheduling is insufficient
    216 (beginning of the pseudorandom stream should be skipped), IV space is
    217 too small and IV reuse makes attacks easier, there is no replay
    218 protection, and non-keyed authentication does not protect against bit
    219 flipping packet data.
    220 
    221 WPA is an intermediate solution for the security issues. It uses
    222 Temporal Key Integrity Protocol (TKIP) to replace WEP. TKIP is a
    223 compromise on strong security and possibility to use existing
    224 hardware. It still uses RC4 for the encryption like WEP, but with
    225 per-packet RC4 keys. In addition, it implements replay protection,
    226 keyed packet authentication mechanism (Michael MIC).
    227 
    228 Keys can be managed using two different mechanisms. WPA can either use
    229 an external authentication server (e.g., RADIUS) and EAP just like
    230 IEEE 802.1X is using or pre-shared keys without need for additional
    231 servers. Wi-Fi calls these "WPA-Enterprise" and "WPA-Personal",
    232 respectively. Both mechanisms will generate a master session key for
    233 the Authenticator (AP) and Supplicant (client station).
    234 
    235 WPA implements a new key handshake (4-Way Handshake and Group Key
    236 Handshake) for generating and exchanging data encryption keys between
    237 the Authenticator and Supplicant. This handshake is also used to
    238 verify that both Authenticator and Supplicant know the master session
    239 key. These handshakes are identical regardless of the selected key
    240 management mechanism (only the method for generating master session
    241 key changes).
    242 
    243 
    244 
    245 IEEE 802.11i / WPA2
    246 -------------------
    247 
    248 The design for parts of IEEE 802.11i that were not included in WPA has
    249 finished (May 2004) and this amendment to IEEE 802.11 was approved in
    250 June 2004. Wi-Fi Alliance is using the final IEEE 802.11i as a new
    251 version of WPA called WPA2. This includes, e.g., support for more
    252 robust encryption algorithm (CCMP: AES in Counter mode with CBC-MAC)
    253 to replace TKIP and optimizations for handoff (reduced number of
    254 messages in initial key handshake, pre-authentication, and PMKSA caching).
    255 
    256 
    257 
    258 wpa_supplicant
    259 --------------
    260 
    261 wpa_supplicant is an implementation of the WPA Supplicant component,
    262 i.e., the part that runs in the client stations. It implements WPA key
    263 negotiation with a WPA Authenticator and EAP authentication with
    264 Authentication Server. In addition, it controls the roaming and IEEE
    265 802.11 authentication/association of the wlan driver.
    266 
    267 wpa_supplicant is designed to be a "daemon" program that runs in the
    268 background and acts as the backend component controlling the wireless
    269 connection. wpa_supplicant supports separate frontend programs and an
    270 example text-based frontend, wpa_cli, is included with wpa_supplicant.
    271 
    272 Following steps are used when associating with an AP using WPA:
    273 
    274 - wpa_supplicant requests the kernel driver to scan neighboring BSSes
    275 - wpa_supplicant selects a BSS based on its configuration
    276 - wpa_supplicant requests the kernel driver to associate with the chosen
    277   BSS
    278 - If WPA-EAP: integrated IEEE 802.1X Supplicant completes EAP
    279   authentication with the authentication server (proxied by the
    280   Authenticator in the AP)
    281 - If WPA-EAP: master key is received from the IEEE 802.1X Supplicant
    282 - If WPA-PSK: wpa_supplicant uses PSK as the master session key
    283 - wpa_supplicant completes WPA 4-Way Handshake and Group Key Handshake
    284   with the Authenticator (AP)
    285 - wpa_supplicant configures encryption keys for unicast and broadcast
    286 - normal data packets can be transmitted and received
    287 
    288 
    289 
    290 Building and installing
    291 -----------------------
    292 
    293 In order to be able to build wpa_supplicant, you will first need to
    294 select which parts of it will be included. This is done by creating a
    295 build time configuration file, .config, in the wpa_supplicant root
    296 directory. Configuration options are text lines using following
    297 format: CONFIG_<option>=y. Lines starting with # are considered
    298 comments and are ignored. See defconfig file for an example configuration
    299 and a list of available options and additional notes.
    300 
    301 The build time configuration can be used to select only the needed
    302 features and limit the binary size and requirements for external
    303 libraries. The main configuration parts are the selection of which
    304 driver interfaces (e.g., nl80211, wext, ..) and which authentication
    305 methods (e.g., EAP-TLS, EAP-PEAP, ..) are included.
    306 
    307 Following build time configuration options are used to control IEEE
    308 802.1X/EAPOL and EAP state machines and all EAP methods. Including
    309 TLS, PEAP, or TTLS will require linking wpa_supplicant with OpenSSL
    310 library for TLS implementation. Alternatively, GnuTLS or the internal
    311 TLSv1 implementation can be used for TLS functionaly.
    312 
    313 CONFIG_IEEE8021X_EAPOL=y
    314 CONFIG_EAP_MD5=y
    315 CONFIG_EAP_MSCHAPV2=y
    316 CONFIG_EAP_TLS=y
    317 CONFIG_EAP_PEAP=y
    318 CONFIG_EAP_TTLS=y
    319 CONFIG_EAP_GTC=y
    320 CONFIG_EAP_OTP=y
    321 CONFIG_EAP_SIM=y
    322 CONFIG_EAP_AKA=y
    323 CONFIG_EAP_PSK=y
    324 CONFIG_EAP_SAKE=y
    325 CONFIG_EAP_GPSK=y
    326 CONFIG_EAP_PAX=y
    327 CONFIG_EAP_LEAP=y
    328 CONFIG_EAP_IKEV2=y
    329 
    330 Following option can be used to include GSM SIM/USIM interface for GSM/UMTS
    331 authentication algorithm (for EAP-SIM/EAP-AKA). This requires pcsc-lite
    332 (http://www.linuxnet.com/) for smart card access.
    333 
    334 CONFIG_PCSC=y
    335 
    336 Following options can be added to .config to select which driver
    337 interfaces are included.
    338 
    339 CONFIG_DRIVER_NL80211=y
    340 CONFIG_DRIVER_WEXT=y
    341 CONFIG_DRIVER_BSD=y
    342 CONFIG_DRIVER_NDIS=y
    343 
    344 Following example includes some more features and driver interfaces that
    345 are included in the wpa_supplicant package:
    346 
    347 CONFIG_DRIVER_NL80211=y
    348 CONFIG_DRIVER_WEXT=y
    349 CONFIG_DRIVER_BSD=y
    350 CONFIG_DRIVER_NDIS=y
    351 CONFIG_IEEE8021X_EAPOL=y
    352 CONFIG_EAP_MD5=y
    353 CONFIG_EAP_MSCHAPV2=y
    354 CONFIG_EAP_TLS=y
    355 CONFIG_EAP_PEAP=y
    356 CONFIG_EAP_TTLS=y
    357 CONFIG_EAP_GTC=y
    358 CONFIG_EAP_OTP=y
    359 CONFIG_EAP_SIM=y
    360 CONFIG_EAP_AKA=y
    361 CONFIG_EAP_PSK=y
    362 CONFIG_EAP_SAKE=y
    363 CONFIG_EAP_GPSK=y
    364 CONFIG_EAP_PAX=y
    365 CONFIG_EAP_LEAP=y
    366 CONFIG_EAP_IKEV2=y
    367 CONFIG_PCSC=y
    368 
    369 EAP-PEAP and EAP-TTLS will automatically include configured EAP
    370 methods (MD5, OTP, GTC, MSCHAPV2) for inner authentication selection.
    371 
    372 
    373 After you have created a configuration file, you can build
    374 wpa_supplicant and wpa_cli with 'make' command. You may then install
    375 the binaries to a suitable system directory, e.g., /usr/local/bin.
    376 
    377 Example commands:
    378 
    379 # build wpa_supplicant and wpa_cli
    380 make
    381 # install binaries (this may need root privileges)
    382 cp wpa_cli wpa_supplicant /usr/local/bin
    383 
    384 
    385 You will need to make a configuration file, e.g.,
    386 /etc/wpa_supplicant.conf, with network configuration for the networks
    387 you are going to use. Configuration file section below includes
    388 explanation fo the configuration file format and includes various
    389 examples. Once the configuration is ready, you can test whether the
    390 configuration work by first running wpa_supplicant with following
    391 command to start it on foreground with debugging enabled:
    392 
    393 wpa_supplicant -iwlan0 -c/etc/wpa_supplicant.conf -d
    394 
    395 Assuming everything goes fine, you can start using following command
    396 to start wpa_supplicant on background without debugging:
    397 
    398 wpa_supplicant -iwlan0 -c/etc/wpa_supplicant.conf -B
    399 
    400 Please note that if you included more than one driver interface in the
    401 build time configuration (.config), you may need to specify which
    402 interface to use by including -D<driver name> option on the command
    403 line. See following section for more details on command line options
    404 for wpa_supplicant.
    405 
    406 
    407 
    408 Command line options
    409 --------------------
    410 
    411 usage:
    412   wpa_supplicant [-BddfhKLqqtuvwW] [-P<pid file>] [-g<global ctrl>] \
    413         [-G<group>] \
    414         -i<ifname> -c<config file> [-C<ctrl>] [-D<driver>] [-p<driver_param>] \
    415         [-b<br_ifname> [-N -i<ifname> -c<conf> [-C<ctrl>] [-D<driver>] \
    416         [-p<driver_param>] [-b<br_ifname>] [-m<P2P Device config file>] ...
    417 
    418 options:
    419   -b = optional bridge interface name
    420   -B = run daemon in the background
    421   -c = Configuration file
    422   -C = ctrl_interface parameter (only used if -c is not)
    423   -i = interface name
    424   -d = increase debugging verbosity (-dd even more)
    425   -D = driver name (can be multiple drivers: nl80211,wext)
    426   -f = Log output to default log location (normally /tmp)
    427   -g = global ctrl_interface
    428   -G = global ctrl_interface group
    429   -K = include keys (passwords, etc.) in debug output
    430   -t = include timestamp in debug messages
    431   -h = show this help text
    432   -L = show license (BSD)
    433   -p = driver parameters
    434   -P = PID file
    435   -q = decrease debugging verbosity (-qq even less)
    436   -u = enable DBus control interface
    437   -v = show version
    438   -w = wait for interface to be added, if needed
    439   -W = wait for a control interface monitor before starting
    440   -N = start describing new interface
    441   -m = Configuration file for the P2P Device
    442 
    443 drivers:
    444   nl80211 = Linux nl80211/cfg80211
    445   wext = Linux wireless extensions (generic)
    446   wired = wpa_supplicant wired Ethernet driver
    447   roboswitch = wpa_supplicant Broadcom switch driver
    448   bsd = BSD 802.11 support (Atheros, etc.)
    449   ndis = Windows NDIS driver
    450 
    451 In most common cases, wpa_supplicant is started with
    452 
    453 wpa_supplicant -B -c/etc/wpa_supplicant.conf -iwlan0
    454 
    455 This makes the process fork into background.
    456 
    457 The easiest way to debug problems, and to get debug log for bug
    458 reports, is to start wpa_supplicant on foreground with debugging
    459 enabled:
    460 
    461 wpa_supplicant -c/etc/wpa_supplicant.conf -iwlan0 -d
    462 
    463 If the specific driver wrapper is not known beforehand, it is possible
    464 to specify multiple comma separated driver wrappers on the command
    465 line. wpa_supplicant will use the first driver wrapper that is able to
    466 initialize the interface.
    467 
    468 wpa_supplicant -Dnl80211,wext -c/etc/wpa_supplicant.conf -iwlan0
    469 
    470 
    471 wpa_supplicant can control multiple interfaces (radios) either by
    472 running one process for each interface separately or by running just
    473 one process and list of options at command line. Each interface is
    474 separated with -N argument. As an example, following command would
    475 start wpa_supplicant for two interfaces:
    476 
    477 wpa_supplicant \
    478 	-c wpa1.conf -i wlan0 -D nl80211 -N \
    479 	-c wpa2.conf -i wlan1 -D wext
    480 
    481 
    482 If the interface is added in a Linux bridge (e.g., br0), the bridge
    483 interface needs to be configured to wpa_supplicant in addition to the
    484 main interface:
    485 
    486 wpa_supplicant -cw.conf -Dnl80211 -iwlan0 -bbr0
    487 
    488 
    489 Configuration file
    490 ------------------
    491 
    492 wpa_supplicant is configured using a text file that lists all accepted
    493 networks and security policies, including pre-shared keys. See
    494 example configuration file, wpa_supplicant.conf, for detailed
    495 information about the configuration format and supported fields.
    496 
    497 Changes to configuration file can be reloaded be sending SIGHUP signal
    498 to wpa_supplicant ('killall -HUP wpa_supplicant'). Similarly,
    499 reloading can be triggered with 'wpa_cli reconfigure' command.
    500 
    501 Configuration file can include one or more network blocks, e.g., one
    502 for each used SSID. wpa_supplicant will automatically select the best
    503 betwork based on the order of network blocks in the configuration
    504 file, network security level (WPA/WPA2 is preferred), and signal
    505 strength.
    506 
    507 Example configuration files for some common configurations:
    508 
    509 1) WPA-Personal (PSK) as home network and WPA-Enterprise with EAP-TLS as work
    510    network
    511 
    512 # allow frontend (e.g., wpa_cli) to be used by all users in 'wheel' group
    513 ctrl_interface=/var/run/wpa_supplicant
    514 ctrl_interface_group=wheel
    515 #
    516 # home network; allow all valid ciphers
    517 network={
    518 	ssid="home"
    519 	scan_ssid=1
    520 	key_mgmt=WPA-PSK
    521 	psk="very secret passphrase"
    522 }
    523 #
    524 # work network; use EAP-TLS with WPA; allow only CCMP and TKIP ciphers
    525 network={
    526 	ssid="work"
    527 	scan_ssid=1
    528 	key_mgmt=WPA-EAP
    529 	pairwise=CCMP TKIP
    530 	group=CCMP TKIP
    531 	eap=TLS
    532 	identity="user (a] example.com"
    533 	ca_cert="/etc/cert/ca.pem"
    534 	client_cert="/etc/cert/user.pem"
    535 	private_key="/etc/cert/user.prv"
    536 	private_key_passwd="password"
    537 }
    538 
    539 
    540 2) WPA-RADIUS/EAP-PEAP/MSCHAPv2 with RADIUS servers that use old peaplabel
    541    (e.g., Funk Odyssey and SBR, Meetinghouse Aegis, Interlink RAD-Series)
    542 
    543 ctrl_interface=/var/run/wpa_supplicant
    544 ctrl_interface_group=wheel
    545 network={
    546 	ssid="example"
    547 	scan_ssid=1
    548 	key_mgmt=WPA-EAP
    549 	eap=PEAP
    550 	identity="user (a] example.com"
    551 	password="foobar"
    552 	ca_cert="/etc/cert/ca.pem"
    553 	phase1="peaplabel=0"
    554 	phase2="auth=MSCHAPV2"
    555 }
    556 
    557 
    558 3) EAP-TTLS/EAP-MD5-Challenge configuration with anonymous identity for the
    559    unencrypted use. Real identity is sent only within an encrypted TLS tunnel.
    560 
    561 ctrl_interface=/var/run/wpa_supplicant
    562 ctrl_interface_group=wheel
    563 network={
    564 	ssid="example"
    565 	scan_ssid=1
    566 	key_mgmt=WPA-EAP
    567 	eap=TTLS
    568 	identity="user (a] example.com"
    569 	anonymous_identity="anonymous (a] example.com"
    570 	password="foobar"
    571 	ca_cert="/etc/cert/ca.pem"
    572 	phase2="auth=MD5"
    573 }
    574 
    575 
    576 4) IEEE 802.1X (i.e., no WPA) with dynamic WEP keys (require both unicast and
    577    broadcast); use EAP-TLS for authentication
    578 
    579 ctrl_interface=/var/run/wpa_supplicant
    580 ctrl_interface_group=wheel
    581 network={
    582 	ssid="1x-test"
    583 	scan_ssid=1
    584 	key_mgmt=IEEE8021X
    585 	eap=TLS
    586 	identity="user (a] example.com"
    587 	ca_cert="/etc/cert/ca.pem"
    588 	client_cert="/etc/cert/user.pem"
    589 	private_key="/etc/cert/user.prv"
    590 	private_key_passwd="password"
    591 	eapol_flags=3
    592 }
    593 
    594 
    595 5) Catch all example that allows more or less all configuration modes. The
    596    configuration options are used based on what security policy is used in the
    597    selected SSID. This is mostly for testing and is not recommended for normal
    598    use.
    599 
    600 ctrl_interface=/var/run/wpa_supplicant
    601 ctrl_interface_group=wheel
    602 network={
    603 	ssid="example"
    604 	scan_ssid=1
    605 	key_mgmt=WPA-EAP WPA-PSK IEEE8021X NONE
    606 	pairwise=CCMP TKIP
    607 	group=CCMP TKIP WEP104 WEP40
    608 	psk="very secret passphrase"
    609 	eap=TTLS PEAP TLS
    610 	identity="user (a] example.com"
    611 	password="foobar"
    612 	ca_cert="/etc/cert/ca.pem"
    613 	client_cert="/etc/cert/user.pem"
    614 	private_key="/etc/cert/user.prv"
    615 	private_key_passwd="password"
    616 	phase1="peaplabel=0"
    617 	ca_cert2="/etc/cert/ca2.pem"
    618 	client_cert2="/etc/cer/user.pem"
    619 	private_key2="/etc/cer/user.prv"
    620 	private_key2_passwd="password"
    621 }
    622 
    623 
    624 6) Authentication for wired Ethernet. This can be used with 'wired' or
    625    'roboswitch' interface (-Dwired or -Droboswitch on command line).
    626 
    627 ctrl_interface=/var/run/wpa_supplicant
    628 ctrl_interface_group=wheel
    629 ap_scan=0
    630 network={
    631 	key_mgmt=IEEE8021X
    632 	eap=MD5
    633 	identity="user"
    634 	password="password"
    635 	eapol_flags=0
    636 }
    637 
    638 
    639 
    640 Certificates
    641 ------------
    642 
    643 Some EAP authentication methods require use of certificates. EAP-TLS
    644 uses both server side and client certificates whereas EAP-PEAP and
    645 EAP-TTLS only require the server side certificate. When client
    646 certificate is used, a matching private key file has to also be
    647 included in configuration. If the private key uses a passphrase, this
    648 has to be configured in wpa_supplicant.conf ("private_key_passwd").
    649 
    650 wpa_supplicant supports X.509 certificates in PEM and DER
    651 formats. User certificate and private key can be included in the same
    652 file.
    653 
    654 If the user certificate and private key is received in PKCS#12/PFX
    655 format, they need to be converted to suitable PEM/DER format for
    656 wpa_supplicant. This can be done, e.g., with following commands:
    657 
    658 # convert client certificate and private key to PEM format
    659 openssl pkcs12 -in example.pfx -out user.pem -clcerts
    660 # convert CA certificate (if included in PFX file) to PEM format
    661 openssl pkcs12 -in example.pfx -out ca.pem -cacerts -nokeys
    662 
    663 
    664 
    665 wpa_cli
    666 -------
    667 
    668 wpa_cli is a text-based frontend program for interacting with
    669 wpa_supplicant. It is used to query current status, change
    670 configuration, trigger events, and request interactive user input.
    671 
    672 wpa_cli can show the current authentication status, selected security
    673 mode, dot11 and dot1x MIBs, etc. In addition, it can configure some
    674 variables like EAPOL state machine parameters and trigger events like
    675 reassociation and IEEE 802.1X logoff/logon. wpa_cli provides a user
    676 interface to request authentication information, like username and
    677 password, if these are not included in the configuration. This can be
    678 used to implement, e.g., one-time-passwords or generic token card
    679 authentication where the authentication is based on a
    680 challenge-response that uses an external device for generating the
    681 response.
    682 
    683 The control interface of wpa_supplicant can be configured to allow
    684 non-root user access (ctrl_interface_group in the configuration
    685 file). This makes it possible to run wpa_cli with a normal user
    686 account.
    687 
    688 wpa_cli supports two modes: interactive and command line. Both modes
    689 share the same command set and the main difference is in interactive
    690 mode providing access to unsolicited messages (event messages,
    691 username/password requests).
    692 
    693 Interactive mode is started when wpa_cli is executed without including
    694 the command as a command line parameter. Commands are then entered on
    695 the wpa_cli prompt. In command line mode, the same commands are
    696 entered as command line arguments for wpa_cli.
    697 
    698 
    699 Interactive authentication parameters request
    700 
    701 When wpa_supplicant need authentication parameters, like username and
    702 password, which are not present in the configuration file, it sends a
    703 request message to all attached frontend programs, e.g., wpa_cli in
    704 interactive mode. wpa_cli shows these requests with
    705 "CTRL-REQ-<type>-<id>:<text>" prefix. <type> is IDENTITY, PASSWORD, or
    706 OTP (one-time-password). <id> is a unique identifier for the current
    707 network. <text> is description of the request. In case of OTP request,
    708 it includes the challenge from the authentication server.
    709 
    710 The reply to these requests can be given with 'identity', 'password',
    711 and 'otp' commands. <id> needs to be copied from the the matching
    712 request. 'password' and 'otp' commands can be used regardless of
    713 whether the request was for PASSWORD or OTP. The main difference
    714 between these two commands is that values given with 'password' are
    715 remembered as long as wpa_supplicant is running whereas values given
    716 with 'otp' are used only once and then forgotten, i.e., wpa_supplicant
    717 will ask frontend for a new value for every use. This can be used to
    718 implement one-time-password lists and generic token card -based
    719 authentication.
    720 
    721 Example request for password and a matching reply:
    722 
    723 CTRL-REQ-PASSWORD-1:Password needed for SSID foobar
    724 > password 1 mysecretpassword
    725 
    726 Example request for generic token card challenge-response:
    727 
    728 CTRL-REQ-OTP-2:Challenge 1235663 needed for SSID foobar
    729 > otp 2 9876
    730 
    731 
    732 wpa_cli commands
    733 
    734   status = get current WPA/EAPOL/EAP status
    735   mib = get MIB variables (dot1x, dot11)
    736   help = show this usage help
    737   interface [ifname] = show interfaces/select interface
    738   level <debug level> = change debug level
    739   license = show full wpa_cli license
    740   logoff = IEEE 802.1X EAPOL state machine logoff
    741   logon = IEEE 802.1X EAPOL state machine logon
    742   set = set variables (shows list of variables when run without arguments)
    743   pmksa = show PMKSA cache
    744   reassociate = force reassociation
    745   reconfigure = force wpa_supplicant to re-read its configuration file
    746   preauthenticate <BSSID> = force preauthentication
    747   identity <network id> <identity> = configure identity for an SSID
    748   password <network id> <password> = configure password for an SSID
    749   pin <network id> <pin> = configure pin for an SSID
    750   otp <network id> <password> = configure one-time-password for an SSID
    751   passphrase <network id> <passphrase> = configure private key passphrase
    752     for an SSID
    753   bssid <network id> <BSSID> = set preferred BSSID for an SSID
    754   list_networks = list configured networks
    755   select_network <network id> = select a network (disable others)
    756   enable_network <network id> = enable a network
    757   disable_network <network id> = disable a network
    758   add_network = add a network
    759   remove_network <network id> = remove a network
    760   set_network <network id> <variable> <value> = set network variables (shows
    761     list of variables when run without arguments)
    762   get_network <network id> <variable> = get network variables
    763   save_config = save the current configuration
    764   disconnect = disconnect and wait for reassociate command before connecting
    765   scan = request new BSS scan
    766   scan_results = get latest scan results
    767   get_capability <eap/pairwise/group/key_mgmt/proto/auth_alg> = get capabilies
    768   terminate = terminate wpa_supplicant
    769   quit = exit wpa_cli
    770 
    771 
    772 wpa_cli command line options
    773 
    774 wpa_cli [-p<path to ctrl sockets>] [-i<ifname>] [-hvB] [-a<action file>] \
    775         [-P<pid file>] [-g<global ctrl>]  [command..]
    776   -h = help (show this usage text)
    777   -v = shown version information
    778   -a = run in daemon mode executing the action file based on events from
    779        wpa_supplicant
    780   -B = run a daemon in the background
    781   default path: /var/run/wpa_supplicant
    782   default interface: first interface found in socket path
    783 
    784 
    785 Using wpa_cli to run external program on connect/disconnect
    786 -----------------------------------------------------------
    787 
    788 wpa_cli can used to run external programs whenever wpa_supplicant
    789 connects or disconnects from a network. This can be used, e.g., to
    790 update network configuration and/or trigget DHCP client to update IP
    791 addresses, etc.
    792 
    793 One wpa_cli process in "action" mode needs to be started for each
    794 interface. For example, the following command starts wpa_cli for the
    795 default ingterface (-i can be used to select the interface in case of
    796 more than one interface being used at the same time):
    797 
    798 wpa_cli -a/sbin/wpa_action.sh -B
    799 
    800 The action file (-a option, /sbin/wpa_action.sh in this example) will
    801 be executed whenever wpa_supplicant completes authentication (connect
    802 event) or detects disconnection). The action script will be called
    803 with two command line arguments: interface name and event (CONNECTED
    804 or DISCONNECTED). If the action script needs to get more information
    805 about the current network, it can use 'wpa_cli status' to query
    806 wpa_supplicant for more information.
    807 
    808 Following example can be used as a simple template for an action
    809 script:
    810 
    811 #!/bin/sh
    812 
    813 IFNAME=$1
    814 CMD=$2
    815 
    816 if [ "$CMD" = "CONNECTED" ]; then
    817     SSID=`wpa_cli -i$IFNAME status | grep ^ssid= | cut -f2- -d=`
    818     # configure network, signal DHCP client, etc.
    819 fi
    820 
    821 if [ "$CMD" = "DISCONNECTED" ]; then
    822     # remove network configuration, if needed
    823     SSID=
    824 fi
    825 
    826 
    827 
    828 Integrating with pcmcia-cs/cardmgr scripts
    829 ------------------------------------------
    830 
    831 wpa_supplicant needs to be running when using a wireless network with
    832 WPA. It can be started either from system startup scripts or from
    833 pcmcia-cs/cardmgr scripts (when using PC Cards). WPA handshake must be
    834 completed before data frames can be exchanged, so wpa_supplicant
    835 should be started before DHCP client.
    836 
    837 For example, following small changes to pcmcia-cs scripts can be used
    838 to enable WPA support:
    839 
    840 Add MODE="Managed" and WPA="y" to the network scheme in
    841 /etc/pcmcia/wireless.opts.
    842 
    843 Add the following block to the end of 'start' action handler in
    844 /etc/pcmcia/wireless:
    845 
    846     if [ "$WPA" = "y" -a -x /usr/local/bin/wpa_supplicant ]; then
    847 	/usr/local/bin/wpa_supplicant -B -c/etc/wpa_supplicant.conf \
    848 		-i$DEVICE
    849     fi
    850 
    851 Add the following block to the end of 'stop' action handler (may need
    852 to be separated from other actions) in /etc/pcmcia/wireless:
    853 
    854     if [ "$WPA" = "y" -a -x /usr/local/bin/wpa_supplicant ]; then
    855 	killall wpa_supplicant
    856     fi
    857 
    858 This will make cardmgr start wpa_supplicant when the card is plugged
    859 in.
    860 
    861 
    862 
    863 Dynamic interface add and operation without configuration files
    864 ---------------------------------------------------------------
    865 
    866 wpa_supplicant can be started without any configuration files or
    867 network interfaces. When used in this way, a global (i.e., per
    868 wpa_supplicant process) control interface is used to add and remove
    869 network interfaces. Each network interface can then be configured
    870 through a per-network interface control interface. For example,
    871 following commands show how to start wpa_supplicant without any
    872 network interfaces and then add a network interface and configure a
    873 network (SSID):
    874 
    875 # Start wpa_supplicant in the background
    876 wpa_supplicant -g/var/run/wpa_supplicant-global -B
    877 
    878 # Add a new interface (wlan0, no configuration file, driver=nl80211, and
    879 # enable control interface)
    880 wpa_cli -g/var/run/wpa_supplicant-global interface_add wlan0 \
    881 	"" nl80211 /var/run/wpa_supplicant
    882 
    883 # Configure a network using the newly added network interface:
    884 wpa_cli -iwlan0 add_network
    885 wpa_cli -iwlan0 set_network 0 ssid '"test"'
    886 wpa_cli -iwlan0 set_network 0 key_mgmt WPA-PSK
    887 wpa_cli -iwlan0 set_network 0 psk '"12345678"'
    888 wpa_cli -iwlan0 set_network 0 pairwise TKIP
    889 wpa_cli -iwlan0 set_network 0 group TKIP
    890 wpa_cli -iwlan0 set_network 0 proto WPA
    891 wpa_cli -iwlan0 enable_network 0
    892 
    893 # At this point, the new network interface should start trying to associate
    894 # with the WPA-PSK network using SSID test.
    895 
    896 # Remove network interface
    897 wpa_cli -g/var/run/wpa_supplicant-global interface_remove wlan0
    898 
    899 
    900 Privilege separation
    901 --------------------
    902 
    903 To minimize the size of code that needs to be run with root privileges
    904 (e.g., to control wireless interface operation), wpa_supplicant
    905 supports optional privilege separation. If enabled, this separates the
    906 privileged operations into a separate process (wpa_priv) while leaving
    907 rest of the code (e.g., EAP authentication and WPA handshakes) into an
    908 unprivileged process (wpa_supplicant) that can be run as non-root
    909 user. Privilege separation restricts the effects of potential software
    910 errors by containing the majority of the code in an unprivileged
    911 process to avoid full system compromise.
    912 
    913 Privilege separation is not enabled by default and it can be enabled
    914 by adding CONFIG_PRIVSEP=y to the build configuration (.config). When
    915 enabled, the privileged operations (driver wrapper and l2_packet) are
    916 linked into a separate daemon program, wpa_priv. The unprivileged
    917 program, wpa_supplicant, will be built with a special driver/l2_packet
    918 wrappers that communicate with the privileged wpa_priv process to
    919 perform the needed operations. wpa_priv can control what privileged
    920 are allowed.
    921 
    922 wpa_priv needs to be run with network admin privileges (usually, root
    923 user). It opens a UNIX domain socket for each interface that is
    924 included on the command line; any other interface will be off limits
    925 for wpa_supplicant in this kind of configuration. After this,
    926 wpa_supplicant can be run as a non-root user (e.g., all standard users
    927 on a laptop or as a special non-privileged user account created just
    928 for this purpose to limit access to user files even further).
    929 
    930 
    931 Example configuration:
    932 - create user group for users that are allowed to use wpa_supplicant
    933   ('wpapriv' in this example) and assign users that should be able to
    934   use wpa_supplicant into that group
    935 - create /var/run/wpa_priv directory for UNIX domain sockets and control
    936   user access by setting it accessible only for the wpapriv group:
    937   mkdir /var/run/wpa_priv
    938   chown root:wpapriv /var/run/wpa_priv
    939   chmod 0750 /var/run/wpa_priv
    940 - start wpa_priv as root (e.g., from system startup scripts) with the
    941   enabled interfaces configured on the command line:
    942   wpa_priv -B -P /var/run/wpa_priv.pid nl80211:wlan0
    943 - run wpa_supplicant as non-root with a user that is in wpapriv group:
    944   wpa_supplicant -i ath0 -c wpa_supplicant.conf
    945 
    946 wpa_priv does not use the network interface before wpa_supplicant is
    947 started, so it is fine to include network interfaces that are not
    948 available at the time wpa_priv is started. As an alternative, wpa_priv
    949 can be started when an interface is added (hotplug/udev/etc. scripts).
    950 wpa_priv can control multiple interface with one process, but it is
    951 also possible to run multiple wpa_priv processes at the same time, if
    952 desired.
    953 
    954 
    955 Linux capabilities instead of privileged process
    956 ------------------------------------------------
    957 
    958 wpa_supplicant performs operations that need special permissions, e.g.,
    959 to control the network connection. Traditionally this has been achieved
    960 by running wpa_supplicant as a privileged process with effective user id
    961 0 (root). Linux capabilities can be used to provide restricted set of
    962 capabilities to match the functions needed by wpa_supplicant. The
    963 minimum set of capabilities needed for the operations is CAP_NET_ADMIN
    964 and CAP_NET_RAW.
    965 
    966 setcap(8) can be used to set file capabilities. For example:
    967 
    968 sudo setcap cap_net_raw,cap_net_admin+ep wpa_supplicant
    969 
    970 Please note that this would give anyone being able to run that
    971 wpa_supplicant binary access to the additional capabilities. This can
    972 further be limited by file owner/group and mode bits. For example:
    973 
    974 sudo chown wpas wpa_supplicant
    975 sudo chmod 0100 wpa_supplicant
    976 
    977 This combination of setcap, chown, and chmod commands would allow wpas
    978 user to execute wpa_supplicant with additional network admin/raw
    979 capabilities.
    980 
    981 Common way style of creating a control interface socket in
    982 /var/run/wpa_supplicant could not be done by this user, but this
    983 directory could be created before starting the wpa_supplicant and set to
    984 suitable mode to allow wpa_supplicant to create sockets
    985 there. Alternatively, other directory or abstract socket namespace could
    986 be used for the control interface.
    987 
    988 
    989 External requests for radio control
    990 -----------------------------------
    991 
    992 External programs can request wpa_supplicant to not start offchannel
    993 operations during other tasks that may need exclusive control of the
    994 radio. The RADIO_WORK control interface command can be used for this.
    995 
    996 "RADIO_WORK add <name> [freq=<MHz>] [timeout=<seconds>]" command can be
    997 used to reserve a slot for radio access. If freq is specified, other
    998 radio work items on the same channel may be completed in
    999 parallel. Otherwise, all other radio work items are blocked during
   1000 execution. Timeout is set to 10 seconds by default to avoid blocking
   1001 wpa_supplicant operations for excessive time. If a longer (or shorter)
   1002 safety timeout is needed, that can be specified with the optional
   1003 timeout parameter. This command returns an identifier for the radio work
   1004 item.
   1005 
   1006 Once the radio work item has been started, "EXT-RADIO-WORK-START <id>"
   1007 event message is indicated that the external processing can start. Once
   1008 the operation has been completed, "RADIO_WORK done <id>" is used to
   1009 indicate that to wpa_supplicant. This allows other radio works to be
   1010 performed. If this command is forgotten (e.g., due to the external
   1011 program terminating), wpa_supplicant will time out the radio owrk item
   1012 and send "EXT-RADIO-WORK-TIMEOUT <id>" event ot indicate that this has
   1013 happened. "RADIO_WORK done <id>" can also be used to cancel items that
   1014 have not yet been started.
   1015 
   1016 For example, in wpa_cli interactive mode:
   1017 
   1018 > radio_work add test
   1019 1
   1020 <3>EXT-RADIO-WORK-START 1
   1021 > radio_work show
   1022 ext:test@wlan0:0:1:2.487797
   1023 > radio_work done 1
   1024 OK
   1025 > radio_work show
   1026 
   1027 
   1028 > radio_work done 3
   1029 OK
   1030 > radio_work show
   1031 ext:test freq=2412 timeout=30@wlan0:2412:1:28.583483
   1032 <3>EXT-RADIO-WORK-TIMEOUT 2
   1033 
   1034 
   1035 > radio_work add test2 freq=2412 timeout=60
   1036 5
   1037 <3>EXT-RADIO-WORK-START 5
   1038 > radio_work add test3
   1039 6
   1040 > radio_work add test4
   1041 7
   1042 > radio_work show
   1043 ext:test2 freq=2412 timeout=60@wlan0:2412:1:9.751844
   1044 ext:test3@wlan0:0:0:5.071812
   1045 ext:test4@wlan0:0:0:3.143870
   1046 > radio_work done 6
   1047 OK
   1048 > radio_work show
   1049 ext:test2 freq=2412 timeout=60@wlan0:2412:1:16.287869
   1050 ext:test4@wlan0:0:0:9.679895
   1051 > radio_work done 5
   1052 OK
   1053 <3>EXT-RADIO-WORK-START 7
   1054 <3>EXT-RADIO-WORK-TIMEOUT 7
   1055 

README-HS20

      1 wpa_supplicant and Hotspot 2.0
      2 ==============================
      3 
      4 This document describe how the IEEE 802.11u Interworking and Wi-Fi
      5 Hotspot 2.0 (Release 1) implementation in wpa_supplicant can be
      6 configured and how an external component on the client e.g., management
      7 GUI or Wi-Fi framework) is used to manage this functionality.
      8 
      9 
     10 Introduction to Wi-Fi Hotspot 2.0
     11 ---------------------------------
     12 
     13 Hotspot 2.0 is the name of the Wi-Fi Alliance specification that is used
     14 in the Wi-Fi CERTIFIED Passpoint<TM> program. More information about
     15 this is available in this white paper:
     16 
     17 http://www.wi-fi.org/knowledge-center/white-papers/wi-fi-certified-passpoint%E2%84%A2-new-program-wi-fi-alliance%C2%AE-enable-seamless
     18 
     19 The Hotspot 2.0 specification is also available from WFA:
     20 https://www.wi-fi.org/knowledge-center/published-specifications
     21 
     22 The core Interworking functionality (network selection, GAS/ANQP) were
     23 standardized in IEEE Std 802.11u-2011 which is now part of the IEEE Std
     24 802.11-2012.
     25 
     26 
     27 wpa_supplicant network selection
     28 --------------------------------
     29 
     30 Interworking support added option for configuring credentials that can
     31 work with multiple networks as an alternative to configuration of
     32 network blocks (e.g., per-SSID parameters). When requested to perform
     33 network selection, wpa_supplicant picks the highest priority enabled
     34 network block or credential. If a credential is picked (based on ANQP
     35 information from APs), a temporary network block is created
     36 automatically for the matching network. This temporary network block is
     37 used similarly to the network blocks that can be configured by the user,
     38 but it is not stored into the configuration file and is meant to be used
     39 only for temporary period of time since a new one can be created
     40 whenever needed based on ANQP information and the credential.
     41 
     42 By default, wpa_supplicant is not using automatic network selection
     43 unless requested explicitly with the interworking_select command. This
     44 can be changed with the auto_interworking=1 parameter to perform network
     45 selection automatically whenever trying to find a network for connection
     46 and none of the enabled network blocks match with the scan results. This
     47 case works similarly to "interworking_select auto", i.e., wpa_supplicant
     48 will internally determine which network or credential is going to be
     49 used based on configured priorities, scan results, and ANQP information.
     50 
     51 
     52 wpa_supplicant configuration
     53 ----------------------------
     54 
     55 Interworking and Hotspot 2.0 functionality are optional components that
     56 need to be enabled in the wpa_supplicant build configuration
     57 (.config). This is done by adding following parameters into that file:
     58 
     59 CONFIG_INTERWORKING=y
     60 CONFIG_HS20=y
     61 
     62 It should be noted that this functionality requires a driver that
     63 supports GAS/ANQP operations. This uses the same design as P2P, i.e.,
     64 Action frame processing and building in user space within
     65 wpa_supplicant. The Linux nl80211 driver interface provides the needed
     66 functionality for this.
     67 
     68 
     69 There are number of run-time configuration parameters (e.g., in
     70 wpa_supplicant.conf when using the configuration file) that can be used
     71 to control Hotspot 2.0 operations.
     72 
     73 # Enable Interworking
     74 interworking=1
     75 
     76 # Enable Hotspot 2.0
     77 hs20=1
     78 
     79 # Parameters for controlling scanning
     80 
     81 # Homogenous ESS identifier
     82 # If this is set, scans will be used to request response only from BSSes
     83 # belonging to the specified Homogeneous ESS. This is used only if interworking
     84 # is enabled.
     85 #hessid=00:11:22:33:44:55
     86 
     87 # Access Network Type
     88 # When Interworking is enabled, scans can be limited to APs that advertise the
     89 # specified Access Network Type (0..15; with 15 indicating wildcard match).
     90 # This value controls the Access Network Type value in Probe Request frames.
     91 #access_network_type=15
     92 
     93 # Automatic network selection behavior
     94 # 0 = do not automatically go through Interworking network selection
     95 #     (i.e., require explicit interworking_select command for this; default)
     96 # 1 = perform Interworking network selection if one or more
     97 #     credentials have been configured and scan did not find a
     98 #     matching network block
     99 #auto_interworking=0
    100 
    101 
    102 Credentials can be pre-configured for automatic network selection:
    103 
    104 # credential block
    105 #
    106 # Each credential used for automatic network selection is configured as a set
    107 # of parameters that are compared to the information advertised by the APs when
    108 # interworking_select and interworking_connect commands are used.
    109 #
    110 # credential fields:
    111 #
    112 # temporary: Whether this credential is temporary and not to be saved
    113 #
    114 # priority: Priority group
    115 #	By default, all networks and credentials get the same priority group
    116 #	(0). This field can be used to give higher priority for credentials
    117 #	(and similarly in struct wpa_ssid for network blocks) to change the
    118 #	Interworking automatic networking selection behavior. The matching
    119 #	network (based on either an enabled network block or a credential)
    120 #	with the highest priority value will be selected.
    121 #
    122 # pcsc: Use PC/SC and SIM/USIM card
    123 #
    124 # realm: Home Realm for Interworking
    125 #
    126 # username: Username for Interworking network selection
    127 #
    128 # password: Password for Interworking network selection
    129 #
    130 # ca_cert: CA certificate for Interworking network selection
    131 #
    132 # client_cert: File path to client certificate file (PEM/DER)
    133 #	This field is used with Interworking networking selection for a case
    134 #	where client certificate/private key is used for authentication
    135 #	(EAP-TLS). Full path to the file should be used since working
    136 #	directory may change when wpa_supplicant is run in the background.
    137 #
    138 #	Alternatively, a named configuration blob can be used by setting
    139 #	this to blob://blob_name.
    140 #
    141 # private_key: File path to client private key file (PEM/DER/PFX)
    142 #	When PKCS#12/PFX file (.p12/.pfx) is used, client_cert should be
    143 #	commented out. Both the private key and certificate will be read
    144 #	from the PKCS#12 file in this case. Full path to the file should be
    145 #	used since working directory may change when wpa_supplicant is run
    146 #	in the background.
    147 #
    148 #	Windows certificate store can be used by leaving client_cert out and
    149 #	configuring private_key in one of the following formats:
    150 #
    151 #	cert://substring_to_match
    152 #
    153 #	hash://certificate_thumbprint_in_hex
    154 #
    155 #	For example: private_key="hash://63093aa9c47f56ae88334c7b65a4"
    156 #
    157 #	Note that when running wpa_supplicant as an application, the user
    158 #	certificate store (My user account) is used, whereas computer store
    159 #	(Computer account) is used when running wpasvc as a service.
    160 #
    161 #	Alternatively, a named configuration blob can be used by setting
    162 #	this to blob://blob_name.
    163 #
    164 # private_key_passwd: Password for private key file
    165 #
    166 # imsi: IMSI in <MCC> | <MNC> | '-' | <MSIN> format
    167 #
    168 # milenage: Milenage parameters for SIM/USIM simulator in <Ki>:<OPc>:<SQN>
    169 #	format
    170 #
    171 # domain_suffix_match: Constraint for server domain name
    172 #	If set, this FQDN is used as a suffix match requirement for the AAA
    173 #	server certificate in SubjectAltName dNSName element(s). If a
    174 #	matching dNSName is found, this constraint is met. If no dNSName
    175 #	values are present, this constraint is matched against SubjectName CN
    176 #	using same suffix match comparison. Suffix match here means that the
    177 #	host/domain name is compared one label at a time starting from the
    178 #	top-level domain and all the labels in @domain_suffix_match shall be
    179 #	included in the certificate. The certificate may include additional
    180 #	sub-level labels in addition to the required labels.
    181 #
    182 #	For example, domain_suffix_match=example.com would match
    183 #	test.example.com but would not match test-example.com.
    184 #
    185 # domain: Home service provider FQDN(s)
    186 #	This is used to compare against the Domain Name List to figure out
    187 #	whether the AP is operated by the Home SP. Multiple domain entries can
    188 #	be used to configure alternative FQDNs that will be considered home
    189 #	networks.
    190 #
    191 # roaming_consortium: Roaming Consortium OI
    192 #	If roaming_consortium_len is non-zero, this field contains the
    193 #	Roaming Consortium OI that can be used to determine which access
    194 #	points support authentication with this credential. This is an
    195 #	alternative to the use of the realm parameter. When using Roaming
    196 #	Consortium to match the network, the EAP parameters need to be
    197 #	pre-configured with the credential since the NAI Realm information
    198 #	may not be available or fetched.
    199 #
    200 # eap: Pre-configured EAP method
    201 #	This optional field can be used to specify which EAP method will be
    202 #	used with this credential. If not set, the EAP method is selected
    203 #	automatically based on ANQP information (e.g., NAI Realm).
    204 #
    205 # phase1: Pre-configure Phase 1 (outer authentication) parameters
    206 #	This optional field is used with like the 'eap' parameter.
    207 #
    208 # phase2: Pre-configure Phase 2 (inner authentication) parameters
    209 #	This optional field is used with like the 'eap' parameter.
    210 #
    211 # excluded_ssid: Excluded SSID
    212 #	This optional field can be used to excluded specific SSID(s) from
    213 #	matching with the network. Multiple entries can be used to specify more
    214 #	than one SSID.
    215 #
    216 # roaming_partner: Roaming partner information
    217 #	This optional field can be used to configure preferences between roaming
    218 #	partners. The field is a string in following format:
    219 #	<FQDN>,<0/1 exact match>,<priority>,<* or country code>
    220 #	(non-exact match means any subdomain matches the entry; priority is in
    221 #	0..255 range with 0 being the highest priority)
    222 #
    223 # update_identifier: PPS MO ID
    224 #	(Hotspot 2.0 PerProviderSubscription/UpdateIdentifier)
    225 #
    226 # provisioning_sp: FQDN of the SP that provisioned the credential
    227 #	This optional field can be used to keep track of the SP that provisioned
    228 #	the credential to find the PPS MO (./Wi-Fi/<provisioning_sp>).
    229 #
    230 # sp_priority: Credential priority within a provisioning SP
    231 #	This is the priority of the credential among all credentials
    232 #	provisionined by the same SP (i.e., for entries that have identical
    233 #	provisioning_sp value). The range of this priority is 0-255 with 0
    234 #	being the highest and 255 the lower priority.
    235 #
    236 # Minimum backhaul threshold (PPS/<X+>/Policy/MinBackhauldThreshold/*)
    237 #	These fields can be used to specify minimum download/upload backhaul
    238 #	bandwidth that is preferred for the credential. This constraint is
    239 #	ignored if the AP does not advertise WAN Metrics information or if the
    240 #	limit would prevent any connection. Values are in kilobits per second.
    241 # min_dl_bandwidth_home
    242 # min_ul_bandwidth_home
    243 # min_dl_bandwidth_roaming
    244 # min_ul_bandwidth_roaming
    245 #
    246 # max_bss_load: Maximum BSS Load Channel Utilization (1..255)
    247 #	(PPS/<X+>/Policy/MaximumBSSLoadValue)
    248 #	This value is used as the maximum channel utilization for network
    249 #	selection purposes for home networks. If the AP does not advertise
    250 #	BSS Load or if the limit would prevent any connection, this constraint
    251 #	will be ignored.
    252 #
    253 # req_conn_capab: Required connection capability
    254 #	(PPS/<X+>/Policy/RequiredProtoPortTuple)
    255 #	This value is used to configure set of required protocol/port pairs that
    256 #	a roaming network shall support (include explicitly in Connection
    257 #	Capability ANQP element). This constraint is ignored if the AP does not
    258 #	advertise Connection Capability or if this constraint would prevent any
    259 #	network connection. This policy is not used in home networks.
    260 #	Format: <protocol>[:<comma-separated list of ports]
    261 #	Multiple entries can be used to list multiple requirements.
    262 #	For example, number of common TCP protocols:
    263 #	req_conn_capab=6:22,80,443
    264 #	For example, IPSec/IKE:
    265 #	req_conn_capab=17:500
    266 #	req_conn_capab=50
    267 #
    268 # ocsp: Whether to use/require OCSP to check server certificate
    269 #	0 = do not use OCSP stapling (TLS certificate status extension)
    270 #	1 = try to use OCSP stapling, but not require response
    271 #	2 = require valid OCSP stapling response
    272 #
    273 # sim_num: Identifier for which SIM to use in multi-SIM devices
    274 #
    275 # for example:
    276 #
    277 #cred={
    278 #	realm="example.com"
    279 #	username="user (a] example.com"
    280 #	password="password"
    281 #	ca_cert="/etc/wpa_supplicant/ca.pem"
    282 #	domain="example.com"
    283 #	domain_suffix_match="example.com"
    284 #}
    285 #
    286 #cred={
    287 #	imsi="310026-000000000"
    288 #	milenage="90dca4eda45b53cf0f12d7c9c3bc6a89:cb9cccc4b9258e6dca4760379fb82"
    289 #}
    290 #
    291 #cred={
    292 #	realm="example.com"
    293 #	username="user"
    294 #	password="password"
    295 #	ca_cert="/etc/wpa_supplicant/ca.pem"
    296 #	domain="example.com"
    297 #	roaming_consortium=223344
    298 #	eap=TTLS
    299 #	phase2="auth=MSCHAPV2"
    300 #}
    301 
    302 
    303 Control interface
    304 -----------------
    305 
    306 wpa_supplicant provides a control interface that can be used from
    307 external programs to manage various operations. The included command
    308 line tool, wpa_cli, can be used for manual testing with this interface.
    309 
    310 Following wpa_cli interactive mode commands show some examples of manual
    311 operations related to Hotspot 2.0:
    312 
    313 Remove configured networks and credentials:
    314 
    315 > remove_network all
    316 OK
    317 > remove_cred all
    318 OK
    319 
    320 
    321 Add a username/password credential:
    322 
    323 > add_cred
    324 0
    325 > set_cred 0 realm "mail.example.com"
    326 OK
    327 > set_cred 0 username "username"
    328 OK
    329 > set_cred 0 password "password"
    330 OK
    331 > set_cred 0 priority 1
    332 OK
    333 > set_cred 0 temporary 1
    334 OK
    335 
    336 Add a SIM credential using a simulated SIM/USIM card for testing:
    337 
    338 > add_cred
    339 1
    340 > set_cred 1 imsi "23456-0000000000"
    341 OK
    342 > set_cred 1 milenage "90dca4eda45b53cf0f12d7c9c3bc6a89:cb9cccc4b9258e6dca4760379fb82581:000000000123"
    343 OK
    344 > set_cred 1 priority 1
    345 OK
    346 
    347 Note: the return value of add_cred is used as the first argument to
    348 the following set_cred commands.
    349 
    350 Add a SIM credential using a external SIM/USIM processing:
    351 
    352 > set external_sim 1
    353 OK
    354 > add_cred
    355 1
    356 > set_cred 1 imsi "23456-0000000000"
    357 OK
    358 > set_cred 1 eap SIM
    359 OK
    360 
    361 
    362 Add a WPA2-Enterprise network:
    363 
    364 > add_network
    365 0
    366 > set_network 0 key_mgmt WPA-EAP
    367 OK
    368 > set_network 0 ssid "enterprise"
    369 OK
    370 > set_network 0 eap TTLS
    371 OK
    372 > set_network 0 anonymous_identity "anonymous"
    373 OK
    374 > set_network 0 identity "user"
    375 OK
    376 > set_network 0 password "password"
    377 OK
    378 > set_network 0 priority 0
    379 OK
    380 > enable_network 0 no-connect
    381 OK
    382 
    383 
    384 Add an open network:
    385 
    386 > add_network
    387 3
    388 > set_network 3 key_mgmt NONE
    389 OK
    390 > set_network 3 ssid "coffee-shop"
    391 OK
    392 > select_network 3
    393 OK
    394 
    395 Note: the return value of add_network is used as the first argument to
    396 the following set_network commands.
    397 
    398 The preferred credentials/networks can be indicated with the priority
    399 parameter (1 is higher priority than 0).
    400 
    401 
    402 Interworking network selection can be started with interworking_select
    403 command. This instructs wpa_supplicant to run a network scan and iterate
    404 through the discovered APs to request ANQP information from the APs that
    405 advertise support for Interworking/Hotspot 2.0:
    406 
    407 > interworking_select
    408 OK
    409 <3>Starting ANQP fetch for 02:00:00:00:01:00
    410 <3>RX-ANQP 02:00:00:00:01:00 ANQP Capability list
    411 <3>RX-ANQP 02:00:00:00:01:00 Roaming Consortium list
    412 <3>RX-HS20-ANQP 02:00:00:00:01:00 HS Capability List
    413 <3>ANQP fetch completed
    414 <3>INTERWORKING-AP 02:00:00:00:01:00 type=unknown
    415 
    416 
    417 INTERWORKING-AP event messages indicate the APs that support network
    418 selection and for which there is a matching
    419 credential. interworking_connect command can be used to select a network
    420 to connect with:
    421 
    422 
    423 > interworking_connect 02:00:00:00:01:00
    424 OK
    425 <3>CTRL-EVENT-SCAN-RESULTS
    426 <3>SME: Trying to authenticate with 02:00:00:00:01:00 (SSID='Example Network' freq=2412 MHz)
    427 <3>Trying to associate with 02:00:00:00:01:00 (SSID='Example Network' freq=2412 MHz)
    428 <3>Associated with 02:00:00:00:01:00
    429 <3>CTRL-EVENT-EAP-STARTED EAP authentication started
    430 <3>CTRL-EVENT-EAP-PROPOSED-METHOD vendor=0 method=21
    431 <3>CTRL-EVENT-EAP-METHOD EAP vendor 0 method 21 (TTLS) selected
    432 <3>CTRL-EVENT-EAP-SUCCESS EAP authentication completed successfully
    433 <3>WPA: Key negotiation completed with 02:00:00:00:01:00 [PTK=CCMP GTK=CCMP]
    434 <3>CTRL-EVENT-CONNECTED - Connection to 02:00:00:00:01:00 completed (auth) [id=0 id_str=]
    435 
    436 
    437 wpa_supplicant creates a temporary network block for the selected
    438 network based on the configured credential and ANQP information from the
    439 AP:
    440 
    441 > list_networks
    442 network id / ssid / bssid / flags
    443 0	Example Network	any	[CURRENT]
    444 > get_network 0 key_mgmt
    445 WPA-EAP
    446 > get_network 0 eap
    447 TTLS
    448 
    449 
    450 Alternatively to using an external program to select the network,
    451 "interworking_select auto" command can be used to request wpa_supplicant
    452 to select which network to use based on configured priorities:
    453 
    454 
    455 > remove_network all
    456 OK
    457 <3>CTRL-EVENT-DISCONNECTED bssid=02:00:00:00:01:00 reason=1 locally_generated=1
    458 > interworking_select auto
    459 OK
    460 <3>Starting ANQP fetch for 02:00:00:00:01:00
    461 <3>RX-ANQP 02:00:00:00:01:00 ANQP Capability list
    462 <3>RX-ANQP 02:00:00:00:01:00 Roaming Consortium list
    463 <3>RX-HS20-ANQP 02:00:00:00:01:00 HS Capability List
    464 <3>ANQP fetch completed
    465 <3>INTERWORKING-AP 02:00:00:00:01:00 type=unknown
    466 <3>CTRL-EVENT-SCAN-RESULTS
    467 <3>SME: Trying to authenticate with 02:00:00:00:01:00 (SSID='Example Network' freq=2412 MHz)
    468 <3>Trying to associate with 02:00:00:00:01:00 (SSID='Example Network' freq=2412 MHz)
    469 <3>Associated with 02:00:00:00:01:00
    470 <3>CTRL-EVENT-EAP-STARTED EAP authentication started
    471 <3>CTRL-EVENT-EAP-PROPOSED-METHOD vendor=0 method=21
    472 <3>CTRL-EVENT-EAP-METHOD EAP vendor 0 method 21 (TTLS) selected
    473 <3>CTRL-EVENT-EAP-SUCCESS EAP authentication completed successfully
    474 <3>WPA: Key negotiation completed with 02:00:00:00:01:00 [PTK=CCMP GTK=CCMP]
    475 <3>CTRL-EVENT-CONNECTED - Connection to 02:00:00:00:01:00 completed (reauth) [id=0 id_str=]
    476 
    477 
    478 The connection status can be shown with the status command:
    479 
    480 > status
    481 bssid=02:00:00:00:01:00
    482 ssid=Example Network
    483 id=0
    484 mode=station
    485 pairwise_cipher=CCMP       <--- link layer security indication
    486 group_cipher=CCMP
    487 key_mgmt=WPA2/IEEE 802.1X/EAP
    488 wpa_state=COMPLETED
    489 p2p_device_address=02:00:00:00:00:00
    490 address=02:00:00:00:00:00
    491 hs20=1      <--- HS 2.0 indication
    492 Supplicant PAE state=AUTHENTICATED
    493 suppPortStatus=Authorized
    494 EAP state=SUCCESS
    495 selectedMethod=21 (EAP-TTLS)
    496 EAP TLS cipher=AES-128-SHA
    497 EAP-TTLSv0 Phase2 method=PAP
    498 
    499 
    500 > status
    501 bssid=02:00:00:00:02:00
    502 ssid=coffee-shop
    503 id=3
    504 mode=station
    505 pairwise_cipher=NONE
    506 group_cipher=NONE
    507 key_mgmt=NONE
    508 wpa_state=COMPLETED
    509 p2p_device_address=02:00:00:00:00:00
    510 address=02:00:00:00:00:00
    511 
    512 
    513 Note: The Hotspot 2.0 indication is shown as "hs20=1" in the status
    514 command output. Link layer security is indicated with the
    515 pairwise_cipher (CCMP = secure, NONE = no encryption used).
    516 
    517 
    518 Also the scan results include the Hotspot 2.0 indication:
    519 
    520 > scan_results
    521 bssid / frequency / signal level / flags / ssid
    522 02:00:00:00:01:00	2412	-30	[WPA2-EAP-CCMP][ESS][HS20]	Example Network
    523 
    524 
    525 ANQP information for the BSS can be fetched using the BSS command:
    526 
    527 > bss 02:00:00:00:01:00
    528 id=1
    529 bssid=02:00:00:00:01:00
    530 freq=2412
    531 beacon_int=100
    532 capabilities=0x0411
    533 qual=0
    534 noise=-92
    535 level=-30
    536 tsf=1345573286517276
    537 age=105
    538 ie=000f4578616d706c65204e6574776f726b010882848b960c1218240301012a010432043048606c30140100000fac040100000fac040100000fac0100007f04000000806b091e07010203040506076c027f006f1001531122331020304050010203040506dd05506f9a1000
    539 flags=[WPA2-EAP-CCMP][ESS][HS20]
    540 ssid=Example Network
    541 anqp_roaming_consortium=031122330510203040500601020304050603fedcba
    542 
    543 
    544 ANQP queries can also be requested with the anqp_get and hs20_anqp_get
    545 commands:
    546 
    547 > anqp_get 02:00:00:00:01:00 261
    548 OK
    549 <3>RX-ANQP 02:00:00:00:01:00 Roaming Consortium list
    550 > hs20_anqp_get 02:00:00:00:01:00 2
    551 OK
    552 <3>RX-HS20-ANQP 02:00:00:00:01:00 HS Capability List
    553 
    554 In addition, fetch_anqp command can be used to request similar set of
    555 ANQP queries to be done as is run as part of interworking_select:
    556 
    557 > scan
    558 OK
    559 <3>CTRL-EVENT-SCAN-RESULTS
    560 > fetch_anqp
    561 OK
    562 <3>Starting ANQP fetch for 02:00:00:00:01:00
    563 <3>RX-ANQP 02:00:00:00:01:00 ANQP Capability list
    564 <3>RX-ANQP 02:00:00:00:01:00 Roaming Consortium list
    565 <3>RX-HS20-ANQP 02:00:00:00:01:00 HS Capability List
    566 <3>ANQP fetch completed
    567 

README-P2P

      1 wpa_supplicant and Wi-Fi P2P
      2 ============================
      3 
      4 This document describes how the Wi-Fi P2P implementation in
      5 wpa_supplicant can be configured and how an external component on the
      6 client (e.g., management GUI) is used to enable WPS enrollment and
      7 registrar registration.
      8 
      9 
     10 Introduction to Wi-Fi P2P
     11 -------------------------
     12 
     13 TODO
     14 
     15 More information about Wi-Fi P2P is available from Wi-Fi Alliance:
     16 http://www.wi-fi.org/Wi-Fi_Direct.php
     17 
     18 
     19 wpa_supplicant implementation
     20 -----------------------------
     21 
     22 TODO
     23 
     24 
     25 wpa_supplicant configuration
     26 ----------------------------
     27 
     28 Wi-Fi P2P is an optional component that needs to be enabled in the
     29 wpa_supplicant build configuration (.config). Here is an example
     30 configuration that includes Wi-Fi P2P support and Linux nl80211
     31 -based driver interface:
     32 
     33 CONFIG_DRIVER_NL80211=y
     34 CONFIG_CTRL_IFACE=y
     35 CONFIG_P2P=y
     36 CONFIG_AP=y
     37 CONFIG_WPS=y
     38 
     39 
     40 In run-time configuration file (wpa_supplicant.conf), some parameters
     41 for P2P may be set. In order to make the devices easier to recognize,
     42 device_name and device_type should be specified. For example,
     43 something like this should be included:
     44 
     45 ctrl_interface=/var/run/wpa_supplicant
     46 device_name=My P2P Device
     47 device_type=1-0050F204-1
     48 
     49 
     50 wpa_cli
     51 -------
     52 
     53 Actual Wi-Fi P2P operations are requested during runtime. These can be
     54 done for example using wpa_cli (which is described below) or a GUI
     55 like wpa_gui-qt4.
     56 
     57 
     58 wpa_cli starts in interactive mode if no command string is included on
     59 the command line. By default, it will select the first network interface
     60 that it can find (and that wpa_supplicant controls). If more than one
     61 interface is in use, it may be necessary to select one of the explicitly
     62 by adding -i argument on the command line (e.g., 'wpa_cli -i wlan1').
     63 
     64 Most of the P2P operations are done on the main interface (e.g., the
     65 interface that is automatically added when the driver is loaded, e.g.,
     66 wlan0). When using a separate virtual interface for group operations
     67 (e.g., wlan1), the control interface for that group interface may need
     68 to be used for some operations (mainly WPS activation in GO). This may
     69 change in the future so that all the needed operations could be done
     70 over the main control interface.
     71 
     72 Device Discovery
     73 
     74 p2p_find [timeout in seconds] [type=<social|progressive>] \
     75 	[dev_id=<addr>] [dev_type=<device type>] \
     76 	[delay=<search delay in ms>] [seek=<service name>] [freq=<MHz>]
     77 
     78 The default behavior is to run a single full scan in the beginning and
     79 then scan only social channels. type=social will scan only social
     80 channels, i.e., it skips the initial full scan. type=progressive is
     81 like the default behavior, but it will scan through all the channels
     82 progressively one channel at the time in the Search state rounds. This
     83 will help in finding new groups or groups missed during the initial
     84 full scan. When the type parameter is not included (i.e., full scan), the
     85 optional freq parameter can be used to override the first scan to use only
     86 the specified channel after which only social channels are scanned.
     87 
     88 The optional dev_id option can be used to specify a single P2P peer to
     89 search for. The optional delay parameter can be used to request an extra
     90 delay to be used between search iterations (e.g., to free up radio
     91 resources for concurrent operations).
     92 
     93 The optional dev_type option can be used to specify a single device type
     94 (primary or secondary) to search for, e.g.,
     95 "p2p_find dev_type=1-0050F204-1".
     96 
     97 
     98 With one or more seek arguments, the command sends Probe Request frames
     99 for a P2PS service. For example,
    100 p2p_find 5 dev_id=11:22:33:44:55:66 seek=alt.example.chat seek=alt.example.video
    101 
    102 Parameters description:
    103     Timeout - Optional ASCII base-10-encoded u16. If missing, request will not
    104 	time out and must be canceled manually
    105     dev_id - Optional to request responses from a single known remote device
    106     Service Name - Mandatory UTF-8 string for ASP seeks
    107 	Service name must match the remote service being advertised exactly
    108 	(no prefix matching).
    109 	Service name may be empty, in which case all ASP services will be
    110 	returned, and may be filtered with p2p_serv_disc_req settings, and
    111 	p2p_serv_asp_resp results.
    112 	Multiple service names may be requested, but if it exceeds internal
    113 	limit, it will automatically revert to requesting all ASP services.
    114 
    115 p2p_listen [timeout in seconds]
    116 
    117 Start Listen-only state (become discoverable without searching for
    118 other devices). Optional parameter can be used to specify the duration
    119 for the Listen operation in seconds. This command may not be of that
    120 much use during normal operations and is mainly designed for
    121 testing. It can also be used to keep the device discoverable without
    122 having to maintain a group.
    123 
    124 p2p_stop_find
    125 
    126 Stop ongoing P2P device discovery or other operation (connect, listen
    127 mode).
    128 
    129 p2p_flush
    130 
    131 Flush P2P peer table and state.
    132 
    133 Group Formation
    134 
    135 p2p_prov_disc <peer device address> <display|keypad|pbc> [join|auto]
    136 
    137 Send P2P provision discovery request to the specified peer. The
    138 parameters for this command are the P2P device address of the peer and
    139 the desired configuration method. For example, "p2p_prov_disc
    140 02:01:02:03:04:05 display" would request the peer to display a PIN for
    141 us and "p2p_prov_disc 02:01:02:03:04:05 keypad" would request the peer
    142 to enter a PIN that we display.
    143 
    144 The optional "join" parameter can be used to indicate that this command
    145 is requesting an already running GO to prepare for a new client. This is
    146 mainly used with "display" to request it to display a PIN. The "auto"
    147 parameter can be used to request wpa_supplicant to automatically figure
    148 out whether the peer device is operating as a GO and if so, use
    149 join-a-group style PD instead of GO Negotiation style PD.
    150 
    151 p2p_connect <peer device address> <pbc|pin|PIN#|p2ps> [display|keypad|p2ps]
    152 	[persistent|persistent=<network id>] [join|auth]
    153 	[go_intent=<0..15>] [freq=<in MHz>] [ht40] [vht] [provdisc] [auto]
    154 
    155 Start P2P group formation with a discovered P2P peer. This includes
    156 optional group owner negotiation, group interface setup, provisioning,
    157 and establishing data connection.
    158 
    159 The <pbc|pin|PIN#> parameter specifies the WPS provisioning
    160 method. "pbc" string starts pushbutton method, "pin" string start PIN
    161 method using an automatically generated PIN (which will be returned as
    162 the command return code), PIN# means that a pre-selected PIN can be
    163 used (e.g., 12345670). [display|keypad] is used with PIN method
    164 to specify which PIN is used (display=dynamically generated random PIN
    165 from local display, keypad=PIN entered from peer display). "persistent"
    166 parameter can be used to request a persistent group to be formed. The
    167 "persistent=<network id>" alternative can be used to pre-populate
    168 SSID/passphrase configuration based on a previously used persistent
    169 group where this device was the GO. The previously used parameters will
    170 then be used if the local end becomes the GO in GO Negotiation (which
    171 can be forced with go_intent=15).
    172 
    173 "join" indicates that this is a command to join an existing group as a
    174 client. It skips the GO Negotiation part. This will send a Provision
    175 Discovery Request message to the target GO before associating for WPS
    176 provisioning.
    177 
    178 "auth" indicates that the WPS parameters are authorized for the peer
    179 device without actually starting GO Negotiation (i.e., the peer is
    180 expected to initiate GO Negotiation). This is mainly for testing
    181 purposes.
    182 
    183 "go_intent" can be used to override the default GO Intent for this GO
    184 Negotiation.
    185 
    186 "freq" can be used to set a forced operating channel (e.g., freq=2412
    187 to select 2.4 GHz channel 1).
    188 
    189 "provdisc" can be used to request a Provision Discovery exchange to be
    190 used prior to starting GO Negotiation as a workaround with some deployed
    191 P2P implementations that require this to allow the user to accept the
    192 connection.
    193 
    194 "auto" can be used to request wpa_supplicant to automatically figure
    195 out whether the peer device is operating as a GO and if so, use
    196 join-a-group operation rather than GO Negotiation.
    197 
    198 P2PS attribute changes to p2p_connect command:
    199 
    200 P2PS supports two WPS provisioning methods namely PIN method and P2PS default.
    201 The remaining paramters hold same role as in legacy P2P. In case of P2PS default
    202 config method "p2ps" keyword is added in p2p_connect command.
    203 
    204 For example:
    205 p2p_connect 02:0a:f5:85:11:00 12345670 p2ps persistent join
    206 	(WPS Method = P2PS default)
    207 
    208 p2p_connect 02:0a:f5:85:11:00 45629034 keypad persistent
    209 	(WPS Method = PIN)
    210 
    211 p2p_asp_provision <peer MAC address> <adv_id=peer adv id>
    212 	<adv_mac=peer MAC address> [role=2|4|1] <session=session id>
    213 	<session_mac=initiator mac address>
    214 	[info='service info'] <method=Default|keypad|Display>
    215 
    216 This command starts provision discovery with the P2PS enabled peer device.
    217 
    218 For example,
    219 p2p_asp_provision 00:11:22:33:44:55 adv_id=4d6fc7 adv_mac=00:55:44:33:22:11 role=1 session=12ab34 session_mac=00:11:22:33:44:55 info='name=john' method=1000
    220 
    221 Parameter description:
    222     MAC address - Mandatory
    223     adv_id - Mandatory remote Advertising ID of service connection is being
    224 	established for
    225     adv_mac - Mandatory MAC address that owns/registered the service
    226     role - Optional
    227 	2 (group client only) or 4 (group owner only)
    228 	if not present (or 1) role is negotiated by the two peers.
    229     session - Mandatory Session ID of the first session to be established
    230     session_mac - Mandatory MAC address that owns/initiated the session
    231     method - Optional method to request for provisioning (1000 - P2PS Default,
    232 	100 - Keypad(PIN), 8 - Display(PIN))
    233     info - Optional UTF-8 string. Hint for service to indicate possible usage
    234 	parameters - Escape single quote & backslash:
    235 	with a backslash 0x27 == ' == \', and 0x5c == \ == \\
    236 
    237 p2p_asp_provision_resp <peer mac address> <adv_id= local adv id>
    238 	<adv_mac=local MAC address> <role=1|2|4> <status=0>
    239 	<session=session id> <session_mac=peer MAC address>
    240 
    241 This command sends a provision discovery response from responder side.
    242 
    243 For example,
    244 p2p_asp_provision_resp 00:55:44:33:22:11 adv_id=4d6fc7 adv_mac=00:55:44:33:22:11 role=1 status=0 session=12ab34 session_mac=00:11:22:33:44:55
    245 
    246 Parameters definition:
    247     MAC address - Mandatory
    248     adv_id - Mandatory local Advertising ID of service connection is being
    249 	established for
    250     adv_mac - Mandatory MAC address that owns/registered the service
    251     role -  Optional 2 (group client only) or 4 (group owner only)
    252 	if not present (or 1) role is negotiated by the two peers.
    253     status - Mandatory Acceptance/Rejection code of Provisioning
    254     session - Mandatory Session ID of the first session to be established
    255     session_mac - Mandatory MAC address that owns/initiated the session
    256 
    257 p2p_group_add [persistent|persistent=<network id>] [freq=<freq in MHz>]
    258 	[ht40] [vht]
    259 
    260 Set up a P2P group owner manually (i.e., without group owner
    261 negotiation with a specific peer). This is also known as autonomous
    262 GO. Optional persistent=<network id> can be used to specify restart of
    263 a persistent group. Optional freq=<freq in MHz> can be used to force
    264 the GO to be started on a specific frequency. Special freq=2 or freq=5
    265 options can be used to request the best 2.4 GHz or 5 GHz band channel
    266 to be selected automatically.
    267 
    268 p2p_reject <peer device address>
    269 
    270 Reject connection attempt from a peer (specified with a device
    271 address). This is a mechanism to reject a pending GO Negotiation with
    272 a peer and request to automatically block any further connection or
    273 discovery of the peer.
    274 
    275 p2p_group_remove <group interface>
    276 
    277 Terminate a P2P group. If a new virtual network interface was used for
    278 the group, it will also be removed. The network interface name of the
    279 group interface is used as a parameter for this command.
    280 
    281 p2p_cancel
    282 
    283 Cancel an ongoing P2P group formation and joining-a-group related
    284 operation. This operations unauthorizes the specific peer device (if any
    285 had been authorized to start group formation), stops P2P find (if in
    286 progress), stops pending operations for join-a-group, and removes the
    287 P2P group interface (if one was used) that is in the WPS provisioning
    288 step. If the WPS provisioning step has been completed, the group is not
    289 terminated.
    290 
    291 p2p_remove_client <peer's P2P Device Address|iface=<interface address>>
    292 
    293 This command can be used to remove the specified client from all groups
    294 (operating and persistent) from the local GO. Note that the peer device
    295 can rejoin the group if it is in possession of a valid key. See p2p_set
    296 per_sta_psk command below for more details on how the peer can be
    297 removed securely.
    298 
    299 Service Discovery
    300 
    301 p2p_service_add asp <auto accept> <adv id> <status 0/1> <Config Methods>
    302 	<Service name> [Service Information] [Response Info]
    303 
    304 This command can be used to search for a P2PS service which includes
    305 Play, Send, Display, and Print service. The parameters for this command
    306 are "asp" to identify the command as P2PS one, auto accept value,
    307 advertisement id which uniquely identifies the service requests, state
    308 of the service whether the service is available or not, config methods
    309 which can be either P2PS method or PIN method, service name followed by
    310 two optional parameters service information, and response info.
    311 
    312 For example,
    313 p2p_service_add asp 1 4d6fc7 0 1108 alt.example.chat svc_info='name=john' rsp_info='enter PIN 1234'
    314 
    315 Parameters definition:
    316     asp - Mandatory for ASP service registration
    317     auto accept - Mandatory ASCII hex-encoded boolean (0 == no auto-accept,
    318 	1 == auto-accept ANY role, 2 == auto-accept CLIENT role,
    319 	4 == auto-accept GO role)
    320     Advertisement ID - Mandatory non-zero ASCII hex-encoded u32
    321 	(Must be unique/not yet exist in svc db)
    322     State - Mandatory ASCII hex-encoded u8 (0 -- Svc not available,
    323 	1 -- Svc available, 2-0xff  Application defined)
    324     Config Methods - Mandatory ASCII hex-encoded u16 (bitmask of WSC config
    325 	methods)
    326     Service Name - Mandatory UTF-8 string
    327     Service Information - Optional UTF-8 string
    328 	Escape single quote & backslash with a backslash:
    329 	0x27 == ' == \', and 0x5c == \ == \\
    330     Session response information -  Optional (used only if auto accept is TRUE)
    331 	UTF-8 string
    332 	Escape single quote & backslash with a backslash:
    333 	0x27 == ' == \', and 0x5c == \ == \\
    334 
    335 p2p_service_rep asp <auto accept> <adv id> <status 0/1> <Config Methods>
    336 	<Service name> [Service Information] [Response Info]
    337 
    338 This command can be used to replace the existing service request
    339 attributes from the initiator side. The replacement is only allowed if
    340 the advertisement id issued in the command matches with any one entry in
    341 the list of existing SD queries. If advertisement id doesn't match the
    342 command returns a failure.
    343 
    344 For example,
    345 p2p_service_rep asp 1 4d6fc7 1 1108 alt.example.chat svc_info='name=john' rsp_info='enter PIN 1234'
    346 
    347 Parameters definition:
    348     asp - Mandatory for ASP service registration
    349     auto accept - Mandatory ASCII hex-encoded boolean (1 == true, 0 == false)
    350     Advertisement ID - Mandatory non-zero ASCII hex-encoded u32
    351 	(Must already exist in svc db)
    352     State - Mandatory ASCII hex-encoded u8 (can be used to indicate svc
    353 	available or not available for instance)
    354     Config Methods - Mandatory ASCII hex-encoded u16 (bitmask of WSC config
    355 	methods)
    356     Service Name - Mandatory UTF-8 string (Must match existing string in svc db)
    357     Service Information - Optional UTF-8 string
    358 	Escape single quote & backslash with a backslash:
    359 	0x27 == ' == \', and 0x5c == \ == \\
    360     Session response information -  Optional (used only if auto accept is TRUE)
    361 	UTF-8 string
    362 	Escape single quote & backslash with a backslash:
    363 	0x27 == ' == \', and 0x5c == \ == \\
    364 
    365 p2p_serv_disc_req
    366 
    367 Schedule a P2P service discovery request. The parameters for this
    368 command are the device address of the peer device (or 00:00:00:00:00:00
    369 for wildcard query that is sent to every discovered P2P peer that
    370 supports service discovery) and P2P Service Query TLV(s) as hexdump. For
    371 example,
    372 
    373 p2p_serv_disc_req 00:00:00:00:00:00 02000001
    374 
    375 schedules a request for listing all available services of all service
    376 discovery protocols and requests this to be sent to all discovered
    377 peers (note: this can result in long response frames). The pending
    378 requests are sent during device discovery (see p2p_find).
    379 
    380 There can be multiple pending peer device specific queries (each will be
    381 sent in sequence whenever the peer is found).
    382 
    383 This command returns an identifier for the pending query (e.g.,
    384 "1f77628") that can be used to cancel the request. Directed requests
    385 will be automatically removed when the specified peer has replied to
    386 it.
    387 
    388 Service Query TLV has following format:
    389 Length (2 octets, little endian) - length of following data
    390 Service Protocol Type (1 octet) - see the table below
    391 Service Transaction ID (1 octet) - nonzero identifier for the TLV
    392 Query Data (Length - 2 octets of data) - service protocol specific data
    393 
    394 Service Protocol Types:
    395 0 = All service protocols
    396 1 = Bonjour
    397 2 = UPnP
    398 3 = WS-Discovery
    399 4 = Wi-Fi Display
    400 
    401 For UPnP, an alternative command format can be used to specify a
    402 single query TLV (i.e., a service discovery for a specific UPnP
    403 service):
    404 
    405 p2p_serv_disc_req 00:00:00:00:00:00 upnp <version hex> <ST: from M-SEARCH>
    406 
    407 For example:
    408 
    409 p2p_serv_disc_req 00:00:00:00:00:00 upnp 10 urn:schemas-upnp-org:device:InternetGatewayDevice:1
    410 
    411 Additional examples for queries:
    412 
    413 # list of all Bonjour services
    414 p2p_serv_disc_req 00:00:00:00:00:00 02000101
    415 
    416 # list of all UPnP services
    417 p2p_serv_disc_req 00:00:00:00:00:00 02000201
    418 
    419 # list of all WS-Discovery services
    420 p2p_serv_disc_req 00:00:00:00:00:00 02000301
    421 
    422 # list of all Bonjour and UPnP services
    423 p2p_serv_disc_req 00:00:00:00:00:00 0200010102000202
    424 
    425 # Apple File Sharing over TCP
    426 p2p_serv_disc_req 00:00:00:00:00:00 130001010b5f6166706f766572746370c00c000c01
    427 
    428 # Bonjour SSTH (supported service type hash)
    429 p2p_serv_disc_req 00:00:00:00:00:00 05000101000000
    430 
    431 # UPnP examples
    432 p2p_serv_disc_req 00:00:00:00:00:00 upnp 10 ssdp:all
    433 p2p_serv_disc_req 00:00:00:00:00:00 upnp 10 upnp:rootdevice
    434 p2p_serv_disc_req 00:00:00:00:00:00 upnp 10 urn:schemas-upnp-org:service:ContentDirectory:2
    435 p2p_serv_disc_req 00:00:00:00:00:00 upnp 10 uuid:6859dede-8574-59ab-9332-123456789012
    436 p2p_serv_disc_req 00:00:00:00:00:00 upnp 10 urn:schemas-upnp-org:device:InternetGatewayDevice:1
    437 
    438 # Wi-Fi Display examples
    439 # format: wifi-display <list of roles> <list of subelements>
    440 p2p_serv_disc_req 00:00:00:00:00:00 wifi-display [source] 2,3,4,5
    441 p2p_serv_disc_req 02:01:02:03:04:05 wifi-display [pri-sink] 3
    442 p2p_serv_disc_req 00:00:00:00:00:00 wifi-display [sec-source] 2
    443 p2p_serv_disc_req 00:00:00:00:00:00 wifi-display [source+sink] 2,3,4,5
    444 p2p_serv_disc_req 00:00:00:00:00:00 wifi-display [source][pri-sink] 2,3,4,5
    445 
    446 p2p_serv_disc_req <Unicast|Broadcast mac address> asp <Transaction ID>
    447 	<Service Name> [Service Information]
    448 
    449 The command can be used for service discovery for P2PS enabled devices.
    450 
    451 For example: p2p_serv_disc_req 00:00:00:00:00:00 asp a1 alt.example 'john'
    452 
    453 Parameters definition:
    454     MAC address - Mandatory Existing
    455     asp - Mandatory for ASP queries
    456     Transaction ID - Mandatory non-zero ASCII hex-encoded u8 for GAS
    457     Service Name Prefix - Mandatory UTF-8 string.
    458 	Will match from beginning of remote Service Name
    459     Service Information Substring - Optional UTF-8 string
    460 	If Service Information Substring is not included, all services matching
    461 	Service Name Prefix will be returned.
    462 	If Service Information Substring is included, both the Substring and the
    463 	Service Name Prefix must match for service to be returned.
    464 	If remote service has no Service Information, all Substring searches
    465 	will fail.
    466 
    467 p2p_serv_disc_cancel_req <query identifier>
    468 
    469 Cancel a pending P2P service discovery request. This command takes a
    470 single parameter: identifier for the pending query (the value returned
    471 by p2p_serv_disc_req, e.g., "p2p_serv_disc_cancel_req 1f77628".
    472 
    473 p2p_serv_disc_resp
    474 
    475 Reply to a service discovery query. This command takes following
    476 parameters: frequency in MHz, destination address, dialog token,
    477 response TLV(s). The first three parameters are copied from the
    478 request event. For example, "p2p_serv_disc_resp 2437 02:40:61:c2:f3:b7
    479 1 0300000101". This command is used only if external program is used
    480 to process the request (see p2p_serv_disc_external).
    481 
    482 p2p_service_update
    483 
    484 Indicate that local services have changed. This is used to increment
    485 the P2P service indicator value so that peers know when previously
    486 cached information may have changed. This is only needed when external
    487 service discovery processing is enabled since the commands to
    488 pre-configure services for internal processing will increment the
    489 indicator automatically.
    490 
    491 p2p_serv_disc_external <0|1>
    492 
    493 Configure external processing of P2P service requests: 0 (default) =
    494 no external processing of requests (i.e., internal code will process
    495 each request based on pre-configured services), 1 = external
    496 processing of requests (external program is responsible for replying
    497 to service discovery requests with p2p_serv_disc_resp). Please note
    498 that there is quite strict limit on how quickly the response needs to
    499 be transmitted, so use of the internal processing is strongly
    500 recommended.
    501 
    502 p2p_service_add bonjour <query hexdump> <RDATA hexdump>
    503 
    504 Add a local Bonjour service for internal SD query processing.
    505 
    506 Examples:
    507 
    508 # AFP Over TCP (PTR)
    509 p2p_service_add bonjour 0b5f6166706f766572746370c00c000c01 074578616d706c65c027
    510 # AFP Over TCP (TXT) (RDATA=null)
    511 p2p_service_add bonjour 076578616d706c650b5f6166706f766572746370c00c001001 00
    512 
    513 # IP Printing over TCP (PTR) (RDATA=MyPrinter._ipp._tcp.local.)
    514 p2p_service_add bonjour 045f697070c00c000c01 094d795072696e746572c027
    515 # IP Printing over TCP (TXT) (RDATA=txtvers=1,pdl=application/postscript)
    516 p2p_service_add bonjour 096d797072696e746572045f697070c00c001001 09747874766572733d311a70646c3d6170706c69636174696f6e2f706f7374736372797074
    517 
    518 # Supported Service Type Hash (SSTH)
    519 p2p_service_add bonjour 000000 <32-byte bitfield as hexdump>
    520 (note: see P2P spec Annex E.4 for information on how to construct the bitfield)
    521 
    522 p2p_service_del bonjour <query hexdump>
    523 
    524 Remove a local Bonjour service from internal SD query processing.
    525 
    526 p2p_service_add upnp <version hex> <service>
    527 
    528 Add a local UPnP service for internal SD query processing.
    529 
    530 Examples:
    531 
    532 p2p_service_add upnp 10 uuid:6859dede-8574-59ab-9332-123456789012::upnp:rootdevice
    533 p2p_service_add upnp 10 uuid:5566d33e-9774-09ab-4822-333456785632::upnp:rootdevice
    534 p2p_service_add upnp 10 uuid:1122de4e-8574-59ab-9322-333456789044::urn:schemas-upnp-org:service:ContentDirectory:2
    535 p2p_service_add upnp 10 uuid:5566d33e-9774-09ab-4822-333456785632::urn:schemas-upnp-org:service:ContentDirectory:2
    536 p2p_service_add upnp 10 uuid:6859dede-8574-59ab-9332-123456789012::urn:schemas-upnp-org:device:InternetGatewayDevice:1
    537 
    538 p2p_service_del upnp <version hex> <service>
    539 
    540 Remove a local UPnP service from internal SD query processing.
    541 
    542 p2p_service_del asp <adv id>
    543 
    544 Removes the local asp service from internal SD query list.
    545 For example: p2p_service_del asp 4d6fc7
    546 
    547 p2p_service_flush
    548 
    549 Remove all local services from internal SD query processing.
    550 
    551 Invitation
    552 
    553 p2p_invite [persistent=<network id>|group=<group ifname>] [peer=address]
    554 	[go_dev_addr=address] [freq=<freq in MHz>] [ht40] [vht]
    555 	[pref=<MHz>]
    556 
    557 Invite a peer to join a group (e.g., group=wlan1) or to reinvoke a
    558 persistent group (e.g., persistent=4). If the peer device is the GO of
    559 the persistent group, the peer parameter is not needed. Otherwise it is
    560 used to specify which device to invite. go_dev_addr parameter can be
    561 used to override the GO device address for Invitation Request should
    562 it be not known for some reason (this should not be needed in most
    563 cases). When reinvoking a persistent group, the GO device can specify
    564 the frequency for the group with the freq parameter. When reinvoking a
    565 persistent group, the P2P client device can use freq parameter to force
    566 a specific operating channel (or invitation failure if GO rejects that)
    567 or pref parameter to request a specific channel (while allowing GO to
    568 select to use another channel, if needed).
    569 
    570 Group Operations
    571 
    572 (These are used on the group interface.)
    573 
    574 wps_pin <any|address> <PIN>
    575 
    576 Start WPS PIN method. This allows a single WPS Enrollee to connect to
    577 the AP/GO. This is used on the GO when a P2P client joins an existing
    578 group. The second parameter is the address of the Enrollee or a string
    579 "any" to allow any station to use the entered PIN (which will restrict
    580 the PIN for one-time-use). PIN is the Enrollee PIN read either from a
    581 label or display on the P2P Client/WPS Enrollee.
    582 
    583 wps_pbc
    584 
    585 Start WPS PBC method (i.e., push the button). This allows a single WPS
    586 Enrollee to connect to the AP/GO. This is used on the GO when a P2P
    587 client joins an existing group.
    588 
    589 p2p_get_passphrase
    590 
    591 Get the passphrase for a group (only available when acting as a GO).
    592 
    593 p2p_presence_req [<duration> <interval>] [<duration> <interval>]
    594 
    595 Send a P2P Presence Request to the GO (this is only available when
    596 acting as a P2P client). If no duration/interval pairs are given, the
    597 request indicates that this client has no special needs for GO
    598 presence. The first parameter pair gives the preferred duration and
    599 interval values in microseconds. If the second pair is included, that
    600 indicates which value would be acceptable. This command returns OK
    601 immediately and the response from the GO is indicated in a
    602 P2P-PRESENCE-RESPONSE event message.
    603 
    604 Parameters
    605 
    606 p2p_ext_listen [<period> <interval>]
    607 
    608 Configure Extended Listen Timing. If the parameters are omitted, this
    609 feature is disabled. If the parameters are included, Listen State will
    610 be entered every interval msec for at least period msec. Both values
    611 have acceptable range of 1-65535 (with interval obviously having to be
    612 larger than or equal to duration). If the P2P module is not idle at
    613 the time the Extended Listen Timing timeout occurs, the Listen State
    614 operation will be skipped.
    615 
    616 The configured values will also be advertised to other P2P Devices. The
    617 received values are available in the p2p_peer command output:
    618 
    619 ext_listen_period=100 ext_listen_interval=5000
    620 
    621 p2p_set <field> <value>
    622 
    623 Change dynamic P2P parameters
    624 
    625 p2p_set discoverability <0/1>
    626 
    627 Disable/enable advertisement of client discoverability. This is
    628 enabled by default and this parameter is mainly used to allow testing
    629 of device discoverability.
    630 
    631 p2p_set managed <0/1>
    632 
    633 Disable/enable managed P2P Device operations. This is disabled by
    634 default.
    635 
    636 p2p_set listen_channel <1/6/11>
    637 
    638 Set P2P Listen channel. This is mainly meant for testing purposes and
    639 changing the Listen channel during normal operations can result in
    640 protocol failures.
    641 
    642 p2p_set ssid_postfix <postfix>
    643 
    644 Set postfix string to be added to the automatically generated P2P SSID
    645 (DIRECT-<two random characters>). For example, postfix of "-testing"
    646 could result in the SSID becoming DIRECT-ab-testing.
    647 
    648 p2p_set per_sta_psk <0/1>
    649 
    650 Disabled(default)/enables use of per-client PSK in the P2P groups. This
    651 can be used to request GO to assign a unique PSK for each client during
    652 WPS provisioning. When enabled, this allow clients to be removed from
    653 the group securily with p2p_remove_client command since that client's
    654 PSK is removed at the same time to prevent it from connecting back using
    655 the old PSK. When per-client PSK is not used, the client can still be
    656 disconnected, but it will be able to re-join the group since the PSK it
    657 learned previously is still valid. It should be noted that the default
    658 passphrase on the GO that is normally used to allow legacy stations to
    659 connect through manual configuration does not change here, so if that is
    660 shared, devices with knowledge of that passphrase can still connect.
    661 
    662 set <field> <value>
    663 
    664 Set global configuration parameters which may also affect P2P
    665 operations. The format on these parameters is same as is used in
    666 wpa_supplicant.conf. Only the parameters listen here should be
    667 changed. Modifying other parameters may result in incorrect behavior
    668 since not all existing users of the parameters are updated.
    669 
    670 set uuid <UUID>
    671 
    672 Set WPS UUID (by default, this is generated based on the MAC address).
    673 
    674 set device_name <device name>
    675 
    676 Set WPS Device Name (also included in some P2P messages).
    677 
    678 set manufacturer <manufacturer>
    679 
    680 Set WPS Manufacturer.
    681 
    682 set model_name <model name>
    683 
    684 Set WPS Model Name.
    685 
    686 set model_number <model number>
    687 
    688 Set WPS Model Number.
    689 
    690 set serial_number <serial number>
    691 
    692 Set WPS Serial Number.
    693 
    694 set device_type <device type>
    695 
    696 Set WPS Device Type.
    697 
    698 set os_version <OS version>
    699 
    700 Set WPS OS Version.
    701 
    702 set config_methods <config methods>
    703 
    704 Set WPS Configuration Methods.
    705 
    706 set sec_device_type <device type>
    707 
    708 Add a new Secondary Device Type.
    709 
    710 set p2p_go_intent <GO intent>
    711 
    712 Set the default P2P GO Intent. Note: This value can be overridden in
    713 p2p_connect command and as such, there should be no need to change the
    714 default value here during normal operations.
    715 
    716 set p2p_ssid_postfix <P2P SSID postfix>
    717 
    718 Set P2P SSID postfix.
    719 
    720 set persistent_reconnect <0/1>
    721 
    722 Disable/enabled persistent reconnect for reinvocation of persistent
    723 groups. If enabled, invitations to reinvoke a persistent group will be
    724 accepted without separate authorization (e.g., user interaction).
    725 
    726 set country <two character country code>
    727 
    728 Set country code (this is included in some P2P messages).
    729 
    730 set p2p_search_delay <delay>
    731 
    732 Set p2p_search_delay which adds extra delay in milliseconds between
    733 concurrent search iterations to make p2p_find friendlier to concurrent
    734 operations by avoiding it from taking 100% of radio resources. The
    735 default value is 500 ms.
    736 
    737 Status
    738 
    739 p2p_peers [discovered]
    740 
    741 List P2P Device Addresses of all the P2P peers we know. The optional
    742 "discovered" parameter filters out the peers that we have not fully
    743 discovered, i.e., which we have only seen in a received Probe Request
    744 frame.
    745 
    746 p2p_peer <P2P Device Address>
    747 
    748 Fetch information about a known P2P peer.
    749 
    750 Group Status
    751 
    752 (These are used on the group interface.)
    753 
    754 status
    755 
    756 Show status information (connection state, role, use encryption
    757 parameters, IP address, etc.).
    758 
    759 sta
    760 
    761 Show information about an associated station (when acting in AP/GO role).
    762 
    763 all_sta
    764 
    765 Lists the currently associated stations.
    766 
    767 Configuration data
    768 
    769 list_networks
    770 
    771 Lists the configured networks, including stored information for
    772 persistent groups. The identifier in this list is used with
    773 p2p_group_add and p2p_invite to indicate which persistent group is to
    774 be reinvoked.
    775 
    776 remove_network <network id>
    777 
    778 Remove a network entry from configuration. 
    779 
    780 
    781 P2PS Events/Responses:
    782 
    783 P2PS-PROV-START: This events gets triggered when provisioning is issued for
    784 either seeker or advertiser.
    785 
    786 For example,
    787 P2PS-PROV-START 00:55:44:33:22:11 adv_id=111 adv_mac=00:55:44:33:22:11 conncap=1 session=1234567 session_mac=00:11:22:33:44:55 info='xxxx'
    788 
    789 Parameters definition:
    790     MAC address - always
    791     adv_id - always ASCII hex-encoded u32
    792     adv_mac - always MAC address that owns/registered the service
    793     conncap - always mask of 0x01 (new), 0x02 (group client), 0x04 (group owner)
    794 	bits
    795     session - always Session ID of the first session to be established
    796     session_mac - always MAC address that owns/initiated the session
    797     info - if available, UTF-8 string
    798 	Escaped single quote & backslash with a backslash:
    799 	\' == 0x27 == ', and \\ == 0x5c == \
    800 
    801 P2PS-PROV-DONE: When provisioning is completed then this event gets triggered.
    802 
    803 For example,
    804 P2PS-PROV-DONE 00:11:22:33:44:55 status=0 adv_id=111 adv_mac=00:55:44:33:22:11 conncap=1 session=1234567 session_mac=00:11:22:33:44:55 [dev_passwd_id=8 | go=p2p-wlan0-0 | join=11:22:33:44:55:66 | persist=0]
    805 
    806 Parameters definition:
    807     MAC address - always main device address of peer. May be different from MAC
    808 	ultimately connected to.
    809     status - always ascii hex-encoded u8 (0 == success, 12 == deferred success)
    810     adv_id - always ascii hex-encoded u32
    811     adv_mac - always MAC address that owns/registered the service
    812     conncap - always One of: 1 (new), 2 (group client), 4 (group owner) bits
    813     session - always Session ID of the first session to be established
    814     session_mac - always MAC address that owns/initiated the session
    815     dev_passwd_id - only if conncap value == 1 (New GO negotiation)
    816 	8 - "p2ps" password must be passed in p2p_connect command
    817 	1 - "display" password must be passed in p2p_connect command
    818 	5 - "keypad" password must be passed in p2p_connect command
    819     join only - if conncap value == 2 (Client Only). Display password and "join"
    820 	must be passed in p2p_connect and address must be the MAC specified
    821     go only - if conncap value == 4 (GO Only). Interface name must be set with a
    822 	password
    823     persist - only if previous persistent group existed between peers and shall
    824 	be re-used. Group is restarted by sending "p2p_group_add persistent=0"
    825 	where value is taken from P2P-PROV-DONE
    826 
    827 Extended Events/Response
    828 
    829 P2P-DEVICE-FOUND 00:11:22:33:44:55 p2p_dev_addr=00:11:22:33:44:55 pri_dev_type=0-00000000-0 name='' config_methods=0x108 dev_capab=0x21 group_capab=0x0 adv_id=111 asp_svc=alt.example.chat
    830 
    831 Parameters definition:
    832     adv_id - if ASP ASCII hex-encoded u32. If it is reporting the
    833 	"wildcard service", this value will be 0
    834     asp_svc - if ASP this is the service string. If it is reporting the
    835 	"wildcard service", this value will be org.wi-fi.wfds
    836 
    837 
    838 wpa_cli action script
    839 ---------------------
    840 
    841 See examples/p2p-action.sh
    842 
    843 TODO: describe DHCP/DNS setup
    844 TODO: cross-connection
    845 

README-Windows.txt

      1 wpa_supplicant for Windows
      2 ==========================
      3 
      4 Copyright (c) 2003-2009, Jouni Malinen <j (a] w1.fi> and contributors
      5 All Rights Reserved.
      6 
      7 This program is licensed under the BSD license (the one with
      8 advertisement clause removed).
      9 
     10 
     11 wpa_supplicant has support for being used as a WPA/WPA2/IEEE 802.1X
     12 Supplicant on Windows. The current port requires that WinPcap
     13 (http://winpcap.polito.it/) is installed for accessing packets and the
     14 driver interface. Both release versions 3.0 and 3.1 are supported.
     15 
     16 The current port is still somewhat experimental. It has been tested
     17 mainly on Windows XP (SP2) with limited set of NDIS drivers. In
     18 addition, the current version has been reported to work with Windows
     19 2000.
     20 
     21 All security modes have been verified to work (at least complete
     22 authentication and successfully ping a wired host):
     23 - plaintext
     24 - static WEP / open system authentication
     25 - static WEP / shared key authentication
     26 - IEEE 802.1X with dynamic WEP keys
     27 - WPA-PSK, TKIP, CCMP, TKIP+CCMP
     28 - WPA-EAP, TKIP, CCMP, TKIP+CCMP
     29 - WPA2-PSK, TKIP, CCMP, TKIP+CCMP
     30 - WPA2-EAP, TKIP, CCMP, TKIP+CCMP
     31 
     32 
     33 Building wpa_supplicant with mingw
     34 ----------------------------------
     35 
     36 The default build setup for wpa_supplicant is to use MinGW and
     37 cross-compiling from Linux to MinGW/Windows. It should also be
     38 possible to build this under Windows using the MinGW tools, but that
     39 is not tested nor supported and is likely to require some changes to
     40 the Makefile unless cygwin is used.
     41 
     42 
     43 Building wpa_supplicant with MSVC
     44 ---------------------------------
     45 
     46 wpa_supplicant can be built with Microsoft Visual C++ compiler. This
     47 has been tested with Microsoft Visual C++ Toolkit 2003 and Visual
     48 Studio 2005 using the included nmake.mak as a Makefile for nmake. IDE
     49 can also be used by creating a project that includes the files and
     50 defines mentioned in nmake.mak. Example VS2005 solution and project
     51 files are included in vs2005 subdirectory. This can be used as a
     52 starting point for building the programs with VS2005 IDE. Visual Studio
     53 2008 Express Edition is also able to use these project files.
     54 
     55 WinPcap development package is needed for the build and this can be
     56 downloaded from http://www.winpcap.org/install/bin/WpdPack_4_0_2.zip. The
     57 default nmake.mak expects this to be unpacked into C:\dev\WpdPack so
     58 that Include and Lib directories are in this directory. The files can be
     59 stored elsewhere as long as the WINPCAPDIR in nmake.mak is updated to
     60 match with the selected directory. In case a project file in the IDE is
     61 used, these Include and Lib directories need to be added to project
     62 properties as additional include/library directories.
     63 
     64 OpenSSL source package can be downloaded from
     65 http://www.openssl.org/source/openssl-0.9.8i.tar.gz and built and
     66 installed following instructions in INSTALL.W32. Note that if EAP-FAST
     67 support will be included in the wpa_supplicant, OpenSSL needs to be
     68 patched to# support it openssl-0.9.8i-tls-extensions.patch. The example
     69 nmake.mak file expects OpenSSL to be installed into C:\dev\openssl, but
     70 this directory can be modified by changing OPENSSLDIR variable in
     71 nmake.mak.
     72 
     73 If you do not need EAP-FAST support, you may also be able to use Win32
     74 binary installation package of OpenSSL from
     75 http://www.slproweb.com/products/Win32OpenSSL.html instead of building
     76 the library yourself. In this case, you will need to copy Include and
     77 Lib directories in suitable directory, e.g., C:\dev\openssl for the
     78 default nmake.mak. Copy {Win32OpenSSLRoot}\include into
     79 C:\dev\openssl\include and make C:\dev\openssl\lib subdirectory with
     80 files from {Win32OpenSSLRoot}\VC (i.e., libeay*.lib and ssleay*.lib).
     81 This will end up using dynamically linked OpenSSL (i.e., .dll files are
     82 needed) for it. Alternative, you can copy files from
     83 {Win32OpenSSLRoot}\VC\static to create a static build (no OpenSSL .dll
     84 files needed).
     85 
     86 
     87 Building wpa_supplicant for cygwin
     88 ----------------------------------
     89 
     90 wpa_supplicant can be built for cygwin by installing the needed
     91 development packages for cygwin. This includes things like compiler,
     92 make, openssl development package, etc. In addition, developer's pack
     93 for WinPcap (WPdpack.zip) from
     94 http://winpcap.polito.it/install/default.htm is needed.
     95 
     96 .config file should enable only one driver interface,
     97 CONFIG_DRIVER_NDIS. In addition, include directories may need to be
     98 added to match the system. An example configuration is available in
     99 defconfig. The library and include files for WinPcap will either need
    100 to be installed in compiler/linker default directories or their
    101 location will need to be adding to .config when building
    102 wpa_supplicant.
    103 
    104 Othen than this, the build should be more or less identical to Linux
    105 version, i.e., just run make after having created .config file. An
    106 additional tool, win_if_list.exe, can be built by running "make
    107 win_if_list".
    108 
    109 
    110 Building wpa_gui
    111 ----------------
    112 
    113 wpa_gui uses Qt application framework from Trolltech. It can be built
    114 with the open source version of Qt4 and MinGW. Following commands can
    115 be used to build the binary in the Qt 4 Command Prompt:
    116 
    117 # go to the root directory of wpa_supplicant source code
    118 cd wpa_gui-qt4
    119 qmake -o Makefile wpa_gui.pro
    120 make
    121 # the wpa_gui.exe binary is created into 'release' subdirectory
    122 
    123 
    124 Using wpa_supplicant for Windows
    125 --------------------------------
    126 
    127 wpa_supplicant, wpa_cli, and wpa_gui behave more or less identically to
    128 Linux version, so instructions in README and example wpa_supplicant.conf
    129 should be applicable for most parts. In addition, there is another
    130 version of wpa_supplicant, wpasvc.exe, which can be used as a Windows
    131 service and which reads its configuration from registry instead of
    132 text file.
    133 
    134 When using access points in "hidden SSID" mode, ap_scan=2 mode need to
    135 be used (see wpa_supplicant.conf for more information).
    136 
    137 Windows NDIS/WinPcap uses quite long interface names, so some care
    138 will be needed when starting wpa_supplicant. Alternatively, the
    139 adapter description can be used as the interface name which may be
    140 easier since it is usually in more human-readable
    141 format. win_if_list.exe can be used to find out the proper interface
    142 name.
    143 
    144 Example steps in starting up wpa_supplicant:
    145 
    146 # win_if_list.exe
    147 ifname: \Device\NPF_GenericNdisWanAdapter
    148 description: Generic NdisWan adapter
    149 
    150 ifname: \Device\NPF_{769E012B-FD17-4935-A5E3-8090C38E25D2}
    151 description: Atheros Wireless Network Adapter (Microsoft's Packet Scheduler)
    152 
    153 ifname: \Device\NPF_{732546E7-E26C-48E3-9871-7537B020A211}
    154 description: Intel 8255x-based Integrated Fast Ethernet (Microsoft's Packet Scheduler)
    155 
    156 
    157 Since the example configuration used Atheros WLAN card, the middle one
    158 is the correct interface in this case. The interface name for -i
    159 command line option is the full string following "ifname:" (the
    160 "\Device\NPF_" prefix can be removed). In other words, wpa_supplicant
    161 would be started with the following command:
    162 
    163 # wpa_supplicant.exe -i'{769E012B-FD17-4935-A5E3-8090C38E25D2}' -c wpa_supplicant.conf -d
    164 
    165 -d optional enables some more debugging (use -dd for even more, if
    166 needed). It can be left out if debugging information is not needed.
    167 
    168 With the alternative mechanism for selecting the interface, this
    169 command has identical results in this case:
    170 
    171 # wpa_supplicant.exe -iAtheros -c wpa_supplicant.conf -d
    172 
    173 
    174 Simple configuration example for WPA-PSK:
    175 
    176 #ap_scan=2
    177 ctrl_interface=
    178 network={
    179 	ssid="test"
    180 	key_mgmt=WPA-PSK
    181 	proto=WPA
    182 	pairwise=TKIP
    183 	psk="secret passphrase"
    184 }
    185 
    186 (remove '#' from the comment out ap_scan line to enable mode in which
    187 wpa_supplicant tries to associate with the SSID without doing
    188 scanning; this allows APs with hidden SSIDs to be used)
    189 
    190 
    191 wpa_cli.exe and wpa_gui.exe can be used to interact with the
    192 wpa_supplicant.exe program in the same way as with Linux. Note that
    193 ctrl_interface is using UNIX domain sockets when built for cygwin, but
    194 the native build for Windows uses named pipes and the contents of the
    195 ctrl_interface configuration item is used to control access to the
    196 interface. Anyway, this variable has to be included in the configuration
    197 to enable the control interface.
    198 
    199 
    200 Example SDDL string formats:
    201 
    202 (local admins group has permission, but nobody else):
    203 
    204 ctrl_interface=SDDL=D:(A;;GA;;;BA)
    205 
    206 ("A" == "access allowed", "GA" == GENERIC_ALL == all permissions, and
    207 "BA" == "builtin administrators" == the local admins.  The empty fields
    208 are for flags and object GUIDs, none of which should be required in this
    209 case.)
    210 
    211 (local admins and the local "power users" group have permissions,
    212 but nobody else):
    213 
    214 ctrl_interface=SDDL=D:(A;;GA;;;BA)(A;;GA;;;PU)
    215 
    216 (One ACCESS_ALLOWED ACE for GENERIC_ALL for builtin administrators, and
    217 one ACCESS_ALLOWED ACE for GENERIC_ALL for power users.)
    218 
    219 (close to wide open, but you have to be a valid user on
    220 the machine):
    221 
    222 ctrl_interface=SDDL=D:(A;;GA;;;AU)
    223 
    224 (One ACCESS_ALLOWED ACE for GENERIC_ALL for the "authenticated users"
    225 group.)
    226 
    227 This one would allow absolutely everyone (including anonymous
    228 users) -- this is *not* recommended, since named pipes can be attached
    229 to from anywhere on the network (i.e. there's no "this machine only"
    230 like there is with 127.0.0.1 sockets):
    231 
    232 ctrl_interface=SDDL=D:(A;;GA;;;BU)(A;;GA;;;AN)
    233 
    234 (BU == "builtin users", "AN" == "anonymous")
    235 
    236 See also [1] for the format of ACEs, and [2] for the possible strings
    237 that can be used for principal names.
    238 
    239 [1]
    240 http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthz/security/ace_strings.asp
    241 [2]
    242 http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthz/security/sid_strings.asp
    243 
    244 
    245 Starting wpa_supplicant as a Windows service (wpasvc.exe)
    246 ---------------------------------------------------------
    247 
    248 wpa_supplicant can be started as a Windows service by using wpasvc.exe
    249 program that is alternative build of wpa_supplicant.exe. Most of the
    250 core functionality of wpasvc.exe is identical to wpa_supplicant.exe,
    251 but it is using Windows registry for configuration information instead
    252 of a text file and command line parameters. In addition, it can be
    253 registered as a service that can be started automatically or manually
    254 like any other Windows service.
    255 
    256 The root of wpa_supplicant configuration in registry is
    257 HKEY_LOCAL_MACHINE\SOFTWARE\wpa_supplicant. This level includes global
    258 parameters and a 'interfaces' subkey with all the interface configuration
    259 (adapter to confname mapping). Each such mapping is a subkey that has
    260 'adapter', 'config', and 'ctrl_interface' values.
    261 
    262 This program can be run either as a normal command line application,
    263 e.g., for debugging, with 'wpasvc.exe app' or as a Windows service.
    264 Service need to be registered with 'wpasvc.exe reg <full path to
    265 wpasvc.exe>'. Alternatively, 'wpasvc.exe reg' can be used to register
    266 the service with the current location of wpasvc.exe. After this, wpasvc
    267 can be started like any other Windows service (e.g., 'net start wpasvc')
    268 or it can be configured to start automatically through the Services tool
    269 in administrative tasks. The service can be unregistered with
    270 'wpasvc.exe unreg'.
    271 
    272 If the service is set to start during system bootup to make the
    273 network connection available before any user has logged in, there may
    274 be a long (half a minute or so) delay in starting up wpa_supplicant
    275 due to WinPcap needing a driver called "Network Monitor Driver" which
    276 is started by default on demand.
    277 
    278 To speed up wpa_supplicant start during system bootup, "Network
    279 Monitor Driver" can be configured to be started sooner by setting its
    280 startup type to System instead of the default Demand. To do this, open
    281 up Device Manager, select Show Hidden Devices, expand the "Non
    282 Plug-and-Play devices" branch, double click "Network Monitor Driver",
    283 go to the Driver tab, and change the Demand setting to System instead.
    284 
    285 Configuration data is in HKEY_LOCAL_MACHINE\SOFTWARE\wpa_supplicant\configs
    286 key. Each configuration profile has its own key under this. In terms of text
    287 files, each profile would map to a separate text file with possibly multiple
    288 networks. Under each profile, there is a networks key that lists all
    289 networks as a subkey. Each network has set of values in the same way as
    290 network block in the configuration file. In addition, blobs subkey has
    291 possible blobs as values.
    292 
    293 HKEY_LOCAL_MACHINE\SOFTWARE\wpa_supplicant\configs\test\networks\0000
    294    ssid="example"
    295    key_mgmt=WPA-PSK
    296 
    297 See win_example.reg for an example on how to setup wpasvc.exe
    298 parameters in registry. It can also be imported to registry as a
    299 starting point for the configuration.
    300 

README-WPS

      1 wpa_supplicant and Wi-Fi Protected Setup (WPS)
      2 ==============================================
      3 
      4 This document describes how the WPS implementation in wpa_supplicant
      5 can be configured and how an external component on the client (e.g.,
      6 management GUI) is used to enable WPS enrollment and registrar
      7 registration.
      8 
      9 
     10 Introduction to WPS
     11 -------------------
     12 
     13 Wi-Fi Protected Setup (WPS) is a mechanism for easy configuration of a
     14 wireless network. It allows automated generation of random keys (WPA
     15 passphrase/PSK) and configuration of an access point and client
     16 devices. WPS includes number of methods for setting up connections
     17 with PIN method and push-button configuration (PBC) being the most
     18 commonly deployed options.
     19 
     20 While WPS can enable more home networks to use encryption in the
     21 wireless network, it should be noted that the use of the PIN and
     22 especially PBC mechanisms for authenticating the initial key setup is
     23 not very secure. As such, use of WPS may not be suitable for
     24 environments that require secure network access without chance for
     25 allowing outsiders to gain access during the setup phase.
     26 
     27 WPS uses following terms to describe the entities participating in the
     28 network setup:
     29 - access point: the WLAN access point
     30 - Registrar: a device that control a network and can authorize
     31   addition of new devices); this may be either in the AP ("internal
     32   Registrar") or in an external device, e.g., a laptop, ("external
     33   Registrar")
     34 - Enrollee: a device that is being authorized to use the network
     35 
     36 It should also be noted that the AP and a client device may change
     37 roles (i.e., AP acts as an Enrollee and client device as a Registrar)
     38 when WPS is used to configure the access point.
     39 
     40 
     41 More information about WPS is available from Wi-Fi Alliance:
     42 http://www.wi-fi.org/wifi-protected-setup
     43 
     44 
     45 wpa_supplicant implementation
     46 -----------------------------
     47 
     48 wpa_supplicant includes an optional WPS component that can be used as
     49 an Enrollee to enroll new network credential or as a Registrar to
     50 configure an AP.
     51 
     52 
     53 wpa_supplicant configuration
     54 ----------------------------
     55 
     56 WPS is an optional component that needs to be enabled in
     57 wpa_supplicant build configuration (.config). Here is an example
     58 configuration that includes WPS support and Linux nl80211 -based
     59 driver interface:
     60 
     61 CONFIG_DRIVER_NL80211=y
     62 CONFIG_WPS=y
     63 
     64 If you want to enable WPS external registrar (ER) functionality, you
     65 will also need to add following line:
     66 
     67 CONFIG_WPS_ER=y
     68 
     69 Following parameter can be used to enable support for NFC config method:
     70 
     71 CONFIG_WPS_NFC=y
     72 
     73 
     74 WPS needs the Universally Unique IDentifier (UUID; see RFC 4122) for
     75 the device. This is configured in the runtime configuration for
     76 wpa_supplicant (if not set, UUID will be generated based on local MAC
     77 address):
     78 
     79 # example UUID for WPS
     80 uuid=12345678-9abc-def0-1234-56789abcdef0
     81 
     82 The network configuration blocks needed for WPS are added
     83 automatically based on control interface commands, so they do not need
     84 to be added explicitly in the configuration file.
     85 
     86 WPS registration will generate new network blocks for the acquired
     87 credentials. If these are to be stored for future use (after
     88 restarting wpa_supplicant), wpa_supplicant will need to be configured
     89 to allow configuration file updates:
     90 
     91 update_config=1
     92 
     93 
     94 
     95 External operations
     96 -------------------
     97 
     98 WPS requires either a device PIN code (usually, 8-digit number) or a
     99 pushbutton event (for PBC) to allow a new WPS Enrollee to join the
    100 network. wpa_supplicant uses the control interface as an input channel
    101 for these events.
    102 
    103 The PIN value used in the commands must be processed by an UI to
    104 remove non-digit characters and potentially, to verify the checksum
    105 digit. "wpa_cli wps_check_pin <PIN>" can be used to do such processing.
    106 It returns FAIL if the PIN is invalid, or FAIL-CHECKSUM if the checksum
    107 digit is incorrect, or the processed PIN (non-digit characters removed)
    108 if the PIN is valid.
    109 
    110 If the client device has a display, a random PIN has to be generated
    111 for each WPS registration session. wpa_supplicant can do this with a
    112 control interface request, e.g., by calling wpa_cli:
    113 
    114 wpa_cli wps_pin any
    115 
    116 This will return the generated 8-digit PIN which will then need to be
    117 entered at the Registrar to complete WPS registration. At that point,
    118 the client will be enrolled with credentials needed to connect to the
    119 AP to access the network.
    120 
    121 
    122 If the client device does not have a display that could show the
    123 random PIN, a hardcoded PIN that is printed on a label can be
    124 used. wpa_supplicant is notified this with a control interface
    125 request, e.g., by calling wpa_cli:
    126 
    127 wpa_cli wps_pin any 12345670
    128 
    129 This starts the WPS negotiation in the same way as above with the
    130 generated PIN.
    131 
    132 When the wps_pin command is issued for an AP (including P2P GO) mode
    133 interface, an optional timeout parameter can be used to specify
    134 expiration timeout for the PIN in seconds. For example:
    135 
    136 wpa_cli wps_pin any 12345670 300
    137 
    138 
    139 If a random PIN is needed for a user interface, "wpa_cli wps_pin get"
    140 can be used to generate a new PIN without starting WPS negotiation.
    141 This random PIN can then be passed as an argument to another wps_pin
    142 call when the actual operation should be started.
    143 
    144 If the client design wants to support optional WPS PBC mode, this can
    145 be enabled by either a physical button in the client device or a
    146 virtual button in the user interface. The PBC operation requires that
    147 a button is also pressed at the AP/Registrar at about the same time (2
    148 minute window). wpa_supplicant is notified of the local button event
    149 over the control interface, e.g., by calling wpa_cli:
    150 
    151 wpa_cli wps_pbc
    152 
    153 At this point, the AP/Registrar has two minutes to complete WPS
    154 negotiation which will generate a new WPA PSK in the same way as the
    155 PIN method described above.
    156 
    157 
    158 If the client wants to operate in the Registrar role to learn the
    159 current AP configuration and optionally, to configure an AP,
    160 wpa_supplicant is notified over the control interface, e.g., with
    161 wpa_cli:
    162 
    163 wpa_cli wps_reg <AP BSSID> <AP PIN>
    164 (example: wpa_cli wps_reg 02:34:56:78:9a:bc 12345670)
    165 
    166 This is used to fetch the current AP settings instead of actually
    167 changing them. The main difference with the wps_pin command is that
    168 wps_reg uses the AP PIN (e.g., from a label on the AP) instead of a
    169 PIN generated at the client.
    170 
    171 In order to change the AP configuration, the new configuration
    172 parameters are given to the wps_reg command:
    173 
    174 wpa_cli wps_reg <AP BSSID> <AP PIN> <new SSID> <auth> <encr> <new key>
    175 examples:
    176   wpa_cli wps_reg 02:34:56:78:9a:bc 12345670 testing WPA2PSK CCMP 12345678
    177   wpa_cli wps_reg 02:34:56:78:9a:bc 12345670 clear OPEN NONE ""
    178 
    179 <auth> must be one of the following: OPEN WPAPSK WPA2PSK
    180 <encr> must be one of the following: NONE WEP TKIP CCMP
    181 
    182 
    183 Scanning
    184 --------
    185 
    186 Scan results ('wpa_cli scan_results' or 'wpa_cli bss <idx>') include a
    187 flags field that is used to indicate whether the BSS support WPS. If
    188 the AP support WPS, but has not recently activated a Registrar, [WPS]
    189 flag will be included. If PIN method has been recently selected,
    190 [WPS-PIN] is shown instead. Similarly, [WPS-PBC] is shown if PBC mode
    191 is in progress. GUI programs can use these as triggers for suggesting
    192 a guided WPS configuration to the user. In addition, control interface
    193 monitor events WPS-AP-AVAILABLE{,-PBC,-PIN} can be used to find out if
    194 there are WPS enabled APs in scan results without having to go through
    195 all the details in the GUI. These notification could be used, e.g., to
    196 suggest possible WPS connection to the user.
    197 
    198 
    199 wpa_gui
    200 -------
    201 
    202 wpa_gui-qt4 directory contains a sample GUI that shows an example of
    203 how WPS support can be integrated into the GUI. Its main window has a
    204 WPS tab that guides user through WPS registration with automatic AP
    205 selection. In addition, it shows how WPS can be started manually by
    206 selecting an AP from scan results.
    207 
    208 
    209 Credential processing
    210 ---------------------
    211 
    212 By default, wpa_supplicant processes received credentials and updates
    213 its configuration internally. However, it is possible to
    214 control these operations from external programs, if desired.
    215 
    216 This internal processing can be disabled with wps_cred_processing=1
    217 option. When this is used, an external program is responsible for
    218 processing the credential attributes and updating wpa_supplicant
    219 configuration based on them.
    220 
    221 Following control interface messages are sent out for external programs:
    222 
    223 WPS-CRED-RECEIVED  <hexdump of Credential attribute(s)>
    224 For example:
    225 <2>WPS-CRED-RECEIVED 100e006f10260001011045000c6a6b6d2d7770732d74657374100300020020100f000200081027004030653462303435366332363666653064333961643135353461316634626637313234333761636664623766333939653534663166316230323061643434386235102000060266a0ee1727
    226 
    227 
    228 wpa_supplicant as WPS External Registrar (ER)
    229 ---------------------------------------------
    230 
    231 wpa_supplicant can be used as a WPS ER to configure an AP or enroll
    232 new Enrollee to join the network. This functionality uses UPnP and
    233 requires that a working IP connectivity is available with the AP (this
    234 can be either over a wired or wireless connection).
    235 
    236 Separate wpa_supplicant process can be started for WPS ER
    237 operations. A special "none" driver can be used in such a case to
    238 indicate that no local network interface is actually controlled. For
    239 example, following command could be used to start the ER:
    240 
    241 wpa_supplicant -Dnone -c er.conf -ieth0
    242 
    243 Sample er.conf:
    244 
    245 ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=admin
    246 device_name=WPS External Registrar
    247 
    248 
    249 wpa_cli commands for ER functionality:
    250 
    251 wps_er_start [IP address]
    252 - start WPS ER functionality
    253 - the optional IP address parameter can be used to filter operations only
    254   to include a single AP
    255 - if run again while ER is active, the stored information (discovered APs
    256   and Enrollees) are shown again
    257 
    258 wps_er_stop
    259 - stop WPS ER functionality
    260 
    261 wps_er_learn <UUID|BSSID> <AP PIN>
    262 - learn AP configuration
    263 
    264 wps_er_set_config <UUID|BSSID> <network id>
    265 - use AP configuration from a locally configured network (e.g., from
    266   wps_reg command); this does not change the AP's configuration, but
    267   only prepares a configuration to be used when enrolling a new device
    268   to the AP
    269 
    270 wps_er_config <UUID|BSSID> <AP PIN> <new SSID> <auth> <encr> <new key>
    271 - examples:
    272   wps_er_config 87654321-9abc-def0-1234-56789abc0002 12345670 testing WPA2PSK CCMP 12345678
    273   wpa_er_config 87654321-9abc-def0-1234-56789abc0002 12345670 clear OPEN NONE ""
    274 
    275 <auth> must be one of the following: OPEN WPAPSK WPA2PSK
    276 <encr> must be one of the following: NONE WEP TKIP CCMP
    277 
    278 
    279 wps_er_pbc <Enrollee UUID|MAC address>
    280 - accept an Enrollee PBC using External Registrar
    281 
    282 wps_er_pin <Enrollee UUID|"any"|MAC address> <PIN> [Enrollee MAC address]
    283 - add an Enrollee PIN to External Registrar
    284 - if Enrollee UUID is not known, "any" can be used to add a wildcard PIN
    285 - if the MAC address of the enrollee is known, it should be configured
    286   to allow the AP to advertise list of authorized enrollees
    287 
    288 
    289 WPS ER events:
    290 
    291 WPS_EVENT_ER_AP_ADD
    292 - WPS ER discovered an AP
    293 
    294 WPS-ER-AP-ADD 87654321-9abc-def0-1234-56789abc0002 02:11:22:33:44:55 pri_dev_type=6-0050F204-1 wps_state=1 |Very friendly name|Company|Long description of the model|WAP|http://w1.fi/|http://w1.fi/hostapd/
    295 
    296 WPS_EVENT_ER_AP_REMOVE
    297 - WPS ER removed an AP entry
    298 
    299 WPS-ER-AP-REMOVE 87654321-9abc-def0-1234-56789abc0002
    300 
    301 WPS_EVENT_ER_ENROLLEE_ADD
    302 - WPS ER discovered a new Enrollee
    303 
    304 WPS-ER-ENROLLEE-ADD 2b7093f1-d6fb-5108-adbb-bea66bb87333 02:66:a0:ee:17:27 M1=1 config_methods=0x14d dev_passwd_id=0 pri_dev_type=1-0050F204-1 |Wireless Client|Company|cmodel|123|12345|
    305 
    306 WPS_EVENT_ER_ENROLLEE_REMOVE
    307 - WPS ER removed an Enrollee entry
    308 
    309 WPS-ER-ENROLLEE-REMOVE 2b7093f1-d6fb-5108-adbb-bea66bb87333 02:66:a0:ee:17:27
    310 
    311 WPS-ER-AP-SETTINGS
    312 - WPS ER learned AP settings
    313 
    314 WPS-ER-AP-SETTINGS uuid=fd91b4ec-e3fa-5891-a57d-8c59efeed1d2 ssid=test-wps auth_type=0x0020 encr_type=0x0008 key=12345678
    315 
    316 
    317 WPS with NFC
    318 ------------
    319 
    320 WPS can be used with NFC-based configuration method. An NFC tag
    321 containing a password token from the Enrollee can be used to
    322 authenticate the connection instead of the PIN. In addition, an NFC tag
    323 with a configuration token can be used to transfer AP settings without
    324 going through the WPS protocol.
    325 
    326 When the station acts as an Enrollee, a local NFC tag with a password
    327 token can be used by touching the NFC interface of a Registrar.
    328 
    329 "wps_nfc [BSSID]" command starts WPS protocol run with the local end as
    330 the Enrollee using the NFC password token that is either pre-configured
    331 in the configuration file (wps_nfc_dev_pw_id, wps_nfc_dh_pubkey,
    332 wps_nfc_dh_privkey, wps_nfc_dev_pw) or generated dynamically with
    333 "wps_nfc_token <WPS|NDEF>" command. The included nfc_pw_token tool
    334 (build with "make nfc_pw_token") can be used to generate NFC password
    335 tokens during manufacturing (each station needs to have its own random
    336 keys).
    337 
    338 The "wps_nfc_config_token <WPS/NDEF>" command can be used to build an
    339 NFC configuration token when wpa_supplicant is controlling an AP
    340 interface (AP or P2P GO). The output value from this command is a
    341 hexdump of the current AP configuration (WPS parameter requests this to
    342 include only the WPS attributes; NDEF parameter requests additional NDEF
    343 encapsulation to be included). This data needs to be written to an NFC
    344 tag with an external program. Once written, the NFC configuration token
    345 can be used to touch an NFC interface on a station to provision the
    346 credentials needed to access the network.
    347 
    348 The "wps_nfc_config_token <WPS/NDEF> <network id>" command can be used
    349 to build an NFC configuration token based on a locally configured
    350 network.
    351 
    352 If the station includes NFC interface and reads an NFC tag with a MIME
    353 media type "application/vnd.wfa.wsc", the NDEF message payload (with or
    354 without NDEF encapsulation) can be delivered to wpa_supplicant using the
    355 following wpa_cli command:
    356 
    357 wps_nfc_tag_read <hexdump of payload>
    358 
    359 If the NFC tag contains a configuration token, the network is added to
    360 wpa_supplicant configuration. If the NFC tag contains a password token,
    361 the token is added to the WPS Registrar component. This information can
    362 then be used with wps_reg command (when the NFC password token was from
    363 an AP) using a special value "nfc-pw" in place of the PIN parameter. If
    364 the ER functionality has been started (wps_er_start), the NFC password
    365 token is used to enable enrollment of a new station (that was the source
    366 of the NFC password token).
    367 
    368 "nfc_get_handover_req <NDEF> <WPS-CR>" command can be used to build the
    369 WPS carrier record for a Handover Request Message for connection
    370 handover. The first argument selects the format of the output data and
    371 the second argument selects which type of connection handover is
    372 requested (WPS-CR = Wi-Fi handover as specified in WSC 2.0).
    373 
    374 "nfc_get_handover_sel <NDEF> <WPS> [UUID|BSSID]" command can be used to
    375 build the contents of a Handover Select Message for connection handover
    376 when this does not depend on the contents of the Handover Request
    377 Message. The first argument selects the format of the output data and
    378 the second argument selects which type of connection handover is
    379 requested (WPS = Wi-Fi handover as specified in WSC 2.0). If the options
    380 UUID|BSSID argument is included, this is a request to build the handover
    381 message for the specified AP when wpa_supplicant is operating as a WPS
    382 ER.
    383 
    384 "nfc_report_handover <INIT/RESP> WPS <carrier from handover request>
    385 <carrier from handover select>" can be used as an alternative way for
    386 reporting completed NFC connection handover. The first parameter
    387 indicates whether the local device initiated or responded to the
    388 connection handover and the carrier records are the selected carrier
    389 from the handover request and select messages as a hexdump.
    390 
    391 The "wps_er_nfc_config_token <WPS/NDEF> <UUID|BSSID>" command can be
    392 used to build an NFC configuration token for the specified AP when
    393 wpa_supplicant is operating as a WPS ER. The output value from this
    394 command is a hexdump of the selected AP configuration (WPS parameter
    395 requests this to include only the WPS attributes; NDEF parameter
    396 requests additional NDEF encapsulation to be included). This data needs
    397 to be written to an NFC tag with an external program. Once written, the
    398 NFC configuration token can be used to touch an NFC interface on a
    399 station to provision the credentials needed to access the network.
    400