summaryrefslogtreecommitdiffstats
path: root/contrib/libpcap
diff options
context:
space:
mode:
authorfenner <fenner@FreeBSD.org>2000-03-04 23:57:39 +0000
committerfenner <fenner@FreeBSD.org>2000-03-04 23:57:39 +0000
commit520bac883ea54eeaa4eabcc2daca293baaaed9d8 (patch)
treeccf2f79502021568074a2b4692ddebb851450f94 /contrib/libpcap
parenteb516277dd8029fd7f94f1315c3fa494ce3559c0 (diff)
downloadFreeBSD-src-520bac883ea54eeaa4eabcc2daca293baaaed9d8.zip
FreeBSD-src-520bac883ea54eeaa4eabcc2daca293baaaed9d8.tar.gz
Merge updated file for 0.5 release: handle "ip host foo" and
"ip6 host foo" when foo has both IP and IP6 addresses. PR: bin/17083 Approved by: jkh
Diffstat (limited to 'contrib/libpcap')
-rw-r--r--contrib/libpcap/gencode.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/contrib/libpcap/gencode.c b/contrib/libpcap/gencode.c
index 11ee283..4a7c107 100644
--- a/contrib/libpcap/gencode.c
+++ b/contrib/libpcap/gencode.c
@@ -23,7 +23,7 @@
*/
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/libpcap/gencode.c,v 1.100 1999/12/08 19:54:03 mcr Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/libpcap/gencode.c,v 1.100.2.1 2000/03/01 14:12:54 itojun Exp $ (LBL)";
#endif
#include <sys/types.h>
@@ -2089,15 +2089,21 @@ gen_scode(name, q)
tproto = Q_IP;
tproto6 = Q_IPV6;
}
- while (res) {
+ for (res = res0; res; res = res->ai_next) {
switch (res->ai_family) {
case AF_INET:
+ if (tproto == Q_IPV6)
+ continue;
+
sin = (struct sockaddr_in *)
res->ai_addr;
tmp = gen_host(ntohl(sin->sin_addr.s_addr),
0xffffffff, tproto, dir);
break;
case AF_INET6:
+ if (tproto6 == Q_IP)
+ continue;
+
sin6 = (struct sockaddr_in6 *)
res->ai_addr;
tmp = gen_host6(&sin6->sin6_addr,
@@ -2107,10 +2113,14 @@ gen_scode(name, q)
if (b)
gen_or(b, tmp);
b = tmp;
-
- res = res->ai_next;
}
freeaddrinfo(res0);
+ if (b == NULL) {
+ bpf_error("unknown host '%s'%s", name,
+ (proto == Q_DEFAULT)
+ ? ""
+ : " for specified address family");
+ }
return b;
#endif /*INET6*/
}
OpenPOWER on IntegriCloud