[PATCH] Handle PXE's "BOOTIF=" format for MAC addresses in netname command (#474422)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



PXE passes in the MAC address of the boot interface in the format
"BOOTIF=01-c0-ff-ee-c0-ff-ee".  So translate that format to plain old
"c0:ff:ee:c0:ff:ee" up front, so you can use "netname $BOOTIF eth0".
---
 nash/network.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/nash/network.c b/nash/network.c
index 84398df..47c75a6 100644
--- a/nash/network.c
+++ b/nash/network.c
@@ -817,6 +817,18 @@ renameNetworkInterface(char *hwaddr, char *ifname)
 
     int collision = 0;
     char *oldname;
+    
+    /* if we're called like "netname $BOOTIF eth0", that'll expand to
+     * "01-c0-ff-ee-c0-ff-ee" .  We don't want the leading "01-", and
+     * we want colons not dashes. */
+    if (strlen(hwaddr) == 20 && !strncmp(hwaddr, "01-", 3)) {
+        char *macsep;
+        hwaddr += 3;
+
+        macsep = hwaddr;
+        while ((macsep = strchr(macsep, '-')))
+            *macsep = ':';
+    }
 
     if (get_ifinfo(&ifinfo) >= 0) {
         for (ifentry = ifinfo; ifentry; ifentry = ifentry->next) {
-- 
1.6.0.1

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux