iw ignores channel switch
I am using openwrt on the following system:
root@OpenWrt:/tmp# iw --version iw version 3.17 ieee80211 phy0: Atheros AR9340 Rev:2 mem=0xb8100000, irq=47
I want to switch between managed (station) mode and monitor mode.
So I have the follwoing scenarion:
root@OpenWrt:/tmp# iw dev
phy#1
Interface wlan1
ifindex 5
wdev 0x100000001
addr 00:90:a9:ab:f8:ed
type managed
phy#0
Interface wlan0
ifindex 21 #steadily increasing, not re-used ?
wdev 0x10
addr 00:90:a9:ab:f8:eb
type managed
root@OpenWrt:/tmp# ifconfig wlan0 up
root@OpenWrt:/tmp# iw dev wlan0 connect SSID
root@OpenWrt:/tmp# udhcpc -i wlan0 --quit
udhcpc (v1.23.2) started
Sending discover...
Sending select for 192.168.20.144...
Lease of 192.168.20.144 obtained, lease time 28800
udhcpc: ifconfig wlan0 192.168.20.144 netmask 255.255.255.0 broadcast 192.168.20.255
udhcpc: setting default routers: 192.168.20.1
root@OpenWrt:/tmp# wget http://somewhere.com/something.html
Connecting to somewhere.com (xx.xx.xx.xx:80)
wget: server returned error: HTTP/1.1 500 Internal Server Error
root@OpenWrt:/tmp# iw phy phy0 interface add wmon0 type monitor
root@OpenWrt:/tmp# iw dev
phy#1
Interface wlan1
ifindex 5
wdev 0x100000001
addr 00:90:a9:ab:f8:ed
type managed
phy#0
Interface wmon0
ifindex 22
wdev 0x11
addr 00:90:a9:ab:f8:eb
type monitor
Interface wlan0
ifindex 21
wdev 0x10
addr 00:90:a9:ab:f8:eb
ssid SSID
type managed
channel 7 (2442 MHz), width: 40 MHz, center1: 2452 MHz
root@OpenWrt:/tmp# ifconfig wmon0 up
root@OpenWrt:/tmp# iw dev
phy#1
Interface wlan1
ifindex 5
wdev 0x100000001
addr 00:90:a9:ab:f8:ed
type managed
phy#0
Interface wmon0
ifindex 22
wdev 0x11
addr 00:90:a9:ab:f8:eb
type monitor
Interface wlan0
ifindex 21
wdev 0x10
addr 00:90:a9:ab:f8:eb
ssid SSID
type managed
channel 7 (2442 MHz), width: 40 MHz, center1: 2452 MHz
root@OpenWrt:/tmp# iw dev wlan0 del
root@OpenWrt:/tmp# iw dev
phy#1
Interface wlan1
ifindex 5
wdev 0x100000001
addr 00:90:a9:ab:f8:ed
type managed
phy#0
Interface wmon0
ifindex 22
wdev 0x11
addr 00:90:a9:ab:f8:eb
type monitor
channel 7 (2442 MHz), width: 20 MHz (no HT), center1: 2442 MHz
root@OpenWrt:/tmp# iw dev wmon0 set channel 1
root@OpenWrt:/tmp# iw dev
phy#1
Interface wlan1
ifindex 5
wdev 0x100000001
addr 00:90:a9:ab:f8:ed
type managed
phy#0
Interface wmon0
ifindex 22
wdev 0x11
addr 00:90:a9:ab:f8:eb
type monitor
channel 7 (2442 MHz), width: 20 MHz (no HT), center1: 2442 MHzAs to be seen, the modification of the channel does not generate an error, but is simply ignored. What did I do wrong ?
Second question: The "ifindex" is always increasing, during several tests,
when unsuccessfully trying similar scenarios (different sequence of ifconfig ... up/down, iw dev ... del etc.) Will this "ifindex" "overflow" some time,
even in case of repeated "iw phy phy0 interface add wmon0 type monitor" "iw dev wmon0 del" ? I would have expected some kind of "reuse".
Regards
Signature · 8 lines
Reiner Karlsberg ----- No virus found in this message. Checked by AVG - www.avg.com Version: 2014.0.4842 / Virus Database: 4447/10982 - Release Date: 11/11/15 Internal Virus Database is out of date.
Quoted 4 lines · Reiner Karlsberg
Interface wlan0
ifindex 21 #steadily increasing, not re-used ?
Correct. You'll eventually roll over after 2^32-1 ... this has nothing to do with wifi btw - look at ethernet devices :)
[snip irrelevant use of the station interface]
Quoted 1 line
root@OpenWrt:/tmp# iw dev wmon0 set channel 1
Is 'wmon0' still up at that point? It should work then, not sure why it wouldn't, but it's certainly not an iw problem but more likely a kernel problem. Since openwrt also has a fair number of patches I'd ask you to please retest on a regular kernel first, or report the bug to them.
johannes