Blame 0040-Handle-upper-case-MAC-addresses-in-ifname-option.patch

Harald Hoyer 83ebbb
From acfab3733f406a5b052941ffacc70511e9723106 Mon Sep 17 00:00:00 2001
Harald Hoyer 83ebbb
From: Anton Blanchard <anton@samba.org>
Harald Hoyer 83ebbb
Date: Tue, 27 Dec 2011 09:08:27 +1100
Harald Hoyer 83ebbb
Subject: [PATCH] Handle upper case MAC addresses in ifname option
Harald Hoyer 83ebbb
Harald Hoyer 83ebbb
While the documentation states that ifname MAC addresses must be
Harald Hoyer 83ebbb
lower case, we silently accept upper case ones and fail later on
Harald Hoyer 83ebbb
when udev doesn't rename the device.
Harald Hoyer 83ebbb
Harald Hoyer 83ebbb
Instead of adding sanity checking on the MAC address just convert
Harald Hoyer 83ebbb
it to lower case and remove the requirement completely.
Harald Hoyer 83ebbb
---
Harald Hoyer 83ebbb
 dracut.cmdline.7.xml                |    1 -
Harald Hoyer 83ebbb
 modules.d/40network/parse-ifname.sh |    3 ++-
Harald Hoyer 83ebbb
 2 files changed, 2 insertions(+), 2 deletions(-)
Harald Hoyer 83ebbb
Harald Hoyer 83ebbb
diff --git a/dracut.cmdline.7.xml b/dracut.cmdline.7.xml
Harald Hoyer 83ebbb
index 8a49056..9357e25 100644
Harald Hoyer 83ebbb
--- a/dracut.cmdline.7.xml
Harald Hoyer 83ebbb
+++ b/dracut.cmdline.7.xml
Harald Hoyer 83ebbb
@@ -464,7 +464,6 @@ This parameter can be specified multiple times.</para>
Harald Hoyer 83ebbb
           <term><envar>ifname=</envar><replaceable><interface></replaceable>:<replaceable><MAC></replaceable></term>
Harald Hoyer 83ebbb
           <listitem>
Harald Hoyer 83ebbb
             <para>Assign network device name <interface> (ie eth0) to the NIC with MAC <MAC>.
Harald Hoyer 83ebbb
-Note letters in the MAC-address must be lowercase!
Harald Hoyer 83ebbb
 <remark>Note: If you use this option you <emphasis remap="B">must</emphasis> specify an ifname= argument for all interfaces used in ip= or fcoe= arguments.</remark>
Harald Hoyer 83ebbb
 This parameter can be specified multiple times.</para>
Harald Hoyer 83ebbb
           </listitem>
Harald Hoyer 83ebbb
diff --git a/modules.d/40network/parse-ifname.sh b/modules.d/40network/parse-ifname.sh
Harald Hoyer 83ebbb
index 4c3c70e..26e6084 100755
Harald Hoyer 83ebbb
--- a/modules.d/40network/parse-ifname.sh
Harald Hoyer 83ebbb
+++ b/modules.d/40network/parse-ifname.sh
Harald Hoyer 83ebbb
@@ -25,7 +25,8 @@ parse_ifname_opts() {
Harald Hoyer 83ebbb
     case $# in
Harald Hoyer 83ebbb
         7)
Harald Hoyer 83ebbb
             ifname_if=$1
Harald Hoyer 83ebbb
-            ifname_mac=$2:$3:$4:$5:$6:$7
Harald Hoyer 83ebbb
+            # udev requires MAC addresses to be lower case
Harald Hoyer 83ebbb
+            ifname_mac=`echo $2:$3:$4:$5:$6:$7 | tr '[:upper:]' '[:lower:]'`
Harald Hoyer 83ebbb
             ;;
Harald Hoyer 83ebbb
         *)
Harald Hoyer 83ebbb
             die "Invalid arguments for ifname="