summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/command-line.txt15
-rw-r--r--loader2/loader.c4
-rw-r--r--loader2/loader.h2
-rw-r--r--loader2/net.c19
4 files changed, 32 insertions, 8 deletions
diff --git a/docs/command-line.txt b/docs/command-line.txt
index 7b70c0151..14ad2b8d2 100644
--- a/docs/command-line.txt
+++ b/docs/command-line.txt
@@ -81,8 +81,19 @@ nopass Don't pass keyboard/mouse info to stage 2 installer, good for
serial Turns on serial console support.
-ksdevice Takes an argument like 'eth0', tells install what network
- device to use for kickstart from network.
+ksdevice Takes one of 4 types of argument which tells install
+ what network device to use for kickstart from network:
+
+ - An argument like 'eth0' naming a specific interface
+ - An argument like 00:12:34:56:78:9a indicating the
+ MAC address of a specific interface
+ - The keyword `link' indicating that the first
+ interface with link up
+ - The keyword `bootif' indicating that the MAC address
+ indicated by the BOOTIF command line option will be
+ used to locate the boot interface. BOOTIF is
+ automagically supplied by pxelinux when you include
+ the option `IPAPPEND 2' in your pxelinux.cfg file
ks Kickstart over NFS.
diff --git a/loader2/loader.c b/loader2/loader.c
index 2340917ac..220443659 100644
--- a/loader2/loader.c
+++ b/loader2/loader.c
@@ -596,6 +596,10 @@ static int parseCmdLineFlags(int flags, struct loaderData_s * loaderData,
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;
diff --git a/loader2/loader.h b/loader2/loader.h
index b062458a9..d6cf1a77c 100644
--- a/loader2/loader.h
+++ b/loader2/loader.h
@@ -90,6 +90,8 @@ struct loaderData_s {
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;
diff --git a/loader2/net.c b/loader2/net.c
index a9e48bd23..907d98b9b 100644
--- a/loader2/net.c
+++ b/loader2/net.c
@@ -977,6 +977,7 @@ int chooseNetworkInterface(struct loaderData_s * loaderData,
char ** deviceNames;
int foundDev = 0;
struct device ** devs;
+ char * ksMacAddr = NULL;
devs = probeDevices(CLASS_NETWORK, BUS_UNSPEC, PROBE_LOADED);
if (!devs) {
@@ -988,6 +989,14 @@ int chooseNetworkInterface(struct loaderData_s * loaderData,
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;
@@ -1009,13 +1018,11 @@ int chooseNetworkInterface(struct loaderData_s * loaderData,
if (loaderData->netDev && (loaderData->netDev_set == 1)) {
if (!strcmp(loaderData->netDev, devs[i]->device)) {
foundDev = 1;
- } else {
+ } else if (ksMacAddr != NULL) {
/* maybe it's a mac address */
- char * mac1, * mac2;
- mac1 = sanitizeMacAddr(loaderData->netDev);
- mac2 = sanitizeMacAddr(getMacAddr(devs[i]->device));
- if ((mac1 != NULL) && (mac2 != NULL) &&
- !strcmp(mac1, mac2)) {
+ char * devmacaddr;
+ devmacaddr = sanitizeMacAddr(getMacAddr(devs[i]->device));
+ if ((devmacaddr != NULL) && !strcmp(ksMacAddr, devmacaddr)) {
foundDev = 1;
free(loaderData->netDev);
loaderData->netDev = devs[i]->device;