How to detect p2p connection using wpa_cli.

Jouni Malinen j
Sat Nov 3 02:58:10 PDT 2012


On Sat, Nov 03, 2012 at 03:11:13AM +0900, Satoshi Aoyama wrote:
> I want to detect my p2p_device receives request for connection from
> other p2p_device.
> I'm new to wpa_supplicant. Could you tell me how I can detect ?

wpa_supplicant sends a P2P-GO-NEG-REQUEST event on the control interface
when a GO Negotiation Request is received from a peer.

> Is it useful information for that aim that the commands 'wpa_cli
> p2p_peer' outputs?

The P2P-DEVICE-FOUND event may be enough for number of use cases, but
you can use the p2p_peer command to fetch more complete information of a
discovered peer.

> ex)
>  A is my device. B and C are other p2p_device.
>  I want to distinguish (1) from (2).
>  (1) B starts p2p_connect to A.
>  (2) B starts p2p_connect to C.

I'm not sure I understand the question here.. In (2), your device would
not be part of the negotiation, so it would not see any of the GO
Negotiation frames.


Here's an example session with wpa_cli interactive mode:

Device discovery:

Device A:

> p2p_find 
OK
<3>P2P-DEVICE-FOUND 02:00:00:00:01:00 p2p_dev_addr=02:00:00:00:01:00 pri_dev_type=1-0050F204-1 name='Device B' config_methods=0x108 dev_capab=0x25 group_capab=0x0
<3>P2P-DEVICE-FOUND 02:00:00:00:02:00 p2p_dev_addr=02:00:00:00:02:00 pri_dev_type=1-0050F204-1 name='Device C' config_methods=0x108 dev_capab=0x25 group_capab=0x0

Device B:

> p2p_find 
OK
<3>P2P-DEVICE-FOUND 02:00:00:00:00:00 p2p_dev_addr=02:00:00:00:00:00 pri_dev_type=1-0050F204-1 name='Device A' config_methods=0x108 dev_capab=0x25 group_capab=0x0
<3>P2P-DEVICE-FOUND 02:00:00:00:02:00 p2p_dev_addr=02:00:00:00:02:00 pri_dev_type=1-0050F204-1 name='Device C' config_methods=0x108 dev_capab=0x25 group_capab=0x0

Device C:

> p2p_find 
OK
<3>P2P-DEVICE-FOUND 02:00:00:00:00:00 p2p_dev_addr=02:00:00:00:00:00 pri_dev_type=1-0050F204-1 name='Device A' config_methods=0x108 dev_capab=0x25 group_capab=0x0
<3>P2P-DEVICE-FOUND 02:00:00:00:01:00 p2p_dev_addr=02:00:00:00:01:00 pri_dev_type=1-0050F204-1 name='Device B' config_methods=0x108 dev_capab=0x25 group_capab=0x0


Device B starting group formation with Device A:

> p2p_connect 02:00:00:00:00:00 pbc
OK
<3>P2P-FIND-STOPPED 

Device A reaction to this:

<3>P2P-GO-NEG-REQUEST 02:00:00:00:01:00 dev_passwd_id=4
> p2p_connect 02:00:00:00:01:00 pbc
OK
<3>P2P-FIND-STOPPED 
<3>P2P-GO-NEG-SUCCESS 
... to the completion of group formation
 
-- 
Jouni Malinen                                            PGP id EFC895FA



More information about the Hostap mailing list