aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Fenner <fenner@FreeBSD.org>2000-03-04 23:54:27 +0000
committerBill Fenner <fenner@FreeBSD.org>2000-03-04 23:54:27 +0000
commit5a929640374d7dbe9d197ffece1bc89ea7859da6 (patch)
treed656ba789f9bea5c1ab5b8ad4f7f141f372beb5d
parent8751327cb402b224f87d580cfa2cb02b1467e9c0 (diff)
downloadsrc-5a929640374d7dbe9d197ffece1bc89ea7859da6.tar.gz
src-5a929640374d7dbe9d197ffece1bc89ea7859da6.zip
Import of updated file for 0.5 release
Notes
Notes: svn path=/vendor/libpcap/dist/; revision=57761
-rw-r--r--contrib/libpcap/gencode.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/contrib/libpcap/gencode.c b/contrib/libpcap/gencode.c
index 0298350d6043..6aa956b1543b 100644
--- a/contrib/libpcap/gencode.c
+++ b/contrib/libpcap/gencode.c
@@ -21,7 +21,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>
@@ -2045,15 +2045,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,
@@ -2063,10 +2069,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*/
}
@@ -2423,7 +2433,7 @@ gen_load(proto, index, size)
#ifdef INET6
case Q_IPV6:
#endif
- /* XXX Note that we assume a fixed link link header here. */
+ /* XXX Note that we assume a fixed link header here. */
s = xfer_to_x(index);
tmp = new_stmt(BPF_LD|BPF_IND|size);
tmp->s.k = off_nl;