[PATCH] P2P: Add IFNAME=iface command option for interface redirection

Jouni Malinen j
Sat May 18 10:07:21 PDT 2013


On Tue, May 14, 2013 at 03:50:10PM -0700, Dmitry Shmidt wrote:
> diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
> +/*
> + * Expected command format: CMD IFNAME=ifname [rest of command]
> + */
> +struct wpa_supplicant *wpa_supplicant_redir_iface(struct wpa_supplicant *wpa_s,
> +						  char *buf)

> @@ -5196,6 +5231,8 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
> +	wpa_s = wpa_supplicant_redir_iface(wpa_s, buf);

The part of making control interface commands available through a single
socket sounds reasonable, but I'm not sure whether use of per-interface
socket for this is the best design for it. At least in theory, there
could be different security policies configured for network interfaces
and this design would by-pass such differences. In addition, the concept
of directing commands through another control interface at network
device level does not look correct.

I added a similar mechanism, but using the global control interface
instead of the per-network interface ctrl_iface. In addition to just
handling commands, there is no also support for attaching a monitor
socket on top of the global control interface to get events from all
network interfaces that the wpa_supplicant process controls. There is
also concept of global operations that are not specific to any network
interface, so that it is possible to run P2P Device operations (like
P2P_FIND and P2P_CONNECT) through the control interface without having
to specify any network interface. This should make it quite a bit easier
to change the internal wpa_supplicant and nl80211 design for this
without affecting programs that use the wpa_supplicant control
interface.

The global control interface can be easily tested by adding the -g
command line argument to wpa_supplicant and wpa_cli. It is fine to leave
the per-interface control interfaces as-is, i.e., any combination of
enabled interfaces can be used.

I've adding support for specifying abstract namespace for UNIX domain
sockets (Linux-specific extension) with -g @abstract:name-here.
Similarly, there is now more explicit way of specifying the Android
control socket with -g @android:name-here. This seemed to work fine by
creating wpa_global socket in init.*.rc and adding "-g
@android:wpa_global" to the end of wpa_supplicant command line. The
android-jb branch snapshot in hostap.git can be built as-is with AOSP
4.2.2 to replace the external/wpa_supplicant_8 version for experiments.


wpa_supplicant global interface operations for P2P:

Group formation:

P2P_FIND
P2P_CONNECT <peer> ...

Authorize P2P client to join a group (on GO):

IFNAME=p2p-wlan0-0 WPS_PBC

P2P Device level events without "IFNAME=<ifname> " prefix. P2P group
level events with "IFNAME=<group ifname> " prefix.


Example with wpa_cli interactive mode:

wpa_cli -g @abstract:wpas 

> 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
> p2p_connect 02:00:00:00:01:00 pbc
OK
<3>P2P-FIND-STOPPED 
<3>P2P-GO-NEG-SUCCESS 
IFNAME=p2p-wlan0-0 <3>CTRL-EVENT-CONNECTED - Connection to 42:00:00:00:00:00 completed [id=0 id_str=]
IFNAME=p2p-wlan0-0 <3>WPS-ENROLLEE-SEEN 42:00:00:00:01:00 572cf82f-c957-5653-9b16-b5cfb298abf1 0-00000000-0 0x2148 4 1 [ ]
IFNAME=p2p-wlan0-0 <3>CTRL-EVENT-EAP-STARTED 42:00:00:00:01:00
IFNAME=p2p-wlan0-0 <3>CTRL-EVENT-EAP-PROPOSED-METHOD vendor=0 method=1
IFNAME=p2p-wlan0-0 <3>CTRL-EVENT-EAP-PROPOSED-METHOD vendor=14122 method=254
IFNAME=p2p-wlan0-0 <3>WPS-REG-SUCCESS 42:00:00:00:01:00 572cf82f-c957-5653-9b16-b5cfb298abf1
<3>P2P-GROUP-FORMATION-SUCCESS 
<3>P2P-GROUP-STARTED p2p-wlan0-0 GO ssid="DIRECT-xK" freq=2412 passphrase="YzkxxGUK" go_dev_addr=02:00:00:00:00:00
IFNAME=p2p-wlan0-0 <3>WPS-SUCCESS 
IFNAME=p2p-wlan0-0 <3>CTRL-EVENT-EAP-FAILURE 42:00:00:00:01:00
IFNAME=p2p-wlan0-0 <3>AP-STA-CONNECTED 42:00:00:00:01:00 p2p_dev_addr=02:00:00:00:01:00


<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
<3>P2P-PROV-DISC-PBC-REQ 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 group=p2p-wlan0-0
IFNAME=p2p-wlan0-0 <3>WPS-ENROLLEE-SEEN 02:00:00:00:02:00 a134bcd4-edf6-548b-87e5-49d3aedf9b60 1-0050F204-1 0x2148 4 1 [Device C]
> raw IFNAME=p2p-wlan0-0 WPS_PBC
OK
IFNAME=p2p-wlan0-0 <3>CTRL-EVENT-EAP-STARTED 02:00:00:00:02:00
IFNAME=p2p-wlan0-0 <3>CTRL-EVENT-EAP-PROPOSED-METHOD vendor=0 method=1
IFNAME=p2p-wlan0-0 <3>CTRL-EVENT-EAP-PROPOSED-METHOD vendor=14122 method=254
IFNAME=p2p-wlan0-0 <3>WPS-REG-SUCCESS 02:00:00:00:02:00 a134bcd4-edf6-548b-87e5-49d3aedf9b60
IFNAME=p2p-wlan0-0 <3>WPS-SUCCESS 
IFNAME=p2p-wlan0-0 <3>CTRL-EVENT-EAP-FAILURE 02:00:00:00:02:00
IFNAME=p2p-wlan0-0 <3>AP-STA-CONNECTED 02:00:00:00:02:00 p2p_dev_addr=02:00:00:00:02:00


> p2p_group_remove p2p-wlan0-0 
OK
<3>P2P-GROUP-REMOVED p2p-wlan0-0 GO reason=REQUESTED
IFNAME=p2p-wlan0-0 <3>AP-STA-DISCONNECTED 42:00:00:00:01:00 p2p_dev_addr=02:00:00:00:01:00

-- 
Jouni Malinen                                            PGP id EFC895FA



More information about the Hostap mailing list