From: Hans de Goede Date: Mon, 14 Sep 2009 09:42:52 +0000 (+0200) Subject: Add ifname= argument for persistent netdev names X-Git-Tag: 002~23 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=68f28d69765f6ead72a63a3ddf6a54e2f30a7aff;p=thirdparty%2Fdracut.git Add ifname= argument for persistent netdev names ifname=: Assign network device name (ie eth0) to the NIC with MAC . Note that if you use this option you *must* specify an ifname= argument for all interfaces used in ip= or fcoe= arguments --- diff --git a/dracut.8 b/dracut.8 index 5ebcd16c5..18594e596 100644 --- a/dracut.8 +++ b/dracut.8 @@ -256,6 +256,12 @@ explicit network configuration .B rd_NO_PLYMOUTH do not start plymouth. This will not work with encrypted partitions. +.TP +.B ifname=: +Assign network device name (ie eth0) to the NIC with MAC . +Note that if you use this option you \fBmust\fR specify an ifname= argument +for all interfaces used in ip= or fcoe= arguments + .SH Misc .TP .B rdblacklist= diff --git a/modules.d/40network/install b/modules.d/40network/install index 34aed9325..ded70dafe 100755 --- a/modules.d/40network/install +++ b/modules.d/40network/install @@ -4,10 +4,12 @@ inst "$moddir/ifup" "/sbin/ifup" inst "$moddir/netroot" "/sbin/netroot" inst "$moddir/dhclient-script" "/sbin/dhclient-script" inst "$moddir/dhclient.conf" "/etc/dhclient.conf" +inst_hook pre-udev 50 "$moddir/ifname-genrules.sh" inst_hook pre-udev 60 "$moddir/net-genrules.sh" inst_hook cmdline 91 "$moddir/dhcp-root.sh" inst_hook cmdline 99 "$moddir/parse-ip-opts.sh" inst_hook cmdline 98 "$moddir/parse-bridge.sh" +inst_hook cmdline 99 "$moddir/parse-ifname.sh" inst_hook pre-pivot 10 "$moddir/kill-dhclient.sh" # TODO ifcfg config style is redhat specific, this should probably diff --git a/modules.d/40network/net-genrules.sh b/modules.d/40network/net-genrules.sh index 04e0528b5..ba369cc4e 100755 --- a/modules.d/40network/net-genrules.sh +++ b/modules.d/40network/net-genrules.sh @@ -29,7 +29,7 @@ fix_bootif() { # If we have to handle multiple interfaces, handle only them. elif [ -n "$IFACES" ] ; then for iface in $IFACES ; do - printf 'ACTION=="add", SUBSYSTEM=="net", KERNEL=="%s", RUN+="/sbin/ifup $env{INTERFACE}"\n' "$iface" + printf 'ACTION=="add", SUBSYSTEM=="net", NAME=="%s", RUN+="/sbin/ifup $env{INTERFACE}"\n' "$iface" done # Default: We don't know the interface to use, handle all diff --git a/modules.d/95fcoe/fcoe-genrules.sh b/modules.d/95fcoe/fcoe-genrules.sh index b5d6f0722..e9d015733 100755 --- a/modules.d/95fcoe/fcoe-genrules.sh +++ b/modules.d/95fcoe/fcoe-genrules.sh @@ -9,6 +9,6 @@ if [ -n "$fcoe_mac" ] ; then printf 'ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="%s", RUN+="/sbin/fcoe-up $env{INTERFACE} %s"\n' "$fcoe_mac" "$fcoe_dcb" else - printf 'ACTION=="add", SUBSYSTEM=="net", KERNEL=="%s", RUN+="/sbin/fcoe-up $env{INTERFACE} %s"\n' "$fcoe_interface" "$fcoe_dcb" + printf 'ACTION=="add", SUBSYSTEM=="net", NAME=="%s", RUN+="/sbin/fcoe-up $env{INTERFACE} %s"\n' "$fcoe_interface" "$fcoe_dcb" fi } > /etc/udev/rules.d/60-fcoe.rules diff --git a/modules.d/95fcoe/parse-fcoe.sh b/modules.d/95fcoe/parse-fcoe.sh index 81ec760ba..b35680fce 100755 --- a/modules.d/95fcoe/parse-fcoe.sh +++ b/modules.d/95fcoe/parse-fcoe.sh @@ -11,7 +11,7 @@ # # Examples: # fcoe=eth0:nodcb -# fcoe=4A:3F:4C:04:F8:D7:nodcb +# fcoe=4a:3f:4c:04:f8:d7:nodcb [ -z "$fcoe" ] && fcoe=$(getarg fcoe=)