Android wpa_supplicant with different virtual network interface for WiFi Station Mode (wlan0) and P2P (p2p0)
Xuebing Wang
xbing6 at gmail.com
Thu Mar 24 03:55:21 PDT 2016
Hi,
I am working on WiFi Direct (originally WiFi P2P) on Android 4.4.2,
using Realtek RTL8812AU. I use "-Dnl80211" to use nl80211 driver.
1) I understand if I use "use_p2p_group_interface=1", I will get virtual
network interface like "p2p-wlan0-0". Is there a nl80211 command (then
cfg80211) to the kernel driver to actually create this virtual network
interface?
Realtek driver does not support this, however it supports Concurrent
mode, and it creates 2 network interface "wlan0" and "p2p0".
2) I build Realtek driver with CONFIG_CONCURRENT_MODE defined, and I use
both Station Mode and P2P on wlan0, and everything is fine. init.rc is
like below:
-------------------------------
service wpa_supplicant /system/bin/wpa_supplicant \
-iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \
-I/system/etc/wifi/wpa_supplicant_overlay.conf \
-O/data/misc/wifi/sockets \
-e/data/misc/wifi/entropy.bin -g at android:wpa_wlan0
# we will start as root and wpa_supplicant will switch to user wifi
# after setting up the capabilities required for WEXT
# user wifi
# group wifi inet keystore
class main
socket wpa_wlan0 dgram 660 wifi wifi
disabled
oneshot
service p2p_supplicant /system/bin/wpa_supplicant \
-iwlan0 -Dnl80211 -iwlan0 -c/data/misc/wifi/wpa_supplicant.conf \
-I/system/etc/wifi/wpa_supplicant_overlay.conf \
-O/data/misc/wifi/sockets -N \
-ip2p0 -Dnl80211 -c /data/misc/wifi/p2p_supplicant.conf \
-I/system/etc/wifi/p2p_supplicant_overlay.conf \
-puse_p2p_group_interface=1 -e/data/misc/wifi/entropy.bin \
-g at android:wpa_wlan0
# we will start as root and wpa_supplicant will switch to user wifi
# after setting up the capabilities required for WEXT
# user wifi
# group wifi inet keystore
class main
socket wpa_wlan0 dgram 660 wifi wifi
disabled
oneshot
-------------------------------
Above is actually copy/paste from AOSP source for device Asus Grouper
(Android version 4.4.4), link is below:
https://android.googlesource.com/device/asus/grouper/+/kitkat-release/init.grouper.rc
3) I tried to use different virtual interface for Station Mode (wlan0)
and P2P (p2p0), and change init.${ro.hardware}.rc as below:
-------------------------------
service p2p_supplicant /system/bin/wpa_supplicant \
-ip2p0 -Dnl80211 -iwlan0 -c/data/misc/wifi/wpa_supplicant.conf \
-------------------------------
Only change from "-iwlan0" to "-ip2p0" for service p2p_supplicant.
P2P works on interface p2p0, without issues.
The problem is that interface wlan0 is inactive by run command
"/system/xbin/ifconfig". Of course "/system/xbin/ifconfig -a" shows all
the interfaces, including wlan0.
4) I run command "netcfg wlan0 up", there is error "IPv6:
ADDRCONF(NETDEV_UP): wlan0: link is not ready", this error message is
from kernel source "net/ipv6/addrconf.c".
5) I am not sure if my problem in step (3) above is because of Realtek
driver. In order to use interface p2p0, it is simple as that to use
-ip2p0 rather than -iwlan0 in init.${ro.hardware}.rc? Do I need to do
more changes? Any suggestions?
Thanks.
xuebing wang
More information about the Hostap
mailing list