summaryrefslogtreecommitdiffstats
path: root/contrib/libpcap/nametoaddr.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/libpcap/nametoaddr.c')
-rw-r--r--contrib/libpcap/nametoaddr.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/contrib/libpcap/nametoaddr.c b/contrib/libpcap/nametoaddr.c
index f03c493..3a5e3b6 100644
--- a/contrib/libpcap/nametoaddr.c
+++ b/contrib/libpcap/nametoaddr.c
@@ -24,7 +24,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: nametoaddr.c,v 1.48 98/07/12 13:15:36 leres Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/libpcap/nametoaddr.c,v 1.51 1999/11/25 08:25:35 itojun Exp $ (LBL)";
#endif
#include <sys/param.h>
@@ -41,6 +41,10 @@ struct rtentry;
#include <netinet/in.h>
#include <netinet/if_ether.h>
#include <arpa/inet.h>
+#ifdef INET6
+#include <netdb.h>
+#include <sys/socket.h>
+#endif /*INET6*/
#include <ctype.h>
#include <errno.h>
@@ -70,6 +74,7 @@ static inline int xdtoi(int);
* Convert host name to internet address.
* Return 0 upon failure.
*/
+#ifndef INET6
bpf_u_int32 **
pcap_nametoaddr(const char *name)
{
@@ -93,6 +98,23 @@ pcap_nametoaddr(const char *name)
else
return 0;
}
+#else
+struct addrinfo *
+pcap_nametoaddr(const char *name)
+{
+ struct addrinfo hints, *res;
+ int error;
+
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_family = PF_UNSPEC;
+ hints.ai_socktype = SOCK_STREAM; /*not really*/
+ error = getaddrinfo(name, NULL, &hints, &res);
+ if (error)
+ return NULL;
+ else
+ return res;
+}
+#endif /*INET6*/
/*
* Convert net name to internet address.
@@ -185,6 +207,9 @@ struct eproto eproto_db[] = {
{ "pup", ETHERTYPE_PUP },
{ "xns", ETHERTYPE_NS },
{ "ip", ETHERTYPE_IP },
+#ifdef INET6
+ { "ip6", ETHERTYPE_IPV6 },
+#endif
{ "arp", ETHERTYPE_ARP },
{ "rarp", ETHERTYPE_REVARP },
{ "sprite", ETHERTYPE_SPRITE },
@@ -330,7 +355,7 @@ pcap_ether_hostton(const char *name)
}
#else
-#ifndef sgi
+#if !defined(sgi) && !defined(__NetBSD__)
extern int ether_hostton(char *, struct ether_addr *);
#endif
OpenPOWER on IntegriCloud