summaryrefslogtreecommitdiffstats
path: root/loader2
diff options
context:
space:
mode:
authorDavid Cantrell <dcantrell@redhat.com>2006-07-25 21:44:46 +0000
committerDavid Cantrell <dcantrell@redhat.com>2006-07-25 21:44:46 +0000
commit4bb6482a1718080a531463a28e6a42d39ad198de (patch)
tree2f520c8545748887d344416dd40d878c7c120136 /loader2
parente333a45fd8b922b8499e36eda18bfa542db9092e (diff)
downloadanaconda-4bb6482a1718080a531463a28e6a42d39ad198de.tar.gz
anaconda-4bb6482a1718080a531463a28e6a42d39ad198de.tar.xz
anaconda-4bb6482a1718080a531463a28e6a42d39ad198de.zip
* loader2/net.c: Bump inet_pton() buffers to length 48.
Let users skip entering a DNS server in getDnsServers(), but still require a valid one if they enter anything. * loader2/urls.c (addrToIp): Update to support IPv6.
Diffstat (limited to 'loader2')
-rw-r--r--loader2/net.c25
-rw-r--r--loader2/urls.c20
2 files changed, 23 insertions, 22 deletions
diff --git a/loader2/net.c b/loader2/net.c
index 47f30a480..df0f39cee 100644
--- a/loader2/net.c
+++ b/loader2/net.c
@@ -285,7 +285,8 @@ static int getDnsServers(struct networkDeviceConfig * cfg) {
rc = 0;
if (!ns || !*ns) {
- rc = 2;
+ cfg->dev.numDns = 0;
+ break;
} else {
if (inet_pton(AF_INET, ns, &addr) >= 1)
cfg->dev.dnsServers[0] = ip_addr_in(&addr);
@@ -294,14 +295,16 @@ static int getDnsServers(struct networkDeviceConfig * cfg) {
else
rc = 2;
}
- if (rc)
+
+ if (rc) {
newtWinMessage(_("Invalid IP Information"), _("Retry"),
- _("You entered an invalid IP address."));
+ _("You entered an invalid IP address."));
+ } else {
+ cfg->dev.set |= PUMP_NETINFO_HAS_DNS;
+ cfg->dev.numDns = 1;
+ }
} while (rc == 2);
- cfg->dev.set |= PUMP_NETINFO_HAS_DNS;
- cfg->dev.numDns = 1;
-
return LOADER_OK;
}
@@ -433,7 +436,7 @@ void setupNetworkDeviceConfig(struct networkDeviceConfig * cfg,
if (loaderData->dns) {
char * buf;
- char ret[47];
+ char ret[48];
buf = strdup(loaderData->dns);
/* Scan the dns parameter for multiple comma-separated IP addresses */
@@ -802,7 +805,7 @@ int manualNetConfig(char * device, struct networkDeviceConfig * cfg,
int ipv4Choice, int ipv6Choice) {
int ifour, isix, rows, pos, primary, prefix, cidr;
char buf[4];
- char ret[47];
+ char ret[48];
ip_addr_t *tip;
struct in_addr addr;
struct in6_addr addr6;
@@ -1228,7 +1231,7 @@ int writeNetInfo(const char * fn, struct networkDeviceConfig * dev) {
FILE * f;
int i;
struct device ** devices;
- char ret[47];
+ char ret[48];
ip_addr_t *tip;
devices = probeDevices(CLASS_NETWORK, BUS_UNSPEC, PROBE_LOADED);
@@ -1301,7 +1304,7 @@ int writeResolvConf(struct networkDeviceConfig * net) {
char * filename = "/etc/resolv.conf";
FILE * f;
int i;
- char ret[47];
+ char ret[48];
ip_addr_t *tip;
#if defined(__s390__) || defined(__s390x__)
return 0;
@@ -1334,7 +1337,7 @@ int writeResolvConf(struct networkDeviceConfig * net) {
int findHostAndDomain(struct networkDeviceConfig * dev) {
char * name, * chptr;
- char ret[47];
+ char ret[48];
ip_addr_t *tip;
if (!FL_TESTING(flags)) {
diff --git a/loader2/urls.c b/loader2/urls.c
index 31b2f3f28..ca5b019af 100644
--- a/loader2/urls.c
+++ b/loader2/urls.c
@@ -224,23 +224,21 @@ int urlinstFinishTransfer(struct iurlinfo * ui, int fd) {
char * addrToIp(char * hostname) {
struct in_addr ad;
- char * chptr;
+ struct in6_addr ad6;
char *ret;
- for (chptr = hostname; *chptr; chptr++)
- if (!(isdigit(*chptr) || *chptr == '.')) break;
-
- if (!*chptr)
- return hostname;
-
if (mygethostbyname(hostname, &ad))
- return NULL;
+ return hostname;
if ((ret = malloc(48)) == NULL)
- return NULL;
+ return hostname;
- inet_ntop(AF_INET, &ad, ret, INET_ADDRSTRLEN);
- return ret;
+ if (inet_ntop(AF_INET, &ad, ret, INET_ADDRSTRLEN) != NULL)
+ return ret;
+ else if (inet_ntop(AF_INET, &ad6, ret, INET6_ADDRSTRLEN) != NULL)
+ return ret;
+ else
+ return NULL;
}
int urlMainSetupPanel(struct iurlinfo * ui, urlprotocol protocol,