From 21f331ead265b1f02ae14fd03e9af53ea5b7bd55 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Fri, 5 Mar 2010 20:01:47 +0000 Subject: Added IPv6 name servers support --- ares/ares_gethostbyaddr.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'ares/ares_gethostbyaddr.c') diff --git a/ares/ares_gethostbyaddr.c b/ares/ares_gethostbyaddr.c index cafb15e1d..4b1dad36d 100644 --- a/ares/ares_gethostbyaddr.c +++ b/ares/ares_gethostbyaddr.c @@ -79,8 +79,8 @@ void ares_gethostbyaddr(ares_channel channel, const void *addr, int addrlen, return; } - if ((family == AF_INET && addrlen != sizeof(struct in_addr)) || - (family == AF_INET6 && addrlen != sizeof(struct in6_addr))) + if ((family == AF_INET && addrlen != sizeof(aquery->addr.addrV4)) || + (family == AF_INET6 && addrlen != sizeof(aquery->addr.addrV6))) { callback(arg, ARES_ENOTIMP, 0, NULL); return; @@ -94,9 +94,9 @@ void ares_gethostbyaddr(ares_channel channel, const void *addr, int addrlen, } aquery->channel = channel; if (family == AF_INET) - memcpy(&aquery->addr.addrV4, addr, sizeof(struct in_addr)); + memcpy(&aquery->addr.addrV4, addr, sizeof(aquery->addr.addrV4)); else - memcpy(&aquery->addr.addrV6, addr, sizeof(struct in6_addr)); + memcpy(&aquery->addr.addrV6, addr, sizeof(aquery->addr.addrV6)); aquery->addr.family = family; aquery->callback = callback; aquery->arg = arg; @@ -152,13 +152,13 @@ static void addr_callback(void *arg, int status, int timeouts, { if (aquery->addr.family == AF_INET) { - addrlen = sizeof(struct in_addr); + addrlen = sizeof(aquery->addr.addrV4); status = ares_parse_ptr_reply(abuf, alen, &aquery->addr.addrV4, (int)addrlen, AF_INET, &host); } else { - addrlen = sizeof(struct in6_addr); + addrlen = sizeof(aquery->addr.addrV6); status = ares_parse_ptr_reply(abuf, alen, &aquery->addr.addrV6, (int)addrlen, AF_INET6, &host); } @@ -241,12 +241,12 @@ static int file_lookup(struct ares_addr *addr, struct hostent **host) } if (addr->family == AF_INET) { - if (memcmp((*host)->h_addr, &addr->addrV4, sizeof(struct in_addr)) == 0) + if (memcmp((*host)->h_addr, &addr->addrV4, sizeof(addr->addrV4)) == 0) break; } else if (addr->family == AF_INET6) { - if (memcmp((*host)->h_addr, &addr->addrV6, sizeof(struct in6_addr)) == 0) + if (memcmp((*host)->h_addr, &addr->addrV6, sizeof(addr->addrV6)) == 0) break; } ares_free_hostent(*host); -- cgit v1.2.3