execute wpa_supplicant + wpa_cli with a virtual network interface

Stefano Cappa stefano.cappa
Thu Jan 8 12:28:57 PST 2015


Oh damn!
Thank u for this quick answer, now i'm really scared :(

If i use iw (ok not exactly iw, but an unofficial port of iw that i compiled) on Nexus 5 KitKat i get this:
*
|Supported interface modes:
|		 * IBSS
|		 * managed
|		 * AP
|		 * P2P-client
|		 * P2P-GO
|	software interface modes (can always be added):
|	valid interface combinations:
|		 * #{ managed } <= 2, #{ P2P-client, P2P-GO } <= 2, #{ IBSS } <= 1,
|		   total <= 3, #channels <= 2
*

On Nexus 4 Kitkat i get this:
*
|Supported interface modes:
|		 * IBSS
|		 * managed
|		 * AP
|		 * P2P-client
|		 * P2P-GO
|	software interface modes (can always be added):
|	valid interface combinations:
|		 * #{ managed } <= 3, #{ AP } <= 1, #{ P2P-client, P2P-GO } <= 1,
|		   total <= 3, #channels <= 2
*

This means that is supported for p2p with wpa_supplicant + wpa_cli? 
I need to add another virtual interface for wpa_supplicant, because i want to work with p2p, for example "p2p1".

On nexus 5, If i try to create an interface with iw with this command: "iw dev wlan0 interface add p2p1 type managed"
It works, i hope. And with "iw dev" i get :  

*
|phy#0
|	Interface p2p1
|		ifindex 24
|		type managed
|	Interface wlan0
|		ifindex 21
|		type managed
|	Interface p2p0
|		ifindex 20
|		type managed
*




With Nexus 4 the previous command works without errors, but the interface is not available with  "iw dev". I suppose that Nexus4 driver is not compatible.


The question is: with Nexus 5, in this situation, it's possibile to execute wpa_supplicant on this new virtual interface? I know is the same question, but now i really want to be sure that this is the correct way, because i lost a huge amount of time.

Thank u very much Dan.

Stefano Cappa.


________________________________________
Da: Dan Williams <dcbw at redhat.com>
Inviato: gioved? 8 gennaio 2015 18.42
A: Stefano Cappa
Cc: hostap at lists.shmoo.com
Oggetto: Re: execute wpa_supplicant + wpa_cli with a virtual network interface

On Thu, 2015-01-08 at 16:48 +0000, Stefano Cappa wrote:
> Hi, with Android Kitkat or Lollipop i can execute this commands without problems and use wpa_cli for p2p:
>
>
> 1) wpa_supplicant -B -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf -N -B -ip2p0 -Dnl80211 -c/data/misc/wifi/p2p_supplicant.conf
>
> 2) wpa_cli -ip2p0 -p/data/misc/wifi/sockets
>
>
> Now, i want to create another network interface created in this way (with a "custom android kernel" to enable macvtap, from Android Open Source Project) :
>
> 1) ip link add link wlan0 name INTERFACE_NAME type macvtap
>
> 2) busybox ifconfig INTERFACE_NAME 10.169.129.42 netmask 255.255.248.0 up
>
> 3) busybox ifconfig -a                                   // and i can find the new network interface with MAC, IP... --> PERFECT
>
>
> Now i want to execute wpa_supplicant and wpa_cli with this network interface called in this example "INTERFACE_NAME":
>
> If i try with
>
> 1) "wpa_supplicant -B -iINTERFACE_NAME -Dnl80211 -c/data/misc/wifi/INTERFACE_NAME_supplicant.conf"
>
> with a conf file like wpa_supplicant, exactly the same with ctrl_interface=/data/misc/wifi/sockets, i get this error code "255".

It is very unlikely this will work, because the macvtap interface is
*not* a wifi/nl80211 interface at all, and wpa_supplicant will by trying
to do nl80211 operations on it.

If you're trying to create multiple virtual WiFi interfaces that
wpa_supplicant can control, then you need to use the 'iw' tool to create
them, and the driver needs to support multi-VIF operations.  You can
find out if the driver does this by running "iw phy phy0 info" and
looking at "valid interface combinations".

Dan

> Probably there are no available sockets in /data/misc/wifi/sockets ? Or, I need to use another conf file? I really don't know.
>
>
> I thought, mmm, i can use wpa_cli interface_add INTERFACE_NAME "" nl80211 /data/misc/wifi/sockets,
>
> but i get this error: "Failed to connect to non-global ctrl_ifname: wlan0  error: No such file or directory 255"
>
>
> My questions are:
>
>  A)   How can i execute wpa_supplicant + wpa_cli on a virtuale network interface in android?
>
>  B)   I need to create new sockets? How? I can use socat?
>
>  C)   The syntax of  wpa_cli interface_add  is correct? Because i can't find a good documentation to this command. I searched in the source code to pass the parameters, but i'm not completely sure.
>
>
> Thank u very much,
>
> please help me,  i'm working on this, since...i don't know... days days and days :(
>
>
> _______________________________________________
> HostAP mailing list
> HostAP at lists.shmoo.com
> http://lists.shmoo.com/mailman/listinfo/hostap



More information about the Hostap mailing list