diff options
author | Chris Lumens <clumens@redhat.com> | 2008-01-29 13:34:05 -0500 |
---|---|---|
committer | Chris Lumens <clumens@redhat.com> | 2008-01-30 11:37:47 -0500 |
commit | b4ac8dda462c09e38799645e8eead41ce8c1b093 (patch) | |
tree | 841c07881a4f932737e6b0f6bc0bd86ea9c4be42 | |
parent | 70a6f160ce65ea2af4c69215f83524071b27e42d (diff) | |
download | anaconda-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.
-rw-r--r-- | iw/network_gui.py | 8 | ||||
-rw-r--r-- | kickstart.py | 6 | ||||
-rw-r--r-- | loader2/loader.c | 11 | ||||
-rw-r--r-- | loader2/net.c | 28 | ||||
-rw-r--r-- | loader2/net.h | 4 | ||||
-rw-r--r-- | textw/network_text.py | 8 |
6 files changed, 41 insertions, 24 deletions
diff --git a/iw/network_gui.py b/iw/network_gui.py index 7dc39207c..1aaeff372 100644 --- a/iw/network_gui.py +++ b/iw/network_gui.py @@ -293,7 +293,7 @@ class NetworkWindow(InstallWindow): if device.get('ipaddr').lower() == 'dhcp': ip = 'DHCP' - elif device.get('bootproto').lower() == 'dhcp': + elif device.get('bootproto').lower() in ['query', 'dhcp']: ip = 'DHCP' else: prefix = str(isys.netmask2prefix(device.get('netmask'))) @@ -309,7 +309,7 @@ class NetworkWindow(InstallWindow): addr = device.get('ipv6addr').lower() pfx = device.get('ipv6prefix').lower() - if auto == 'yes' or addr == '': + if auto == 'yes' or addr == '' or addr == 'query': ip = 'Auto' elif addr == 'dhcp': ip = 'DHCPv6' @@ -334,7 +334,7 @@ class NetworkWindow(InstallWindow): for device in self.devices.keys(): bootproto = self.devices[device].get("bootproto") - if bootproto and bootproto.lower() == 'dhcp': + if bootproto and bootproto.lower() in ['query', 'dhcp']: onboot = self.devices[device].get("ONBOOT") if onboot != "no": return 1 @@ -376,7 +376,7 @@ class NetworkWindow(InstallWindow): active = False bootproto = self.devices[device].get("bootproto") - if not bootproto: + if not bootproto or bootproto == 'query': bootproto = 'dhcp' self.devices[device].set(("bootproto", bootproto)) diff --git a/kickstart.py b/kickstart.py index f730a24ae..3c188539f 100644 --- a/kickstart.py +++ b/kickstart.py @@ -876,7 +876,11 @@ class Kickstart(cobject): dispatch.skipStep("betanag") dispatch.skipStep("installtype") dispatch.skipStep("tasksel") - dispatch.skipStep("network") + + # Only skip the network screen if there are no devices that used + # network --bootproto=query. + if len(filter(lambda nd: nd.bootProto == "query", self.ksdata.network)) == 0: + dispatch.skipStep("network") # Don't show confirmation screens on non-interactive installs. if not self.ksdata.interactive: 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); diff --git a/textw/network_text.py b/textw/network_text.py index 6e4a1ffd9..d1928bb37 100644 --- a/textw/network_text.py +++ b/textw/network_text.py @@ -265,7 +265,7 @@ class NetworkDeviceWindow: maingrid = Grid(1, 3) dhcpCb = radio.add(_("Dynamic IP configuration (DHCP)"), - "dhcp", (bootproto == "dhcp")) + "dhcp", (bootproto in ["query", "dhcp"])) maingrid.setField(dhcpCb, 0, 0, growx = 1, anchorLeft = 1) manualCb = radio.add(_("Manual address configuration"), "static", (bootproto == "static")) @@ -393,7 +393,7 @@ class NetworkDeviceWindow: maingrid = Grid(1, 4) autoCb = radio.add(_('Automatic neighbor discovery'), 'auto', - (ipv6autoconf == 'yes')) + (ipv6autoconf in ['query', 'yes'])) maingrid.setField(autoCb, 0, 0, growx = 1, anchorLeft = 1) dhcpCb = radio.add(_('Dynamic IP configuration (DHCPv6)'), 'dhcp', (ipv6addr is not None and ipv6addr == 'dhcp')) @@ -651,12 +651,12 @@ class NetworkDeviceWindow: else: onboot = _("Inactive on boot") - if dev.get('bootproto').lower() == 'dhcp': + if dev.get('bootproto').lower() in ['query', 'dhcp']: ipv4 = _("DHCP") else: ipv4 = dev.get('ipaddr') - if bool(dev.get('ipv6_autoconf')): + if bool(dev.get('ipv6_autoconf')) or dev.get('ipv6addr').lower() == 'query': ipv6 = _("Auto IPv6") elif dev.get('ipv6addr').lower() == 'dhcp': ipv6 = _("DHCPv6") |