P2P Service Discovery

P2P Serive discovery is a optional feature that allows to find the services offered by the peer device. P2P Service discovery used Generic Advertisement Service protocol (GAS) frame exchange. Access Network Query Protocol (ANQP) will be carried inside in the GAS frames to query the services offered by the Peer device. We do see GAS protocol and ANQP protocol in 802.11u (HS2.0) protocol.

Find the below image to check for the service discovery frame exchange.

  1. It may be a single or multiple GAS Initial Request and Response action frame exchange.
  2. The requesting P2P Device transmits one or more GAS Initial Request frames.
  3. A target P2P Device that supports Service Discovery responds with one or more GAS Initial Response frames.

The Service Discovery procedure can be used to find:

  1. A list of all services offered by a P2P Device Information about a single service offered by a P2P Device.
  2. Information about multiple services offered by a P2P Device
  3. If there has been a change in the services offered by a P2P Device

Below are the supported services offered.

See the below frame capture to check the service discovery request and response frames that are using GAS frame exchange. GAS request frame shows the SD query to check about the UPNP protocol. See the below capture for this

Below are the SD response codes.

See the below capture for the Service discovery response.

In the below capture observe that there is a request and response frames exchanged to check the bonjour service. Check the sniffer capture for Request and Response frames, wireshark could not able to properly decode it , but see the frame exchanges.

See the SD response for BONJOUR service

See the below capture to check “WS-DISCOVERY” service. Web Services Dynamic Discovery (WS-Discovery) is a technical specification that defines a multicast discovery protocol to locate services on a local network.

See the response for WS-DISCOVERY Request Frame, just observe the WS-DISCOVERY Response frame to see how the frame looks like. And observe the status code.

As I told earlier , there are multiple service responses will be sent in a single response , observe the below capture to check the multiple services that are sent in a single response (UPNP and BONJOUR) see the below GAS response frame structure.

See the below supplicant logs to check the service discovery request and response. I have replaced the OUI of the MAX with “XX:XX:XX” in the log.

Device 1: P1 :”IFNAME=p2p-dev-wlan0 <3>P2P-SERV-DISC-REQ 2437 XX:XX:XX:74:c0:c1 0 0 120002011075706e703a726f6f74646576696365″

Device 2: P2: <3>P2P-SERV-DISC-RESP XX:XX:XX:7e:c3:8a 1 3e0002010010757569643a34343434343434342d383537342d353961622d393332322d3032323337363939306164393a3a75706e703a726f6f74646576696365

In the Next post, I will post about Group Formation Procedures in WiFi Direct.