All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] Add ifname= argument for persistent netdev names
@ 2009-09-14  9:42 Hans de Goede
       [not found] ` <1252921374-2798-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Hans de Goede @ 2009-09-14  9:42 UTC (permalink / raw)
  To: initramfs; +Cc: Harald Hoyer, Hans de Goede

ifname=<interface>:<MAC>
Assign network device name <interface> (ie eth0) to the NIC with MAC <MAC>.
Note that if you use this option you *must* specify an ifname= argument
for all interfaces used in ip= or fcoe= arguments
---
 dracut.8                               |    6 +++++
 modules.d/40network/ifname-genrules.sh |   21 ++++++++++++++++++
 modules.d/40network/install            |    2 +
 modules.d/40network/net-genrules.sh    |    2 +-
 modules.d/40network/parse-ifname.sh    |   37 ++++++++++++++++++++++++++++++++
 modules.d/95fcoe/fcoe-genrules.sh      |    2 +-
 modules.d/95fcoe/parse-fcoe.sh         |    2 +-
 7 files changed, 69 insertions(+), 3 deletions(-)
 create mode 100755 modules.d/40network/ifname-genrules.sh
 create mode 100755 modules.d/40network/parse-ifname.sh

diff --git a/dracut.8 b/dracut.8
index b0547d9..e9bd0d8 100644
--- a/dracut.8
+++ b/dracut.8
@@ -247,6 +247,12 @@ get ip from dhcp server on a specific interface
 .B ip=<client-IP-number>:[<server-id>]:<gateway-IP-number>:<netmask>:<client-hostname>:<interface>:{none|off}
 explicit network configuration
 
+.TP
+.B ifname=<interface>:<MAC>
+Assign network device name <interface> (ie eth0) to the NIC with MAC <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=<drivername>
diff --git a/modules.d/40network/ifname-genrules.sh b/modules.d/40network/ifname-genrules.sh
new file mode 100755
index 0000000..547f230
--- /dev/null
+++ b/modules.d/40network/ifname-genrules.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+# if there are no ifname parameters, just use NAME=KERNEL
+if ! getarg ifname= >/dev/null ; then
+    echo 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="?*", ATTR{type}=="1", NAME="%k"' \
+        > /etc/udev/rules.d/50-ifname.rules
+    return
+fi
+
+{
+    for p in $(getargs ifname=); do
+        parse_ifname_opts $p
+	printf 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="%s", ATTR{type}=="1", NAME="%s"\n' "$ifname_mac" "$ifname_if"
+    done
+
+    # Rename non named interfaces out of the way for named ones.
+    for p in $(getargs ifname=); do
+        parse_ifname_opts $p
+	printf 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="?*", ATTR{type}=="1", NAME!="?*", KERNEL=="%s", NAME="%%k-renamed"\n' "$ifname_if"
+    done
+} > /etc/udev/rules.d/50-ifname.rules
diff --git a/modules.d/40network/install b/modules.d/40network/install
index 34aed93..ded70da 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 04e0528..ba369cc 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/40network/parse-ifname.sh b/modules.d/40network/parse-ifname.sh
new file mode 100755
index 0000000..aba8475
--- /dev/null
+++ b/modules.d/40network/parse-ifname.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+#
+# Format:
+#	ifname=<interface>:<mac>
+#
+# Note letters in the macaddress must be lowercase!
+#
+# Examples:
+# ifname=eth0:4a:3f:4c:04:f8:d7
+#
+# Note when using ifname= to get persistent interface names, you must specify
+# an ifname= argument for each interface used in an ip= or fcoe= argument
+
+# check if there are any ifname parameters
+if ! getarg ifname= >/dev/null ; then
+    return
+fi
+
+parse_ifname_opts() {
+    local IFS=:
+    set $1
+
+    case $# in
+        7)
+            ifname_if=$1
+            ifname_mac=$2:$3:$4:$5:$6:$7
+            ;;
+        *)
+            die "Invalid arguments for ifname="
+            ;;
+    esac
+}
+
+# Check ifname= lines
+for p in $(getargs ifname=); do
+    parse_ifname_opts $p
+done
diff --git a/modules.d/95fcoe/fcoe-genrules.sh b/modules.d/95fcoe/fcoe-genrules.sh
index b5d6f07..e9d0157 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 81ec760..b35680f 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=)
 
-- 
1.6.4.2

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] Document netroot=fcoe:....
       [not found] ` <1252921374-2798-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2009-09-14  9:42   ` Hans de Goede
       [not found]     ` <1252921374-2798-2-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Hans de Goede @ 2009-09-14  9:42 UTC (permalink / raw)
  To: initramfs; +Cc: Harald Hoyer, Hans de Goede

---
 dracut.8 |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/dracut.8 b/dracut.8
index e9bd0d8..322f879 100644
--- a/dracut.8
+++ b/dracut.8
@@ -224,6 +224,12 @@ e.g.
 .B root=??? iscsi_firmware
 will read the iscsi parameter from the BIOS firmware
 
+.SH FCoE
+.TP
+.B netroot=fcoe:<interface|MAC>:<dcb|nodcb>
+Try to connect to a FCoE SAN through the NIC specified by <interface> or <MAC>,
+for the second argument, currently only nodcb is supported.
+
 .SH NBD
 .TP
 .B root=nbd:<server>:<port>[:<fstype>][:<mountopts>]
-- 
1.6.4.2

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] Document that MAC addresses must be lowercase
       [not found]     ` <1252921374-2798-2-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2009-09-14  9:42       ` Hans de Goede
       [not found]         ` <1252921374-2798-3-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Hans de Goede @ 2009-09-14  9:42 UTC (permalink / raw)
  To: initramfs; +Cc: Harald Hoyer, Hans de Goede

---
 dracut.8 |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/dracut.8 b/dracut.8
index 322f879..32d2e5b 100644
--- a/dracut.8
+++ b/dracut.8
@@ -228,7 +228,8 @@ will read the iscsi parameter from the BIOS firmware
 .TP
 .B netroot=fcoe:<interface|MAC>:<dcb|nodcb>
 Try to connect to a FCoE SAN through the NIC specified by <interface> or <MAC>,
-for the second argument, currently only nodcb is supported.
+for the second argument, currently only nodcb is supported. Note letters in
+the MAC-address must be lowercase!
 
 .SH NBD
 .TP
@@ -256,6 +257,7 @@ explicit network configuration
 .TP
 .B ifname=<interface>:<MAC>
 Assign network device name <interface> (ie eth0) to the NIC with MAC <MAC>.
+Note letters in the MAC-address must be lowercase!
 Note that if you use this option you \fBmust\fR specify an ifname= argument
 for all interfaces used in ip= or fcoe= arguments
 
-- 
1.6.4.2

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 3/3] Document that MAC addresses must be lowercase
       [not found]         ` <1252921374-2798-3-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2009-09-16 15:45           ` Harald Hoyer
  0 siblings, 0 replies; 4+ messages in thread
From: Harald Hoyer @ 2009-09-16 15:45 UTC (permalink / raw)
  To: Hans de Goede; +Cc: initramfs

On 09/14/2009 11:42 AM, Hans de Goede wrote:
> ---
>   dracut.8 |    4 +++-
>   1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/dracut.8 b/dracut.8
> index 322f879..32d2e5b 100644
> --- a/dracut.8
> +++ b/dracut.8
> @@ -228,7 +228,8 @@ will read the iscsi parameter from the BIOS firmware
>   .TP
>   .B netroot=fcoe:<interface|MAC>:<dcb|nodcb>
>   Try to connect to a FCoE SAN through the NIC specified by<interface>  or<MAC>,
> -for the second argument, currently only nodcb is supported.
> +for the second argument, currently only nodcb is supported. Note letters in
> +the MAC-address must be lowercase!
>
>   .SH NBD
>   .TP
> @@ -256,6 +257,7 @@ explicit network configuration
>   .TP
>   .B ifname=<interface>:<MAC>
>   Assign network device name<interface>  (ie eth0) to the NIC with MAC<MAC>.
> +Note letters in the MAC-address must be lowercase!
>   Note that if you use this option you \fBmust\fR specify an ifname= argument
>   for all interfaces used in ip= or fcoe= arguments
>

applied and pushed
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-09-16 15:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-14  9:42 [PATCH 1/3] Add ifname= argument for persistent netdev names Hans de Goede
     [not found] ` <1252921374-2798-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-09-14  9:42   ` [PATCH 2/3] Document netroot=fcoe: Hans de Goede
     [not found]     ` <1252921374-2798-2-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-09-14  9:42       ` [PATCH 3/3] Document that MAC addresses must be lowercase Hans de Goede
     [not found]         ` <1252921374-2798-3-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-09-16 15:45           ` Harald Hoyer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.