From: guy Date: Wed, 21 Feb 2001 09:33:03 +0000 (+0000) Subject: Patch from NetBSD, by Klaus Klein , to support "vrrp" X-Git-Tag: libpcap-0.7.1~94 X-Git-Url: https://git.tcpdump.org/libpcap/commitdiff_plain/cae3c555e61c716f9d613642a379ba674b909874 Patch from NetBSD, by Klaus Klein , to support "vrrp" as an IP protocol, like "udp", "tcp", "icmp", "pim", etc.. --- diff --git a/CREDITS b/CREDITS index bc2507e8..61189293 100644 --- a/CREDITS +++ b/CREDITS @@ -21,6 +21,7 @@ Additional people who have contributed patches: Igor Khristophorov Jefferson Ogata Juergen Schoenwaelder + Klaus Klein Lorenzo Cavallaro Love Hörnquist-Åstrand Monroe Williams diff --git a/gencode.c b/gencode.c index c824b61e..a033a783 100644 --- a/gencode.c +++ b/gencode.c @@ -21,7 +21,7 @@ */ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/libpcap/gencode.c,v 1.148 2001-02-12 09:33:21 itojun Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/libpcap/gencode.c,v 1.149 2001-02-21 09:33:04 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -1698,6 +1698,9 @@ gen_host(addr, mask, proto, dir) case Q_PIM: bpf_error("'pim' modifier applied to host"); + case Q_VRRP: + bpf_error("'vrrp' modifier applied to host"); + case Q_ATALK: bpf_error("ATALK host filtering not implemented"); @@ -1800,6 +1803,9 @@ gen_host6(addr, mask, proto, dir) case Q_PIM: bpf_error("'pim' modifier applied to host"); + case Q_VRRP: + bpf_error("'vrrp' modifier applied to host"); + case Q_ATALK: bpf_error("ATALK host filtering not implemented"); @@ -1963,6 +1969,14 @@ gen_proto_abbrev(proto) #endif break; +#ifndef IPPROTO_VRRP +#define IPPROTO_VRRP 112 +#endif + + case Q_VRRP: + b1 = gen_proto(IPPROTO_VRRP, Q_IP, Q_DEFAULT); + break; + case Q_IP: b1 = gen_linktype(ETHERTYPE_IP); break; @@ -2704,6 +2718,10 @@ gen_proto(v, proto, dir) bpf_error("'pim proto' is bogus"); /* NOTREACHED */ + case Q_VRRP: + bpf_error("'vrrp proto' is bogus"); + /* NOTREACHED */ + #ifdef INET6 case Q_IPV6: b0 = gen_linktype(ETHERTYPE_IPV6); @@ -3254,6 +3272,7 @@ gen_load(proto, index, size) case Q_IGMP: case Q_IGRP: case Q_PIM: + case Q_VRRP: s = new_stmt(BPF_LDX|BPF_MSH|BPF_B); s->s.k = off_nl; sappend(s, xfer_to_a(index)); diff --git a/gencode.h b/gencode.h index fa76fcbf..8dfdcb63 100644 --- a/gencode.h +++ b/gencode.h @@ -18,7 +18,7 @@ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * @(#) $Header: /tcpdump/master/libpcap/gencode.h,v 1.50 2001-01-28 09:44:49 guy Exp $ (LBL) + * @(#) $Header: /tcpdump/master/libpcap/gencode.h,v 1.51 2001-02-21 09:33:05 guy Exp $ (LBL) */ /* Address qualifiers. */ @@ -57,19 +57,20 @@ #define Q_ESP 19 #define Q_PIM 20 +#define Q_VRRP 21 -#define Q_AARP 21 +#define Q_AARP 22 -#define Q_ISO 22 -#define Q_ESIS 23 -#define Q_ISIS 24 -#define Q_CLNP 25 +#define Q_ISO 23 +#define Q_ESIS 24 +#define Q_ISIS 25 +#define Q_CLNP 26 -#define Q_STP 26 +#define Q_STP 27 -#define Q_IPX 27 +#define Q_IPX 28 -#define Q_NETBEUI 28 +#define Q_NETBEUI 29 /* Directional qualifiers. */ diff --git a/grammar.y b/grammar.y index 3b26e270..52281b42 100644 --- a/grammar.y +++ b/grammar.y @@ -22,7 +22,7 @@ */ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/libpcap/grammar.y,v 1.67 2001-01-28 09:44:50 guy Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/libpcap/grammar.y,v 1.68 2001-02-21 09:33:05 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -106,7 +106,7 @@ pcap_parse() %token DST SRC HOST GATEWAY %token NET MASK PORT LESS GREATER PROTO PROTOCHAIN BYTE -%token ARP RARP IP TCP UDP ICMP IGMP IGRP PIM +%token ARP RARP IP TCP UDP ICMP IGMP IGRP PIM VRRP %token ATALK AARP DECNET LAT SCA MOPRC MOPDL %token TK_BROADCAST TK_MULTICAST %token NUM INBOUND OUTBOUND @@ -251,6 +251,7 @@ pname: LINK { $$ = Q_LINK; } | IGMP { $$ = Q_IGMP; } | IGRP { $$ = Q_IGRP; } | PIM { $$ = Q_PIM; } + | VRRP { $$ = Q_VRRP; } | ATALK { $$ = Q_ATALK; } | AARP { $$ = Q_AARP; } | DECNET { $$ = Q_DECNET; } diff --git a/scanner.l b/scanner.l index b6ed45ac..4ebc1992 100644 --- a/scanner.l +++ b/scanner.l @@ -22,7 +22,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/libpcap/scanner.l,v 1.73 2001-01-28 09:44:50 guy Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/libpcap/scanner.l,v 1.74 2001-02-21 09:33:06 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -176,6 +176,7 @@ icmp return ICMP; igmp return IGMP; igrp return IGRP; pim return PIM; +vrrp return VRRP; ip6 return IPV6; icmp6 return ICMPV6;