#499868 udev: multiple mac80211 interfaces created on the same physical device are incorrectly renamed

Package:
iw
Source:
iw
Description:
tool for configuring Linux wireless devices
Submitter:
Celejar
Date:
2015-03-07 02:27:08 UTC
Severity:
normal
#499868#5
Date:
2008-09-23 05:46:57 UTC
From:
To:
mac80211 drivers allow multiple interfaces to be created on the same physical
device, so the underlying wmaster0 device can have eth0, eth1 and eth2.  When
the driver is first loaded, a udev rule like this is written:

# PCI device 0x14e4:0x4318 (b43)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="xx:xx:xx:xx:xx:xx", ATTR{type}=="1", KERNEL=="wlan*", NAME="eth0"

(originally 'NAME="wlan0"', I changed it to eth0)

When I subsequently add an interface with

iw dev wmaster0 interface add eth1 type station

a udev rule like this is added:

# PCI device 0x14e4:0x4318 (b43)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="xx:xx:xx:xx:xx:xx", ATTR{type}=="1", KERNEL=="eth**", NAME="eth1"

Then, if I add another interface with

iw dev wmaster0 interface add eth2 type station

it gets caught by the existing rule and I get the infamous 'eth2_rename'
instead of 'eth2'.

I have seen this behavior with both b43 and ath5k.  Perhaps creating multiple
ethX interfaces is a corner case, but the documentation should at least warn
about it.

#499868#10
Date:
2009-03-18 01:09:48 UTC
From:
To:
Is the MAC address the same for all eth* devices?
#499868#15
Date:
2009-03-19 23:52:34 UTC
From:
To:
On Wed, 18 Mar 2009 02:09:48 +0100 md@Linux.IT (Marco d'Itri) wrote:

Yes, they all have the same MAC address.

Celejar
--
mailmin.sourceforge.net - remote access via secure (OpenPGP) email
ssuds.sourceforge.net - A Simple Sudoku Solver and Generator

#499868#20
Date:
2009-03-23 02:17:49 UTC
From:
To:
No wonder then...
Please attach the output of this command for two or more interfaces
created on the same physical device.

udevadm info --query=all --attribute-walk --path=/sys/class/net/ethX/

Since you are deciding the interface name when they are created I
suppose that udev just needs to ignore them.

#499868#25
Date:
2009-03-29 04:48:47 UTC
From:
To:
On Mon, 23 Mar 2009 03:17:49 +0100 md@Linux.IT (Marco d'Itri) wrote:

Attached.

Celejar
--
mailmin.sourceforge.net - remote access via secure (OpenPGP) email
ssuds.sourceforge.net - A Simple Sudoku Solver and Generator

#499868#30
Date:
2009-03-29 11:35:10 UTC
From:
To:
Actually the devices you showed have *different* MAC addresses.
Please clarify.

#499868#35
Date:
2009-04-06 17:04:29 UTC
From:
To:
On Sun, 29 Mar 2009 13:35:10 +0200 md@Linux.IT (Marco d'Itri) wrote:

Oh, sorry.  I often use macchanger on the interface.  Here's some proper output:

~# udevadm info --query=all --attribute-walk --path=/sys/class/net/eth0

Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

  looking at device '/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/ssb0:0/net/eth0':
    KERNEL=="eth0"
    SUBSYSTEM=="net"
    DRIVER==""
    ATTR{addr_len}=="6"
    ATTR{dev_id}=="0x0"
    ATTR{ifalias}==""
    ATTR{iflink}=="15"
    ATTR{ifindex}=="15"
    ATTR{features}=="0x2000"
    ATTR{type}=="1"
    ATTR{link_mode}=="1"
    ATTR{address}=="00:19:7d:06:a5:44"
    ATTR{broadcast}=="ff:ff:ff:ff:ff:ff"
    ATTR{carrier}=="1"
    ATTR{dormant}=="0"
    ATTR{operstate}=="up"
    ATTR{mtu}=="1500"
    ATTR{flags}=="0x1003"
    ATTR{tx_queue_len}=="1000"

  looking at parent device '/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/ssb0:0':
    KERNELS=="ssb0:0"
    SUBSYSTEMS=="ssb"
    DRIVERS=="b43"

  looking at parent device '/devices/pci0000:00/0000:00:1e.0/0000:06:02.0':
    KERNELS=="0000:06:02.0"
    SUBSYSTEMS=="pci"
    DRIVERS=="b43-pci-bridge"
    ATTRS{vendor}=="0x14e4"
    ATTRS{device}=="0x4318"
    ATTRS{subsystem_vendor}=="0x1468"
    ATTRS{subsystem_device}=="0x0312"
    ATTRS{class}=="0x028000"
    ATTRS{irq}=="22"
    ATTRS{local_cpus}=="1"
    ATTRS{local_cpulist}=="0"
    ATTRS{modalias}=="pci:v000014E4d00004318sv00001468sd00000312bc02sc80i00"
    ATTRS{enable}=="1"
    ATTRS{broken_parity_status}=="0"
    ATTRS{msi_bus}==""
    ATTRS{ssb_sprom}=="012000001203681418430080020000000010001800000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFFFFFFFFFFFFFFFFFFFFFFFFFF1900067D44A5FFFFFFFFFFFFFFFFFFFFFFFFFFFF4130C21585FA79FEFFFFFFFF4C00FFFFFFFFFFFF3E00496A02FF00001000FFFFFFFF02CD"

  looking at parent device '/devices/pci0000:00/0000:00:1e.0':
    KERNELS=="0000:00:1e.0"
    SUBSYSTEMS=="pci"
    DRIVERS==""
    ATTRS{vendor}=="0x8086"
    ATTRS{device}=="0x2448"
    ATTRS{subsystem_vendor}=="0x0000"
    ATTRS{subsystem_device}=="0x0000"
    ATTRS{class}=="0x060401"
    ATTRS{irq}=="0"
    ATTRS{local_cpus}=="1"
    ATTRS{local_cpulist}=="0"
    ATTRS{modalias}=="pci:v00008086d00002448sv00000000sd00000000bc06sc04i01"
    ATTRS{enable}=="1"
    ATTRS{broken_parity_status}=="0"
    ATTRS{msi_bus}=="1"

  looking at parent device '/devices/pci0000:00':
    KERNELS=="pci0000:00"
    SUBSYSTEMS==""
    DRIVERS==""

~# udevadm info --query=all --attribute-walk --path=/sys/class/net/eth4

Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

  looking at device '/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/ssb0:0/net/eth4':
    KERNEL=="eth4"
    SUBSYSTEM=="net"
    DRIVER==""
    ATTR{addr_len}=="6"
    ATTR{dev_id}=="0x0"
    ATTR{ifalias}==""
    ATTR{iflink}=="16"
    ATTR{ifindex}=="16"
    ATTR{features}=="0x2000"
    ATTR{type}=="1"
    ATTR{link_mode}=="0"
    ATTR{address}=="00:19:7d:06:a5:44"
    ATTR{broadcast}=="ff:ff:ff:ff:ff:ff"
    ATTR{operstate}=="down"
    ATTR{mtu}=="1500"
    ATTR{flags}=="0x1002"
    ATTR{tx_queue_len}=="1000"

  looking at parent device '/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/ssb0:0':
    KERNELS=="ssb0:0"
    SUBSYSTEMS=="ssb"
    DRIVERS=="b43"

  looking at parent device '/devices/pci0000:00/0000:00:1e.0/0000:06:02.0':
    KERNELS=="0000:06:02.0"
    SUBSYSTEMS=="pci"
    DRIVERS=="b43-pci-bridge"
    ATTRS{vendor}=="0x14e4"
    ATTRS{device}=="0x4318"
    ATTRS{subsystem_vendor}=="0x1468"
    ATTRS{subsystem_device}=="0x0312"
    ATTRS{class}=="0x028000"
    ATTRS{irq}=="22"
    ATTRS{local_cpus}=="1"
    ATTRS{local_cpulist}=="0"
    ATTRS{modalias}=="pci:v000014E4d00004318sv00001468sd00000312bc02sc80i00"
    ATTRS{enable}=="1"
    ATTRS{broken_parity_status}=="0"
    ATTRS{msi_bus}==""
    ATTRS{ssb_sprom}=="012000001203681418430080020000000010001800000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFFFFFFFFFFFFFFFFFFFFFFFFFF1900067D44A5FFFFFFFFFFFFFFFFFFFFFFFFFFFF4130C21585FA79FEFFFFFFFF4C00FFFFFFFFFFFF3E00496A02FF00001000FFFFFFFF02CD"

  looking at parent device '/devices/pci0000:00/0000:00:1e.0':
    KERNELS=="0000:00:1e.0"
    SUBSYSTEMS=="pci"
    DRIVERS==""
    ATTRS{vendor}=="0x8086"
    ATTRS{device}=="0x2448"
    ATTRS{subsystem_vendor}=="0x0000"
    ATTRS{subsystem_device}=="0x0000"
    ATTRS{class}=="0x060401"
    ATTRS{irq}=="0"
    ATTRS{local_cpus}=="1"
    ATTRS{local_cpulist}=="0"
    ATTRS{modalias}=="pci:v00008086d00002448sv00000000sd00000000bc06sc04i01"
    ATTRS{enable}=="1"
    ATTRS{broken_parity_status}=="0"
    ATTRS{msi_bus}=="1"

  looking at parent device '/devices/pci0000:00':
    KERNELS=="pci0000:00"
    SUBSYSTEMS==""
    DRIVERS==""
~# udevadm info --query=all --attribute-walk --path=/sys/class/net/eth3_rename

Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

  looking at device '/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/ssb0:0/net/eth3_rename':
    KERNEL=="eth3_rename"
    SUBSYSTEM=="net"
    DRIVER==""
    ATTR{addr_len}=="6"
    ATTR{dev_id}=="0x0"
    ATTR{ifalias}==""
    ATTR{iflink}=="17"
    ATTR{ifindex}=="17"
    ATTR{features}=="0x2000"
    ATTR{type}=="1"
    ATTR{link_mode}=="0"
    ATTR{address}=="00:19:7d:06:a5:44"
    ATTR{broadcast}=="ff:ff:ff:ff:ff:ff"
    ATTR{operstate}=="down"
    ATTR{mtu}=="1500"
    ATTR{flags}=="0x1002"
    ATTR{tx_queue_len}=="1000"

  looking at parent device '/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/ssb0:0':
    KERNELS=="ssb0:0"
    SUBSYSTEMS=="ssb"
    DRIVERS=="b43"

  looking at parent device '/devices/pci0000:00/0000:00:1e.0/0000:06:02.0':
    KERNELS=="0000:06:02.0"
    SUBSYSTEMS=="pci"
    DRIVERS=="b43-pci-bridge"
    ATTRS{vendor}=="0x14e4"
    ATTRS{device}=="0x4318"
    ATTRS{subsystem_vendor}=="0x1468"
    ATTRS{subsystem_device}=="0x0312"
    ATTRS{class}=="0x028000"
    ATTRS{irq}=="22"
    ATTRS{local_cpus}=="1"
    ATTRS{local_cpulist}=="0"
    ATTRS{modalias}=="pci:v000014E4d00004318sv00001468sd00000312bc02sc80i00"
    ATTRS{enable}=="1"
    ATTRS{broken_parity_status}=="0"
    ATTRS{msi_bus}==""
    ATTRS{ssb_sprom}=="012000001203681418430080020000000010001800000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFFFFFFFFFFFFFFFFFFFFFFFFFF1900067D44A5FFFFFFFFFFFFFFFFFFFFFFFFFFFF4130C21585FA79FEFFFFFFFF4C00FFFFFFFFFFFF3E00496A02FF00001000FFFFFFFF02CD"

  looking at parent device '/devices/pci0000:00/0000:00:1e.0':
    KERNELS=="0000:00:1e.0"
    SUBSYSTEMS=="pci"
    DRIVERS==""
    ATTRS{vendor}=="0x8086"
    ATTRS{device}=="0x2448"
    ATTRS{subsystem_vendor}=="0x0000"
    ATTRS{subsystem_device}=="0x0000"
    ATTRS{class}=="0x060401"
    ATTRS{irq}=="0"
    ATTRS{local_cpus}=="1"
    ATTRS{local_cpulist}=="0"
    ATTRS{modalias}=="pci:v00008086d00002448sv00000000sd00000000bc06sc04i01"
    ATTRS{enable}=="1"
    ATTRS{broken_parity_status}=="0"
    ATTRS{msi_bus}=="1"

  looking at parent device '/devices/pci0000:00':
    KERNELS=="pci0000:00"
    SUBSYSTEMS==""
    DRIVERS==""

Celejar
--
mailmin.sourceforge.net - remote access via secure (OpenPGP) email
ssuds.sourceforge.net - A Simple Sudoku Solver and Generator

#499868#40
Date:
2009-04-18 01:37:54 UTC
From:
To:
reassign 499868 iw
thanks
The udev upstream maintainer says "don't do this":

  I don't think that can ever work in the default ethX namespace. The
  userspace logic that requests these interfaces should be able to
  supply a custom name along with the request for the new device.
  Putting things like this by default under the ethX namespace can not
  work with any current logic.

Further discussions about this should happen on the linux-hotplug
mailing list.