execute wpa_supplicant + wpa_cli with a virtual network interface

Dan Williams dcbw at redhat.com
Thu Jan 8 12:42:28 EST 2015


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