[syslinux] [PATCH] MAC Address Ranges

Jason Hiatt jason.hiatt at gmail.com
Sat Mar 26 20:32:59 PDT 2011


Hi all,

I'm new here so bear with me.  I am working on a project at work where
we are replacing 1000+ Dell servers.
When a new Dell server is delivered to one of our remote offices it
will PXE boot off of the existing Dell server and install openSuse and
then configure itself.
We also PXE boot windows PCs in the remote offices so we needed a way
to assign a large range of MAC addresses to a specific config file.
We have the MAC address ranges for all of the Dell servers that will
be installed in the remote offices; so, now we can distribute a file
called 01-BC-05-CD to all of the existing servers and be confident
that the new servers will load the PXE config file that it's supposed
to.

The path below will take the client's MAC address and walk through
(almost) all of the MAC address ranges.

--- syslinux-4.03/core/fs/pxe/pxe.c.orig        2011-03-26
22:33:37.067359656 -0400
+++ syslinux-4.03/core/fs/pxe/pxe.c     2011-03-26 22:40:18.470771416 -0400
@@ -1079,6 +1079,8 @@ static int pxe_load_config(void)
     char *config_file;
     char *last;
     int tries = 8;
+    int mac_tries = 16;
+    char *last_mac;

     get_prefix();
     if (DHCPMagic & 0x02) {
@@ -1101,8 +1103,16 @@ static int pxe_load_config(void)

     /* Try loading by MAC address */
     strcpy(config_file, MAC_str);
-    if (try_load(ConfigName))
-        return 0;
+    last_mac = &config_file[20];
+
+    while (mac_tries) {
+        *last_mac = '\0';
+        if (try_load(ConfigName)) {
+                return 0;
+        }
+        last_mac--;
+        mac_tries--;
+    }

     /* Nope, try hexadecimal IP prefixes... */
     uchexbytes(config_file, (uint8_t *)&IPInfo.myip, 4);


Thanks,
Hiatt




More information about the Syslinux mailing list