diff options
author | Denis Vlasenko | 2007-02-04 02:41:57 +0000 |
---|---|---|
committer | Denis Vlasenko | 2007-02-04 02:41:57 +0000 |
commit | e99130340610a09de7581abe5c127c024347bc32 (patch) | |
tree | 85f96b893cc174965b65d8691901da659468ed97 /networking | |
parent | 10944524238532ad35aaefec89cf7cc950745d6b (diff) | |
download | busybox-e99130340610a09de7581abe5c127c024347bc32.zip busybox-e99130340610a09de7581abe5c127c024347bc32.tar.gz |
udhcp: use improved gethostbyname replacement from IPv6 code
Diffstat (limited to 'networking')
-rw-r--r-- | networking/udhcp/files.c | 17 |
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; } |