X-Git-Url: https://tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=lib%2Ffake-getaddrinfo.c;h=29b3f9b0417767eade30943a29c1a4b30b84082b;hp=d831732d71bd384bcc2b64167da4c88701934c11;hb=c1e8152f4fe5e4557784d8411e50006d461b8786;hpb=f6905582d0e70ac5b44369780aaa921d9c721197 diff --git a/lib/fake-getaddrinfo.c b/lib/fake-getaddrinfo.c index d831732d..29b3f9b0 100644 --- a/lib/fake-getaddrinfo.c +++ b/lib/fake-getaddrinfo.c @@ -9,17 +9,10 @@ * that ai_family is AF_INET. Don't use it for another purpose. */ -#include "config.h" - -#include -#include -#include -#include -#include -#include - -#include +#include "system.h" +#include "ipv4.h" +#include "ipv6.h" #include "fake-getaddrinfo.h" #ifndef HAVE_GAI_STRERROR @@ -49,7 +42,7 @@ void freeaddrinfo(struct addrinfo *ai) #endif /* !HAVE_FREEADDRINFO */ #ifndef HAVE_GETADDRINFO -static struct addrinfo *malloc_ai(int port, u_long addr) +static struct addrinfo *malloc_ai(int port, uint32_t addr) { struct addrinfo *ai; @@ -97,12 +90,14 @@ int getaddrinfo(const char *hostname, const char *servname, return EAI_MEMORY; } +#ifdef HAVE_INET_ATON if (inet_aton(hostname, &in)) { if (NULL != (*res = malloc_ai(port, in.s_addr))) return 0; else return EAI_MEMORY; } +#endif hp = gethostbyname(hostname); if (hp && hp->h_name && hp->h_name[0] && hp->h_addr_list[0]) {