tony123r / vwifi

A Simple Virtual Wireless Driver for Linux

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

vwifi: A Simple Virtual Wireless Driver for Linux

vwifi implements a minimal interface to achieve basic functionalities, 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).

Prerequisite

The following packages must be installed before building vwifi.

In order to compile the kernel driver successfully, package versions of currently used kernel, kernel-devel and kernel-headers need to be matched.

$ sudo apt install linux-headers-$(uname -r)

Since vwifi relies on the Linux wireless (IEEE-802.11) subsystem, iw is necessary for retrieving more information and configuring:

sudo apt install iw

Build and Run

Run make to build the kernel module:

make

Load cfg80211 kernel module:

sudo modprobe cfg80211

Insert vwifi driver:

sudo insmod vwifi.ko ssid_list='[MyHomeWiFi][MyWifi_1][MyWifi_2]'

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 ip link set owl0 up

Show available wireless interfaces:

sudo iw dev

You should get something as following:

phy#0
	Interface owl0
		ifindex 3
		wdev 0x1
		addr 00:00:00:00:00:00
		type managed

Dump wireless information:

sudo iw list

Reference output:

Wiphy owl
	max # scan SSIDs: 69
	max scan IEs length: 0 bytes
	max # sched scan SSIDs: 0
	max # match sets: 0
	max # scan plans: 1
	max scan plan interval: -1
	max scan plan iterations: 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 ca:9c:00:c6:c2:eb(on owl0)
	TSF: 0 usec (0d, 00:00:00)
	freq: 2437
	beacon interval: 100 TUs
	capability: ESS (0x0001)
	signal: -59.00 dBm
	last seen: 0 ms ago
	SSID: MyHomeWifi
	SSID: MyHomeWiFi

Finally, we can connect to the dummy SSID MyHomeWiFi:

sudo iw dev owl0 connect MyHomeWiFi

Validate the connection:

sudo iw dev owl0 link

Reference output:

Connected to 26:05:d1:60:34:c8 (on owl0)
	SSID: MyHomeWiFi
	freq: 2437

Change wifi list:

echo -n "[MyHomeWiFi][MyWifi_1][MyWifi_2]" | sudo tee /sys/module/vwifi/parameters/ssid_list

SSID Naming Convention:

Don't put [ or ] in your SSID. Also, the length of each SSID should be restricted between 0 and 32. The default value of ssid_list is [MyHomeWiFi] if it's not specified explicitly by user.

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

About

A Simple Virtual Wireless Driver for Linux

License:MIT License


Languages

Language:C 85.8%Language:Shell 12.8%Language:Makefile 1.4%