Excluding some device types from persistent-net (xen, s390)
Hi there!
I have a change to persistent-net behaviour, to exclude xen-devices, and s390-devices.
Can that rule be formatted better?
Does that syntax work: SUBSYSTEMS!="xen|ccwgroup"
I saw the ACTION!="add|change" commit, but does that apply to the SUBSYSTEMS list also?
Matthias
Signature · 1 line
Matthias Schwarzott (zzam)
extras/rule_generator/75-persistent-net-generator.rules +2 -2
@@ -1,6 +1,7 @@ # these rules generate rules for persistent network device naming -ACTION=="add", SUBSYSTEM=="net", KERNEL=="eth*|ath*|wlan*|ra*|sta*" \ +ACTION=="add", SUBSYSTEM=="net", SUBSYSTEMS!="xen", SUBSYSTEMS!="ccwgroup" \ + KERNEL=="eth*|ath*|wlan*|ra*|sta*" \ NAME!="?*", DRIVERS=="?*", GOTO="persistent_net_generator_do" GOTO="persistent_net_generator_end"
@@ -10,7 +11,6 @@ LABEL="persistent_net_generator_do" SUBSYSTEMS=="pci", ENV{COMMENT}="PCI device $attr{vendor}:$attr{device} ($attr{driver})" SUBSYSTEMS=="usb", ENV{COMMENT}="USB device 0x$attr{idVendor}:0x$attr{idProduct} ($attr{driver})" SUBSYSTEMS=="ieee1394", ENV{COMMENT}="Firewire device $attr{host_id})" -SUBSYSTEMS=="xen", ENV{COMMENT}="Xen virtual device" ENV{COMMENT}=="", ENV{COMMENT}="$env{SUBSYSTEM} device ($attr{driver})" IMPORT{program}="write_net_rules $attr{address}"
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 2 lines · Matthias Schwarzott
I have a change to persistent-net behaviour, to exclude xen-devices, and s390-devices.
It's not needed, or does not work for xen and s390?
Quoted 1 line
Can that rule be formatted better?
With the current logic, only one SUBSYSTEMS-key (same for most other keys) is supported per rule.
(I have a patch pending, that removes the limitation and just creates a big linear match/action from of the rules, without the limitation on the count of keys, but that patch is not finished now.)
Quoted 3 lines
Does that syntax work: SUBSYSTEMS!="xen|ccwgroup"
I saw the ACTION!="add|change" commit, but does that apply to the SUBSYSTEMS list also?
It should work for all match-keys, yes.
Thanks,
Kay
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 5 lines · you
Quoted 2 lines · Matthias Schwarzott
I have a change to persistent-net behaviour, to exclude xen-devices, and s390-devices.
It's not needed, or does not work for xen and s390?
xen creates random macs per default I think. And s390 does create macs on login or similar? Perhaps someone really using a s390 could comment on this.
Quoted 9 lines
Quoted 2 lines
Can that rule be formatted better?
With the current logic, only one SUBSYSTEMS-key (same for most other keys) is supported per rule.
(I have a patch pending, that removes the limitation and just creates a big linear match/action from of the rules, without the limitation on the count of keys, but that patch is not finished now.)
Quoted 6 lines
Quoted 3 lines
Does that syntax work: SUBSYSTEMS!="xen|ccwgroup"
I saw the ACTION!="add|change" commit, but does that apply to the SUBSYSTEMS list also?It should work for all match-keys, yes.
But that means for now I have to use
SUBSYSTEMS="xen", GOTO="persistent_net_end"
SUBSYSTEMS="ccwgroup", GOTO="persistent_net_end"
or does
SUBSYSTEMS="xen|ccwgroup", GOTO="persistent_net_end" or
...., SUBSYSTEMS!="xen|ccwgroup", ...
work, as this IS just one SUBSYSTEMS per line.
Greetings
Matthias
Signature · 11 lines
Matthias Schwarzott (zzam) ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net [email protected] https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 2 lines · Matthias Schwarzott
xen creates random macs per default I think. And s390 does create macs on login or similar? Perhaps someone really using a s390 could comment on this.
There are a few cases where the mac address can be zero (some VM Guest Lan, iirc), and some ccwgroup devices don't have a mac address (keep in mind that ccwgroup is just the bus; devices can be fundamentally different, like qeth and ctc). But these cases should be handled well during persistent rule generation.
Also, not all s390 network devices are on the ccwgroup bus; however netiucv device are already excluded since they use iucv* and don't have mac addresses anyway.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 24 lines · Matthias Schwarzott
Quoted 5 lines · you
Quoted 2 lines · Matthias Schwarzott
I have a change to persistent-net behaviour, to exclude xen-devices, and s390-devices.
It's not needed, or does not work for xen and s390?
xen creates random macs per default I think. And s390 does create macs on login or similar? Perhaps someone really using a s390 could comment on this.
Quoted 13 lines
Quoted 2 lines
Can that rule be formatted better?
With the current logic, only one SUBSYSTEMS-key (same for most other keys) is supported per rule.
(I have a patch pending, that removes the limitation and just creates a big linear match/action from of the rules, without the limitation on the count of keys, but that patch is not finished now.)Quoted 3 lines
Does that syntax work: SUBSYSTEMS!="xen|ccwgroup"
I saw the ACTION!="add|change" commit, but does that apply to the SUBSYSTEMS list also?
Quoted 6 lines
Quoted 2 lines
It should work for all match-keys, yes.
But that means for now I have to use
SUBSYSTEMS="xen", GOTO="persistent_net_end"
SUBSYSTEMS="ccwgroup", GOTO="persistent_net_end"
That should work.
Quoted 3 lines
or does
SUBSYSTEMS="xen|ccwgroup", GOTO="persistent_net_end" or
That should work too, only the != has the weird behavior.
Quoted 2 lines
...., SUBSYSTEMS!="xen|ccwgroup", ...
work, as this IS just one SUBSYSTEMS per line.
This will work with the next udev, today:
!="a|b"
means:
(!a) || (!b)
which is pretty useless. :)
Kay
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 14 lines · Kay Sievers
Quoted 11 lines · Matthias Schwarzott
Quoted 5 lines · you
Quoted 2 lines · Matthias Schwarzott
I have a change to persistent-net behaviour, to exclude xen-devices, and s390-devices.
It's not needed, or does not work for xen and s390?
xen creates random macs per default I think. And s390 does create macs on login or similar? Perhaps someone really using a s390 could comment on this.
Quoted 6 lines
Quoted 3 lines
or does
SUBSYSTEMS=="xen|ccwgroup", GOTO="persistent_net_end" orThat should work too, only the != has the weird behavior.
Updated patch with this variant attached.
Now we can discuss if the rules itself are usfull.
1. xen:
I think for xen the persistence framework itself is not usefull, as the order of the devices is every time the same, isn't it. The only known problem is caused by the rules itself: When mac is randomly assigned udev counts up xen[0-9].
2. s390 / ccwgroup
I have no such machine, but I have this request to re-add (the for s390 completely removed persistence-net):
http://bugs.gentoo.org/show_bug.cgi?id=173797
Quoted 9 lines · Cornelia Huck <[email protected]> (IBM Deutschland Entwicklung GmbH) wrote:
There are a few cases where the mac address can be zero (some VM Guest Lan, iirc), and some ccwgroup devices don't have a mac address (keep in mind that ccwgroup is just the bus; devices can be fundamentally different, like qeth and ctc). But these cases should be handled well during persistent rule generation.
Also, not all s390 network devices are on the ccwgroup bus; however netiucv device are already excluded since they use iucv* and don't have mac addresses anyway.
that is part of the used rules: apply persistence only on this condition:
KERNEL=="eth*|ath*|wlan*|ra*|sta*"
That means qeth and ctc (if that is the device name) should already be ignored.
Matthias
Signature · 1 line
Matthias Schwarzott (zzam)
extras/rule_generator/75-persistent-net-generator.rules +1 -1
@@ -1,5 +1,6 @@ # these rules generate rules for persistent network device naming +SUBSYSTEMS=="xen|ccwgroup", GOTO="persistent_net_generator_end" ACTION=="add", SUBSYSTEM=="net", KERNEL=="eth*|ath*|wlan*|ra*|sta*" \ NAME!="?*", DRIVERS=="?*", GOTO="persistent_net_generator_do"
@@ -10,7 +11,6 @@ LABEL="persistent_net_generator_do" SUBSYSTEMS=="pci", ENV{COMMENT}="PCI device $attr{vendor}:$attr{device} ($attr{driver})" SUBSYSTEMS=="usb", ENV{COMMENT}="USB device 0x$attr{idVendor}:0x$attr{idProduct} ($attr{driver})" SUBSYSTEMS=="ieee1394", ENV{COMMENT}="Firewire device $attr{host_id})" -SUBSYSTEMS=="xen", ENV{COMMENT}="Xen virtual device" ENV{COMMENT}=="", ENV{COMMENT}="$env{SUBSYSTEM} device ($attr{driver})" IMPORT{program}="write_net_rules $attr{address}"
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 17 lines · Matthias Schwarzott
2. s390 / ccwgroup
I have no such machine, but I have this request to re-add (the for s390 completely removed persistence-net):
http://bugs.gentoo.org/show_bug.cgi?id3797Quoted 9 lines · Cornelia Huck <[email protected]> (IBM Deutschland Entwicklung GmbH) wrote:
There are a few cases where the mac address can be zero (some VM Guest Lan, iirc), and some ccwgroup devices don't have a mac address (keep in mind that ccwgroup is just the bus; devices can be fundamentally different, like qeth and ctc). But these cases should be handled well during persistent rule generation.
Also, not all s390 network devices are on the ccwgroup bus; however netiucv device are already excluded since they use iucv* and don't have mac addresses anyway.
Quoted 5 lines
that is part of the used rules: apply persistence only on this condition:
KERNEL="eth*|ath*|wlan*|ra*|sta*"That means qeth and ctc (if that is the device name) should already be ignored.
I think you misunderstood me :) qeth and ctc are the names of the device drivers.
For qeth, you'll usually have run-of-the mill tr* or eth* interfaces, except for the special hsi* (HiperSockets, this may be where the mac address is zero) and osn* (special purpose). For eth*, I don't foresee any trouble, the remainder are ignored anyway.
ctc and claw should be unproblematic as well, as they use special interface names (as does netiucv).
lcs is the only one I'm not 100% sure about. Interfaces will be tr* or eth*, macaddress may be zero for ethernet (I don't quite remember).
Were there any problems associated with persistent rules for ccwgroup devices?
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 2 lines · Cornelia Huck
Were there any problems associated with persistent rules for ccwgroup devices?
yes, that's why we disabled it ... the proposed patch came from OpenSUSE as the route we were going before (simply delete the file on s390) is the behavior we copied from Debian (which they were doing because the persistent-net rules were screwing things up for their users) -mike
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 8 lines · Mike Frysinger
Quoted 2 lines · Cornelia Huck
Were there any problems associated with persistent rules for ccwgroup devices?
yes, that's why we disabled it ... the proposed patch came from OpenSUSE as the route we were going before (simply delete the file on s390) is the behavior we copied from Debian (which they were doing because the persistent-net rules were screwing things up for their users)
Could anyone please point me to those problem reports? I have not been able to google anything (ok, it's Friday) on this but something about ctcs which are ignored anyway...
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 7 lines · Cornelia Huck
On Thu, 12 Apr 2007 10:12:57 -0400,
Quoted 4 lines · Mike Frysinger
Quoted 2 lines · Cornelia Huck
Were there any problems associated with persistent rules for ccwgroup devices?
Quoted 8 lines
Quoted 4 lines
yes, that's why we disabled it ... the proposed patch came from OpenSUSE as the route we were going before (simply delete the file on s390) is the behavior we copied from Debian (which they were doing because the persistent-net rules were screwing things up for their users)
Could anyone please point me to those problem reports? I have not been able to google anything (ok, it's Friday) on this but something about ctcs which are ignored anyway...
Debian is filed under #383303 ... no idea about SuSE, just ripped out of some .src.rpm
but thinking about it logically, the MAC is generated on the fly so the MAC/iface binding from the previous boot really has no relevance at the next boot
-mike
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 2 lines · Mike Frysinger
Debian is filed under #383303 ... no idea about SuSE, just ripped out of some .src.rpm
Ah, ok, I saw that, but coundn't make sense of it.
Quoted 4 lines
but thinking about it logically, the MAC is generated on the fly so the MAC/iface binding from the previous boot really has no relevance at the next boot
If it were generated on the fly, then yes. But the mac really should be constant afaik, I've never seen it otherwise (though, maybe under hercules?)
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 5 lines · Matthias Schwarzott
Hi there!
I have a change to persistent-net behaviour, to exclude xen-devices, and s390-devices.
I thought even more about the persistent-net framework.
The problems appear in two different cases:
1. Random MAC addresses (as we for now only use by-mac as method) This will lead to increasing numbers for the device after each reboot with different mac.
2. Devices that are ignored and does not add persistent-rules.
This leads to errors as soon as on a system there are devices which we try to get persistent, and devices which we ignore (with the same prefix, e.g. eth*).
As udev cannot rename the device as soon as the dest name is already occupied. (ignored devices being eth1, and udev trying to rename eth2 to eth1 will lead to eth?_rename devices ...)
Possible solutions for different devices (restricting me to eth, will add new mail about wifi stuff):
xen-devices:
# udevinfo -a -p /sys/class/net/eth0
looking at device '/class/net/eth0':
KERNEL="eth0"
SUBSYSTEM="net"
DRIVER=""
ATTR{weight}="64"
ATTR{tx_queue_len}="1000"
ATTR{flags}="0x1003"
ATTR{mtu}="1500"
ATTR{carrier}="1"
ATTR{broadcast}="ff:ff:ff:ff:ff:ff"
ATTR{address}="00:16:3e:08:25:1d"looking at parent device '/devices/xen/vif-0':
KERNELS="vif-0"
SUBSYSTEMS="xen"
DRIVERS="vif"
ATTRS{devtype}="vif"
ATTRS{nodename}="device/vif/0"looking at parent device '/devices/xen':
KERNELS="xen"
SUBSYSTEMS=""
DRIVERS=""Perhaps the KERNEL(S) attribute of the parent device can be used for persistence (even though I don't know how the rule should look like) but perhaps just KERNELS="vif-0" will work. As I think the number refers to the (n+1)-th network interface declared in xen-conf for this domain. And that should be constant, even if mac changes.
Better solutions for xen-devices?
s390: For s390 I don't know the facts, please others discuss if there is something special necessary or not.
eth1394: Some users seem to have problems with eth1394, but the people I asked seem to have no problems with it (seem to have macs set and constant).
See this thread: "Problems with udev > 106 and multiple network cards" Perhaps if just one device of this type appears we can persist it with ATTR{type}="24" in case no mac exists, ugly :(
Matthias
Signature · 11 lines
Matthias Schwarzott (zzam) ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net [email protected] https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 29 lines · Matthias Schwarzott
On Donnerstag, 12. April 2007, Matthias Schwarzott wrote:
xen-devices:
# udevinfo -a -p /sys/class/net/eth0looking at device '/class/net/eth0':
KERNEL=="eth0" SUBSYSTEM=="net" DRIVER=="" ATTR{weight}=="64" ATTR{tx_queue_len}=="1000" ATTR{flags}=="0x1003" ATTR{mtu}=="1500" ATTR{carrier}=="1" ATTR{broadcast}=="ff:ff:ff:ff:ff:ff" ATTR{address}=="00:16:3e:08:25:1d"looking at parent device '/devices/xen/vif-0':
KERNELS=="vif-0" SUBSYSTEMS=="xen" DRIVERS=="vif" ATTRS{devtype}=="vif" ATTRS{nodename}=="device/vif/0"looking at parent device '/devices/xen':
KERNELS=="xen" SUBSYSTEMS=="" DRIVERS==""
Quoted 7 lines
Perhaps the KERNEL(S) attribute of the parent device can be used for persistence (even though I don't know how the rule should look like) but perhaps just KERNELS=="vif-0" will work. As I think the number refers to the (n+1)-th network interface declared in xen-conf for this domain. And that should be constant, even if mac changes.
Better solutions for xen-devices?
Attached is an (untested) implementation, that
1. Adds a METHOD setting to write_net_rules
2. Adds methods by-mac and by-xen-vif.
If none specified checking $DEVPATH/device/subsystem - and use by-xen-vif in case subsystem is "xen".
3. by-mac does what was default before.
4. by-xen-vif: Look up the name of the device symlink (VIF_NAME) and adding a rule with KERNELS=="$VIF_NAME".
For other devices perhaps more such special methods are required.
Matthias
PS: by-path could also be added.
Signature · 1 line
Matthias Schwarzott (zzam)
extras/rule_generator/write_net_rules +49 -12
@@ -85,20 +85,57 @@ if [ -z "$INTERFACE" ]; then exit 1 fi -if [ "$1" ]; then - MAC_ADDR="$1" +if [ "${1}" != "${1##by-}" ]; then + METHOD="${1}" + shift else - MAC_ADDR=$(sysread address) + # get subsystem of device + SUBSYSTEM=$(sysreadlink device/subsystem) + SUBSYSTEM=${SUBSYSTEM##*/} + case $SUBSYSTEM in + xen) + METHOD='by-xen-vif' + ;; + *) + METHOD='by-mac' + ;; + esac fi -if [ -z "$MAC_ADDR" ]; then - echo "No MAC address for $INTERFACE." >&2 - exit 1 -fi -if [ "$MAC_ADDR" = "00:00:00:00:00:00" ]; then - echo "NULL MAC address for $INTERFACE." >&2 - exit 1 -fi +case "$METHOD" in + by-mac) + if [ "$1" ]; then + MAC_ADDR="$1" + else + MAC_ADDR=$(sysread address) + fi + + if [ -z "$MAC_ADDR" ]; then + echo "No MAC address for $INTERFACE." >&2 + exit 1 + fi + if [ "$MAC_ADDR" = "00:00:00:00:00:00" ]; then + echo "NULL MAC address for $INTERFACE." >&2 + exit 1 + fi + RULE="ATTRS{address}==\"$MAC_ADDR\"" + ;; + + by-xen-vif) + VIF_NAME="$(sysreadlink device)" + VIF_NAME=${VIF_NAME##*/} + if [ -z "$VIF_NAME" ]; then + echo "No VIF name for $INTERFACE." >&2 + exit 1 + fi + RULE="KERNELS==\"$VIF_NAME\"" + ;; + + *) + echo "Invalid argument (must be either by-mac or by-xen-vif)." >&2 + exit 1 + ;; +esac # Prevent concurrent processes from modifying the file at the same time. lock_rules_file
@@ -117,7 +154,7 @@ if interface_name_taken; then fi # the DRIVERS key is needed to not match bridges and VLAN sub-interfaces -match="DRIVERS==\"?*\", ATTRS{address}==\"$MAC_ADDR\"" +match="DRIVERS==\"?*\", $RULE" if [ $basename = "ath" -o $basename = "wlan" ]; then match="$match, ATTRS{type}==\"1\"" # do not match the wifi* interfaces fi
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 30 lines · Matthias Schwarzott
Quoted 29 lines · Matthias Schwarzott
On Donnerstag, 12. April 2007, Matthias Schwarzott wrote:
xen-devices:
# udevinfo -a -p /sys/class/net/eth0looking at device '/class/net/eth0':
KERNEL=="eth0" SUBSYSTEM=="net" DRIVER=="" ATTR{weight}=="64" ATTR{tx_queue_len}=="1000" ATTR{flags}=="0x1003" ATTR{mtu}=="1500" ATTR{carrier}=="1" ATTR{broadcast}=="ff:ff:ff:ff:ff:ff" ATTR{address}=="00:16:3e:08:25:1d"looking at parent device '/devices/xen/vif-0':
KERNELS=="vif-0" SUBSYSTEMS=="xen" DRIVERS=="vif" ATTRS{devtype}=="vif" ATTRS{nodename}=="device/vif/0"looking at parent device '/devices/xen':
KERNELS=="xen" SUBSYSTEMS=="" DRIVERS==""
Quoted 8 lines
Quoted 6 lines
Perhaps the KERNEL(S) attribute of the parent device can be used for persistence (even though I don't know how the rule should look like) but perhaps just KERNELS=="vif-0" will work. As I think the number refers to the (n+1)-th network interface declared in xen-conf for this domain. And that should be constant, even if mac changes.
Better solutions for xen-devices?Attached is an (untested) implementation, that
Now checked on one system - and corrected all errors :) The dest of the device link did not has a subsystem link. Now checking device/devtype == "vif".
Quoted 11 lines
1. Adds a METHOD setting to
write_net_rules
2. Adds methods by-mac and by-xen-vif.
If none specified checking $DEVPATH/device/subsystem - and use by-xen-vif in case subsystem is "xen".
3. by-mac does what was default before.
4. by-xen-vif: Look up the name of the device symlink (VIF_NAME) and adding a rule with KERNELS=="$VIF_NAME".For other devices perhaps more such special methods are required.
Matthias
Signature · 1 line
Matthias Schwarzott (zzam)
extras/rule_generator/write_net_rules +46 -12
@@ -85,21 +85,55 @@ if [ -z "$INTERFACE" ]; then exit 1 fi -if [ "$1" ]; then - MAC_ADDR="$1" +if [ "${1}" != "${1##by-}" ]; then + METHOD="${1}" + shift else - MAC_ADDR=$(sysread address) -fi + # default method + METHOD='by-mac' -if [ -z "$MAC_ADDR" ]; then - echo "No MAC address for $INTERFACE." >&2 - exit 1 -fi -if [ "$MAC_ADDR" = "00:00:00:00:00:00" ]; then - echo "NULL MAC address for $INTERFACE." >&2 - exit 1 + # get subsystem of device + devtype=$(sysread device/devtype) + if [ "$devtype" = "vif" ]; then + METHOD='by-xen-vif' + fi fi +case "$METHOD" in + by-mac) + if [ "$1" ]; then + MAC_ADDR="$1" + else + MAC_ADDR=$(sysread address) + fi + + if [ -z "$MAC_ADDR" ]; then + echo "No MAC address for $INTERFACE." >&2 + exit 1 + fi + if [ "$MAC_ADDR" = "00:00:00:00:00:00" ]; then + echo "NULL MAC address for $INTERFACE." >&2 + exit 1 + fi + RULE="ATTRS{address}==\"$MAC_ADDR\"" + ;; + + by-xen-vif) + VIF_NAME="$(sysreadlink device)" + VIF_NAME=${VIF_NAME##*/} + if [ -z "$VIF_NAME" ]; then + echo "No VIF name for $INTERFACE." >&2 + exit 1 + fi + RULE="KERNELS==\"$VIF_NAME\"" + ;; + + *) + echo "Invalid argument (must be either by-mac or by-xen-vif)." >&2 + exit 1 + ;; +esac + # Prevent concurrent processes from modifying the file at the same time. lock_rules_file
@@ -117,7 +151,7 @@ if interface_name_taken; then fi # the DRIVERS key is needed to not match bridges and VLAN sub-interfaces -match="DRIVERS==\"?*\", ATTRS{address}==\"$MAC_ADDR\"" +match="DRIVERS==\"?*\", $RULE" if [ $basename = "ath" -o $basename = "wlan" ]; then match="$match, ATTRS{type}==\"1\"" # do not match the wifi* interfaces fi
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 2 lines · Matthias Schwarzott
s390: For s390 I don't know the facts, please others discuss if there is something special necessary or not.
It may be a good idea to use the bus id for ccwgroup devices, something like eth-0.0.fd00. Reasons:
- Unlike the mac address, it is always there :)
- It is unique. The bus id of the ccwgroup device is the bus id of the 'leading' slave ccw device, and ccw devices have unique ids.
Maybe we should still leave out netiucv (iucv bus) devices, since they are created by the user writing the id of the remote VM guest...
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 6 lines · Cornelia Huck
On Fri, 13 Apr 2007 22:08:19 +0200,
Quoted 2 lines · Matthias Schwarzott
s390: For s390 I don't know the facts, please others discuss if there is something special necessary or not.
Quoted 8 lines
It may be a good idea to use the bus id for ccwgroup devices, something like eth-0.0.fd00. Reasons:
- Unlike the mac address, it is always there :)
- It is unique. The bus id of the ccwgroup device is the bus id of the 'leading' slave ccw device, and ccw devices have unique ids.Maybe we should still leave out netiucv (iucv bus) devices, since they are created by the user writing the id of the remote VM guest...
That sounds like a good idea.
We just need some code:
Some questions for this:
1. should write_net_rules detect itself what kind of device - or should the rules detect this (they already do) and pass this to write_net_rules?
2. How to get the unique identifier of that ccwgroup?
First from a udev-rule and then from write_net_rules?
Matthias
Signature · 11 lines
Matthias Schwarzott (zzam) ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net [email protected] https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 13 lines · Matthias Schwarzott
Quoted 12 lines · Cornelia Huck
On Fri, 13 Apr 2007 22:08:19 +0200,
Quoted 2 lines · Matthias Schwarzott
s390: For s390 I don't know the facts, please others discuss if there is something special necessary or not.
It may be a good idea to use the bus id for ccwgroup devices, something like eth-0.0.fd00. Reasons:
- Unlike the mac address, it is always there :)
- It is unique. The bus id of the ccwgroup device is the bus id of the 'leading' slave ccw device, and ccw devices have unique ids.
Quoted 6 lines
Quoted 2 lines
Maybe we should still leave out netiucv (iucv bus) devices, since they are created by the user writing the id of the remote VM guest...
That sounds like a good idea.
We just need some code:
Some questions for this:
<Note: I'm not very familiar with the udev rules stuff>
Quoted 2 lines
1. should
write_net_rulesdetect itself what kind of device - or should the rules detect this (they already do) and pass this towrite_net_rules?
This info should already be in SUBSYSTEM and passed on to write_net_rules, I guess.
Quoted 2 lines
2. How to get the unique identifier of that ccwgroup? First from a udev-rule and then from
write_net_rules?
Can't this simply be stripped from DEVPATH (last element)?
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 14 lines · Cornelia Huck
On Wed, 18 Apr 2007 23:00:11 +0200,
Quoted 5 lines · Matthias Schwarzott
On Montag, 16. April 2007, Cornelia Huck wrote:
That sounds like a good idea.
We just need some code:
Some questions for this:<Note: I'm not very familiar with the udev rules stuff>
Quoted 2 lines
1. should
write_net_rulesdetect itself what kind of device - or should the rules detect this (they already do) and pass this towrite_net_rules?
Quoted 7 lines
This info should already be in SUBSYSTEM and passed on to
write_net_rules, I guess.Quoted 2 lines
2. How to get the unique identifier of that ccwgroup? First from a udev-rule and then from
write_net_rules?Can't this simply be stripped from DEVPATH (last element)?
As I do not know how the DEVPATH for such devices look like, some info like udevinfo -a -p /class/net/eth? or file lists in sysfs could help.
Matthias
Signature · 11 lines
Matthias Schwarzott (zzam) ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net [email protected] https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 7 lines · Matthias Schwarzott
Quoted 4 lines
Quoted 2 lines
2. How to get the unique identifier of that ccwgroup? First from a udev-rule and then from
write_net_rules?Can't this simply be stripped from DEVPATH (last element)?
As I do not know how the DEVPATH for such devices look like, some info like udevinfo -a -p /class/net/eth? or file lists in sysfs could help.
<btw: it would be nice if you kept me on cc:>
ccwgroup devices sit under a ccw driver specific root device, like
/sys/devices/qeth/0.0.f5f0/
for a qeth device or
/sys/devices/cu3088/0.0.7000/
for a ctc device.
In any case, the network interface is like
/sys/devices/qeth/0.0.f5f0/net/eth0
or
/sys/devices/cu3088/0.0.7000/net/ctc0,
so you should be able to use ID from the parent's parent.
udevinfo -a -p /sys/class/net/ctc0/ says:
looking at device '/devices/cu3088/0.0.7000/net/ctc0':
KERNEL="ctc0"
SUBSYSTEM="net"
DRIVER=""
SYSFS{weight}="0"
SYSFS{tx_queue_len}="100"
SYSFS{flags}="0x90"
SYSFS{mtu}="32760"
SYSFS{operstate}="down"
SYSFS{broadcast}=""
SYSFS{address}=""
SYSFS{link_mode}="0"
SYSFS{type}="256"
SYSFS{features}="0x0"
SYSFS{ifindex}="7"
SYSFS{iflink}="7"
SYSFS{addr_len}="0"looking at parent device '/devices/cu3088/0.0.7000/net':
ID="net"
BUS=""
DRIVER=""looking at parent device '/devices/cu3088/0.0.7000':
ID="0.0.7000"
BUS="ccwgroup"
DRIVER="ctc"
SYSFS{stats}="0"
SYSFS{loglevel}="71"
SYSFS{buffer}="32768"
SYSFS{type}="CTC/A"
SYSFS{protocol}="0"
SYSFS{online}="1"
SYSFS{uevent}="DRIVER=ctc"looking at parent device '/devices/cu3088':
ID="cu3088"
BUS=""
DRIVER=""
SYSFS{uevent}=""HTH,
Cornelia.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel