summaryrefslogtreecommitdiff
path: root/networking/udhcp/files.c
diff options
context:
space:
mode:
authorDenis Vlasenko2007-02-04 02:41:57 +0000
committerDenis Vlasenko2007-02-04 02:41:57 +0000
commite99130340610a09de7581abe5c127c024347bc32 (patch)
tree85f96b893cc174965b65d8691901da659468ed97 /networking/udhcp/files.c
parent10944524238532ad35aaefec89cf7cc950745d6b (diff)
downloadbusybox-e99130340610a09de7581abe5c127c024347bc32.zip
busybox-e99130340610a09de7581abe5c127c024347bc32.tar.gz
udhcp: use improved gethostbyname replacement from IPv6 code
Diffstat (limited to 'networking/udhcp/files.c')
-rw-r--r--networking/udhcp/files.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/networking/udhcp/files.c b/networking/udhcp/files.c
index c3ab17d..e35f50a 100644
--- a/networking/udhcp/files.c
+++ b/networking/udhcp/files.c
@@ -21,15 +21,14 @@
/* on these functions, make sure you datatype matches */
static int read_ip(const char *line, void *arg)
{
- struct in_addr *addr = arg;
- struct hostent *host;
- int retval = 1;
-
- if (!inet_aton(line, addr)) {
- host = gethostbyname(line);
- if (host)
- addr->s_addr = *((unsigned long *) host->h_addr_list[0]);
- else retval = 0;
+ len_and_sockaddr *lsa;
+ int retval = 0;
+
+ lsa = host_and_af2sockaddr(line, 0, AF_INET);
+ if (lsa) {
+ *(struct in_addr*)arg = lsa->sin.sin_addr;
+ free(lsa);
+ retval = 1;
}
return retval;
}