mac80211-next: rtnetlink wifi simulation device
Subsystems (3)
PATCH v4 1/1 mac80211-next: rtnetlink wifi simulation device
This device takes over an existing network device and produces a new one that appears like a wireless connection, returning enough canned responses to nl80211 to satisfy a standard connection manager. If necessary, it can also be set up one step removed from an existing network device, such as through a vlan/80211Q or macvlan connection to not disrupt the existing network interface.
To use it to wrap a bare ethernet connection:
ip link add link eth0 name wlan0 type virt_wifi
You may have to rename or otherwise hide the eth0 from your connection manager, as the original network link will become unusuable and only the wireless wrapper will be functional. This can also be combined with vlan or macvlan links on top of eth0 to share the network between distinct links, but that requires support outside the machine for accepting vlan-tagged packets or packets from multiple MAC addresses.
This is being used for Google's Remote Android Virtual Device project, which runs Android devices in virtual machines. The standard network interfaces provided inside the virtual machines are all ethernet. However, Android is not interested in ethernet devices and would rather connect to a wireless interface. This patch allows the virtual machine guest to treat one of its network connections as wireless rather than ethernet, satisfying Android's network connection requirements.
We believe this is a generally useful driver for simulating wireless network connections in other environments where a wireless connection is desired by some userspace process but is not available.
This is distinct from other testing efforts such as mac80211_hwsim by being a cfg80211 device instead of mac80211 device, allowing straight pass-through on the data plane instead of forcing packaging of ethernet data into mac80211 frames.
---
Thanks for the comments on previous changes. Patch comments are now addressed in responses to those emails. There will be a slight delay as I get the appropriate lkml.org link to reference the code review comments to this new patch.
I apologize for the long delay in creating this new version.
First version: https://lkml.org/lkml/2018/7/27/947
First review: https://lore.kernel.org/lkml/[email protected]/
Second version: https://lore.kernel.org/lkml/20180926194324.71290-1-schuffelen-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org/
Second review: Comments of https://www.lkml.org/lkml/2018/9/26/1169
Third review: https://lkml.org/lkml/2018/10/4/966
drivers/net/wireless/Kconfig | 7 + drivers/net/wireless/Makefile | 2 + drivers/net/wireless/virt_wifi.c | 632 +++++++++++++++++++++++++++++++ 3 files changed, 641 insertions(+) create mode 100644 drivers/net/wireless/virt_wifi.c
drivers/net/wireless/Kconfig +7 -0
@@ -114,4 +114,11 @@ config USB_NET_RNDIS_WLAN If you choose to build a module, it'll be called rndis_wlan. +config VIRT_WIFI + bool "Wifi wrapper for ethernet drivers" + depends on CFG80211 + ---help--- + This option adds support for ethernet connections to appear as if they + are wifi connections through a special rtnetlink device. + endif # WLAN
drivers/net/wireless/Makefile +2 -0
@@ -27,3 +27,5 @@ obj-$(CONFIG_PCMCIA_WL3501) += wl3501_cs.o obj-$(CONFIG_USB_NET_RNDIS_WLAN) += rndis_wlan.o obj-$(CONFIG_MAC80211_HWSIM) += mac80211_hwsim.o + +obj-$(CONFIG_VIRT_WIFI) += virt_wifi.o
drivers/net/wireless/virt_wifi.c new file +632 -0
632 lines not on this page · raw message
Signature · 1 line
2.19.1.1215.g8438c0b245-goog
kbuild test robot
build botThank you for the patch! Yet something to improve:
Hi Cody,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on mac80211-next/master]
url: https://github.com/0day-ci/linux/commits/Cody-Schuffelen/mac80211-next-rtnetlink-wifi-simulation-device/20181124-020949 base: https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git master config: ia64-allmodconfig (attached as .config) compiler: ia64-linux-gcc (GCC) 8.1.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=8.1.0 make.cross ARCH=ia64
All errors (new ones prefixed by >>):
drivers/net/wireless/virt_wifi.o: In function `virt_wifi_cancel_scan':
>> virt_wifi.c:(.text+0x101): undefined reference to `cfg80211_scan_done' drivers/net/wireless/virt_wifi.o: In function `virt_wifi_cancel_connect': >> virt_wifi.c:(.text+0x1f2): undefined reference to `cfg80211_connect_done' drivers/net/wireless/virt_wifi.o: In function `virt_wifi_connect_complete': virt_wifi.c:(.text+0x562): undefined reference to `cfg80211_connect_done' drivers/net/wireless/virt_wifi.o: In function `virt_wifi_scan_result': >> virt_wifi.c:(.text+0x1022): undefined reference to `cfg80211_inform_bss_data' >> virt_wifi.c:(.text+0x1032): undefined reference to `cfg80211_put_bss' virt_wifi.c:(.text+0x1052): undefined reference to `cfg80211_scan_done' drivers/net/wireless/virt_wifi.o: In function `virt_wifi_disconnect': >> virt_wifi.c:(.text+0x13d2): undefined reference to `cfg80211_disconnected' drivers/net/wireless/virt_wifi.o: In function `virt_wifi_destroy_wiphy': >> virt_wifi.c:(.text.unlikely+0x92): undefined reference to `wiphy_unregister' >> virt_wifi.c:(.text.unlikely+0xa2): undefined reference to `wiphy_free' drivers/net/wireless/virt_wifi.o: In function `virt_wifi_init_module': >> virt_wifi.c:(.init.text+0x72): undefined reference to `wiphy_new_nm' >> virt_wifi.c:(.init.text+0x1f2): undefined reference to `wiphy_register' >> virt_wifi.c:(.init.text+0x232): undefined reference to `wiphy_free'
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Johannes Berg
maintainerdrivers/net/wireless/Kconfig config USB_NET_RNDIS_WLAN · line 118
Quoted 3 lines · Cody Schuffelen
drivers/net/wireless/Kconfig +2
-0+config VIRT_WIFI + bool "Wifi wrapper for ethernet drivers"
The built bot complaint is most likely because of this being bool rather than tristate (CFG80211=m, VIRT_WIFI=y, I guess, didn't check), I thought this was because of the wrong reasons and should be back to tristate?
I can change it back, let me know.
johannes
Quoted 11 lines
drivers/net/wireless/Kconfig config USB_NET_RNDIS_WLAN · line 118
Quoted 2 lines
drivers/net/wireless/Kconfig +2
-0+config VIRT_WIFI + bool "Wifi wrapper for ethernet drivers"The built bot complaint is most likely because of this being bool rather than tristate (CFG80211=m, VIRT_WIFI=y, I guess, didn't check), I thought this was because of the wrong reasons and should be back to tristate?
I can change it back, let me know.
johannes
Right, my mistake. This should be a tristate again, sorry about that. Should I send v5 for this?
Cody