summaryrefslogtreecommitdiff
path: root/epan/addr_resolv.c
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2008-12-23 18:15:09 +0000
committerGerald Combs <gerald@wireshark.org>2008-12-23 18:15:09 +0000
commit8f375871c1fc75685d776d360620f8793f5328fb (patch)
tree8311a31acfebaa3c81dc83057f2d1ac2d8701467 /epan/addr_resolv.c
parent38fc4d7e6901041c8f733ae651ab0c0083fb3a6c (diff)
downloadwireshark-8f375871c1fc75685d776d360620f8793f5328fb.tar.gz
Allow compilation with c-ares <= 1.4.0 (untested). While we're at it, fix
c-ares name resolution. svn path=/trunk/; revision=27096
Diffstat (limited to 'epan/addr_resolv.c')
-rw-r--r--epan/addr_resolv.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/epan/addr_resolv.c b/epan/addr_resolv.c
index 45125a648a..97725ddd7f 100644
--- a/epan/addr_resolv.c
+++ b/epan/addr_resolv.c
@@ -110,6 +110,7 @@
# define socklen_t unsigned int
# endif
# include <ares.h>
+# include <ares_version.h>
#else
# ifdef HAVE_GNU_ADNS
# include <errno.h>
@@ -306,7 +307,11 @@ typedef struct _c_ares_queue_msg
int family;
} c_ares_queue_msg_t;
+#if ARES_VERSION <= 0x140
+static void c_ares_ghba_cb(void *arg, int status, struct hostent *hostent);
+#else
static void c_ares_ghba_cb(void *arg, int status, int timeouts _U_, struct hostent *hostent);
+#endif
#else
/* GNU ADNS */
@@ -668,23 +673,25 @@ static void fill_dummy_ip4(guint addr, hashipv4_t* volatile tp)
#ifdef HAVE_C_ARES
static void
+#if ARES_VERSION <= 0x140
+c_ares_ghba_cb(void *arg, int status, struct hostent *he) {
+#else
c_ares_ghba_cb(void *arg, int status, int timeouts _U_, struct hostent *he) {
+#endif
c_ares_queue_msg_t *caqm = arg;
char **p;
- char name[MAXNAMELEN];
if (!caqm) return;
c_ares_in_flight--;
if (status == ARES_SUCCESS) {
for (p = he->h_addr_list; *p != NULL; p++) {
- inet_ntop(he->h_addrtype, *p, name, sizeof(name));
switch(caqm->family) {
case AF_INET:
- add_ipv4_name(caqm->addr.ip4, name);
+ add_ipv4_name(caqm->addr.ip4, he->h_name);
break;
case AF_INET6:
- add_ipv6_name(&caqm->addr.ip6, name);
+ add_ipv6_name(&caqm->addr.ip6, he->h_name);
break;
default:
/* Throw an exception? */