summaryrefslogtreecommitdiffstats
path: root/loader2
diff options
context:
space:
mode:
authorChris Lumens <clumens@redhat.com>2008-01-29 13:34:05 -0500
committerChris Lumens <clumens@redhat.com>2008-01-30 11:37:47 -0500
commitb4ac8dda462c09e38799645e8eead41ce8c1b093 (patch)
tree841c07881a4f932737e6b0f6bc0bd86ea9c4be42 /loader2
parent70a6f160ce65ea2af4c69215f83524071b27e42d (diff)
downloadanaconda-b4ac8dda462c09e38799645e8eead41ce8c1b093.tar.gz
anaconda-b4ac8dda462c09e38799645e8eead41ce8c1b093.tar.xz
anaconda-b4ac8dda462c09e38799645e8eead41ce8c1b093.zip
Initial support for network --bootproto=query (#401531).
This patch adds support for a new network bootproto. The point of this is to work around our basic assumption that no network line in the kickstart file means you get dhcp. Some environments may want the assumption that no network line means you get prompted for network configuration. That's what this patch adds.
Diffstat (limited to 'loader2')
-rw-r--r--loader2/loader.c11
-rw-r--r--loader2/net.c28
-rw-r--r--loader2/net.h4
3 files changed, 28 insertions, 15 deletions
diff --git a/loader2/loader.c b/loader2/loader.c
index 9ad654872..2b20ac774 100644
--- a/loader2/loader.c
+++ b/loader2/loader.c
@@ -1149,7 +1149,9 @@ static char *doLoaderMain(char * location,
strcpy(netDev.dev.device, devName);
/* fall through to ip config */
- case STEP_IP:
+ case STEP_IP: {
+ int query = !strncmp(loaderData->ip, "query", 5);
+
if (!needsNetwork) {
step = STEP_METHOD; /* only hit going back */
break;
@@ -1157,12 +1159,12 @@ static char *doLoaderMain(char * location,
logMessage(INFO, "going to do getNetConfig");
- if (FL_NOIPV4(flags) || (!FL_IP_PARAM(flags) && !FL_KICKSTART(flags)))
+ if (query || FL_NOIPV4(flags) || (!FL_IP_PARAM(flags) && !FL_KICKSTART(flags)))
loaderData->ipinfo_set = 0;
else
loaderData->ipinfo_set = 1;
- if (FL_NOIPV6(flags) || (!FL_IPV6_PARAM(flags) && !FL_KICKSTART(flags)))
+ if (query || FL_NOIPV6(flags) || (!FL_IPV6_PARAM(flags) && !FL_KICKSTART(flags)))
loaderData->ipv6info_set = 0;
else
loaderData->ipv6info_set = 1;
@@ -1173,7 +1175,7 @@ static char *doLoaderMain(char * location,
}
setupNetworkDeviceConfig(&netDev, loaderData);
- rc = readNetConfig(devName, &netDev, loaderData->netCls, methodNum);
+ rc = readNetConfig(devName, &netDev, loaderData->netCls, methodNum, query);
if ((rc == LOADER_NOOP) && (netDev.preset == 0)) {
loaderData->ipinfo_set = 0;
loaderData->ipv6info_set = 0;
@@ -1189,6 +1191,7 @@ static char *doLoaderMain(char * location,
writeNetInfo("/tmp/netinfo", &netDev);
step = STEP_URL;
dir = 1;
+ }
case STEP_URL:
logMessage(INFO, "starting to STEP_URL");
diff --git a/loader2/net.c b/loader2/net.c
index 12e96be64..eae93c3cd 100644
--- a/loader2/net.c
+++ b/loader2/net.c
@@ -546,7 +546,7 @@ void setupNetworkDeviceConfig(struct networkDeviceConfig * cfg,
}
int readNetConfig(char * device, struct networkDeviceConfig * cfg,
- char * dhcpclass, int methodNum) {
+ char * dhcpclass, int methodNum, int query) {
struct networkDeviceConfig newCfg;
int ret;
int i = 0;
@@ -620,7 +620,7 @@ int readNetConfig(char * device, struct networkDeviceConfig * cfg,
/* dhcp/manual network configuration loop */
i = 1;
while (i == 1) {
- ret = configureTCPIP(device, cfg, &newCfg, &opts, methodNum);
+ ret = configureTCPIP(device, cfg, &newCfg, &opts, methodNum, query);
if (ret == LOADER_NOOP) {
/* dhcp selected, proceed */
@@ -710,7 +710,8 @@ int readNetConfig(char * device, struct networkDeviceConfig * cfg,
int configureTCPIP(char * device, struct networkDeviceConfig * cfg,
struct networkDeviceConfig * newCfg,
- struct netconfopts * opts, int methodNum) {
+ struct netconfopts * opts, int methodNum,
+ int query) {
int i = 0, z = 0, skipForm = 0;
char *dret = NULL;
newtComponent f, okay, back, answer;
@@ -796,13 +797,14 @@ int configureTCPIP(char * device, struct networkDeviceConfig * cfg,
* noipv4 noipv6
* ip=<val> noipv6
* ipv6=<val> noipv4
- * we also skip this form for anyone doing a kickstart install
+ * we also skip this form for anyone doing a kickstart install,
+ * but only if they also didn't specify --bootproto=query
*/
if ((FL_IP_PARAM(flags) && FL_IPV6_PARAM(flags)) ||
(FL_IP_PARAM(flags) && FL_NOIPV6(flags)) ||
(FL_IPV6_PARAM(flags) && FL_NOIPV4(flags)) ||
(FL_NOIPV4(flags) && FL_NOIPV6(flags)) ||
- (FL_IS_KICKSTART(flags))) {
+ (FL_IS_KICKSTART(flags) && !query)) {
skipForm = 1;
}
@@ -1627,7 +1629,10 @@ void setKickstartNetwork(struct loaderData_s * loaderData, int argc,
/* if they've specified dhcp/bootp or haven't specified anything,
* use dhcp for the interface */
- if ((bootProto && (!strncmp(bootProto, "dhcp", 4) ||
+ if (bootProto && !strncmp(bootProto, "query", 3)) {
+ loaderData->ip = strdup("query");
+ loaderData->ipinfo_set = 0;
+ } else if ((bootProto && (!strncmp(bootProto, "dhcp", 4) ||
!strncmp(bootProto, "bootp", 4))) ||
(!bootProto && !loaderData->ip)) {
loaderData->ip = strdup("dhcp");
@@ -1839,7 +1844,7 @@ int chooseNetworkInterface(struct loaderData_s * loaderData) {
* the network */
int kickstartNetworkUp(struct loaderData_s * loaderData,
struct networkDeviceConfig *netCfgPtr) {
- int rc;
+ int rc, query;
/* we may have networking already, so return to the caller */
if ((loaderData->ipinfo_set == 1) || (loaderData->ipv6info_set == 1)) {
@@ -1881,12 +1886,17 @@ int kickstartNetworkUp(struct loaderData_s * loaderData,
if (!loaderData->ip) {
loaderData->ip = strdup("dhcp");
}
- loaderData->ipinfo_set = 1;
+
+ query = !strncmp(loaderData->ip, "query", 5);
+
+ if (!query) {
+ loaderData->ipinfo_set = 1;
+ }
setupNetworkDeviceConfig(netCfgPtr, loaderData);
rc = readNetConfig(loaderData->netDev, netCfgPtr, loaderData->netCls,
- loaderData->method);
+ loaderData->method, query);
if (rc == LOADER_ERROR) {
logMessage(ERROR, "unable to setup networking");
diff --git a/loader2/net.h b/loader2/net.h
index 149b23cc8..b625fd1fb 100644
--- a/loader2/net.h
+++ b/loader2/net.h
@@ -56,10 +56,10 @@ struct netconfopts {
typedef int int32;
int readNetConfig(char * device, struct networkDeviceConfig * dev,
- char * dhcpclass, int methodNum);
+ char * dhcpclass, int methodNum, int query);
int configureTCPIP(char * device, struct networkDeviceConfig * cfg,
struct networkDeviceConfig * newCfg,
- struct netconfopts * opts, int methodNum);
+ struct netconfopts * opts, int methodNum, int query);
int manualNetConfig(char * device, struct networkDeviceConfig * cfg,
struct networkDeviceConfig * newCfg,
struct intfconfig_s * ipcomps, struct netconfopts * opts);