Implement a rtnetlink device which simulates wifi.
PATCH 1/1 Implement a rtnetlink device which simulates wifi.
The device added here is used through "ip link add ... type virt_wifi" The intention is to take over an existing network device and produce a new one that appears like a wireless connection, returning enough canned responses to nl80211 to satisfy a standard network 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.
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. Future work can also include exporting the wireless control plane to userspace, so the device can configure the behavior of the simulated wireless network itself.
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.
--- drivers/net/wireless/Kconfig | 7 + drivers/net/wireless/Makefile | 2 + drivers/net/wireless/virt_wifi.c | 544 +++++++++++++++++++++++++++++++ 3 files changed, 553 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 + tristate "Wifi wrapper for ethernet drivers" + default n + ---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 +544 -0
544 lines not on this page · raw message
Signature · 1 line
2.18.0.233.g985f88cf7e-goog