From 4565e1baf3c5f432538274e0b706659fd63620e8 Mon Sep 17 00:00:00 2001 From: Karl Ramm Date: Fri, 20 Mar 2009 06:39:23 +0000 Subject: ares_getnameinfo makes the decision on the address family BY THE LENGTH OF THE SOCKADDR_IN ARGUMENT --- zwgc/main.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'zwgc') diff --git a/zwgc/main.c b/zwgc/main.c index e66e209..1725c13 100644 --- a/zwgc/main.c +++ b/zwgc/main.c @@ -407,7 +407,12 @@ notice_handler(ZNotice_t *notice) #endif #ifdef HAVE_ARES - ares_getnameinfo(achannel, (const struct sockaddr *)&(notice->z_sender_sockaddr), + ares_getnameinfo(achannel, + (const struct sockaddr *)&(notice->z_sender_sockaddr), + notice->z_sender_sockaddr.sa.sa_family == AF_INET ? + sizeof(struct sockaddr_in) : + notice->z_sender_sockaddr.sa.sa_family == AF_INET6 ? + sizeof(struct sockaddr_in6) : sizeof(notice->z_sender_sockaddr), ARES_NI_LOOKUPHOST, notice_callback, notice); -- cgit v1.2.3