aboutsummaryrefslogtreecommitdiffstats
path: root/resolv.c
diff options
context:
space:
mode:
authorGilbert Ramirez <gram@alumni.rice.edu>1999-03-28 18:32:03 +0000
committerGilbert Ramirez <gram@alumni.rice.edu>1999-03-28 18:32:03 +0000
commit2b86d46d706b3f60e3804b6ee9348752aa601b9a (patch)
tree73171006c6a2e830fe9b6742f081ab1e0b24131c /resolv.c
parent4932ef3dcc5b76692e982fbb4d17153e998f69ba (diff)
Jun-ichiro's IPv6 patch is merged in with ethereal and now uses the new
proto*() functions. The configure script tries to use ipv6 name resolution if it knows the type of ipv6 stack the user has (this can be avoided with the --disable-ipv6 switch) Additionally, the configure script now deals with wiretap better. If the user doesn't want to compile wiretap, the wiretap is never visited. A few unnecessary #includes were removed from some wiretap files, and a CPP macro was moved from bpf.c to wtap.h. svn path=/trunk/; revision=229
Diffstat (limited to 'resolv.c')
-rw-r--r--resolv.c48
1 files changed, 47 insertions, 1 deletions
diff --git a/resolv.c b/resolv.c
index 50d08c13ed..cb46eb3e0d 100644
--- a/resolv.c
+++ b/resolv.c
@@ -1,7 +1,7 @@
/* resolv.c
* Routines for network object lookup
*
- * $Id: resolv.c,v 1.5 1998/12/17 05:42:32 gram Exp $
+ * $Id: resolv.c,v 1.6 1999/03/28 18:32:00 gram Exp $
*
* Laurent Deniel <deniel@worldnet.fr>
*
@@ -57,6 +57,7 @@
#include "ethereal.h"
#include "packet.h"
+#include "packet-ipv6.h"
#include "resolv.h"
#ifndef MAXNAMELEN
@@ -253,6 +254,40 @@ static u_char *host_name_lookup(u_int addr)
} /* host_name_lookup */
+static u_char *host_name_lookup6(struct e_in6_addr *addr)
+{
+ static u_char name[MAXNAMELEN];
+#ifdef INET6
+ struct hostent *hostp;
+
+#ifdef AVOID_DNS_TIMEOUT
+
+ /* Quick hack to avoid DNS/YP timeout */
+
+ if (!setjmp(hostname_env)) {
+ signal(SIGALRM, abort_network_query);
+ alarm(DNS_TIMEOUT);
+#endif /* AVOID_DNS_TIMEOUT */
+ hostp = gethostbyaddr((char *)addr, sizeof(*addr), AF_INET6);
+#ifdef AVOID_DNS_TIMEOUT
+ alarm(0);
+#endif
+ if (hostp != NULL) {
+ strncpy(name, hostp->h_name, MAXNAMELEN);
+ name[MAXNAMELEN-1] = '\0';
+ return name;
+ }
+#ifdef AVOID_DNS_TIMEOUT
+ }
+#endif
+
+ /* unknown host or DNS timeout */
+#endif /* INET6 */
+ sprintf(name, "%s", ip6_to_str(addr));
+
+ return (name);
+}
+
/*
* Miscellaneous functions
*/
@@ -663,6 +698,17 @@ extern u_char *get_hostname(u_int addr)
return host_name_lookup(addr);
}
+extern gchar *get_hostname6(struct e_in6_addr *addr)
+{
+#ifdef INET6
+ if (!g_resolving_actif)
+ return ip6_to_str(addr);
+ if (IN6_IS_ADDR_LINKLOCAL(addr) || IN6_IS_ADDR_MULTICAST(addr))
+ return ip6_to_str(addr);
+#endif
+ return host_name_lookup6(addr);
+}
+
extern void add_host_name(u_int addr, u_char *name)
{