1252190Srpaulowpa_supplicant and Wi-Fi P2P 2252190Srpaulo============================ 3252190Srpaulo 4252190SrpauloThis document describes how the Wi-Fi P2P implementation in 5252190Srpaulowpa_supplicant can be configured and how an external component on the 6252190Srpauloclient (e.g., management GUI) is used to enable WPS enrollment and 7252190Srpauloregistrar registration. 8252190Srpaulo 9252190Srpaulo 10252190SrpauloIntroduction to Wi-Fi P2P 11252190Srpaulo------------------------- 12252190Srpaulo 13252190SrpauloTODO 14252190Srpaulo 15252190SrpauloMore information about Wi-Fi P2P is available from Wi-Fi Alliance: 16252190Srpaulohttp://www.wi-fi.org/Wi-Fi_Direct.php 17252190Srpaulo 18252190Srpaulo 19252190Srpaulowpa_supplicant implementation 20252190Srpaulo----------------------------- 21252190Srpaulo 22252190SrpauloTODO 23252190Srpaulo 24252190Srpaulo 25252190Srpaulowpa_supplicant configuration 26252190Srpaulo---------------------------- 27252190Srpaulo 28252190SrpauloWi-Fi P2P is an optional component that needs to be enabled in the 29252190Srpaulowpa_supplicant build configuration (.config). Here is an example 30252190Srpauloconfiguration that includes Wi-Fi P2P support and Linux nl80211 31252190Srpaulo-based driver interface: 32252190Srpaulo 33252190SrpauloCONFIG_DRIVER_NL80211=y 34252190SrpauloCONFIG_CTRL_IFACE=y 35252190SrpauloCONFIG_P2P=y 36252190SrpauloCONFIG_AP=y 37252190SrpauloCONFIG_WPS=y 38252190Srpaulo 39252190Srpaulo 40252190SrpauloIn run-time configuration file (wpa_supplicant.conf), some parameters 41252190Srpaulofor P2P may be set. In order to make the devices easier to recognize, 42252190Srpaulodevice_name and device_type should be specified. For example, 43252190Srpaulosomething like this should be included: 44252190Srpaulo 45252190Srpauloctrl_interface=/var/run/wpa_supplicant 46252190Srpaulodevice_name=My P2P Device 47252190Srpaulodevice_type=1-0050F204-1 48252190Srpaulo 49252190Srpaulo 50252190Srpaulowpa_cli 51252190Srpaulo------- 52252190Srpaulo 53252190SrpauloActual Wi-Fi P2P operations are requested during runtime. These can be 54252190Srpaulodone for example using wpa_cli (which is described below) or a GUI 55252190Srpaulolike wpa_gui-qt4. 56252190Srpaulo 57252190Srpaulo 58252190Srpaulowpa_cli starts in interactive mode if no command string is included on 59252190Srpaulothe command line. By default, it will select the first network interface 60252190Srpaulothat it can find (and that wpa_supplicant controls). If more than one 61252190Srpaulointerface is in use, it may be necessary to select one of the explicitly 62252190Srpauloby adding -i argument on the command line (e.g., 'wpa_cli -i wlan1'). 63252190Srpaulo 64252190SrpauloMost of the P2P operations are done on the main interface (e.g., the 65252190Srpaulointerface that is automatically added when the driver is loaded, e.g., 66252190Srpaulowlan0). When using a separate virtual interface for group operations 67252190Srpaulo(e.g., wlan1), the control interface for that group interface may need 68252190Srpauloto be used for some operations (mainly WPS activation in GO). This may 69252190Srpaulochange in the future so that all the needed operations could be done 70252190Srpauloover the main control interface. 71252190Srpaulo 72252190SrpauloDevice Discovery 73252190Srpaulo 74252190Srpaulop2p_find [timeout in seconds] [type=<social|progressive>] \ 75281806Srpaulo [dev_id=<addr>] [dev_type=<device type>] \ 76281806Srpaulo [delay=<search delay in ms>] [seek=<service name>] [freq=<MHz>] 77252190Srpaulo 78252190SrpauloThe default behavior is to run a single full scan in the beginning and 79252190Srpaulothen scan only social channels. type=social will scan only social 80252190Srpaulochannels, i.e., it skips the initial full scan. type=progressive is 81252190Srpaulolike the default behavior, but it will scan through all the channels 82252190Srpauloprogressively one channel at the time in the Search state rounds. This 83252190Srpaulowill help in finding new groups or groups missed during the initial 84281806Srpaulofull scan. When the type parameter is not included (i.e., full scan), the 85281806Srpaulooptional freq parameter can be used to override the first scan to use only 86281806Srpaulothe specified channel after which only social channels are scanned. 87252190Srpaulo 88252190SrpauloThe optional dev_id option can be used to specify a single P2P peer to 89252190Srpaulosearch for. The optional delay parameter can be used to request an extra 90252190Srpaulodelay to be used between search iterations (e.g., to free up radio 91252190Srpauloresources for concurrent operations). 92252190Srpaulo 93281806SrpauloThe optional dev_type option can be used to specify a single device type 94281806Srpaulo(primary or secondary) to search for, e.g., 95281806Srpaulo"p2p_find dev_type=1-0050F204-1". 96281806Srpaulo 97281806Srpaulo 98281806SrpauloWith one or more seek arguments, the command sends Probe Request frames 99281806Srpaulofor a P2PS service. For example, 100281806Srpaulop2p_find 5 dev_id=11:22:33:44:55:66 seek=alt.example.chat seek=alt.example.video 101281806Srpaulo 102281806SrpauloParameters description: 103281806Srpaulo Timeout - Optional ASCII base-10-encoded u16. If missing, request will not 104281806Srpaulo time out and must be canceled manually 105281806Srpaulo dev_id - Optional to request responses from a single known remote device 106281806Srpaulo Service Name - Mandatory UTF-8 string for ASP seeks 107281806Srpaulo Service name must match the remote service being advertised exactly 108281806Srpaulo (no prefix matching). 109281806Srpaulo Service name may be empty, in which case all ASP services will be 110281806Srpaulo returned, and may be filtered with p2p_serv_disc_req settings, and 111281806Srpaulo p2p_serv_asp_resp results. 112281806Srpaulo Multiple service names may be requested, but if it exceeds internal 113281806Srpaulo limit, it will automatically revert to requesting all ASP services. 114281806Srpaulo 115252190Srpaulop2p_listen [timeout in seconds] 116252190Srpaulo 117252190SrpauloStart Listen-only state (become discoverable without searching for 118252190Srpauloother devices). Optional parameter can be used to specify the duration 119252190Srpaulofor the Listen operation in seconds. This command may not be of that 120252190Srpaulomuch use during normal operations and is mainly designed for 121252190Srpaulotesting. It can also be used to keep the device discoverable without 122252190Srpaulohaving to maintain a group. 123252190Srpaulo 124252190Srpaulop2p_stop_find 125252190Srpaulo 126252190SrpauloStop ongoing P2P device discovery or other operation (connect, listen 127252190Srpaulomode). 128252190Srpaulo 129252190Srpaulop2p_flush 130252190Srpaulo 131252190SrpauloFlush P2P peer table and state. 132252190Srpaulo 133252190SrpauloGroup Formation 134252190Srpaulo 135252190Srpaulop2p_prov_disc <peer device address> <display|keypad|pbc> [join|auto] 136252190Srpaulo 137252190SrpauloSend P2P provision discovery request to the specified peer. The 138252190Srpauloparameters for this command are the P2P device address of the peer and 139252190Srpaulothe desired configuration method. For example, "p2p_prov_disc 140252190Srpaulo02:01:02:03:04:05 display" would request the peer to display a PIN for 141252190Srpaulous and "p2p_prov_disc 02:01:02:03:04:05 keypad" would request the peer 142252190Srpauloto enter a PIN that we display. 143252190Srpaulo 144252190SrpauloThe optional "join" parameter can be used to indicate that this command 145252190Srpaulois requesting an already running GO to prepare for a new client. This is 146252190Srpaulomainly used with "display" to request it to display a PIN. The "auto" 147252190Srpauloparameter can be used to request wpa_supplicant to automatically figure 148252190Srpauloout whether the peer device is operating as a GO and if so, use 149252190Srpaulojoin-a-group style PD instead of GO Negotiation style PD. 150252190Srpaulo 151281806Srpaulop2p_connect <peer device address> <pbc|pin|PIN#|p2ps> [display|keypad|p2ps] 152252190Srpaulo [persistent|persistent=<network id>] [join|auth] 153346981Scy [go_intent=<0..15>] [freq=<in MHz>] [ht40] [vht] [he] [provdisc] [auto] 154337817Scy [ssid=<hexdump>] 155252190Srpaulo 156252190SrpauloStart P2P group formation with a discovered P2P peer. This includes 157252190Srpaulooptional group owner negotiation, group interface setup, provisioning, 158252190Srpauloand establishing data connection. 159252190Srpaulo 160252190SrpauloThe <pbc|pin|PIN#> parameter specifies the WPS provisioning 161252190Srpaulomethod. "pbc" string starts pushbutton method, "pin" string start PIN 162252190Srpaulomethod using an automatically generated PIN (which will be returned as 163252190Srpaulothe command return code), PIN# means that a pre-selected PIN can be 164252190Srpauloused (e.g., 12345670). [display|keypad] is used with PIN method 165252190Srpauloto specify which PIN is used (display=dynamically generated random PIN 166252190Srpaulofrom local display, keypad=PIN entered from peer display). "persistent" 167252190Srpauloparameter can be used to request a persistent group to be formed. The 168252190Srpaulo"persistent=<network id>" alternative can be used to pre-populate 169252190SrpauloSSID/passphrase configuration based on a previously used persistent 170252190Srpaulogroup where this device was the GO. The previously used parameters will 171252190Srpaulothen be used if the local end becomes the GO in GO Negotiation (which 172252190Srpaulocan be forced with go_intent=15). 173252190Srpaulo 174252190Srpaulo"join" indicates that this is a command to join an existing group as a 175252190Srpauloclient. It skips the GO Negotiation part. This will send a Provision 176252190SrpauloDiscovery Request message to the target GO before associating for WPS 177252190Srpauloprovisioning. 178252190Srpaulo 179252190Srpaulo"auth" indicates that the WPS parameters are authorized for the peer 180252190Srpaulodevice without actually starting GO Negotiation (i.e., the peer is 181252190Srpauloexpected to initiate GO Negotiation). This is mainly for testing 182252190Srpaulopurposes. 183252190Srpaulo 184252190Srpaulo"go_intent" can be used to override the default GO Intent for this GO 185252190SrpauloNegotiation. 186252190Srpaulo 187252190Srpaulo"freq" can be used to set a forced operating channel (e.g., freq=2412 188252190Srpauloto select 2.4 GHz channel 1). 189252190Srpaulo 190252190Srpaulo"provdisc" can be used to request a Provision Discovery exchange to be 191252190Srpauloused prior to starting GO Negotiation as a workaround with some deployed 192252190SrpauloP2P implementations that require this to allow the user to accept the 193252190Srpauloconnection. 194252190Srpaulo 195281806Srpaulo"auto" can be used to request wpa_supplicant to automatically figure 196281806Srpauloout whether the peer device is operating as a GO and if so, use 197281806Srpaulojoin-a-group operation rather than GO Negotiation. 198252190Srpaulo 199337817Scy"ssid=<hexdump>" can be used to specify the Group SSID for join 200337817Scyoperations. This allows the P2P Client interface to filter scan results 201337817Scybased on SSID to avoid selecting an incorrect BSS entry in case the same 202337817ScyP2P Device or Interface address have been used in multiple groups 203337817Scyrecently. 204337817Scy 205281806SrpauloP2PS attribute changes to p2p_connect command: 206281806Srpaulo 207281806SrpauloP2PS supports two WPS provisioning methods namely PIN method and P2PS default. 208337817ScyThe remaining parameters hold same role as in legacy P2P. In case of P2PS 209337817Scydefault config method "p2ps" keyword is added in p2p_connect command. 210281806Srpaulo 211281806SrpauloFor example: 212281806Srpaulop2p_connect 02:0a:f5:85:11:00 12345670 p2ps persistent join 213281806Srpaulo (WPS Method = P2PS default) 214281806Srpaulo 215281806Srpaulop2p_connect 02:0a:f5:85:11:00 45629034 keypad persistent 216281806Srpaulo (WPS Method = PIN) 217281806Srpaulo 218281806Srpaulop2p_asp_provision <peer MAC address> <adv_id=peer adv id> 219281806Srpaulo <adv_mac=peer MAC address> [role=2|4|1] <session=session id> 220281806Srpaulo <session_mac=initiator mac address> 221281806Srpaulo [info='service info'] <method=Default|keypad|Display> 222281806Srpaulo 223281806SrpauloThis command starts provision discovery with the P2PS enabled peer device. 224281806Srpaulo 225281806SrpauloFor example, 226281806Srpaulop2p_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 227281806Srpaulo 228281806SrpauloParameter description: 229281806Srpaulo MAC address - Mandatory 230281806Srpaulo adv_id - Mandatory remote Advertising ID of service connection is being 231281806Srpaulo established for 232281806Srpaulo adv_mac - Mandatory MAC address that owns/registered the service 233281806Srpaulo role - Optional 234281806Srpaulo 2 (group client only) or 4 (group owner only) 235281806Srpaulo if not present (or 1) role is negotiated by the two peers. 236281806Srpaulo session - Mandatory Session ID of the first session to be established 237281806Srpaulo session_mac - Mandatory MAC address that owns/initiated the session 238281806Srpaulo method - Optional method to request for provisioning (1000 - P2PS Default, 239281806Srpaulo 100 - Keypad(PIN), 8 - Display(PIN)) 240281806Srpaulo info - Optional UTF-8 string. Hint for service to indicate possible usage 241281806Srpaulo parameters - Escape single quote & backslash: 242281806Srpaulo with a backslash 0x27 == ' == \', and 0x5c == \ == \\ 243281806Srpaulo 244281806Srpaulop2p_asp_provision_resp <peer mac address> <adv_id= local adv id> 245281806Srpaulo <adv_mac=local MAC address> <role=1|2|4> <status=0> 246281806Srpaulo <session=session id> <session_mac=peer MAC address> 247281806Srpaulo 248281806SrpauloThis command sends a provision discovery response from responder side. 249281806Srpaulo 250281806SrpauloFor example, 251281806Srpaulop2p_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 252281806Srpaulo 253281806SrpauloParameters definition: 254281806Srpaulo MAC address - Mandatory 255281806Srpaulo adv_id - Mandatory local Advertising ID of service connection is being 256281806Srpaulo established for 257281806Srpaulo adv_mac - Mandatory MAC address that owns/registered the service 258281806Srpaulo role - Optional 2 (group client only) or 4 (group owner only) 259281806Srpaulo if not present (or 1) role is negotiated by the two peers. 260281806Srpaulo status - Mandatory Acceptance/Rejection code of Provisioning 261281806Srpaulo session - Mandatory Session ID of the first session to be established 262281806Srpaulo session_mac - Mandatory MAC address that owns/initiated the session 263281806Srpaulo 264281806Srpaulop2p_group_add [persistent|persistent=<network id>] [freq=<freq in MHz>] 265346981Scy [ht40] [vht] [he] 266281806Srpaulo 267252190SrpauloSet up a P2P group owner manually (i.e., without group owner 268252190Srpaulonegotiation with a specific peer). This is also known as autonomous 269252190SrpauloGO. Optional persistent=<network id> can be used to specify restart of 270252190Srpauloa persistent group. Optional freq=<freq in MHz> can be used to force 271252190Srpaulothe GO to be started on a specific frequency. Special freq=2 or freq=5 272252190Srpaulooptions can be used to request the best 2.4 GHz or 5 GHz band channel 273252190Srpauloto be selected automatically. 274252190Srpaulo 275252190Srpaulop2p_reject <peer device address> 276252190Srpaulo 277252190SrpauloReject connection attempt from a peer (specified with a device 278252190Srpauloaddress). This is a mechanism to reject a pending GO Negotiation with 279252190Srpauloa peer and request to automatically block any further connection or 280252190Srpaulodiscovery of the peer. 281252190Srpaulo 282252190Srpaulop2p_group_remove <group interface> 283252190Srpaulo 284252190SrpauloTerminate a P2P group. If a new virtual network interface was used for 285252190Srpaulothe group, it will also be removed. The network interface name of the 286252190Srpaulogroup interface is used as a parameter for this command. 287252190Srpaulo 288252190Srpaulop2p_cancel 289252190Srpaulo 290252190SrpauloCancel an ongoing P2P group formation and joining-a-group related 291337817Scyoperation. This operation unauthorizes the specific peer device (if any 292252190Srpaulohad been authorized to start group formation), stops P2P find (if in 293252190Srpauloprogress), stops pending operations for join-a-group, and removes the 294252190SrpauloP2P group interface (if one was used) that is in the WPS provisioning 295252190Srpaulostep. If the WPS provisioning step has been completed, the group is not 296252190Srpauloterminated. 297252190Srpaulo 298281806Srpaulop2p_remove_client <peer's P2P Device Address|iface=<interface address>> 299281806Srpaulo 300281806SrpauloThis command can be used to remove the specified client from all groups 301281806Srpaulo(operating and persistent) from the local GO. Note that the peer device 302281806Srpaulocan rejoin the group if it is in possession of a valid key. See p2p_set 303281806Srpauloper_sta_psk command below for more details on how the peer can be 304281806Srpauloremoved securely. 305281806Srpaulo 306252190SrpauloService Discovery 307252190Srpaulo 308281806Srpaulop2p_service_add asp <auto accept> <adv id> <status 0/1> <Config Methods> 309281806Srpaulo <Service name> [Service Information] [Response Info] 310281806Srpaulo 311281806SrpauloThis command can be used to search for a P2PS service which includes 312281806SrpauloPlay, Send, Display, and Print service. The parameters for this command 313281806Srpauloare "asp" to identify the command as P2PS one, auto accept value, 314281806Srpauloadvertisement id which uniquely identifies the service requests, state 315281806Srpauloof the service whether the service is available or not, config methods 316281806Srpaulowhich can be either P2PS method or PIN method, service name followed by 317281806Srpaulotwo optional parameters service information, and response info. 318281806Srpaulo 319281806SrpauloFor example, 320281806Srpaulop2p_service_add asp 1 4d6fc7 0 1108 alt.example.chat svc_info='name=john' rsp_info='enter PIN 1234' 321281806Srpaulo 322281806SrpauloParameters definition: 323281806Srpaulo asp - Mandatory for ASP service registration 324281806Srpaulo auto accept - Mandatory ASCII hex-encoded boolean (0 == no auto-accept, 325281806Srpaulo 1 == auto-accept ANY role, 2 == auto-accept CLIENT role, 326281806Srpaulo 4 == auto-accept GO role) 327281806Srpaulo Advertisement ID - Mandatory non-zero ASCII hex-encoded u32 328281806Srpaulo (Must be unique/not yet exist in svc db) 329281806Srpaulo State - Mandatory ASCII hex-encoded u8 (0 -- Svc not available, 330281806Srpaulo 1 -- Svc available, 2-0xff Application defined) 331281806Srpaulo Config Methods - Mandatory ASCII hex-encoded u16 (bitmask of WSC config 332281806Srpaulo methods) 333281806Srpaulo Service Name - Mandatory UTF-8 string 334281806Srpaulo Service Information - Optional UTF-8 string 335281806Srpaulo Escape single quote & backslash with a backslash: 336281806Srpaulo 0x27 == ' == \', and 0x5c == \ == \\ 337281806Srpaulo Session response information - Optional (used only if auto accept is TRUE) 338281806Srpaulo UTF-8 string 339281806Srpaulo Escape single quote & backslash with a backslash: 340281806Srpaulo 0x27 == ' == \', and 0x5c == \ == \\ 341281806Srpaulo 342281806Srpaulop2p_service_rep asp <auto accept> <adv id> <status 0/1> <Config Methods> 343281806Srpaulo <Service name> [Service Information] [Response Info] 344281806Srpaulo 345281806SrpauloThis command can be used to replace the existing service request 346281806Srpauloattributes from the initiator side. The replacement is only allowed if 347281806Srpaulothe advertisement id issued in the command matches with any one entry in 348281806Srpaulothe list of existing SD queries. If advertisement id doesn't match the 349281806Srpaulocommand returns a failure. 350281806Srpaulo 351281806SrpauloFor example, 352281806Srpaulop2p_service_rep asp 1 4d6fc7 1 1108 alt.example.chat svc_info='name=john' rsp_info='enter PIN 1234' 353281806Srpaulo 354281806SrpauloParameters definition: 355281806Srpaulo asp - Mandatory for ASP service registration 356281806Srpaulo auto accept - Mandatory ASCII hex-encoded boolean (1 == true, 0 == false) 357281806Srpaulo Advertisement ID - Mandatory non-zero ASCII hex-encoded u32 358281806Srpaulo (Must already exist in svc db) 359281806Srpaulo State - Mandatory ASCII hex-encoded u8 (can be used to indicate svc 360281806Srpaulo available or not available for instance) 361281806Srpaulo Config Methods - Mandatory ASCII hex-encoded u16 (bitmask of WSC config 362281806Srpaulo methods) 363281806Srpaulo Service Name - Mandatory UTF-8 string (Must match existing string in svc db) 364281806Srpaulo Service Information - Optional UTF-8 string 365281806Srpaulo Escape single quote & backslash with a backslash: 366281806Srpaulo 0x27 == ' == \', and 0x5c == \ == \\ 367281806Srpaulo Session response information - Optional (used only if auto accept is TRUE) 368281806Srpaulo UTF-8 string 369281806Srpaulo Escape single quote & backslash with a backslash: 370281806Srpaulo 0x27 == ' == \', and 0x5c == \ == \\ 371281806Srpaulo 372252190Srpaulop2p_serv_disc_req 373252190Srpaulo 374252190SrpauloSchedule a P2P service discovery request. The parameters for this 375252190Srpaulocommand are the device address of the peer device (or 00:00:00:00:00:00 376252190Srpaulofor wildcard query that is sent to every discovered P2P peer that 377252190Srpaulosupports service discovery) and P2P Service Query TLV(s) as hexdump. For 378252190Srpauloexample, 379252190Srpaulo 380252190Srpaulop2p_serv_disc_req 00:00:00:00:00:00 02000001 381252190Srpaulo 382252190Srpauloschedules a request for listing all available services of all service 383252190Srpaulodiscovery protocols and requests this to be sent to all discovered 384252190Srpaulopeers (note: this can result in long response frames). The pending 385252190Srpaulorequests are sent during device discovery (see p2p_find). 386252190Srpaulo 387281806SrpauloThere can be multiple pending peer device specific queries (each will be 388281806Srpaulosent in sequence whenever the peer is found). 389252190Srpaulo 390252190SrpauloThis command returns an identifier for the pending query (e.g., 391252190Srpaulo"1f77628") that can be used to cancel the request. Directed requests 392252190Srpaulowill be automatically removed when the specified peer has replied to 393252190Srpauloit. 394252190Srpaulo 395281806SrpauloService Query TLV has following format: 396281806SrpauloLength (2 octets, little endian) - length of following data 397281806SrpauloService Protocol Type (1 octet) - see the table below 398281806SrpauloService Transaction ID (1 octet) - nonzero identifier for the TLV 399281806SrpauloQuery Data (Length - 2 octets of data) - service protocol specific data 400281806Srpaulo 401281806SrpauloService Protocol Types: 402281806Srpaulo0 = All service protocols 403281806Srpaulo1 = Bonjour 404281806Srpaulo2 = UPnP 405281806Srpaulo3 = WS-Discovery 406281806Srpaulo4 = Wi-Fi Display 407281806Srpaulo 408252190SrpauloFor UPnP, an alternative command format can be used to specify a 409252190Srpaulosingle query TLV (i.e., a service discovery for a specific UPnP 410252190Srpauloservice): 411252190Srpaulo 412252190Srpaulop2p_serv_disc_req 00:00:00:00:00:00 upnp <version hex> <ST: from M-SEARCH> 413252190Srpaulo 414252190SrpauloFor example: 415252190Srpaulo 416252190Srpaulop2p_serv_disc_req 00:00:00:00:00:00 upnp 10 urn:schemas-upnp-org:device:InternetGatewayDevice:1 417252190Srpaulo 418252190SrpauloAdditional examples for queries: 419252190Srpaulo 420252190Srpaulo# list of all Bonjour services 421252190Srpaulop2p_serv_disc_req 00:00:00:00:00:00 02000101 422252190Srpaulo 423252190Srpaulo# list of all UPnP services 424252190Srpaulop2p_serv_disc_req 00:00:00:00:00:00 02000201 425252190Srpaulo 426252190Srpaulo# list of all WS-Discovery services 427252190Srpaulop2p_serv_disc_req 00:00:00:00:00:00 02000301 428252190Srpaulo 429252190Srpaulo# list of all Bonjour and UPnP services 430252190Srpaulop2p_serv_disc_req 00:00:00:00:00:00 0200010102000202 431252190Srpaulo 432252190Srpaulo# Apple File Sharing over TCP 433252190Srpaulop2p_serv_disc_req 00:00:00:00:00:00 130001010b5f6166706f766572746370c00c000c01 434252190Srpaulo 435252190Srpaulo# Bonjour SSTH (supported service type hash) 436252190Srpaulop2p_serv_disc_req 00:00:00:00:00:00 05000101000000 437252190Srpaulo 438252190Srpaulo# UPnP examples 439252190Srpaulop2p_serv_disc_req 00:00:00:00:00:00 upnp 10 ssdp:all 440252190Srpaulop2p_serv_disc_req 00:00:00:00:00:00 upnp 10 upnp:rootdevice 441252190Srpaulop2p_serv_disc_req 00:00:00:00:00:00 upnp 10 urn:schemas-upnp-org:service:ContentDirectory:2 442252190Srpaulop2p_serv_disc_req 00:00:00:00:00:00 upnp 10 uuid:6859dede-8574-59ab-9332-123456789012 443252190Srpaulop2p_serv_disc_req 00:00:00:00:00:00 upnp 10 urn:schemas-upnp-org:device:InternetGatewayDevice:1 444252190Srpaulo 445252190Srpaulo# Wi-Fi Display examples 446252190Srpaulo# format: wifi-display <list of roles> <list of subelements> 447252190Srpaulop2p_serv_disc_req 00:00:00:00:00:00 wifi-display [source] 2,3,4,5 448252190Srpaulop2p_serv_disc_req 02:01:02:03:04:05 wifi-display [pri-sink] 3 449252190Srpaulop2p_serv_disc_req 00:00:00:00:00:00 wifi-display [sec-source] 2 450252190Srpaulop2p_serv_disc_req 00:00:00:00:00:00 wifi-display [source+sink] 2,3,4,5 451252190Srpaulop2p_serv_disc_req 00:00:00:00:00:00 wifi-display [source][pri-sink] 2,3,4,5 452252190Srpaulo 453281806Srpaulop2p_serv_disc_req <Unicast|Broadcast mac address> asp <Transaction ID> 454281806Srpaulo <Service Name> [Service Information] 455281806Srpaulo 456281806SrpauloThe command can be used for service discovery for P2PS enabled devices. 457281806Srpaulo 458281806SrpauloFor example: p2p_serv_disc_req 00:00:00:00:00:00 asp a1 alt.example 'john' 459281806Srpaulo 460281806SrpauloParameters definition: 461281806Srpaulo MAC address - Mandatory Existing 462281806Srpaulo asp - Mandatory for ASP queries 463281806Srpaulo Transaction ID - Mandatory non-zero ASCII hex-encoded u8 for GAS 464281806Srpaulo Service Name Prefix - Mandatory UTF-8 string. 465281806Srpaulo Will match from beginning of remote Service Name 466281806Srpaulo Service Information Substring - Optional UTF-8 string 467281806Srpaulo If Service Information Substring is not included, all services matching 468281806Srpaulo Service Name Prefix will be returned. 469281806Srpaulo If Service Information Substring is included, both the Substring and the 470281806Srpaulo Service Name Prefix must match for service to be returned. 471281806Srpaulo If remote service has no Service Information, all Substring searches 472281806Srpaulo will fail. 473281806Srpaulo 474252190Srpaulop2p_serv_disc_cancel_req <query identifier> 475252190Srpaulo 476252190SrpauloCancel a pending P2P service discovery request. This command takes a 477252190Srpaulosingle parameter: identifier for the pending query (the value returned 478252190Srpauloby p2p_serv_disc_req, e.g., "p2p_serv_disc_cancel_req 1f77628". 479252190Srpaulo 480252190Srpaulop2p_serv_disc_resp 481252190Srpaulo 482252190SrpauloReply to a service discovery query. This command takes following 483252190Srpauloparameters: frequency in MHz, destination address, dialog token, 484252190Srpauloresponse TLV(s). The first three parameters are copied from the 485252190Srpaulorequest event. For example, "p2p_serv_disc_resp 2437 02:40:61:c2:f3:b7 486252190Srpaulo1 0300000101". This command is used only if external program is used 487252190Srpauloto process the request (see p2p_serv_disc_external). 488252190Srpaulo 489252190Srpaulop2p_service_update 490252190Srpaulo 491252190SrpauloIndicate that local services have changed. This is used to increment 492252190Srpaulothe P2P service indicator value so that peers know when previously 493252190Srpaulocached information may have changed. This is only needed when external 494252190Srpauloservice discovery processing is enabled since the commands to 495252190Srpaulopre-configure services for internal processing will increment the 496252190Srpauloindicator automatically. 497252190Srpaulo 498252190Srpaulop2p_serv_disc_external <0|1> 499252190Srpaulo 500252190SrpauloConfigure external processing of P2P service requests: 0 (default) = 501252190Srpaulono external processing of requests (i.e., internal code will process 502252190Srpauloeach request based on pre-configured services), 1 = external 503252190Srpauloprocessing of requests (external program is responsible for replying 504252190Srpauloto service discovery requests with p2p_serv_disc_resp). Please note 505252190Srpaulothat there is quite strict limit on how quickly the response needs to 506252190Srpaulobe transmitted, so use of the internal processing is strongly 507252190Srpaulorecommended. 508252190Srpaulo 509252190Srpaulop2p_service_add bonjour <query hexdump> <RDATA hexdump> 510252190Srpaulo 511252190SrpauloAdd a local Bonjour service for internal SD query processing. 512252190Srpaulo 513252190SrpauloExamples: 514252190Srpaulo 515252190Srpaulo# AFP Over TCP (PTR) 516252190Srpaulop2p_service_add bonjour 0b5f6166706f766572746370c00c000c01 074578616d706c65c027 517252190Srpaulo# AFP Over TCP (TXT) (RDATA=null) 518252190Srpaulop2p_service_add bonjour 076578616d706c650b5f6166706f766572746370c00c001001 00 519252190Srpaulo 520252190Srpaulo# IP Printing over TCP (PTR) (RDATA=MyPrinter._ipp._tcp.local.) 521252190Srpaulop2p_service_add bonjour 045f697070c00c000c01 094d795072696e746572c027 522252190Srpaulo# IP Printing over TCP (TXT) (RDATA=txtvers=1,pdl=application/postscript) 523252190Srpaulop2p_service_add bonjour 096d797072696e746572045f697070c00c001001 09747874766572733d311a70646c3d6170706c69636174696f6e2f706f7374736372797074 524252190Srpaulo 525252190Srpaulo# Supported Service Type Hash (SSTH) 526252190Srpaulop2p_service_add bonjour 000000 <32-byte bitfield as hexdump> 527252190Srpaulo(note: see P2P spec Annex E.4 for information on how to construct the bitfield) 528252190Srpaulo 529252190Srpaulop2p_service_del bonjour <query hexdump> 530252190Srpaulo 531252190SrpauloRemove a local Bonjour service from internal SD query processing. 532252190Srpaulo 533252190Srpaulop2p_service_add upnp <version hex> <service> 534252190Srpaulo 535252190SrpauloAdd a local UPnP service for internal SD query processing. 536252190Srpaulo 537252190SrpauloExamples: 538252190Srpaulo 539252190Srpaulop2p_service_add upnp 10 uuid:6859dede-8574-59ab-9332-123456789012::upnp:rootdevice 540252190Srpaulop2p_service_add upnp 10 uuid:5566d33e-9774-09ab-4822-333456785632::upnp:rootdevice 541252190Srpaulop2p_service_add upnp 10 uuid:1122de4e-8574-59ab-9322-333456789044::urn:schemas-upnp-org:service:ContentDirectory:2 542252190Srpaulop2p_service_add upnp 10 uuid:5566d33e-9774-09ab-4822-333456785632::urn:schemas-upnp-org:service:ContentDirectory:2 543252190Srpaulop2p_service_add upnp 10 uuid:6859dede-8574-59ab-9332-123456789012::urn:schemas-upnp-org:device:InternetGatewayDevice:1 544252190Srpaulo 545252190Srpaulop2p_service_del upnp <version hex> <service> 546252190Srpaulo 547252190SrpauloRemove a local UPnP service from internal SD query processing. 548252190Srpaulo 549281806Srpaulop2p_service_del asp <adv id> 550281806Srpaulo 551281806SrpauloRemoves the local asp service from internal SD query list. 552281806SrpauloFor example: p2p_service_del asp 4d6fc7 553281806Srpaulo 554252190Srpaulop2p_service_flush 555252190Srpaulo 556252190SrpauloRemove all local services from internal SD query processing. 557252190Srpaulo 558252190SrpauloInvitation 559252190Srpaulo 560252190Srpaulop2p_invite [persistent=<network id>|group=<group ifname>] [peer=address] 561346981Scy [go_dev_addr=address] [freq=<freq in MHz>] [ht40] [vht] [he] 562281806Srpaulo [pref=<MHz>] 563252190Srpaulo 564252190SrpauloInvite a peer to join a group (e.g., group=wlan1) or to reinvoke a 565252190Srpaulopersistent group (e.g., persistent=4). If the peer device is the GO of 566252190Srpaulothe persistent group, the peer parameter is not needed. Otherwise it is 567252190Srpauloused to specify which device to invite. go_dev_addr parameter can be 568252190Srpauloused to override the GO device address for Invitation Request should 569252190Srpauloit be not known for some reason (this should not be needed in most 570252190Srpaulocases). When reinvoking a persistent group, the GO device can specify 571281806Srpaulothe frequency for the group with the freq parameter. When reinvoking a 572281806Srpaulopersistent group, the P2P client device can use freq parameter to force 573281806Srpauloa specific operating channel (or invitation failure if GO rejects that) 574281806Srpauloor pref parameter to request a specific channel (while allowing GO to 575281806Srpauloselect to use another channel, if needed). 576252190Srpaulo 577252190SrpauloGroup Operations 578252190Srpaulo 579252190Srpaulo(These are used on the group interface.) 580252190Srpaulo 581252190Srpaulowps_pin <any|address> <PIN> 582252190Srpaulo 583252190SrpauloStart WPS PIN method. This allows a single WPS Enrollee to connect to 584252190Srpaulothe AP/GO. This is used on the GO when a P2P client joins an existing 585252190Srpaulogroup. The second parameter is the address of the Enrollee or a string 586252190Srpaulo"any" to allow any station to use the entered PIN (which will restrict 587252190Srpaulothe PIN for one-time-use). PIN is the Enrollee PIN read either from a 588252190Srpaulolabel or display on the P2P Client/WPS Enrollee. 589252190Srpaulo 590252190Srpaulowps_pbc 591252190Srpaulo 592252190SrpauloStart WPS PBC method (i.e., push the button). This allows a single WPS 593252190SrpauloEnrollee to connect to the AP/GO. This is used on the GO when a P2P 594252190Srpauloclient joins an existing group. 595252190Srpaulo 596252190Srpaulop2p_get_passphrase 597252190Srpaulo 598252190SrpauloGet the passphrase for a group (only available when acting as a GO). 599252190Srpaulo 600252190Srpaulop2p_presence_req [<duration> <interval>] [<duration> <interval>] 601252190Srpaulo 602252190SrpauloSend a P2P Presence Request to the GO (this is only available when 603252190Srpauloacting as a P2P client). If no duration/interval pairs are given, the 604252190Srpaulorequest indicates that this client has no special needs for GO 605281806Srpaulopresence. The first parameter pair gives the preferred duration and 606252190Srpaulointerval values in microseconds. If the second pair is included, that 607281806Srpauloindicates which value would be acceptable. This command returns OK 608281806Srpauloimmediately and the response from the GO is indicated in a 609281806SrpauloP2P-PRESENCE-RESPONSE event message. 610252190Srpaulo 611252190SrpauloParameters 612252190Srpaulo 613252190Srpaulop2p_ext_listen [<period> <interval>] 614252190Srpaulo 615252190SrpauloConfigure Extended Listen Timing. If the parameters are omitted, this 616252190Srpaulofeature is disabled. If the parameters are included, Listen State will 617252190Srpaulobe entered every interval msec for at least period msec. Both values 618252190Srpaulohave acceptable range of 1-65535 (with interval obviously having to be 619252190Srpaulolarger than or equal to duration). If the P2P module is not idle at 620252190Srpaulothe time the Extended Listen Timing timeout occurs, the Listen State 621252190Srpaulooperation will be skipped. 622252190Srpaulo 623252190SrpauloThe configured values will also be advertised to other P2P Devices. The 624252190Srpauloreceived values are available in the p2p_peer command output: 625252190Srpaulo 626252190Srpauloext_listen_period=100 ext_listen_interval=5000 627252190Srpaulo 628252190Srpaulop2p_set <field> <value> 629252190Srpaulo 630252190SrpauloChange dynamic P2P parameters 631252190Srpaulo 632252190Srpaulop2p_set discoverability <0/1> 633252190Srpaulo 634252190SrpauloDisable/enable advertisement of client discoverability. This is 635252190Srpauloenabled by default and this parameter is mainly used to allow testing 636252190Srpauloof device discoverability. 637252190Srpaulo 638252190Srpaulop2p_set managed <0/1> 639252190Srpaulo 640252190SrpauloDisable/enable managed P2P Device operations. This is disabled by 641252190Srpaulodefault. 642252190Srpaulo 643337817Scyp2p_set listen_channel <channel> [<op_class>] 644252190Srpaulo 645252190SrpauloSet P2P Listen channel. This is mainly meant for testing purposes and 646252190Srpaulochanging the Listen channel during normal operations can result in 647252190Srpauloprotocol failures. 648252190Srpaulo 649337817ScyWhen specifying a social channel on the 2.4 GHz band (1/6/11) there is 650337817Scyno need to specify the operating class since it defaults to 81. When 651337817Scyspecifying a social channel on the 60 GHz band (2), specify the 60 GHz 652337817Scyoperating class (180). 653337817Scy 654252190Srpaulop2p_set ssid_postfix <postfix> 655252190Srpaulo 656252190SrpauloSet postfix string to be added to the automatically generated P2P SSID 657252190Srpaulo(DIRECT-<two random characters>). For example, postfix of "-testing" 658252190Srpaulocould result in the SSID becoming DIRECT-ab-testing. 659252190Srpaulo 660281806Srpaulop2p_set per_sta_psk <0/1> 661281806Srpaulo 662281806SrpauloDisabled(default)/enables use of per-client PSK in the P2P groups. This 663281806Srpaulocan be used to request GO to assign a unique PSK for each client during 664281806SrpauloWPS provisioning. When enabled, this allow clients to be removed from 665337817Scythe group securely with p2p_remove_client command since that client's 666281806SrpauloPSK is removed at the same time to prevent it from connecting back using 667281806Srpaulothe old PSK. When per-client PSK is not used, the client can still be 668281806Srpaulodisconnected, but it will be able to re-join the group since the PSK it 669281806Srpaulolearned previously is still valid. It should be noted that the default 670281806Srpaulopassphrase on the GO that is normally used to allow legacy stations to 671281806Srpauloconnect through manual configuration does not change here, so if that is 672281806Srpauloshared, devices with knowledge of that passphrase can still connect. 673281806Srpaulo 674252190Srpauloset <field> <value> 675252190Srpaulo 676252190SrpauloSet global configuration parameters which may also affect P2P 677252190Srpaulooperations. The format on these parameters is same as is used in 678252190Srpaulowpa_supplicant.conf. Only the parameters listen here should be 679252190Srpaulochanged. Modifying other parameters may result in incorrect behavior 680252190Srpaulosince not all existing users of the parameters are updated. 681252190Srpaulo 682252190Srpauloset uuid <UUID> 683252190Srpaulo 684252190SrpauloSet WPS UUID (by default, this is generated based on the MAC address). 685252190Srpaulo 686252190Srpauloset device_name <device name> 687252190Srpaulo 688252190SrpauloSet WPS Device Name (also included in some P2P messages). 689252190Srpaulo 690252190Srpauloset manufacturer <manufacturer> 691252190Srpaulo 692252190SrpauloSet WPS Manufacturer. 693252190Srpaulo 694252190Srpauloset model_name <model name> 695252190Srpaulo 696252190SrpauloSet WPS Model Name. 697252190Srpaulo 698252190Srpauloset model_number <model number> 699252190Srpaulo 700252190SrpauloSet WPS Model Number. 701252190Srpaulo 702252190Srpauloset serial_number <serial number> 703252190Srpaulo 704252190SrpauloSet WPS Serial Number. 705252190Srpaulo 706252190Srpauloset device_type <device type> 707252190Srpaulo 708252190SrpauloSet WPS Device Type. 709252190Srpaulo 710252190Srpauloset os_version <OS version> 711252190Srpaulo 712252190SrpauloSet WPS OS Version. 713252190Srpaulo 714252190Srpauloset config_methods <config methods> 715252190Srpaulo 716252190SrpauloSet WPS Configuration Methods. 717252190Srpaulo 718252190Srpauloset sec_device_type <device type> 719252190Srpaulo 720252190SrpauloAdd a new Secondary Device Type. 721252190Srpaulo 722252190Srpauloset p2p_go_intent <GO intent> 723252190Srpaulo 724252190SrpauloSet the default P2P GO Intent. Note: This value can be overridden in 725252190Srpaulop2p_connect command and as such, there should be no need to change the 726252190Srpaulodefault value here during normal operations. 727252190Srpaulo 728252190Srpauloset p2p_ssid_postfix <P2P SSID postfix> 729252190Srpaulo 730252190SrpauloSet P2P SSID postfix. 731252190Srpaulo 732252190Srpauloset persistent_reconnect <0/1> 733252190Srpaulo 734252190SrpauloDisable/enabled persistent reconnect for reinvocation of persistent 735252190Srpaulogroups. If enabled, invitations to reinvoke a persistent group will be 736252190Srpauloaccepted without separate authorization (e.g., user interaction). 737252190Srpaulo 738252190Srpauloset country <two character country code> 739252190Srpaulo 740252190SrpauloSet country code (this is included in some P2P messages). 741252190Srpaulo 742281806Srpauloset p2p_search_delay <delay> 743281806Srpaulo 744281806SrpauloSet p2p_search_delay which adds extra delay in milliseconds between 745281806Srpauloconcurrent search iterations to make p2p_find friendlier to concurrent 746281806Srpaulooperations by avoiding it from taking 100% of radio resources. The 747281806Srpaulodefault value is 500 ms. 748281806Srpaulo 749252190SrpauloStatus 750252190Srpaulo 751252190Srpaulop2p_peers [discovered] 752252190Srpaulo 753252190SrpauloList P2P Device Addresses of all the P2P peers we know. The optional 754252190Srpaulo"discovered" parameter filters out the peers that we have not fully 755252190Srpaulodiscovered, i.e., which we have only seen in a received Probe Request 756252190Srpauloframe. 757252190Srpaulo 758252190Srpaulop2p_peer <P2P Device Address> 759252190Srpaulo 760252190SrpauloFetch information about a known P2P peer. 761252190Srpaulo 762252190SrpauloGroup Status 763252190Srpaulo 764252190Srpaulo(These are used on the group interface.) 765252190Srpaulo 766252190Srpaulostatus 767252190Srpaulo 768252190SrpauloShow status information (connection state, role, use encryption 769252190Srpauloparameters, IP address, etc.). 770252190Srpaulo 771252190Srpaulosta 772252190Srpaulo 773252190SrpauloShow information about an associated station (when acting in AP/GO role). 774252190Srpaulo 775252190Srpauloall_sta 776252190Srpaulo 777252190SrpauloLists the currently associated stations. 778252190Srpaulo 779252190SrpauloConfiguration data 780252190Srpaulo 781252190Srpaulolist_networks 782252190Srpaulo 783252190SrpauloLists the configured networks, including stored information for 784252190Srpaulopersistent groups. The identifier in this list is used with 785252190Srpaulop2p_group_add and p2p_invite to indicate which persistent group is to 786252190Srpaulobe reinvoked. 787252190Srpaulo 788252190Srpauloremove_network <network id> 789252190Srpaulo 790252190SrpauloRemove a network entry from configuration. 791252190Srpaulo 792252190Srpaulo 793281806SrpauloP2PS Events/Responses: 794281806Srpaulo 795281806SrpauloP2PS-PROV-START: This events gets triggered when provisioning is issued for 796281806Srpauloeither seeker or advertiser. 797281806Srpaulo 798281806SrpauloFor example, 799281806SrpauloP2PS-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' 800281806Srpaulo 801281806SrpauloParameters definition: 802281806Srpaulo MAC address - always 803281806Srpaulo adv_id - always ASCII hex-encoded u32 804281806Srpaulo adv_mac - always MAC address that owns/registered the service 805281806Srpaulo conncap - always mask of 0x01 (new), 0x02 (group client), 0x04 (group owner) 806281806Srpaulo bits 807281806Srpaulo session - always Session ID of the first session to be established 808281806Srpaulo session_mac - always MAC address that owns/initiated the session 809281806Srpaulo info - if available, UTF-8 string 810281806Srpaulo Escaped single quote & backslash with a backslash: 811281806Srpaulo \' == 0x27 == ', and \\ == 0x5c == \ 812281806Srpaulo 813281806SrpauloP2PS-PROV-DONE: When provisioning is completed then this event gets triggered. 814281806Srpaulo 815281806SrpauloFor example, 816281806SrpauloP2PS-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] 817281806Srpaulo 818281806SrpauloParameters definition: 819281806Srpaulo MAC address - always main device address of peer. May be different from MAC 820281806Srpaulo ultimately connected to. 821281806Srpaulo status - always ascii hex-encoded u8 (0 == success, 12 == deferred success) 822281806Srpaulo adv_id - always ascii hex-encoded u32 823281806Srpaulo adv_mac - always MAC address that owns/registered the service 824281806Srpaulo conncap - always One of: 1 (new), 2 (group client), 4 (group owner) bits 825281806Srpaulo session - always Session ID of the first session to be established 826281806Srpaulo session_mac - always MAC address that owns/initiated the session 827281806Srpaulo dev_passwd_id - only if conncap value == 1 (New GO negotiation) 828281806Srpaulo 8 - "p2ps" password must be passed in p2p_connect command 829281806Srpaulo 1 - "display" password must be passed in p2p_connect command 830281806Srpaulo 5 - "keypad" password must be passed in p2p_connect command 831281806Srpaulo join only - if conncap value == 2 (Client Only). Display password and "join" 832281806Srpaulo must be passed in p2p_connect and address must be the MAC specified 833281806Srpaulo go only - if conncap value == 4 (GO Only). Interface name must be set with a 834281806Srpaulo password 835281806Srpaulo persist - only if previous persistent group existed between peers and shall 836281806Srpaulo be re-used. Group is restarted by sending "p2p_group_add persistent=0" 837281806Srpaulo where value is taken from P2P-PROV-DONE 838281806Srpaulo 839281806SrpauloExtended Events/Response 840281806Srpaulo 841281806SrpauloP2P-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 842281806Srpaulo 843281806SrpauloParameters definition: 844281806Srpaulo adv_id - if ASP ASCII hex-encoded u32. If it is reporting the 845281806Srpaulo "wildcard service", this value will be 0 846281806Srpaulo asp_svc - if ASP this is the service string. If it is reporting the 847281806Srpaulo "wildcard service", this value will be org.wi-fi.wfds 848281806Srpaulo 849281806Srpaulo 850252190Srpaulowpa_cli action script 851252190Srpaulo--------------------- 852252190Srpaulo 853252190SrpauloSee examples/p2p-action.sh 854252190Srpaulo 855252190SrpauloTODO: describe DHCP/DNS setup 856252190SrpauloTODO: cross-connection 857