You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this update, an ad-hoc (IBSS) mode has been added.
Add the 'NL80211_IFTYPE_ADHOC' interface type to wiphy, enabling
it to switch to Ad-hoc (IBSS) mode through the 'vwifi_change_iface'
operation.
Implement 'vwifi_join_ibss' and 'vwifi_leave_ibss' based on the
'cfg80211_ops' structure to enable IBSS devices to join a specific
IBSS cell and frequency band.
In the global structure 'vwifi_context', add 'ibss_list' to
facilitate finding IBSS devices. When a device joins, it will be
added to the 'ibss_list', and when a device leaves, it will be
removed.
Implement the IBSS mode packet forwarding mechanism.
Additionally, ad-hoc related test items have been added, and the
IBSS devices are scannable.
Update the README file to include information about IBSS mode.
To test the network environment, we can utilize the **Linux network namespace**.
40
+
Linux network namespace allows us to isolate a network environment from the host system, providing its own routes, firewall rules, and network devices.
41
+
Essentially, it creates a separate instance of the network stack.
42
+
43
+
Without network namespace, when virtual interfaces are created that share the same network namespace and start transmitting/receiving packets between them,
44
+
the kernel will use the loopback device for packet transmission/reception. This behavior occurs because the kernel identifies that the sender and receiver are on the same host.
45
+
46
+
In conclusion, all the interfaces created by `vwifi` in the testing environment will be added to an isolated network namespace.
The testing environment consists of **one AP and two STAs**.
@@ -48,15 +57,12 @@ The AP then performs the following actions based on the packet type:
48
57
2. Broadcast: The AP forwards the packet to all other STAs in the network, except for the source STA, and then passes it to the protocol stack.
49
58
3. Multicast: The AP treats multicast packets the same way as broadcast packets.
50
59
51
-
To test the network environment, we can utilize the **Linux network namespace**.
52
-
Linux network namespace allows us to isolate a network environment from the host system, providing its own routes, firewall rules, and network devices.
53
-
Essentially, it creates a separate instance of the network stack.
54
-
55
-
Without network namespace, when virtual interfaces are created that share the same network namespace and start transmitting/receiving packets between them,
56
-
the kernel will use the loopback device for packet transmission/reception. This behavior occurs because the kernel identifies that the sender and receiver are on the same host.
In conclusion, all the interfaces created by `vwifi` in the testing environment will be added to an isolated network namespace.
63
+
The testing environment consists of **two IBSS devices**.
59
64
65
+
The testing environment operates in IEEE 802.11 independent BSS. IBSS devices can communicate with any device in the same IBSS network **without the need to establish a connection beforehand**. However, devices in different IBSS networks cannot communicate with each other.
60
66
## Build and Run (non-virtio)
61
67
62
68
To build the kernel module, execute the following command:
@@ -72,7 +78,7 @@ $ sudo modprobe cfg80211
72
78
Insert the `vwifi` driver.
73
79
This will create three interfaces (the "station" parameter can be modified according to preference):
74
80
```shell
75
-
$ sudo insmod vwifi.ko station=3
81
+
$ sudo insmod vwifi.ko station=5
76
82
```
77
83
78
84
Please note that interfaces can only be created in station mode during the initialization phase.
@@ -85,7 +91,7 @@ To check the network interfaces, run the following command:
85
91
$ ip link
86
92
```
87
93
88
-
There should be entries starting with `vw0`, `vw1`, and `vw2`, which correspond to the interfaces created by `vwifi`.
94
+
There should be entries starting with `vw0`, `vw1`, `vw2`, `vw3`, and `vw4`, which correspond to the interfaces created by `vwifi`.
89
95
90
96
To view the available wireless interfaces, execute the following command:
91
97
```shell
@@ -94,24 +100,41 @@ $ sudo iw dev
94
100
95
101
You should see something similar to the following output:
96
102
```
97
-
phy#2
103
+
phy#5
104
+
Interface vw4
105
+
ifindex 7
106
+
wdev 0x500000001
107
+
addr 00:76:77:34:00:00
108
+
type managed
109
+
txpower 0.00 dBm
110
+
phy#4
111
+
Interface vw3
112
+
ifindex 6
113
+
wdev 0x400000001
114
+
addr 00:76:77:33:00:00
115
+
type managed
116
+
txpower 0.00 dBm
117
+
phy#3
98
118
Interface vw2
99
119
ifindex 5
100
-
wdev 0x200000001
101
-
addr 00:6f:77:6c:32:00
120
+
wdev 0x300000001
121
+
addr 00:76:77:32:00:00
102
122
type managed
103
-
phy#1
123
+
txpower 0.00 dBm
124
+
phy#2
104
125
Interface vw1
105
126
ifindex 4
106
-
wdev 0x100000001
107
-
addr 00:6f:77:6c:31:00
127
+
wdev 0x200000001
128
+
addr 00:76:77:31:00:00
108
129
type managed
109
-
phy#0
130
+
txpower 0.00 dBm
131
+
phy#1
110
132
Interface vw0
111
133
ifindex 3
112
-
wdev 0x1
113
-
addr 00:6f:77:6c:30:00
134
+
wdev 0x100000001
135
+
addr 00:76:77:30:00:00
114
136
type managed
137
+
txpower 0.00 dBm
115
138
```
116
139
117
140
As observed, each interface has its own phy (`struct wiphy`), allowing them to be placed into separate network namespaces.
Check whether the name of each `wiphy` is the same as the name listing under the command `sudo iw list`
414
+
```shell
415
+
$ echo$vw3_phy
416
+
vw_phy3
417
+
$ echo$vw4_phy
418
+
vw_phy4
419
+
```
420
+
Assign the two interfaces to separate network namespaces.
421
+
Please note that the `wiphy` is placed within the network namespace, and the interface associated with that wiphy will be contained within it.
422
+
```shell
423
+
$ sudo iw phy vw_phy3 set netns name ns3
424
+
$ sudo iw phy vw_phy4 set netns name ns4
425
+
```
426
+
#### Assigning IP Addresses to Each Interface
427
+
428
+
Now, assign an IP address to both interfaces using the following commands:
429
+
```shell
430
+
$ sudo ip netns exec ns3 ip addr add 10.0.0.4/24 dev vw3
431
+
$ sudo ip netns exec ns4 ip addr add 10.0.0.5/24 dev vw4
432
+
```
433
+
#### Switch to IBSS mode
434
+
Switch device to IBSS mode using the following command :
435
+
436
+
***iw dev [interface] set type ibss***
437
+
438
+
The following commands switch `vw3` and `vw4` to IBSS mode.
439
+
```shell
440
+
$ sudo ip netns exec ns3 iw dev vw3 settype ibss
441
+
$ sudo ip netns exec ns4 iw dev vw4 settype ibss
442
+
```
443
+
Check the information of `vw3`.
444
+
```shell
445
+
$ sudo ip netns exec ns3 iw dev vw3 info
446
+
```
447
+
You should see output similar to the following:
448
+
```
449
+
Interface vw3
450
+
ifindex 6
451
+
wdev 0x400000001
452
+
addr 00:76:77:33:00:00
453
+
type IBSS
454
+
wiphy 4
455
+
txpower 0.00 dBm
456
+
```
457
+
#### Join IBSS network
458
+
```shell
459
+
$ sudo ip netns exec ns3 ip link set vw3 up
460
+
$ sudo ip netns exec ns4 ip link set vw4 up
461
+
```
462
+
Users can join a specific IBSS cell and configure additional settings using the command :
463
+
464
+
***iw dev [interface] ibss join [SSID][freq in MHz][NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz][fixed-freq][fixed-bssid][beacon-interval <TU>][basic-rates <rate in Mbps,rate2,…>][mcast-rate <rateinMbps>][key d:0:abcde]***
465
+
466
+
If the IBSS cell does not already exist, it will be created.
467
+
468
+
The following command makes `vw3` and `vw4` join the same IBSS cell with the SSID `ibss1` and specifies the frequency as 2412 MHz:
469
+
```shell
470
+
$ sudo ip netns exec ns3 iw dev vw3 ibss join ibss1 2412 NOHT fixed-freq 00:76:77:33:00:00 beacon-interval 200
471
+
$ sudo ip netns exec ns4 iw dev vw4 ibss join ibss1 2412 NOHT fixed-freq 00:76:77:33:00:00 beacon-interval 200
472
+
```
473
+
Check the information of `vw3`.
474
+
```shell
475
+
$ sudo ip netns exec ns3 iw dev vw3 info
476
+
```
477
+
You should see output similar to the following:
478
+
```
479
+
Interface vw3
480
+
ifindex 6
481
+
wdev 0x400000001
482
+
addr 00:76:77:33:00:00
483
+
ssid ibss1
484
+
type IBSS
485
+
wiphy 4
486
+
txpower 0.00 dBm
487
+
```
488
+
#### Transmission/Receivement test
489
+
To perform a ping test between two IBSS devices (`vw3` and `vw4`) in the same ibss cell (`ibss1`), use the following command:
490
+
```shell
491
+
$ sudo ip netns exec ns3 ping -c 1 10.0.0.5
492
+
```
493
+
You should see output similar to the following:
494
+
```
495
+
PING 10.0.0.5 (10.0.0.5) 56(84) bytes of data.
496
+
64 bytes from 10.0.0.5: icmp_seq=1 ttl=64 time=0.093 ms
497
+
498
+
--- 10.0.0.5 ping statistics ---
499
+
1 packets transmitted, 1 received, 0% packet loss, time 0ms
500
+
rtt min/avg/max/mdev = 0.093/0.093/0.093/0.000 ms
501
+
```
502
+
#### Leave IBSS network
503
+
To leave the current IBSS cell, use ***iw dev [interface] ibss leave***.
504
+
505
+
The following command makes `vw3` and `vw4` leave `ibss1`:
506
+
```shell
507
+
$ sudo ip netns exec ns3 iw dev vw3 ibss leave
508
+
$ sudo ip netns exec ns4 iw dev vw4 ibss leave
509
+
```
510
+
Check the information of `vw3`.
511
+
```shell
512
+
$ sudo ip netns exec ns3 iw dev vw3 info
513
+
```
514
+
You should see output similar to the following:
515
+
```
516
+
Interface vw3
517
+
ifindex 6
518
+
wdev 0x400000001
519
+
addr 00:76:77:33:00:00
520
+
type IBSS
521
+
wiphy 4
522
+
txpower 0.00 dBm
523
+
```
524
+
369
525
### vwifi-tool
370
526
A userspace tool which supports more user-specific utilization for vwifi.
371
527
Aiming to provide more flexibility and customization for users of vwifi.
0 commit comments