diff options
author | Jeremy Katz <katzj@redhat.com> | 2002-07-29 21:54:39 +0000 |
---|---|---|
committer | Jeremy Katz <katzj@redhat.com> | 2002-07-29 21:54:39 +0000 |
commit | 698647c8b8650ca7132e8dbc457117510ffbd4ec (patch) | |
tree | bb936977b6c676dc66b0b0b72ad8bff0ff1c14d2 | |
parent | f1b45c3ec8588cdcd08e76291a96842641ca824b (diff) | |
download | anaconda-698647c8b8650ca7132e8dbc457117510ffbd4ec.tar.gz anaconda-698647c8b8650ca7132e8dbc457117510ffbd4ec.tar.xz anaconda-698647c8b8650ca7132e8dbc457117510ffbd4ec.zip |
merge ia64 branch bits to have dns work in non-diet loaders
-rw-r--r-- | isys/dns.c | 27 | ||||
-rw-r--r-- | loader/Makefile | 2 | ||||
-rw-r--r-- | loader/ftp.c | 9 | ||||
-rw-r--r-- | loader/net.c | 8 |
4 files changed, 36 insertions, 10 deletions
diff --git a/isys/dns.c b/isys/dns.c index 232215efa..776441d8d 100644 --- a/isys/dns.c +++ b/isys/dns.c @@ -9,6 +9,7 @@ /* This is dumb, but glibc doesn't like to do hostname lookups w/o libc.so */ +#ifndef DIET union dns_response{ HEADER hdr; u_char buf[PACKETSZ]; @@ -117,3 +118,29 @@ char * mygethostbyaddr(char * ipnum) { int mygethostbyname(char * name, struct in_addr * addr) { return doQuery(name, T_A, NULL, addr); } + +#else +#include <netdb.h> + + +int mygethostbyname(char * host, struct in_addr * address) { + struct hostent * hostinfo; + + hostinfo = gethostbyname(host); + if (!hostinfo) return 1; + + memcpy(address, hostinfo->h_addr_list[0], hostinfo->h_length); + return 0; +} + +char * mygethostbyaddr(char * ipnum) { + struct hostent * he; + + he = gethostbyaddr( ipnum, strlen(ipnum), AF_INET); + if (he) + return he->h_name; + else + return NULL; +} + +#endif diff --git a/loader/Makefile b/loader/Makefile index ae0c12294..919d79b07 100644 --- a/loader/Makefile +++ b/loader/Makefile @@ -96,10 +96,12 @@ ifeq (sparc, $(ARCH)) MINILIBC=minilibc.o /usr/lib/libc.a CFLAGS+=-DUSE_MINILIBC=1 -DUSE_LOGDEV LDFLAGS = -nostdlib /usr/lib/crt1.o +LOADERLIBS += -lresolv STATIC=-static else CFLAGS+=-DUSE_MINILIBC=0 STATIC=-static +LOADERLIBS += -lresolv endif endif diff --git a/loader/ftp.c b/loader/ftp.c index 728cc9db8..0654bc26f 100644 --- a/loader/ftp.c +++ b/loader/ftp.c @@ -185,15 +185,6 @@ int ftpCommand(int sock, char * command, ...) { return 0; } -int mygethostbyname(char * host, struct in_addr * address) { - struct hostent * hostinfo; - - hostinfo = gethostbyname(host); - if (!hostinfo) return 1; - - memcpy(address, hostinfo->h_addr_list[0], hostinfo->h_length); - return 0; -} static int getHostAddress(const char * host, struct in_addr * address) { if (isdigit(host[0])) { diff --git a/loader/net.c b/loader/net.c index 48fe6fce5..a0c473772 100644 --- a/loader/net.c +++ b/loader/net.c @@ -28,8 +28,8 @@ #include <stdlib.h> #include <string.h> -#include <netdb.h> #ifdef __STANDALONE__ +#include <netdb.h> #include <libintl.h> #include <locale.h> @@ -612,7 +612,9 @@ int writeResolvConf(struct networkDeviceConfig * net) { int findHostAndDomain(struct networkDeviceConfig * dev, int flags) { char * name, * chptr; +#ifdef __STANDALONE__ struct hostent * he; +#endif if (!FL_TESTING(flags)) { writeResolvConf(dev); @@ -621,8 +623,12 @@ int findHostAndDomain(struct networkDeviceConfig * dev, int flags) { if (!(dev->dev.set & PUMP_NETINFO_HAS_HOSTNAME)) { winStatus(40, 3, _("Hostname"), _("Determining host name and domain...")); +#ifdef __STANDALONE__ he = gethostbyaddr( (char *) &dev->dev.ip, sizeof (dev->dev.ip), AF_INET); name = he ? he->h_name : 0; +#else + name = mygethostbyaddr(inet_ntoa(dev->dev.ip)); +#endif newtPopWindow(); if (!name) { |