summaryrefslogtreecommitdiffstats
path: root/loader2
diff options
context:
space:
mode:
authorJeremy Katz <katzj@redhat.com>2005-08-17 15:06:40 +0000
committerJeremy Katz <katzj@redhat.com>2005-08-17 15:06:40 +0000
commit9e6599179969a4588c8f5e4107270e0c155f1753 (patch)
treeada3e9970dc926509ce368de5d9e4393b9669846 /loader2
parent36cb88ae10fec0f6fb79440e4fa80d69e2838fd0 (diff)
downloadanaconda-9e6599179969a4588c8f5e4107270e0c155f1753.tar.gz
anaconda-9e6599179969a4588c8f5e4107270e0c155f1753.tar.xz
anaconda-9e6599179969a4588c8f5e4107270e0c155f1753.zip
2005-08-17 Jeremy Katz <katzj@redhat.com>
* loader2/net.c: Add support for ksdevice=bootif with patch from Alex Kiernan (alex.kiernan@gmail.com). This plus "IPAPPEND 2" in your pxelinux config will set your install device to the one you pxebooted from. (#166135) * loader2/loader.h: Likewise. * loader2/loader.c: Likewise. * docs/command-line.txt: Document it!
Diffstat (limited to 'loader2')
-rw-r--r--loader2/loader.c4
-rw-r--r--loader2/loader.h2
-rw-r--r--loader2/net.c19
3 files changed, 19 insertions, 6 deletions
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;