Allow "carp" to be used as a filter, rather than requiring "ip proto
112" or one of "ip proto {vrrp,carp}" depending on whether you're
running an OS that chooses to have 112 as CARP rather than VRRP in
/etc/protocols. (Yes, that means that "carp" will capture VRRP
packets. So it goes....)
Reviewed-By: Guy Harris <[email protected]>
case Q_VRRP:
bpf_error("'vrrp' modifier applied to %s", typestr);
case Q_VRRP:
bpf_error("'vrrp' modifier applied to %s", typestr);
+ case Q_CARP:
+ bpf_error("'carp' modifier applied to %s", typestr);
+
case Q_ATALK:
bpf_error("ATALK host filtering not implemented");
case Q_ATALK:
bpf_error("ATALK host filtering not implemented");
case Q_VRRP:
bpf_error("'vrrp' modifier applied to %s", typestr);
case Q_VRRP:
bpf_error("'vrrp' modifier applied to %s", typestr);
+ case Q_CARP:
+ bpf_error("'carp' modifier applied to %s", typestr);
+
case Q_ATALK:
bpf_error("ATALK host filtering not implemented");
case Q_ATALK:
bpf_error("ATALK host filtering not implemented");
b1 = gen_proto(IPPROTO_VRRP, Q_IP, Q_DEFAULT);
break;
b1 = gen_proto(IPPROTO_VRRP, Q_IP, Q_DEFAULT);
break;
+#ifndef IPPROTO_CARP
+#define IPPROTO_CARP 112
+#endif
+
+ case Q_CARP:
+ b1 = gen_proto(IPPROTO_CARP, Q_IP, Q_DEFAULT);
+ break;
+
case Q_IP:
b1 = gen_linktype(ETHERTYPE_IP);
break;
case Q_IP:
b1 = gen_linktype(ETHERTYPE_IP);
break;
bpf_error("'vrrp proto' is bogus");
/* NOTREACHED */
bpf_error("'vrrp proto' is bogus");
/* NOTREACHED */
+ case Q_CARP:
+ bpf_error("'carp proto' is bogus");
+ /* NOTREACHED */
+
#ifdef INET6
case Q_IPV6:
b0 = gen_linktype(ETHERTYPE_IPV6);
#ifdef INET6
case Q_IPV6:
b0 = gen_linktype(ETHERTYPE_IPV6);
case Q_IGRP:
case Q_PIM:
case Q_VRRP:
case Q_IGRP:
case Q_PIM:
case Q_VRRP:
/*
* The offset is relative to the beginning of
* the transport-layer header.
/*
* The offset is relative to the beginning of
* the transport-layer header.
/* Directional qualifiers. */
#define Q_SRC 1
/* Directional qualifiers. */
#define Q_SRC 1
%token DST SRC HOST GATEWAY
%token NET NETMASK PORT PORTRANGE LESS GREATER PROTO PROTOCHAIN CBYTE
%token DST SRC HOST GATEWAY
%token NET NETMASK PORT PORTRANGE LESS GREATER PROTO PROTOCHAIN CBYTE
-%token ARP RARP IP SCTP TCP UDP ICMP IGMP IGRP PIM VRRP
+%token ARP RARP IP SCTP TCP UDP ICMP IGMP IGRP PIM VRRP CARP
%token ATALK AARP DECNET LAT SCA MOPRC MOPDL
%token TK_BROADCAST TK_MULTICAST
%token NUM INBOUND OUTBOUND
%token ATALK AARP DECNET LAT SCA MOPRC MOPDL
%token TK_BROADCAST TK_MULTICAST
%token NUM INBOUND OUTBOUND
| IGRP { $$ = Q_IGRP; }
| PIM { $$ = Q_PIM; }
| VRRP { $$ = Q_VRRP; }
| IGRP { $$ = Q_IGRP; }
| PIM { $$ = Q_PIM; }
| VRRP { $$ = Q_VRRP; }
+ | CARP { $$ = Q_CARP; }
| ATALK { $$ = Q_ATALK; }
| AARP { $$ = Q_AARP; }
| DECNET { $$ = Q_DECNET; }
| ATALK { $$ = Q_ATALK; }
| AARP { $$ = Q_AARP; }
| DECNET { $$ = Q_DECNET; }
igrp return IGRP;
pim return PIM;
vrrp return VRRP;
igrp return IGRP;
pim return PIM;
vrrp return VRRP;
radio return RADIO;
ip6 {
radio return RADIO;
ip6 {