From 3237209fe33a3a154642a500f869a9347f6f9d69 Mon Sep 17 00:00:00 2001 From: itojun Date: Fri, 14 Apr 2000 14:26:35 +0000 Subject: [PATCH] more fallback #define. more friendly message on "ip host ip6only-host" or "ip6 host ip4only-host". (sync with tcpdump.org) --- lib/libpcap/ethertype.h | 5 ++++- lib/libpcap/gencode.c | 23 +++++++++++++++++------ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/lib/libpcap/ethertype.h b/lib/libpcap/ethertype.h index 95027ea3cda2..4e89508f1d53 100644 --- a/lib/libpcap/ethertype.h +++ b/lib/libpcap/ethertype.h @@ -1,4 +1,4 @@ -/* $NetBSD: ethertype.h,v 1.4 1997/10/03 15:53:04 christos Exp $ */ +/* $NetBSD: ethertype.h,v 1.5 2000/04/14 14:26:35 itojun Exp $ */ /* * Copyright (c) 1993, 1994, 1996 @@ -73,6 +73,9 @@ #ifndef ETHERTYPE_AARP #define ETHERTYPE_AARP 0x80f3 #endif +#ifndef ETHERTYPE_IPV6 +#define ETHERTYPE_IPV6 0x80f3 +#endif #ifndef ETHERTYPE_LOOPBACK #define ETHERTYPE_LOOPBACK 0x9000 #endif diff --git a/lib/libpcap/gencode.c b/lib/libpcap/gencode.c index 019097f7f873..91efd4ff7cfc 100644 --- a/lib/libpcap/gencode.c +++ b/lib/libpcap/gencode.c @@ -1,4 +1,4 @@ -/* $NetBSD: gencode.c,v 1.22 2000/03/01 03:47:48 itojun Exp $ */ +/* $NetBSD: gencode.c,v 1.23 2000/04/14 14:26:35 itojun Exp $ */ /* * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 @@ -26,7 +26,7 @@ static const char rcsid[] = "@(#) Header: gencode.c,v 1.93 97/06/12 14:22:47 leres Exp (LBL)"; #else -__RCSID("$NetBSD: gencode.c,v 1.22 2000/03/01 03:47:48 itojun Exp $"); +__RCSID("$NetBSD: gencode.c,v 1.23 2000/04/14 14:26:35 itojun Exp $"); #endif #endif @@ -1223,8 +1223,12 @@ gen_proto_abbrev(proto) b1 = gen_proto(IPPROTO_ICMP, Q_IP, Q_DEFAULT); break; +#ifndef IPPROTO_IGMP +#define IPPROTO_IGMP 2 +#endif + case Q_IGMP: - b1 = gen_proto(2, Q_IP, Q_DEFAULT); + b1 = gen_proto(IPPROTO_IGMP, Q_IP, Q_DEFAULT); break; #ifndef IPPROTO_IGRP @@ -1232,9 +1236,12 @@ gen_proto_abbrev(proto) #endif case Q_IGRP: b1 = gen_proto(IPPROTO_IGRP, Q_IP, Q_DEFAULT); - gen_and(b0, b1); break; +#ifndef IPPROTO_PIM +#define IPPROTO_PIM 103 +#endif + case Q_PIM: b1 = gen_proto(IPPROTO_PIM, Q_IP, Q_DEFAULT); #ifdef INET6 @@ -2073,8 +2080,12 @@ gen_scode(name, q) b = tmp; } freeaddrinfo(res0); - if (b == NULL) - bpf_error("unknown host '%s'", name); + if (b == NULL) { + bpf_error("unknown host '%s'%s", name, + (proto == Q_DEFAULT) + ? "" + : " for specified address family"); + } return b; #endif /*INET6*/ }