[arch-general] Using ATTR{flags} in udev rules
Hi, While building an Arch-based wireless router I ran into a problem of persistent NIC naming. To differentiate which interfaces go to WAN and LAN, I have created a simple udev rule like this /etc/udev/rules.d/10-network.rules # On-board NIC (Realtek, r8169) SUBSYSTEM=="net", ATTR{address}==mac, NAME="wan" # USB ethernet adapter (Asix) SUBSYSTEM=="net", ATTR{address}==mac, NAME="elan0" # PCI card (dlink dwa-552, ath9k) SUBSYSTEM=="net", ATTR{address}==mac, NAME="wap" These work OK until hostapd starts. It creates a bridge br0=(wap) and also a "mon.wap" interface. Both new interfaces share the same mac address as "wap" which confuses udev, as it tries to rename them as well and fails. Matching parent devices is not enough because "wap" and "mon.wap" have the same parent. However, ATTR{flags} is different for the two (at the device level). What does this attribute mean and is it a good idea to use it in a ruleset? Thanks. -- Leonid Isaev GnuPG key: 0x164B5A6D Fingerprint: C0DF 20D0 C075 C3F1 E1BE 775A A7AE F6CB 164B 5A6D
On Sat, Aug 11, 2012 at 11:56 AM, Leonid Isaev <lisaev@umail.iu.edu> wrote:
Hi,
While building an Arch-based wireless router I ran into a problem of persistent NIC naming. To differentiate which interfaces go to WAN and LAN, I have created a simple udev rule like this /etc/udev/rules.d/10-network.rules # On-board NIC (Realtek, r8169) SUBSYSTEM=="net", ATTR{address}==mac, NAME="wan" # USB ethernet adapter (Asix) SUBSYSTEM=="net", ATTR{address}==mac, NAME="elan0" # PCI card (dlink dwa-552, ath9k) SUBSYSTEM=="net", ATTR{address}==mac, NAME="wap"
These work OK until hostapd starts. It creates a bridge br0=(wap) and also a "mon.wap" interface. Both new interfaces share the same mac address as "wap" which confuses udev, as it tries to rename them as well and fails. Matching parent devices is not enough because "wap" and "mon.wap" have the same parent. However, ATTR{flags} is different for the two (at the device level). What does this attribute mean and is it a good idea to use it in a ruleset?
I think those are standard if flags as defined in /usr/include/linux/if.h. Probably not a good idea to use I think.
On Mon, 13 Aug 2012 09:03:20 -0500 Sander Jansen <s.jansen@gmail.com> wrote:
On Sat, Aug 11, 2012 at 11:56 AM, Leonid Isaev <lisaev@umail.iu.edu> wrote:
Hi,
While building an Arch-based wireless router I ran into a problem of persistent NIC naming. To differentiate which interfaces go to WAN and LAN, I have created a simple udev rule like this /etc/udev/rules.d/10-network.rules # On-board NIC (Realtek, r8169) SUBSYSTEM=="net", ATTR{address}==mac, NAME="wan" # USB ethernet adapter (Asix) SUBSYSTEM=="net", ATTR{address}==mac, NAME="elan0" # PCI card (dlink dwa-552, ath9k) SUBSYSTEM=="net", ATTR{address}==mac, NAME="wap"
These work OK until hostapd starts. It creates a bridge br0=(wap) and also a "mon.wap" interface. Both new interfaces share the same mac address as "wap" which confuses udev, as it tries to rename them as well and fails. Matching parent devices is not enough because "wap" and "mon.wap" have the same parent. However, ATTR{flags} is different for the two (at the device level). What does this attribute mean and is it a good idea to use it in a ruleset?
I think those are standard if flags as defined in /usr/include/linux/if.h. Probably not a good idea to use I think.
Yeah... I already got that after messing my network :) -- Leonid Isaev GnuPG key: 0x164B5A6D Fingerprint: C0DF 20D0 C075 C3F1 E1BE 775A A7AE F6CB 164B 5A6D
participants (2)
-
Leonid Isaev
-
Sander Jansen