Skip to contentSkip to conversation

Convert MAC in BOOTIF parameter to lower case

PATCH In review Srinivasa T N 2 participants 4 messages Jun 26, 2012 – Jun 29, 2012 2 messages not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Convert MAC in BOOTIF parameter to lower case

The patch at http://comments.gmane.org/gmane.linux.kernel.initramfs/2244 takes care of only the MAC conversion to lower case in the interface name. But the same has to be taken care for BOOTIF also. This patch takes care of changing the BOOTIF to lower case.

Note that sed has been used instead of tr, as dracut does not install tr to the initramfs, atleast on RHEL 6.x.

dracut-004/modules.d/40network/net-genrules.sh +2 -1
diff -rNu a/dracut-004/modules.d/40network/net-genrules.sh b/dracut-004/modules.d/40network/net-genrules.sh
@@ -10,7 +10,8 @@
     macaddr=${macaddr%:}
     # strip hardware type field from pxelinux
     [ -n "${macaddr%??:??:??:??:??:??}" ] && macaddr=${macaddr#??:}
-    echo $macaddr
+    # return macaddr with lowercase alpha characters expected by udev
+    echo $macaddr | sed 'y/ABCDEF/abcdef/'
 }
 
 # Don't continue if we don't need network

A message that is not in the archive (sent off-list or not yet received): 4FEA00BC.8090505-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org

#2 lore raw

Hi,

Quoted 8 lines

The patch at
http://comments.gmane.org/gmane.linux.kernel.initramfs/2244 takes care of only the MAC conversion to lower case in the interface name. But the same has to be taken care for BOOTIF also. This patch takes care of changing the BOOTIF to lower case.

Note that sed has been used instead of tr, as dracut does not install tr to the initramfs, atleast on RHEL 6.x.

Good to know, could you replace the existing interface MAC conversion with sed too?

Thanks,
Anton

#3 lore raw
Quoted 9 lines · Anton Blanchard

Hi,

Quoted 6 lines

The patch at
http://comments.gmane.org/gmane.linux.kernel.initramfs/2244 takes care of only the MAC conversion to lower case in the interface name. But the same has to be taken care for BOOTIF also. This patch takes care of changing the BOOTIF to lower case.

Quoted 6 lines
Quoted 2 lines

Note that sed has been used instead of tr, as dracut does not install tr to the initramfs, atleast on RHEL 6.x.

Good to know, could you replace the existing interface MAC conversion with sed too?

Attached a patch to do the same.

Regards,
Seenu.

A message that is not in the archive (sent off-list or not yet received): 4FEAF08F.1030103-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org

#5 lore raw
Quoted 10 lines · Srinivasa T N
Quoted 9 lines · Anton Blanchard

Hi,

Quoted 6 lines

The patch at
http://comments.gmane.org/gmane.linux.kernel.initramfs/2244 takes care of only the MAC conversion to lower case in the interface name. But the same has to be taken care for BOOTIF also. This patch takes care of changing the BOOTIF to lower case.

Quoted 9 lines
Quoted 6 lines
Quoted 2 lines

Note that sed has been used instead of tr, as dracut does not install tr to the initramfs, atleast on RHEL 6.x.

Good to know, could you replace the existing interface MAC conversion with sed too?

Attached a patch to do the same.

Sorry for sending the wrong patch yesterday. I am sending the correct patch with both the patches.

Regards,
Seenu.

From 2ec9c91adbf808dbad9bdd2057d9df55a62b711f Mon Sep 17 00:00:00 2001
From: Srinivasa T N <[email protected]>
Date: Wed, 27 Jun 2012 11:20:13 +0530
Subject: [PATCH 1/2] Fixed BOOTIF for converting mac addr to lowercase

---
 modules.d/40network/net-genrules.sh |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
modules.d/40network/net-genrules.sh +2 -1
index 99d0fe5..b2f4fbf 100755
@@ -10,7 +10,8 @@ fix_bootif() {
     macaddr=${macaddr%:}
     # strip hardware type field from pxelinux
     [ -n "${macaddr%??:??:??:??:??:??}" ] && macaddr=${macaddr#??:}
-    echo $macaddr
+    # return macaddr with lowercase alpha characters expected by udev
+    echo $macaddr | sed 'y/ABCDEF/abcdef/'
 }
 
 # Don't continue if we don't need network
Signature · 12 lines
1.7.4.4


From 675f6055c742a7aa2c92420cd73d9299eb2d8166 Mon Sep 17 00:00:00 2001
From: Srinivasa T N <[email protected]>
Date: Wed, 27 Jun 2012 16:59:27 +0530
Subject: [PATCH 2/2] Convert the MAC in interface name to use sed instead of
 tr

---
 modules.d/40network/parse-ifname.sh |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
modules.d/40network/parse-ifname.sh +1 -2
index 26e6084..863fd2f 100755
@@ -5,7 +5,6 @@
 # Format:
 #       ifname=<interface>:<mac>
 #
-# Note letters in the macaddress must be lowercase!
 #
 # Examples:
 # ifname=eth0:4a:3f:4c:04:f8:d7
@@ -26,7 +25,7 @@ parse_ifname_opts() {
         7)
             ifname_if=$1
             # udev requires MAC addresses to be lower case
-            ifname_mac=`echo $2:$3:$4:$5:$6:$7 | tr '[:upper:]' '[:lower:]'`
+            ifname_mac=`echo $2:$3:$4:$5:$6:$7 | sed 'y/ABCDEF/abcdef'`
             ;;
         *)
             die "Invalid arguments for ifname="
Signature · 1 line
1.7.4.4