diff options
| author | Martin Pitt <martin.pitt@ubuntu.com> | 2016-04-12 08:26:44 (GMT) |
|---|---|---|
| committer | Martin Pitt <martin.pitt@ubuntu.com> | 2016-04-12 08:32:33 (GMT) |
| commit | 3dee9daaf6521e14b85fbe02345af3d5182ef661 (patch) | |
| tree | 6c2b841421eaad35637558d62aab39b10487ad32 | |
| parent | d3e7a70d51afd38ddf9e14f0a02298a5894ae95a (diff) | |
73-special-net-names.rules: Refine ibmveth naming
Stop assuming that the bus number always starts with '3', e. g. QEMU defaults
to '7'. Instead, now always just cut off the bus number prefix. This assumes
that we won't get *two* virtual buses with conflicting device numbers, but
having multiple buses has never been observed.
If a device has number 'x000000', name it "ibmveth0" instead of just "ibmveth".
Add missing ' to terminate the sh -c '' command.
Thanks to Adam Conrad!
| -rw-r--r-- | debian/extra/rules/73-special-net-names.rules | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/debian/extra/rules/73-special-net-names.rules b/debian/extra/rules/73-special-net-names.rules index 2e6c672..db3ff09 100644 --- a/debian/extra/rules/73-special-net-names.rules +++ b/debian/extra/rules/73-special-net-names.rules @@ -2,7 +2,8 @@ # which terminates in the iDRAC. Help identify this with 'idrac' ACTION=="add", SUBSYSTEM=="net", SUBSYSTEMS=="usb", ATTRS{idVendor}=="413c", ATTRS{idProduct}=="a102", NAME="idrac" -# ibmveth devices' $DEVPATH number usually starts with '3' and is tied to -# (virtual) hardware (slot id selected in the HMC), thus this provides a -# reliable naming (e. g. "/devices/vio/30000002/net/eth1") -ACTION=="add", SUBSYSTEM=="net", NAME=="", DRIVERS=="ibmveth", PROGRAM="/bin/sh -ec 'D=${DEVPATH#*/vio/}; D=${D#3}; echo ${D%%%%/*} | sed s/^0*//", NAME="ibmveth$result" +# ibmveth devices' $DEVPATH number is tied to (virtual) hardware (slot id +# selected in the HMC), thus this provides a reliable naming (e. g. +# "/devices/vio/30000002/net/eth1"); the bus number ('3') is irrelevant, and +# there should only ever be one bus. +ACTION=="add", SUBSYSTEM=="net", NAME=="", DRIVERS=="ibmveth", PROGRAM="/bin/sh -ec 'D=${DEVPATH#*/vio/}; D=${D%%%%/*}; D=${D##*0}; echo ${D:-0}'", NAME="ibmveth$result" |
