Skip to contentSkip to conversation

wireless device and udev

DISCUSSION John W. Linville 7 participants 13 messages Dec 8, 2009 – Dec 9, 2009 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Quoted 10 lines · Stephen Hemminger

The default udev persistent network rules based on hardware mac id doesn't work well when multiple SSID's are created on an access-point. The command
iw phy phy0 interface add wlan1 type managed

is supposed to make a device name wlan1, but udev sees that it has the same mac address as wlan0 and gets confused leaving the device named wlan1_rename

It looks like wlanX is breaking assumptions of existing udev persistent network device name generation rules. Perhaps there needs to be special case for wlanX devices?

Yes, probably so. But what would it be? Factoring-in SSID is clearly not right for the usual case (i.e. one interface on a mobile device). I'm not sure what else one could use as a key.

What does udev do for bridge, bond, or vlan devices? Don't those share MAC addresses with the underlying physical device?

John

Signature · 2 lines
John W. Linville		Someday the world will need a hero, and you
[email protected]			might be all we have.  Be ready.
#2 lore raw
Quoted 2 lines · John W. Linville

What does udev do for bridge, bond, or vlan devices? Don't those share MAC addresses with the underlying physical device?

They are blacklisted (by the DRIVERS=="?*" check) so they do not get persistent names.

Signature · 2 lines
ciao,
Marco
#3 lore raw
In reply to John W. Linville
Quoted 12 lines · On Tue, 8 Dec 2009 09:29:40 -0500 "John W. Linville" <[email protected]>…
Quoted 10 lines · Stephen Hemminger

The default udev persistent network rules based on hardware mac id doesn't work well when multiple SSID's are created on an access-point. The command
iw phy phy0 interface add wlan1 type managed

is supposed to make a device name wlan1, but udev sees that it has the same mac address as wlan0 and gets confused leaving the device named wlan1_rename

It looks like wlanX is breaking assumptions of existing udev persistent network device name generation rules. Perhaps there needs to be special case for wlanX devices?

Quoted 8 lines

Yes, probably so. But what would it be? Factoring-in SSID is clearly not right for the usual case (i.e. one interface on a mobile device). I'm not sure what else one could use as a key.

What does udev do for bridge, bond, or vlan devices? Don't those share MAC addresses with the underlying physical device?

John

At least on ubuntu/debian the name whitelist is:

# device name whitelist
KERNEL!="eth*|ath*|wlan*[0-9]|msh*|ra*|sta*|ctc*|lcs*|hsi*", GOTO="persistent_net_generator_end"

So bond or bridge don't match and don't get tampered with.

The problem is that wlan* device names are used for both hardware and virtual devices. Udev scripts can be fixed "do the right thing" but there is not sufficient information for the script to decide how to attach persistent name. What values from sysfs (ie attributes) should script be using? This probably means that additional attributes needed to be added to wireless device infrastructure in kernel.

#4 lore raw
Quoted 30 lines · Stephen Hemminger
Quoted 12 lines · On Tue, 8 Dec 2009 09:29:40 -0500 "John W. Linville" <[email protected]>…
Quoted 10 lines · Stephen Hemminger

The default udev persistent network rules based on hardware mac id doesn't work well when multiple SSID's are created on an access-point.  The command iw phy phy0 interface add wlan1 type managed

is supposed to make a device name wlan1, but udev sees that it has the same mac address as wlan0 and gets confused leaving the device named wlan1_rename

It looks like wlanX is breaking assumptions of existing udev persistent network device name generation rules.  Perhaps there needs to be special case for wlanX devices?

Quoted 8 lines

Yes, probably so.  But what would it be?  Factoring-in SSID is clearly not right for the usual case (i.e. one interface on a mobile device). I'm not sure what else one could use as a key.

What does udev do for bridge, bond, or vlan devices?  Don't those share MAC addresses with the underlying physical device?

John

At least on ubuntu/debian the name whitelist is:

# device name whitelist
KERNEL!="eth*|ath*|wlan*[0-9]|msh*|ra*|sta*|ctc*|lcs*|hsi*", GOTO="persistent_net_generator_end"
Quoted 8 lines

So bond or bridge don't match and don't get tampered with.

The problem is that wlan* device names are used for both hardware and virtual devices.  Udev scripts can be fixed "do the right thing" but there is not sufficient information for the script to decide how to attach persistent name. What values from sysfs (ie attributes) should script be using?  This probably means that additional attributes needed to be added to wireless device infrastructure in kernel.

We could likely use the new SET_NETDEV_DEVTYPE() but I have yet to see where this is exported. It must be there somewhere.

Luis

#8 lore raw
In reply to Stephen Hemminger
Quoted 30 lines · Stephen Hemminger
Quoted 12 lines · On Tue, 8 Dec 2009 09:29:40 -0500 "John W. Linville" <[email protected]>…
Quoted 10 lines · Stephen Hemminger

The default udev persistent network rules based on hardware mac id doesn't work well when multiple SSID's are created on an access-point. The command
iw phy phy0 interface add wlan1 type managed

is supposed to make a device name wlan1, but udev sees that it has the same mac address as wlan0 and gets confused leaving the device named wlan1_rename

It looks like wlanX is breaking assumptions of existing udev persistent network device name generation rules. Perhaps there needs to be special case for wlanX devices?

Quoted 8 lines

Yes, probably so. But what would it be? Factoring-in SSID is clearly not right for the usual case (i.e. one interface on a mobile device). I'm not sure what else one could use as a key.

What does udev do for bridge, bond, or vlan devices? Don't those share MAC addresses with the underlying physical device?

John

At least on ubuntu/debian the name whitelist is:

# device name whitelist
KERNEL!="eth*|ath*|wlan*[0-9]|msh*|ra*|sta*|ctc*|lcs*|hsi*", GOTO="persistent_net_generator_end"
Quoted 8 lines

So bond or bridge don't match and don't get tampered with.

The problem is that wlan* device names are used for both hardware and virtual devices. Udev scripts can be fixed "do the right thing" but there is not sufficient information for the script to decide how to attach persistent name. What values from sysfs (ie attributes) should script be using? This probably means that additional attributes needed to be added to wireless device infrastructure in kernel.

So, probably we need to map from the wlanX name to the phyY name, then determine whether or not this is the first wlanX for phyY. If not, then the name should be left alone.

Now, how do we figure out how many wlanX's belong to phyY?

John

Signature · 2 lines
John W. Linville		Someday the world will need a hero, and you
[email protected]			might be all we have.  Be ready.
#5 lore raw
In reply to Luis R. Rodriguez
Quoted 41 lines · On Tue, 8 Dec 2009 10:50:30 -0800 "Luis R. Rodriguez" <[email protected]> wrote:
Quoted 30 lines · Stephen Hemminger
Quoted 12 lines · On Tue, 8 Dec 2009 09:29:40 -0500 "John W. Linville" <[email protected]>…
Quoted 10 lines · Stephen Hemminger

The default udev persistent network rules based on hardware mac id doesn't work well when multiple SSID's are created on an access-point.  The command iw phy phy0 interface add wlan1 type managed

is supposed to make a device name wlan1, but udev sees that it has the same mac address as wlan0 and gets confused leaving the device named wlan1_rename

It looks like wlanX is breaking assumptions of existing udev persistent network device name generation rules.  Perhaps there needs to be special case for wlanX devices?

Quoted 8 lines

Yes, probably so.  But what would it be?  Factoring-in SSID is clearly not right for the usual case (i.e. one interface on a mobile device). I'm not sure what else one could use as a key.

What does udev do for bridge, bond, or vlan devices?  Don't those share MAC addresses with the underlying physical device?

John

At least on ubuntu/debian the name whitelist is:

# device name whitelist
KERNEL!="eth*|ath*|wlan*[0-9]|msh*|ra*|sta*|ctc*|lcs*|hsi*", GOTO="persistent_net_generator_end"
Quoted 8 lines

So bond or bridge don't match and don't get tampered with.

The problem is that wlan* device names are used for both hardware and virtual devices.  Udev scripts can be fixed "do the right thing" but there is not sufficient information for the script to decide how to attach persistent name. What values from sysfs (ie attributes) should script be using?  This probably means that additional attributes needed to be added to wireless device infrastructure in kernel.

Quoted 2 lines

We could likely use the new SET_NETDEV_DEVTYPE() but I have yet to see where this is exported. It must be there somewhere.

Both devices would have same type? don't see how that would help

Imagine a system with two Atheros cards, and 2 SSID's per card. How would devices be identified by udev to assign persistent name?

#9 lore raw
In reply to John W. Linville
Quoted 5 lines · John W. Linville

So, probably we need to map from the wlanX name to the phyY name, then determine whether or not this is the first wlanX for phyY. If not, then the name should be left alone.

Now, how do we figure out how many wlanX's belong to phyY?

And what's the "first" one? :)

ls /sys/class/net/wlan0/device/net/

will give you the list of interface associated with this device.

johannes

#6 lore raw
In reply to Stephen Hemminger
Quoted 44 lines · Stephen Hemminger
Quoted 41 lines · On Tue, 8 Dec 2009 10:50:30 -0800 "Luis R. Rodriguez" <[email protected]> wrote:
Quoted 38 lines · Stephen Hemminger
Quoted 12 lines · On Tue, 8 Dec 2009 09:29:40 -0500 "John W. Linville" <[email protected]>…
Quoted 10 lines · Stephen Hemminger

The default udev persistent network rules based on hardware mac id doesn't work well when multiple SSID's are created on an access-point.  The command iw phy phy0 interface add wlan1 type managed

is supposed to make a device name wlan1, but udev sees that it has the same mac address as wlan0 and gets confused leaving the device named wlan1_rename

It looks like wlanX is breaking assumptions of existing udev persistent network device name generation rules.  Perhaps there needs to be special case for wlanX devices?

Quoted 8 lines

Yes, probably so.  But what would it be?  Factoring-in SSID is clearly not right for the usual case (i.e. one interface on a mobile device). I'm not sure what else one could use as a key.

What does udev do for bridge, bond, or vlan devices?  Don't those share MAC addresses with the underlying physical device?

John

At least on ubuntu/debian the name whitelist is:

# device name whitelist
KERNEL!="eth*|ath*|wlan*[0-9]|msh*|ra*|sta*|ctc*|lcs*|hsi*", GOTO="persistent_net_generator_end"

So bond or bridge don't match and don't get tampered with.

The problem is that wlan* device names are used for both hardware and virtual devices.  Udev scripts can be fixed "do the right thing" but there is not sufficient information for the script to decide how to attach persistent name. What values from sysfs (ie attributes) should script be using?  This probably means that additional attributes needed to be added to wireless device infrastructure in kernel.

Quoted 7 lines
Quoted 2 lines

We could likely use the new SET_NETDEV_DEVTYPE() but I have yet to see where this is exported. It must be there somewhere.

Both devices would have same type? don't see how that would help

Imagine a system with two Atheros cards, and 2 SSID's per card. How would devices be identified by udev to assign persistent name?

Yeah sorry, I was thinking of just wlan0++ for a new wlan net device type, but yeah keeping them persistent would require more work.

Luis

#10 lore raw
In reply to Johannes Berg
Quoted 9 lines · Johannes Berg
Quoted 5 lines · John W. Linville

So, probably we need to map from the wlanX name to the phyY name, then determine whether or not this is the first wlanX for phyY. If not, then the name should be left alone.

Now, how do we figure out how many wlanX's belong to phyY?

And what's the "first" one? :)

I suppose I was figuring that if there was only one, it was the first. :-) But you're right, I suppose that could be racy...

Quoted 3 lines

ls /sys/class/net/wlan0/device/net/

will give you the list of interface associated with this device.

Cool...

Signature · 2 lines
John W. Linville		Someday the world will need a hero, and you
[email protected]			might be all we have.  Be ready.
#7 lore raw
In reply to Luis R. Rodriguez

Hi Luis,

Quoted 35 lines
Quoted 26 lines
Quoted 11 lines
Quoted 10 lines

The default udev persistent network rules based on hardware mac id doesn't work well when multiple SSID's are created on an access-point. The command
iw phy phy0 interface add wlan1 type managed

is supposed to make a device name wlan1, but udev sees that it has the same mac address as wlan0 and gets confused leaving the device named wlan1_rename

It looks like wlanX is breaking assumptions of existing udev persistent network device name generation rules. Perhaps there needs to be special case for wlanX devices?

Quoted 8 lines

Yes, probably so. But what would it be? Factoring-in SSID is clearly not right for the usual case (i.e. one interface on a mobile device). I'm not sure what else one could use as a key.

What does udev do for bridge, bond, or vlan devices? Don't those share MAC addresses with the underlying physical device?

John

At least on ubuntu/debian the name whitelist is:

# device name whitelist
KERNEL!="eth*|ath*|wlan*[0-9]|msh*|ra*|sta*|ctc*|lcs*|hsi*", GOTO="persistent_net_generator_end"
Quoted 8 lines

So bond or bridge don't match and don't get tampered with.

The problem is that wlan* device names are used for both hardware and virtual devices. Udev scripts can be fixed "do the right thing" but there is not sufficient information for the script to decide how to attach persistent name. What values from sysfs (ie attributes) should script be using? This probably means that additional attributes needed to be added to wireless device infrastructure in kernel.

Quoted 2 lines

We could likely use the new SET_NETDEV_DEVTYPE() but I have yet to see where this is exported. It must be there somewhere.

they are part of the uevent the kernel sends. It will have the DEVTYPE value there. However this has to be exactly the hardware type and in both cases it will be "wlan" and has to be. The analogy that works here is similar to partitions and disks in the storage world. We have just different kinds of network interfaces.

Regards

Marcel

#11 lore raw
In reply to John W. Linville
Quoted 10 lines · On Tuesday 08 of December 2009 23:05:04 John W. Linville wrote:
Quoted 8 lines · Johannes Berg
Quoted 5 lines · John W. Linville

So, probably we need to map from the wlanX name to the phyY name, then determine whether or not this is the first wlanX for phyY. If not, then the name should be left alone.

Now, how do we figure out how many wlanX's belong to phyY?

And what's the "first" one? :)

Quoted 9 lines

I suppose I was figuring that if there was only one, it was the first. :-) But you're right, I suppose that could be racy...

Quoted 3 lines

ls /sys/class/net/wlan0/device/net/

will give you the list of interface associated with this device.

Cool...

Is it possible to distinguish between automatic system enumeration when new device is created and explicit name that user gives? Because in example above (iw phy add interface) user already supplied specific name; there is no reason for udev to (try to) mangle it.

So far the only possibility seems to check for wild card in interface name. So what about adding new event attribute NAME_AUTOGENERATED=(yes| no) and simply leaving any event with NAME_AUTOGENERATED=no alone in udev? Any immediate problems?

#12 lore raw
Quoted 9 lines · Andrey Borzenkov

Is it possible to distinguish between automatic system enumeration when new device is created and explicit name that user gives? Because in example above (iw phy add interface) user already supplied specific name; there is no reason for udev to (try to) mangle it.

So far the only possibility seems to check for wild card in interface name. So what about adding new event attribute NAME_AUTOGENERATED=(yes| no) and simply leaving any event with NAME_AUTOGENERATED=no alone in udev? Any immediate problems?

This is non-trivial because it really goes through the same code paths internally. Feel free to send patches.

johannes

#13 lore raw
In reply to Andrey Borzenkov
Quoted 18 lines · Andrey Borzenkov
Quoted 17 lines · On Tuesday 08 of December 2009 23:05:04 John W. Linville wrote:
Quoted 8 lines · Johannes Berg
Quoted 5 lines · John W. Linville

So, probably we need to map from the wlanX name to the phyY name, then determine whether or not this is the first wlanX for phyY. If not, then the name should be left alone.

Now, how do we figure out how many wlanX's belong to phyY?

And what's the "first" one? :)

I suppose I was figuring that if there was only one, it was the first. :-) But you're right, I suppose that could be racy...

Quoted 3 lines

ls /sys/class/net/wlan0/device/net/

will give you the list of interface associated with this device.

Quoted 7 lines
Quoted 2 lines

Cool...

Is it possible to distinguish between automatic system enumeration when new device is created and explicit name that user gives? Because in example above (iw phy add interface) user already supplied specific name; there is no reason for udev to (try to) mangle it.

That's why I wanted the "first" one...it is auto-generated. :-)

John

Signature · 2 lines
John W. Linville		Someday the world will need a hero, and you
[email protected]			might be all we have.  Be ready.