Ubuntu Pastebin

Paste from martin at Tue, 12 Apr 2016 09:58:17 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
commit f3b932418a7e7304980671d3110a1b6d0d394654
Author: Martin Pitt <martin.pitt@ubuntu.com>
Date:   Tue Apr 12 11:49:19 2016 +0200

    73-special-net-names.rules: Further refine ibmveth naming
    
    Don't greedily chop off everything before a 0, as that breaks with vio
    addresses like "30001002". Instead, just chop off the first four digits (bus
    number) and employ some ugly shell loop to chop off leading zeros (to avoid
    calling sed or other external programs).

diff --git a/debian/extra/rules/73-special-net-names.rules b/debian/extra/rules/73-special-net-names.rules
index db3ff09..ef25e99 100644
--- a/debian/extra/rules/73-special-net-names.rules
+++ b/debian/extra/rules/73-special-net-names.rules
@@ -4,6 +4,6 @@ ACTION=="add", SUBSYSTEM=="net", SUBSYSTEMS=="usb", ATTRS{idVendor}=="413c", ATT
 
 # 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"
+# "/devices/vio/30000002/net/eth1"); we ignore the bus number, as
+# there should only ever be one bus, and then remove leading zeros
+ACTION=="add", SUBSYSTEM=="net", NAME=="", DRIVERS=="ibmveth", PROGRAM="/bin/sh -ec 'D=${DEVPATH#*/vio/}; D=${D%%%%/*}; D=${D#????}; while [ ${D#0} != $D ]; do D=${D#0}; done; echo ${D:-0}'", NAME="ibmveth$result"
Download as text