diff options
author | Jeremy Katz <katzj@redhat.com> | 2003-02-17 20:48:48 +0000 |
---|---|---|
committer | Jeremy Katz <katzj@redhat.com> | 2003-02-17 20:48:48 +0000 |
commit | d48401b2c7ede21cd11dd522b1508f6800462a14 (patch) | |
tree | 36f2b17add31c4f16e063a327e736e00e710e8b7 /loader2 | |
parent | e64fe95f7d1f7fdc2bb81279e4c45fdba8f242a0 (diff) | |
download | anaconda-d48401b2c7ede21cd11dd522b1508f6800462a14.tar.gz anaconda-d48401b2c7ede21cd11dd522b1508f6800462a14.tar.xz anaconda-d48401b2c7ede21cd11dd522b1508f6800462a14.zip |
handle specifying multiple dns servers either via command line or kickstart
(mostly patch from mattdm@mattdm.org, #84409)
Diffstat (limited to 'loader2')
-rw-r--r-- | loader2/net.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/loader2/net.c b/loader2/net.c index 0a1152337..3aa0a0081 100644 --- a/loader2/net.c +++ b/loader2/net.c @@ -202,6 +202,7 @@ void setupNetworkDeviceConfig(struct networkDeviceConfig * cfg, struct loaderData_s * loaderData, int flags) { struct in_addr addr; + char * c; /* set to 1 to get ks network struct logged */ #if 0 @@ -254,10 +255,22 @@ void setupNetworkDeviceConfig(struct networkDeviceConfig * cfg, cfg->dev.set |= PUMP_NETINFO_HAS_GATEWAY; } - if (loaderData->dns && (inet_aton(loaderData->dns, &addr))) { - cfg->dev.dnsServers[0] = addr; - cfg->dev.numDns = 1; - cfg->dev.set |= PUMP_NETINFO_HAS_DNS; + if (loaderData->dns) { + char * buf; + buf = strdup(loaderData->dns); + + /* Scan the dns parameter for multiple comma-separated IP addresses */ + c = strtok(buf, ","); + while ((cfg->dev.numDns < MAX_DNS_SERVERS) && (c != NULL) && + (inet_aton(c,&addr))) { + cfg->dev.dnsServers[cfg->dev.numDns] = addr; + cfg->dev.numDns++; + logMessage("adding %s", inet_ntoa(addr)); + c = strtok(NULL, ","); + } + logMessage("dnsservers is %s", loaderData->dns); + if (cfg->dev.numDns) + cfg->dev.set |= PUMP_NETINFO_HAS_DNS; } if (loaderData->hostname) { @@ -478,6 +491,12 @@ int readNetConfig(char * device, struct networkDeviceConfig * cfg, int flags) { } #endif /* s390 */ + /* preserve extra dns servers for the sake of being nice */ + for (i = newCfg.dev.numDns; i < cfg->dev.numDns; i++) { + newCfg.dev.dnsServers[i] = cfg->dev.dnsServers[i]; + } + newCfg.dev.numDns = cfg->dev.numDns; + cfg->isDynamic = newCfg.isDynamic; memcpy(&cfg->dev,&newCfg.dev,sizeof(newCfg.dev)); |