execute wpa_supplicant + wpa_cli with a virtual network interface
Stefano Cappa
stefano.cappa
Fri Jan 9 06:32:03 PST 2015
Yes, i'm using this http://wireless.kernel.org/en/developers/p2p/howto and i can connect 2 device together with p2p-p2p0-1 interface, generated by wpa_supplicant. Perfect.
But now i want another interface to execute the same protocol at the same time.
If i try to lunch "p2p_connect go_address pbc go_intent=15" on the third device and "p2p_connect new_device_address pbc go_intent=1" is not working on the previous device, because the go_address device is a GO on the interface and can't be a client.
For this reason i want to create another interface.
Obviously i'm not sure that my device and/or kernel supports all this things. I'm trying to find the best way to reach my objectives. Probably i need to recompile the kernel with more modules, because i have problems to maintain as "UP" 3 interfaces (error: Device or resource busy), i'm not sure, but this is a different story.
Now i want to be sure how can i achieve this, theoretically, before that i can start to work.
Another approach, like your suggestions (without using directly iw):
How can i start a p2p connection (on a device already connected to a third device as GO) as client with another device that is a GO? I mean, if everything is ok, driver ok, kernel ok, os ok, everything...with wpa_cli how can i achieve this without creating an interface with iw, but using wpa_supplicant like in this post (http://wireless.kernel.org/en/developers/p2p/howto) ?
I'm really sorry for this long email ;)
Thank u,
Stefano Cappa
________________________________________
Da: Dan Williams <dcbw at redhat.com>
Inviato: gioved? 8 gennaio 2015 23.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 20:28 +0000, Stefano Cappa wrote:
> 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:
Instead of iw directly, does any of the stuff mentioned here with
wpa_supplicant work? eg, letting the supplicant handle creation of the
other interface if it needs to?
http://wireless.kernel.org/en/developers/p2p/howto
Dan
> |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
> _______________________________________________
> HostAP mailing list
> HostAP at lists.shmoo.com
> http://lists.shmoo.com/mailman/listinfo/hostap
More information about the Hostap
mailing list