diff options
author | Chris Lumens <clumens@redhat.com> | 2007-10-19 14:28:32 +0000 |
---|---|---|
committer | Chris Lumens <clumens@redhat.com> | 2007-10-19 14:28:32 +0000 |
commit | a000662d2310380842acdfb6dcbad0e2e3c373d5 (patch) | |
tree | a5f18366308674a15d823e59511bf16e7ef66c0b | |
parent | 4690ebd8d12099f89932e1f7daac1a6ac7b2a33f (diff) | |
download | anaconda-a000662d2310380842acdfb6dcbad0e2e3c373d5.tar.gz anaconda-a000662d2310380842acdfb6dcbad0e2e3c373d5.tar.xz anaconda-a000662d2310380842acdfb6dcbad0e2e3c373d5.zip |
Use the netlink code to get our IP address, instead of trusting that
kickstartNetworkUp will set the data correctly on the second time through
(#336761).
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | loader2/nfsinstall.c | 19 | ||||
-rw-r--r-- | loader2/urlinstall.c | 13 |
3 files changed, 23 insertions, 14 deletions
@@ -3,6 +3,11 @@ * isys/nl.c (netlink_interfaces_ip2str, netlink_interfaces_mac2str): Detect success from netlink_init_interfaces_list correctly. + * loader2/nfsinstall.c (getFileFromNfs): Use the netlink code to get + our IP address, instead of trusting that kickstartNetworkUp will set + the data correctly on the second time through (#336761). + * loader2/urlinstall.c (getFileFromUrl): Likewise. + 2007-10-17 Peter Jones <pjones@redhat.com> * isys/isys.c: add matchPathContext and setFileContext calls, diff --git a/loader2/nfsinstall.c b/loader2/nfsinstall.c index 6bf324dbf..f250528ef 100644 --- a/loader2/nfsinstall.c +++ b/loader2/nfsinstall.c @@ -35,6 +35,7 @@ #include "windows.h" #include "../isys/imount.h" +#include "../isys/nl.h" /* boot flags */ extern uint64_t flags; @@ -300,12 +301,10 @@ void setKickstartNfs(struct loaderData_s * loaderData, int argc, int getFileFromNfs(char * url, char * dest, struct loaderData_s * loaderData) { - char ret[47]; char * host = NULL, *path = NULL, * file = NULL, * opts = NULL; - char * chk = NULL; + char * chk = NULL, *ip = NULL; int failed = 0; struct networkDeviceConfig netCfg; - ip_addr_t *tip; if (kickstartNetworkUp(loaderData, &netCfg)) { logMessage(ERROR, "unable to bring up network"); @@ -316,6 +315,9 @@ int getFileFromNfs(char * url, char * dest, struct loaderData_s * loaderData) { * the dhcp/bootp information */ if (url == NULL) { + char ret[47]; + ip_addr_t *tip; + if (!(netCfg.dev.set & PUMP_INTFINFO_HAS_NEXTSERVER)) { logMessage(ERROR, "no bootserver was found"); return 1; @@ -324,24 +326,25 @@ int getFileFromNfs(char * url, char * dest, struct loaderData_s * loaderData) { tip = &(netCfg.dev.nextServer); if (!(netCfg.dev.set & PUMP_INTFINFO_HAS_BOOTFILE)) { inet_ntop(tip->sa_family, IP_ADDR(tip), ret, IP_STRLEN(tip)); + ip = strdup(ret); url = sdupprintf("%s:%s", ret, "/kickstart/"); logMessage(ERROR, "bootp: no bootfile received"); } else { inet_ntop(tip->sa_family, IP_ADDR(tip), ret, IP_STRLEN(tip)); + ip = strdup(ret); url = sdupprintf("%s:%s", ret, netCfg.dev.bootFile); logMessage(INFO, "bootp: bootfile is %s", netCfg.dev.bootFile); } - } + } /* get the IP of the target system */ - tip = &(netCfg.dev.ip); - if (inet_ntop(tip->sa_family, IP_ADDR(tip), ret, IP_STRLEN(tip)) == NULL) { - logMessage(ERROR, "getFileFromNfs: no client IP information"); + if (ip == NULL && (ip = netlink_interfaces_ip2str(loaderData->netDev)) == NULL) { + logMessage(ERROR, "netlink_interfaces_ip2str returned NULL"); return 1; } logMessage(INFO, "url is %s", url); - getHostandPath(url, &host, &path, ret); + getHostandPath(url, &host, &path, ip); opts = strchr(host, ':'); if (opts && (strlen(opts) > 1)) { diff --git a/loader2/urlinstall.c b/loader2/urlinstall.c index c4fe21c00..5a4bff965 100644 --- a/loader2/urlinstall.c +++ b/loader2/urlinstall.c @@ -346,15 +346,13 @@ char * mountUrlImage(struct installMethod * method, int getFileFromUrl(char * url, char * dest, struct loaderData_s * loaderData) { int retval = 0; - char ret[47]; struct iurlinfo ui; enum urlprotocol_t proto = !strncmp(url, "ftp://", 6) ? URL_METHOD_FTP : URL_METHOD_HTTP; char * host = NULL, * file = NULL, * chptr = NULL, *login = NULL, *password = NULL; int fd, rc; struct networkDeviceConfig netCfg; - char * ehdrs = NULL; - ip_addr_t *tip; + char *ehdrs = NULL, *ip = NULL; if (kickstartNetworkUp(loaderData, &netCfg)) { logMessage(ERROR, "unable to bring up network"); @@ -364,10 +362,13 @@ int getFileFromUrl(char * url, char * dest, memset(&ui, 0, sizeof(ui)); ui.protocol = proto; - tip = &(netCfg.dev.ip); - inet_ntop(tip->sa_family, IP_ADDR(tip), ret, IP_STRLEN(tip)); + if ((ip = netlink_interfaces_ip2str(loaderData->netDev)) == NULL) { + logMessage(ERROR, "getFileFromUrl: no client IP information"); + return 1; + } + getHostPathandLogin((proto == URL_METHOD_FTP ? url + 6 : url + 7), - &host, &file, &login, &password, ret); + &host, &file, &login, &password, ip); logMessage(INFO, "file location: %s://%s%s", (proto == URL_METHOD_FTP ? "ftp" : "http"), host, file); |