summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Cantrell <dcantrell@redhat.com>2007-03-23 17:53:02 +0000
committerDavid Cantrell <dcantrell@redhat.com>2007-03-23 17:53:02 +0000
commit21f897e806bb516c8244b61b3bf3c361ed58cacb (patch)
tree6d577a20393d16fc5e021879929990dedb6931bb
parenta6ccde9a50ead82814740e175e7d5b2b6f94bd69 (diff)
downloadanaconda-21f897e806bb516c8244b61b3bf3c361ed58cacb.tar.gz
anaconda-21f897e806bb516c8244b61b3bf3c361ed58cacb.tar.xz
anaconda-21f897e806bb516c8244b61b3bf3c361ed58cacb.zip
* loader2/loader.h: Change 'ip' structure member to 'ipv4'.
* loader2/loader.c (readNetInfo, parseCmdLineIp, doLoaderMain): Where the 'ip' structure member was referenced in loaderData, change it to 'ipv4'. * loader2/net.c: Likewise. * loader2/loader.c (doLoaderMain): In STEP_IP, handle inet_ntop() return values more gracefully when setting loaderData fields after readNetConfig() has been called. * anaconda.spec: Require libdhcp-devel >= 1.24 to handle dual-stack manual IP configuration correctly (#232690).
-rw-r--r--ChangeLog15
-rw-r--r--anaconda.spec2
-rw-r--r--loader2/loader.c39
-rw-r--r--loader2/loader.h2
-rw-r--r--loader2/net.c25
5 files changed, 54 insertions, 29 deletions
diff --git a/ChangeLog b/ChangeLog
index 00f0681a5..76bd6fea7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2007-03-23 David Cantrell <dcantrell@redhat.com>
+
+ * loader2/loader.h: Change 'ip' structure member to 'ipv4'.
+ * loader2/loader.c (readNetInfo, parseCmdLineIp, doLoaderMain): Where
+ the 'ip' structure member was referenced in loaderData, change it to
+ 'ipv4'.
+ * loader2/net.c: Likewise.
+
+ * loader2/loader.c (doLoaderMain): In STEP_IP, handle inet_ntop()
+ return values more gracefully when setting loaderData fields after
+ readNetConfig() has been called.
+
+ * anaconda.spec: Require libdhcp-devel >= 1.24 to handle dual-stack
+ manual IP configuration correctly (#232690).
+
2007-03-23 Jeremy Katz <katzj@redhat.com>
* anaconda (getInstClass): Don't duplicate code (Elliot Peele)
diff --git a/anaconda.spec b/anaconda.spec
index af5202191..aaeb9573a 100644
--- a/anaconda.spec
+++ b/anaconda.spec
@@ -21,7 +21,7 @@ BuildRequires: pango-devel, pirut, libXt-devel
BuildRequires: slang-devel >= 2.0.6-2, slang-static
BuildRequires: newt-devel, newt-static
BuildRequires: glib2-devel >= 2.11.1-5, glib2-static
-BuildRequires: libdhcp-devel >= 1.19, mkinitrd-devel >= 5.1.2-1
+BuildRequires: libdhcp-devel >= 1.24, mkinitrd-devel >= 5.1.2-1
BuildRequires: audit-libs-devel
%ifarch %livearches
BuildRequires: desktop-file-utils
diff --git a/loader2/loader.c b/loader2/loader.c
index 343486b03..220795e8a 100644
--- a/loader2/loader.c
+++ b/loader2/loader.c
@@ -464,7 +464,7 @@ static void readNetInfo(struct loaderData_s ** ld) {
continue;
if (!strncmp(vname, "IPADDR", 6)) {
- loaderData->ip = strdup(vparm);
+ loaderData->ipv4 = strdup(vparm);
loaderData->ipinfo_set = 1;
}
@@ -513,7 +513,7 @@ static void parseCmdLineIp(struct loaderData_s * loaderData, char *argv)
/* IP */
start = argv + 3;
end = strstr(start, ":");
- loaderData->ip = strndup(start, end-start);
+ loaderData->ipv4 = strndup(start, end-start);
loaderData->ipinfo_set = 0;
/* Boot server */
@@ -541,7 +541,7 @@ static void parseCmdLineIp(struct loaderData_s * loaderData, char *argv)
start = end + 1;
loaderData->netmask = strdup(start);
} else {
- loaderData->ip = strdup(argv + 3);
+ loaderData->ipv4 = strdup(argv + 3);
loaderData->ipinfo_set = 0;
}
}
@@ -862,7 +862,7 @@ static char *doLoaderMain(char * location,
STEP_DRIVERDISK, STEP_NETWORK, STEP_IFACE,
STEP_IP, STEP_URL, STEP_DONE } step;
char * url = NULL;
- char ret[48];
+ char * ret = NULL;
int dir = 1;
int rc, i;
@@ -1020,7 +1020,6 @@ static char *doLoaderMain(char * location,
break;
}
-
rc = newtWinTernary(_("No driver found"), _("Select driver"),
_("Use a driver disk"), _("Back"),
_("Unable to find any devices of the type "
@@ -1105,6 +1104,11 @@ static char *doLoaderMain(char * location,
break;
}
+ if ((ret = malloc(48)) == NULL) {
+ logMessage(ERROR, "malloc failure for ret in STEP_IP");
+ exit(EXIT_FAILURE);
+ }
+
logMessage(INFO, "going to do getNetConfig");
/* populate netDev based on any kickstart data */
if (loaderData->ipinfo_set) {
@@ -1116,13 +1120,14 @@ static char *doLoaderMain(char * location,
if ((loaderData->noipv4 = netDev.noipv4) == 1) {
loaderData->ipinfo_set = 0;
} else {
- if (!loaderData->ip) {
- if (netDev.isDynamic) {
- loaderData->ip = strdup("dhcp");
+ if (loaderData->ipv4 == NULL) {
+ ret = (char *) inet_ntop(AF_INET,
+ IP_ADDR(&(netDev.dev.ip)), ret,
+ IP_STRLEN(&(netDev.dev.ip)));
+ if (netDev.isDynamic || ret == NULL) {
+ loaderData->ipv4 = strdup("dhcp");
} else {
- inet_ntop(AF_INET, IP_ADDR(&(netDev.dev.ipv4)), ret,
- IP_STRLEN(&(netDev.dev.ipv4)));
- loaderData->ip = strdup(ret);
+ loaderData->ipv4 = strdup(ret);
}
}
@@ -1132,12 +1137,13 @@ static char *doLoaderMain(char * location,
if ((loaderData->noipv6 = netDev.noipv6) == 1) {
loaderData->ipv6info_set = 0;
} else {
- if (!loaderData->ip) {
- if (netDev.isDynamic) {
+ if (loaderData->ipv6 == NULL) {
+ ret = (char *) inet_ntop(AF_INET6,
+ IP_ADDR(&(netDev.dev.ip)), ret,
+ IP_STRLEN(&(netDev.dev.ip)));
+ if (netDev.isDynamic || ret == NULL) {
loaderData->ipv6 = strdup("dhcpv6");
} else {
- inet_ntop(AF_INET6, IP_ADDR(&(netDev.dev.ipv6)), ret,
- IP_STRLEN(&(netDev.dev.ipv6)));
loaderData->ipv6 = strdup(ret);
}
}
@@ -1145,6 +1151,9 @@ static char *doLoaderMain(char * location,
loaderData->ipv6info_set = 1;
}
+ free(ret);
+ ret = NULL;
+
if ((rc == LOADER_BACK) || (rc == LOADER_ERROR) ||
((dir == -1) && (rc == LOADER_NOOP))) {
step = STEP_IFACE;
diff --git a/loader2/loader.h b/loader2/loader.h
index 58be623b9..7967c0556 100644
--- a/loader2/loader.h
+++ b/loader2/loader.h
@@ -99,7 +99,7 @@ struct loaderData_s {
int bootIf_set;
char * netCls;
int netCls_set;
- char *ip, *ipv6, *netmask, *gateway, *dns, *hostname, *peerid, *ethtool, *subchannels, *portname, *essid, *wepkey, *nettype, *ctcprot;
+ char *ipv4, *ipv6, *netmask, *gateway, *dns, *hostname, *peerid, *ethtool, *subchannels, *portname, *essid, *wepkey, *nettype, *ctcprot;
int mtu;
int noDns;
int ipinfo_set;
diff --git a/loader2/net.c b/loader2/net.c
index 4d78b88c2..43492188f 100644
--- a/loader2/net.c
+++ b/loader2/net.c
@@ -335,7 +335,7 @@ static int getDnsServers(struct networkDeviceConfig * cfg) {
void printLoaderDataIPINFO(struct loaderData_s *loaderData) {
logMessage(DEBUGLVL, "loaderData->ipinfo_set = |%d|", loaderData->ipinfo_set);
- logMessage(DEBUGLVL, "loaderData->ip = |%s|", loaderData->ip);
+ logMessage(DEBUGLVL, "loaderData->ipv4 = |%s|", loaderData->ipv4);
logMessage(DEBUGLVL, "loaderData->ipv6info_set = |%d|", loaderData->ipv6info_set);
logMessage(DEBUGLVL, "loaderData->ipv6 = |%s|", loaderData->ipv6);
logMessage(DEBUGLVL, "loaderData->netmask = |%s|", loaderData->netmask);
@@ -395,7 +395,7 @@ void setupNetworkDeviceConfig(struct networkDeviceConfig * cfg,
}
/* this is how we specify dhcp */
- if (!strncmp(loaderData->ip, "dhcp", 4)) {
+ if (!strncmp(loaderData->ipv4, "dhcp", 4)) {
char *ret = NULL;
/* JKFIXME: this soooo doesn't belong here. and it needs to
@@ -431,13 +431,13 @@ void setupNetworkDeviceConfig(struct networkDeviceConfig * cfg,
cfg->isDynamic = 1;
cfg->preset = 1;
- } else if (inet_pton(AF_INET, loaderData->ip, &addr) >= 1) {
+ } else if (inet_pton(AF_INET, loaderData->ipv4, &addr) >= 1) {
cfg->dev.ip = ip_addr_in(&addr);
cfg->dev.ipv4 = ip_addr_in(&addr);
cfg->dev.set |= PUMP_INTFINFO_HAS_IP|PUMP_INTFINFO_HAS_IPV4_IP;
cfg->isDynamic = 0;
cfg->preset = 1;
- } else if (inet_pton(AF_INET6, loaderData->ip, &addr6) >= 1) {
+ } else if (inet_pton(AF_INET6, loaderData->ipv6, &addr6) >= 1) {
cfg->dev.ip = ip_addr_in6(&addr6);
cfg->dev.ipv6 = ip_addr_in6(&addr6);
cfg->dev.set |= PUMP_INTFINFO_HAS_IP|PUMP_INTFINFO_HAS_IPV6_IP;
@@ -446,7 +446,8 @@ void setupNetworkDeviceConfig(struct networkDeviceConfig * cfg,
} else { /* invalid ip information, disable the setting of ip info */
loaderData->ipinfo_set = 0;
cfg->isDynamic = 0;
- loaderData->ip = NULL;
+ loaderData->ipv4 = NULL;
+ loaderData->ipv6 = NULL;
}
}
@@ -1591,7 +1592,7 @@ void setKickstartNetwork(struct loaderData_s * loaderData, int argc,
loaderData->gateway = strdup(arg);
break;
case 'i':
- loaderData->ip = strdup(arg);
+ loaderData->ipv4 = strdup(arg);
break;
case 'n':
loaderData->dns = strdup(arg);
@@ -1620,10 +1621,10 @@ void setKickstartNetwork(struct loaderData_s * loaderData, int argc,
* use dhcp for the interface */
if ((bootProto && (!strncmp(bootProto, "dhcp", 4) ||
!strncmp(bootProto, "bootp", 4))) ||
- (!bootProto && !loaderData->ip)) {
- loaderData->ip = strdup("dhcp");
+ (!bootProto && !loaderData->ipv4)) {
+ loaderData->ipv4 = strdup("dhcp");
loaderData->ipinfo_set = 1;
- } else if (loaderData->ip) {
+ } else if (loaderData->ipv4) {
/* JKFIXME: this assumes a bit... */
loaderData->ipinfo_set = 1;
}
@@ -1877,8 +1878,8 @@ int kickstartNetworkUp(struct loaderData_s * loaderData,
/* JKFIXME: this is kind of crufty, we depend on the fact that the
* ip is set and then just get the network up. we should probably
* add a way to do asking about static here and not be such a hack */
- if (!loaderData->ip) {
- loaderData->ip = strdup("dhcp");
+ if (!loaderData->ipv4) {
+ loaderData->ipv4 = strdup("dhcp");
}
loaderData->ipinfo_set = 1;
@@ -1896,7 +1897,7 @@ int kickstartNetworkUp(struct loaderData_s * loaderData,
* we set before attempting to bring the incorrect interface up.
*/
loaderData->netDev_set = 0;
- free(loaderData->ip);
+ free(loaderData->ipv4);
loaderData->ipinfo_set = 0;
}
else