systemd/debian/extra/rules/73-special-net-names.rules
Dan Streetman 8797c07910 d/extra/rules/73-special-net-names.rules: use $$ instead of $ in PROGRAM= value
The use of the '$' character in PROGRAM="" values is supposed to be doubled
if it is intended for use by the program being run, instead of as a
substitution variable for udev to replace before running the program; i.e.
it should be '$$' if udev should pass a single '$' in its place to the
program command line.

However, if the variable it precedes isn't a valid substitution variable
name, it is left in place for the program to evaluate.  So, while not
correct per the 'man udev' documentation, this udev rule's use of single
'$' characters has (and still currently does) work correctly.

However, since commit d7aee41db35f808bca92d4910bf6e52cec3f8e59, un-doubled
use of '$' characters like this has resulted in a warning message being printed:
[   17.560125] systemd-udevd[132]: /lib/udev/rules.d/73-special-net-names.rules:14 Invalid value "/bin/sh -ec 'D=${DEVPATH#*/vio/}; D=${D%%%%/*}; D=${D#????}; D=${D#0}; D=${D#0}; D=${D#0}; D=${D#0}; echo ${D:-0}'" for PROGRAM (char 16: invalid substitution type), ignoring, but please fix it.

This corrects the rule to use $$ instead.

Also, just to note, the rule already correctly doubles the '%' chars
that it uses.
2019-09-05 06:10:13 +00:00

15 lines
969 B
Plaintext

# On Dell PowerEdge systems, the iDRAC7 and later support a USB Virtual NIC
# which terminates in the iDRAC. Help identify this with 'idrac'
ACTION=="add", SUBSYSTEM=="net", SUBSYSTEMS=="usb", ATTRS{idVendor}=="413c", ATTRS{idProduct}=="a102", NAME="idrac"
# On IBM systems the Integrated Management Module is reachable using a
# # USB Virtual NIC.
ACTION=="add", SUBSYSTEM=="net", SUBSYSTEMS=="usb", \
ATTRS{idVendor}=="04b3", ATTRS{idProduct}=="0325", NAME="ibmimm"
# 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"); 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#????}; D=$${D#0}; D=$${D#0}; D=$${D#0}; D=$${D#0}; echo $${D:-0}'", NAME="ibmveth$result"