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

Support for setting ksdevice to the interface used for PXE



I've been trying to sort out our kickstart infrastructure and hit one
box I just could get to co-operate without external intervention - it
has three NICs, the onboard ones start at eth1 (which is the one I
need it to use), but eth2 also has a link (which is why ksdevice=link
didn't help).

So instead I implemented `ksdevice=bootif' which when used with
`IPAPPEND 2' in your pxelinux.cfg pulls the BOOTIF variable off the
command line and uses the mac PXE booted the machine from as the
interface for ksdevice (which exactly matches the behaviour I want).

Not sure if you prefer such things in bugzilla or mail.

-- 
Alex Kiernan
diff -ur anaconda-10.2.1.5.orig/loader2/loader.c anaconda-10.2.1.5/loader2/loader.c
--- anaconda-10.2.1.5.orig/loader2/loader.c	2005-05-05 18:43:38.000000000 +0100
+++ anaconda-10.2.1.5/loader2/loader.c	2005-08-12 08:54:02.000000000 +0100
@@ -576,6 +576,10 @@
         else if (!strncasecmp(argv[i], "ksdevice=", 9)) {
             loaderData->netDev = strdup(argv[i] + 9);
             loaderData->netDev_set = 1;
+	} else if (!strncmp(argv[i], "BOOTIF=", 7)) {
+	    /* +10 so that we skip over the leading 01- */
+            loaderData->bootIf = strdup(argv[i] + 10);
+            loaderData->bootIf_set = 1;
         } else if (!strncasecmp(argv[i], "dhcpclass=", 10)) {
             loaderData->netCls = strdup(argv[i] + 10);
             loaderData->netCls_set = 1;
Only in anaconda-10.2.1.5/loader2: loader.c~
diff -ur anaconda-10.2.1.5.orig/loader2/loader.h anaconda-10.2.1.5/loader2/loader.h
--- anaconda-10.2.1.5.orig/loader2/loader.h	2005-05-19 19:52:30.000000000 +0100
+++ anaconda-10.2.1.5/loader2/loader.h	2005-08-12 08:54:15.000000000 +0100
@@ -90,6 +90,8 @@
     int kbd_set;
     char * netDev;
     int netDev_set;
+    char * bootIf;
+    int bootIf_set;
     char * netCls;
     int netCls_set;
     char * ip, *netmask, *gateway, *dns, *hostname, *peerid, *ethtool, *subchannels, *portname, *essid, *wepkey, *nettype, *ctcprot;
Only in anaconda-10.2.1.5/loader2: loader.h~
diff -ur anaconda-10.2.1.5.orig/loader2/net.c anaconda-10.2.1.5/loader2/net.c
--- anaconda-10.2.1.5.orig/loader2/net.c	2005-05-23 16:09:55.000000000 +0100
+++ anaconda-10.2.1.5/loader2/net.c	2005-08-12 08:55:03.000000000 +0100
@@ -971,6 +971,7 @@
     char ** deviceNames;
     int foundDev = 0;
     struct device ** devs;
+    char * ksMacAddr = NULL;
 
     devs = probeDevices(CLASS_NETWORK, BUS_UNSPEC, PROBE_LOADED);
     if (!devs) {
@@ -982,6 +983,14 @@
 
     devices = alloca((i + 1) * sizeof(*devices));
     deviceNames = alloca((i + 1) * sizeof(*devices));
+    if (loaderData->netDev && (loaderData->netDev_set) == 1) {
+      if ((loaderData->bootIf && (loaderData->bootIf_set) == 1) &&
+	  !strcasecmp(loaderData->netDev, "bootif"))
+	    ksMacAddr = sanitizeMacAddr(loaderData->bootIf);
+	else
+	    ksMacAddr = sanitizeMacAddr(loaderData->netDev);
+    }
+
     for (i = 0; devs[i]; i++) {
         if (!devs[i]->device)
 	    continue;
@@ -1005,11 +1014,10 @@
                 foundDev = 1;
             } else {
                 /* maybe it's a mac address */
-                char * mac1, * mac2;
-                mac1 = sanitizeMacAddr(loaderData->netDev);
+                char * mac2;
                 mac2 = sanitizeMacAddr(getMacAddr(devs[i]->device));
-                if ((mac1 != NULL) && (mac2 != NULL) &&
-                    !strcmp(mac1, mac2)) {
+                if ((ksMacAddr != NULL) && (mac2 != NULL) &&
+                    !strcmp(ksMacAddr, mac2)) {
                     foundDev = 1;
                     free(loaderData->netDev);
                     loaderData->netDev = devs[i]->device;
Only in anaconda-10.2.1.5/loader2: net.c~




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