/vwifi

A Simple Virtual Wireless Driver for Linux

Primary LanguageCMIT LicenseMIT

vwifi: A Simple Virtual Wireless Driver for Linux

vwifi implements a minimal interface to achieve basic functonalities, such as scanning dummy Wi-Fi network, connecting, and disconnecting from it. vwifi is based on cfg80211 subsystem, which works together with FullMAC drivers. At present, it only supports station mode (STA).

Build

Run make to build the kernel module:

make

Usage

Get necessary packages in advance:

sudo apt install iw
sudo apt install wireless-tools

Add cfg80211 kernel module:

sudo modprobe cfg80211

Insert vwifi driver:

sudo insmod vwifi.ko

Check network interfaces:

ip link

There should be an entry starting with owl0, which is exactly the interface created by vwifi.

Bring up the network interface:

sudo ifconfig owl0 up

or

sudo ip link set owl0 up

Show available wireless interfaces:

sudo iw dev

You should get something as following:

phy#7
	Interface owl0
		ifindex 12
		wdev 0x700000001
		addr 00:00:00:00:00:00
		type managed

Dump wireless information:

sudo iw list

Reference output:

Wiphy owl
	wiphy index: 7
	max # scan SSIDs: 69
	max scan IEs length: 0 bytes
	max # sched scan SSIDs: 0
	max # match sets: 0
	Retry short limit: 7
	Retry long limit: 4
	Coverage class: 0 (up to 0m)
	Available Antennas: TX 0 RX 0
	Supported interface modes:
		 * managed

Then, perform scanning:

sudo iw dev owl0 scan

You should get the following:

BSS aa:bb:cc:dd:ee:ff(on owl0)
	TSF: 0 usec (0d, 00:00:00)
	freq: 2437
	beacon interval: 100 TUs
	capability: ESS (0x0001)
	last seen: 0 ms ago
	SSID: MyHomeWiFi

Finally, we can connect to the dummy SSID MyHomeWiFi:

sudo iw dev owl0 connect MyHomeWiFi

Validate the connection:

iwconfig owl0

Reference output:

owl0      IEEE 802.11  ESSID:"MyHomeWiFi"
          Mode:Managed  Frequency:2.437 GHz  Access Point: AA:BB:CC:DD:EE:FF
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Power Management:on

Optional, you can use wireless device monitoring applications such as wavemon to watch signal and noise levels, packet statistics, device configuration and network parameters of vwifi.

sudo apt install wavemon

logo image

License

vwifi is released under the MIT license. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.

Reference