I need to put wifi interface into additional monitor state.
- If I don't use udev rule and wifi interface named by kernel as wlan0 (default):
$ iw dev wlan0 interface add mon0 type monitor
in this case I don't have any problem and everything works. I can see mon0 interface in iwconfig output.
mon0 IEEE 802.11 Mode:Monitor Frequency:2.412 GHz
Retry short limit:7 RTS thr:off Fragment thr:off
Power Management:on
wlan0 IEEE 802.11 ESSID:off/any
Mode:Managed Access Point: Not-Associated
Retry short limit:7 RTS thr:off Fragment thr:off
Encryption key:off
Power Management:on
- If I'm using udev rule and wifi interface named as wbrd0:
70-wireless.rule file:
SUBSYSTEM=="net", ACTION=="add", ATTRS{address}=="xx:xx:xx:xx:xx:xx", NAME="wbrd0"
$ iw dev wbrd0 interface add mon0 type monitor
In this case iwconfig output looks like this:
rename4 IEEE 802.11 Mode:Monitor Frequency:2.412 GHz
Retry short limit:7 RTS thr:off Fragment thr:off
Power Management:on
wbrd0 IEEE 802.11 ESSID:off/any
Mode:Managed Access Point: Not-Associated
Retry short limit:7 RTS thr:off Fragment thr:off
Encryption key:off
Power Management:on
As you can see there's no mon0 interface and instead it's renamed as rename4. I think it's because of udev rule, udev is trying to name new monitor interface as wbrd0 instead of mon0. Probably there's something I'm missing in udev documentation. Though I know that it works with default udev rules but I cannot find a place where it is.
I have a workaround, I can just rename rename4 interface with:
$ ip link set rename4 name mon0
But it's really dirty there should be a better way.
So my question is how to write udev rule which will create a monitor interface from existing wbrd0?
OR
How to find a place in default udev rule which is renaming monitor interface into mon0 when I'm not using my 70-wireless.rule?