diff options
Diffstat (limited to 'networking/udhcp/files.c')
-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; } |