sysprog21 / vwifi

A virtual wireless device driver for Linux
MIT License
205 stars 39 forks source link

wiphy physical device name alters when doing manual testing #54

Closed vax-r closed 9 months ago

vax-r commented 10 months ago

Description

When doing the ping test manually (without using verify.sh) , we have to assign different physical devices into seperate network namespace. Using the command indicated in README.md like the following.

$ sudo iw phy phy0 set netns name ns0
$ sudo iw phy phy1 set netns name ns1
$ sudo iw phy phy2 set netns name ns2

However, after I remove vwifi kernel module and register it into kernel again, the number of wiphy's name changes everytime I reload vwifi.

$ sudo iw dev
phy#32
        Interface owl2
                ifindex 36
                wdev 0x2000000001
                addr 00:6f:77:6c:32:00
                type managed
phy#31
        Interface owl1
                ifindex 35
                wdev 0x1f00000001
                addr 00:6f:77:6c:31:00
                type managed
phy#30
        Interface owl0
                ifindex 34
                wdev 0x1e00000001
                addr 00:6f:77:6c:30:00
                type managed

We can see that wiphy's name changes from #0, #1, #2 to #30, #31, #32, and the number will become larger if I repeat the above actions more times. It becomes troublesome when doing manual testing because we have to remember different number everytime. I suggest we can fixed the naming of wiphy physical device. For example when we have n wiphy, we can make sure the name of them are phy#0, phy#1 ,..., phy#n-1

Possible approach

Instead of using NULL in wiphy_new_nm for the default naming phy%d, we can assign each wiphy a index and use it as the requested_name of wiphy_new_nm

https://github.com/sysprog21/vwifi/blob/20d4a42ff659aa93701cf88a518b3847f508ab89/vwifi.c#L1811