Deleted Added
full compact
22c22
< * $FreeBSD: head/contrib/libpcap/grammar.y 162015 2006-09-04 19:54:21Z sam $
---
> * $FreeBSD: head/contrib/libpcap/grammar.y 172680 2007-10-16 02:07:55Z mlaier $
26c26
< "@(#) $Header: /tcpdump/master/libpcap/grammar.y,v 1.86.2.5 2005/09/05 09:08:06 guy Exp $ (LBL)";
---
> "@(#) $Header: /tcpdump/master/libpcap/grammar.y,v 1.86.2.9 2007/09/12 19:17:25 guy Exp $ (LBL)";
56c56,60
< #include "pf.h"
---
> #ifdef HAVE_NET_PFVAR_H
> #include <net/if.h>
> #include <net/pfvar.h>
> #include <net/if_pflog.h>
> #endif
72c76
< yyerror(char *msg)
---
> yyerror(const char *msg)
88a93,136
> #ifdef HAVE_NET_PFVAR_H
> static int
> pfreason_to_num(const char *reason)
> {
> const char *reasons[] = PFRES_NAMES;
> int i;
>
> for (i = 0; reasons[i]; i++) {
> if (pcap_strcasecmp(reason, reasons[i]) == 0)
> return (i);
> }
> bpf_error("unknown PF reason");
> /*NOTREACHED*/
> }
>
> static int
> pfaction_to_num(const char *action)
> {
> if (pcap_strcasecmp(action, "pass") == 0 ||
> pcap_strcasecmp(action, "accept") == 0)
> return (PF_PASS);
> else if (pcap_strcasecmp(action, "drop") == 0 ||
> pcap_strcasecmp(action, "block") == 0)
> return (PF_DROP);
> else {
> bpf_error("unknown PF action");
> /*NOTREACHED*/
> }
> }
> #else /* !HAVE_NET_PFVAR_H */
> static int
> pfreason_to_num(const char *reason)
> {
> bpf_error("libpcap was compiled on a machine without pf support");
> /*NOTREACHED*/
> }
>
> static int
> pfaction_to_num(const char *action)
> {
> bpf_error("libpcap was compiled on a machine without pf support");
> /*NOTREACHED*/
> }
> #endif /* HAVE_NET_PFVAR_H */
117,118c165,167
< %type <blk> mtp3field
< %type <blk> mtp3fieldvalue mtp3value mtp3listvalue
---
> %type <i> mtp2type
> %type <blk> mtp3field
> %type <blk> mtp3fieldvalue mtp3value mtp3listvalue
144c193,194
< %token SIO OPC DPC SLS
---
> %token FISU LSSU MSU
> %token SIO OPC DPC SLS
264a315
> | mtp2type { $$.b = gen_mtp2type_abbrev($1); $$.q = qerr; }
352,362c403
< | ID { const char *reasons[] = PFRES_NAMES;
< int i;
< for (i = 0; reasons[i]; i++) {
< if (pcap_strcasecmp($1, reasons[i]) == 0) {
< $$ = i;
< break;
< }
< }
< if (reasons[i] == NULL)
< bpf_error("unknown PF reason");
< }
---
> | ID { $$ = pfreason_to_num($1); }
365,373c406
< action: ID { if (pcap_strcasecmp($1, "pass") == 0 ||
< pcap_strcasecmp($1, "accept") == 0)
< $$ = PF_PASS;
< else if (pcap_strcasecmp($1, "drop") == 0 ||
< pcap_strcasecmp($1, "block") == 0)
< $$ = PF_DROP;
< else
< bpf_error("unknown PF action");
< }
---
> action: ID { $$ = pfaction_to_num($1); }
442a476,480
> /* MTP2 types quantifier */
> mtp2type: FISU { $$ = M_FISU; }
> | LSSU { $$ = M_LSSU; }
> | MSU { $$ = M_MSU; }
> ;