aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorJörg Mayer <jmayer@loplof.de>2004-06-25 07:00:54 +0000
committerJörg Mayer <jmayer@loplof.de>2004-06-25 07:00:54 +0000
commit021f72021e8de04728950de107fa94c750dfbc9b (patch)
tree88f8b5408d401a86cd757681ee2afb5c41bebe89 /epan
parente790073f3afed22dc5084a37424e35ab14412400 (diff)
Fix automagically generated filters in case of remote login via IPv6.
This fix was picked from the source rpm of Suse 9.1. svn path=/trunk/; revision=11234
Diffstat (limited to 'epan')
-rw-r--r--epan/resolv.c17
-rw-r--r--epan/resolv.h9
2 files changed, 24 insertions, 2 deletions
diff --git a/epan/resolv.c b/epan/resolv.c
index cd5612c597..72f0cbbb20 100644
--- a/epan/resolv.c
+++ b/epan/resolv.c
@@ -1,7 +1,7 @@
/* resolv.c
* Routines for network object lookup
*
- * $Id: resolv.c,v 1.43 2004/05/20 13:43:14 ulfl Exp $
+ * $Id: resolv.c,v 1.44 2004/06/25 07:00:54 jmayer Exp $
*
* Laurent Deniel <laurent.deniel@free.fr>
*
@@ -1898,3 +1898,18 @@ gboolean get_host_ipaddr6(const char *host, struct e_in6_addr *addrp)
return FALSE;
}
+
+/*
+ * Find out whether a hostname resolves to an ip or ipv6 address
+ * Return "ip6" if it is IPv6, "ip" otherwise (including the case
+ * that we don't know)
+ */
+const char* host_ip_af(const char *host)
+{
+#ifdef HAVE_GETHOSTBYNAME2
+ struct hostent *h;
+ return (h = gethostbyname2(host, AF_INET6)) && h->h_addrtype == AF_INET6 ? "ip6" : "ip";
+#else
+ return "ip";
+#endif
+}
diff --git a/epan/resolv.h b/epan/resolv.h
index 1eef0da6fc..8d5c810111 100644
--- a/epan/resolv.h
+++ b/epan/resolv.h
@@ -1,7 +1,7 @@
/* resolv.h
* Definitions for network object lookup
*
- * $Id: resolv.h,v 1.17 2004/05/09 10:03:40 guy Exp $
+ * $Id: resolv.h,v 1.18 2004/06/25 07:00:54 jmayer Exp $
*
* Laurent Deniel <laurent.deniel@free.fr>
*
@@ -131,4 +131,11 @@ gboolean get_host_ipaddr(const char *host, guint32 *addrp);
*/
gboolean get_host_ipaddr6(const char *host, struct e_in6_addr *addrp);
+/*
+ * Find out whether a hostname resolves to an ip or ipv6 address
+ * Return "ip6" if it is IPv6, "ip" otherwise (including the case
+ * that we don't know)
+ */
+const char* host_ip_af(const char *host);
+
#endif /* __RESOLV_H__ */