diff options
Diffstat (limited to 'freebsd/contrib/libpcap/grammar.y')
-rw-r--r-- | freebsd/contrib/libpcap/grammar.y | 297 |
1 files changed, 184 insertions, 113 deletions
diff --git a/freebsd/contrib/libpcap/grammar.y b/freebsd/contrib/libpcap/grammar.y index ac69db9f..ef6a7abb 100644 --- a/freebsd/contrib/libpcap/grammar.y +++ b/freebsd/contrib/libpcap/grammar.y @@ -1,3 +1,28 @@ +/* + * We want a reentrant parser. + */ +%pure-parser + +/* + * We also want a reentrant scanner, so we have to pass the + * handle for the reentrant scanner to the parser, and the + * parser has to pass it to the lexical analyzer. + * + * We use void * rather than yyscan_t because, at least with some + * versions of Flex and Bison, if you use yyscan_t in %parse-param and + * %lex-param, you have to include scanner.h before grammar.h to get + * yyscan_t declared, and you have to include grammar.h before scanner.h + * to get YYSTYPE declared. Using void * breaks the cycle; the Flex + * documentation says yyscan_t is just a void *. + */ +%parse-param {void *yyscanner} +%lex-param {void *yyscanner} + +/* + * And we need to pass the compiler state to the scanner. + */ +%parse-param {compiler_state_t *cstate} + %{ /* * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996 @@ -21,25 +46,21 @@ * * $FreeBSD$ */ -#ifndef lint -static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/libpcap/grammar.y,v 1.101 2007-11-18 02:03:52 guy Exp $ (LBL)"; -#endif #ifdef HAVE_CONFIG_H #include "config.h" #endif -#ifdef WIN32 +#ifdef _WIN32 #include <pcap-stdinc.h> -#else /* WIN32 */ +#else /* _WIN32 */ #include <sys/types.h> #include <sys/socket.h> -#endif /* WIN32 */ +#endif /* _WIN32 */ #include <stdlib.h> -#ifndef WIN32 +#ifndef _WIN32 #if __STDC__ struct mbuf; struct rtentry; @@ -47,18 +68,22 @@ struct rtentry; #include <netinet/in.h> #include <arpa/inet.h> -#endif /* WIN32 */ +#endif /* _WIN32 */ #include <stdio.h> #include "pcap-int.h" #include "gencode.h" +#include "grammar.h" +#include "scanner.h" + #ifdef HAVE_NET_PFVAR_H #include <net/if.h> -#include <net/pfvar.h> +#include <netpfil/pf/pf.h> #include <net/if_pflog.h> #endif +#include "llc.h" #include "ieee80211.h" #include <pcap/namedb.h> @@ -133,6 +158,23 @@ static const struct tok ieee80211_data_subtypes[] = { { IEEE80211_FC0_SUBTYPE_QOS|IEEE80211_FC0_SUBTYPE_NODATA_CF_ACPL, "qos-cf-ack-poll" }, { 0, NULL } }; +static const struct tok llc_s_subtypes[] = { + { LLC_RR, "rr" }, + { LLC_RNR, "rnr" }, + { LLC_REJ, "rej" }, + { 0, NULL } +}; +static const struct tok llc_u_subtypes[] = { + { LLC_UI, "ui" }, + { LLC_UA, "ua" }, + { LLC_DISC, "disc" }, + { LLC_DM, "dm" }, + { LLC_SABME, "sabme" }, + { LLC_TEST, "test" }, + { LLC_XID, "xid" }, + { LLC_FRMR, "frmr" }, + { 0, NULL } +}; struct type2tok { int type; const struct tok *tok; @@ -156,31 +198,18 @@ str2tok(const char *str, const struct tok *toks) return (-1); } -int n_errors = 0; - static struct qual qerr = { Q_UNDEF, Q_UNDEF, Q_UNDEF, Q_UNDEF }; static void -yyerror(const char *msg) +yyerror(void *yyscanner, compiler_state_t *cstate, const char *msg) { - ++n_errors; - bpf_error("%s", msg); + bpf_syntax_error(cstate, msg); /* NOTREACHED */ } -#ifdef NEED_YYPARSE_WRAPPER -int yyparse(void); - -int -pcap_parse() -{ - return (yyparse()); -} -#endif - #ifdef HAVE_NET_PFVAR_H static int -pfreason_to_num(const char *reason) +pfreason_to_num(compiler_state_t *cstate, const char *reason) { const char *reasons[] = PFRES_NAMES; int i; @@ -189,12 +218,12 @@ pfreason_to_num(const char *reason) if (pcap_strcasecmp(reason, reasons[i]) == 0) return (i); } - bpf_error("unknown PF reason"); + bpf_error(cstate, "unknown PF reason"); /*NOTREACHED*/ } static int -pfaction_to_num(const char *action) +pfaction_to_num(compiler_state_t *cstate, const char *action) { if (pcap_strcasecmp(action, "pass") == 0 || pcap_strcasecmp(action, "accept") == 0) @@ -213,15 +242,15 @@ pfaction_to_num(const char *action) return (PF_NORDR); #endif else { - bpf_error("unknown PF action"); + bpf_error(cstate, "unknown PF action"); /*NOTREACHED*/ } } #else /* !HAVE_NET_PFVAR_H */ static int -pfreason_to_num(const char *reason) +pfreason_to_num(compiler_state_t *cstate, const char *reason) { - bpf_error("libpcap was compiled on a machine without pf support"); + bpf_error(cstate, "libpcap was compiled on a machine without pf support"); /*NOTREACHED*/ /* this is to make the VC compiler happy */ @@ -229,9 +258,9 @@ pfreason_to_num(const char *reason) } static int -pfaction_to_num(const char *action) +pfaction_to_num(compiler_state_t *cstate, const char *action) { - bpf_error("libpcap was compiled on a machine without pf support"); + bpf_error(cstate, "libpcap was compiled on a machine without pf support"); /*NOTREACHED*/ /* this is to make the VC compiler happy */ @@ -262,7 +291,7 @@ pfaction_to_num(const char *action) %type <a> arth narth %type <i> byteop pname pnum relop irelop %type <blk> and or paren not null prog -%type <rblk> other pfvar p80211 +%type <rblk> other pfvar p80211 pllc %type <i> atmtype atmmultitype %type <blk> atmfield %type <blk> atmfieldvalue atmvalue atmlistvalue @@ -286,8 +315,8 @@ pfaction_to_num(const char *action) %token LEN %token IPV6 ICMPV6 AH ESP %token VLAN MPLS -%token PPPOED PPPOES -%token ISO ESIS CLNP ISIS L1 L2 IIH LSP SNP CSNP PSNP +%token PPPOED PPPOES GENEVE +%token ISO ESIS CLNP ISIS L1 L2 IIH LSP SNP CSNP PSNP %token STP %token IPX %token NETBEUI @@ -295,8 +324,9 @@ pfaction_to_num(const char *action) %token OAM OAMF4 CONNECTMSG METACONNECT %token VPI VCI %token RADIO -%token FISU LSSU MSU -%token SIO OPC DPC SLS +%token FISU LSSU MSU HFISU HLSSU HMSU +%token SIO OPC DPC SLS HSIO HOPC HDPC HSLS + %type <s> ID %type <e> EID @@ -315,7 +345,7 @@ pfaction_to_num(const char *action) %% prog: null expr { - finish_parse($2.b); + finish_parse(cstate, $2.b); } | null ; @@ -332,48 +362,48 @@ and: AND { $$ = $<blk>0; } or: OR { $$ = $<blk>0; } ; id: nid - | pnum { $$.b = gen_ncode(NULL, (bpf_u_int32)$1, + | pnum { $$.b = gen_ncode(cstate, NULL, (bpf_u_int32)$1, $$.q = $<blk>0.q); } | paren pid ')' { $$ = $2; } ; -nid: ID { $$.b = gen_scode($1, $$.q = $<blk>0.q); } - | HID '/' NUM { $$.b = gen_mcode($1, NULL, $3, +nid: ID { $$.b = gen_scode(cstate, $1, $$.q = $<blk>0.q); } + | HID '/' NUM { $$.b = gen_mcode(cstate, $1, NULL, $3, $$.q = $<blk>0.q); } - | HID NETMASK HID { $$.b = gen_mcode($1, $3, 0, + | HID NETMASK HID { $$.b = gen_mcode(cstate, $1, $3, 0, $$.q = $<blk>0.q); } | HID { /* Decide how to parse HID based on proto */ $$.q = $<blk>0.q; if ($$.q.addr == Q_PORT) - bpf_error("'port' modifier applied to ip host"); + bpf_error(cstate, "'port' modifier applied to ip host"); else if ($$.q.addr == Q_PORTRANGE) - bpf_error("'portrange' modifier applied to ip host"); + bpf_error(cstate, "'portrange' modifier applied to ip host"); else if ($$.q.addr == Q_PROTO) - bpf_error("'proto' modifier applied to ip host"); + bpf_error(cstate, "'proto' modifier applied to ip host"); else if ($$.q.addr == Q_PROTOCHAIN) - bpf_error("'protochain' modifier applied to ip host"); - $$.b = gen_ncode($1, 0, $$.q); + bpf_error(cstate, "'protochain' modifier applied to ip host"); + $$.b = gen_ncode(cstate, $1, 0, $$.q); } | HID6 '/' NUM { #ifdef INET6 - $$.b = gen_mcode6($1, NULL, $3, + $$.b = gen_mcode6(cstate, $1, NULL, $3, $$.q = $<blk>0.q); #else - bpf_error("'ip6addr/prefixlen' not supported " + bpf_error(cstate, "'ip6addr/prefixlen' not supported " "in this configuration"); #endif /*INET6*/ } | HID6 { #ifdef INET6 - $$.b = gen_mcode6($1, 0, 128, + $$.b = gen_mcode6(cstate, $1, 0, 128, $$.q = $<blk>0.q); #else - bpf_error("'ip6addr' not supported " + bpf_error(cstate, "'ip6addr' not supported " "in this configuration"); #endif /*INET6*/ } - | EID { - $$.b = gen_ecode($1, $$.q = $<blk>0.q); + | EID { + $$.b = gen_ecode(cstate, $1, $$.q = $<blk>0.q); /* * $1 was allocated by "pcap_ether_aton()", * so we must free it now that we're done @@ -382,7 +412,7 @@ nid: ID { $$.b = gen_scode($1, $$.q = $<blk>0.q); } free($1); } | AID { - $$.b = gen_acode($1, $$.q = $<blk>0.q); + $$.b = gen_acode(cstate, $1, $$.q = $<blk>0.q); /* * $1 was allocated by "pcap_ether_aton()", * so we must free it now that we're done @@ -400,7 +430,7 @@ pid: nid | qid and id { gen_and($1.b, $3.b); $$ = $3; } | qid or id { gen_or($1.b, $3.b); $$ = $3; } ; -qid: pnum { $$.b = gen_ncode(NULL, (bpf_u_int32)$1, +qid: pnum { $$.b = gen_ncode(cstate, NULL, (bpf_u_int32)$1, $$.q = $<blk>0.q); } | pid ; @@ -416,16 +446,16 @@ head: pqual dqual aqual { QSET($$.q, $1, $2, $3); } ; rterm: head id { $$ = $2; } | paren expr ')' { $$.b = $2.b; $$.q = $1.q; } - | pname { $$.b = gen_proto_abbrev($1); $$.q = qerr; } - | arth relop arth { $$.b = gen_relation($2, $1, $3, 0); + | pname { $$.b = gen_proto_abbrev(cstate, $1); $$.q = qerr; } + | arth relop arth { $$.b = gen_relation(cstate, $2, $1, $3, 0); $$.q = qerr; } - | arth irelop arth { $$.b = gen_relation($2, $1, $3, 1); + | arth irelop arth { $$.b = gen_relation(cstate, $2, $1, $3, 1); $$.q = qerr; } | other { $$.b = $1; $$.q = qerr; } - | atmtype { $$.b = gen_atmtype_abbrev($1); $$.q = qerr; } - | atmmultitype { $$.b = gen_atmmulti_abbrev($1); $$.q = qerr; } + | atmtype { $$.b = gen_atmtype_abbrev(cstate, $1); $$.q = qerr; } + | atmmultitype { $$.b = gen_atmmulti_abbrev(cstate, $1); $$.q = qerr; } | atmfield atmvalue { $$.b = $2.b; $$.q = qerr; } - | mtp2type { $$.b = gen_mtp2type_abbrev($1); $$.q = qerr; } + | mtp2type { $$.b = gen_mtp2type_abbrev(cstate, $1); $$.q = qerr; } | mtp3field mtp3value { $$.b = $2.b; $$.q = qerr; } ; /* protocol level qualifiers */ @@ -495,50 +525,54 @@ pname: LINK { $$ = Q_LINK; } | NETBEUI { $$ = Q_NETBEUI; } | RADIO { $$ = Q_RADIO; } ; -other: pqual TK_BROADCAST { $$ = gen_broadcast($1); } - | pqual TK_MULTICAST { $$ = gen_multicast($1); } - | LESS NUM { $$ = gen_less($2); } - | GREATER NUM { $$ = gen_greater($2); } - | CBYTE NUM byteop NUM { $$ = gen_byteop($3, $2, $4); } - | INBOUND { $$ = gen_inbound(0); } - | OUTBOUND { $$ = gen_inbound(1); } - | VLAN pnum { $$ = gen_vlan($2); } - | VLAN { $$ = gen_vlan(-1); } - | MPLS pnum { $$ = gen_mpls($2); } - | MPLS { $$ = gen_mpls(-1); } - | PPPOED { $$ = gen_pppoed(); } - | PPPOES { $$ = gen_pppoes(); } +other: pqual TK_BROADCAST { $$ = gen_broadcast(cstate, $1); } + | pqual TK_MULTICAST { $$ = gen_multicast(cstate, $1); } + | LESS NUM { $$ = gen_less(cstate, $2); } + | GREATER NUM { $$ = gen_greater(cstate, $2); } + | CBYTE NUM byteop NUM { $$ = gen_byteop(cstate, $3, $2, $4); } + | INBOUND { $$ = gen_inbound(cstate, 0); } + | OUTBOUND { $$ = gen_inbound(cstate, 1); } + | VLAN pnum { $$ = gen_vlan(cstate, $2); } + | VLAN { $$ = gen_vlan(cstate, -1); } + | MPLS pnum { $$ = gen_mpls(cstate, $2); } + | MPLS { $$ = gen_mpls(cstate, -1); } + | PPPOED { $$ = gen_pppoed(cstate); } + | PPPOES pnum { $$ = gen_pppoes(cstate, $2); } + | PPPOES { $$ = gen_pppoes(cstate, -1); } + | GENEVE pnum { $$ = gen_geneve(cstate, $2); } + | GENEVE { $$ = gen_geneve(cstate, -1); } | pfvar { $$ = $1; } | pqual p80211 { $$ = $2; } + | pllc { $$ = $1; } ; -pfvar: PF_IFNAME ID { $$ = gen_pf_ifname($2); } - | PF_RSET ID { $$ = gen_pf_ruleset($2); } - | PF_RNR NUM { $$ = gen_pf_rnr($2); } - | PF_SRNR NUM { $$ = gen_pf_srnr($2); } - | PF_REASON reason { $$ = gen_pf_reason($2); } - | PF_ACTION action { $$ = gen_pf_action($2); } +pfvar: PF_IFNAME ID { $$ = gen_pf_ifname(cstate, $2); } + | PF_RSET ID { $$ = gen_pf_ruleset(cstate, $2); } + | PF_RNR NUM { $$ = gen_pf_rnr(cstate, $2); } + | PF_SRNR NUM { $$ = gen_pf_srnr(cstate, $2); } + | PF_REASON reason { $$ = gen_pf_reason(cstate, $2); } + | PF_ACTION action { $$ = gen_pf_action(cstate, $2); } ; p80211: TYPE type SUBTYPE subtype - { $$ = gen_p80211_type($2 | $4, + { $$ = gen_p80211_type(cstate, $2 | $4, IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_MASK); } - | TYPE type { $$ = gen_p80211_type($2, + | TYPE type { $$ = gen_p80211_type(cstate, $2, IEEE80211_FC0_TYPE_MASK); } - | SUBTYPE type_subtype { $$ = gen_p80211_type($2, + | SUBTYPE type_subtype { $$ = gen_p80211_type(cstate, $2, IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_MASK); } - | DIR dir { $$ = gen_p80211_fcdir($2); } + | DIR dir { $$ = gen_p80211_fcdir(cstate, $2); } ; type: NUM | ID { $$ = str2tok($1, ieee80211_types); if ($$ == -1) - bpf_error("unknown 802.11 type name"); + bpf_error(cstate, "unknown 802.11 type name"); } ; @@ -548,7 +582,7 @@ subtype: NUM for (i = 0;; i++) { if (ieee80211_type_subtypes[i].tok == NULL) { /* Ran out of types */ - bpf_error("unknown 802.11 type"); + bpf_error(cstate, "unknown 802.11 type"); break; } if ($<i>-1 == ieee80211_type_subtypes[i].type) { @@ -559,7 +593,7 @@ subtype: NUM $$ = str2tok($1, types); if ($$ == -1) - bpf_error("unknown 802.11 subtype name"); + bpf_error(cstate, "unknown 802.11 subtype name"); } ; @@ -567,7 +601,7 @@ type_subtype: ID { int i; for (i = 0;; i++) { if (ieee80211_type_subtypes[i].tok == NULL) { /* Ran out of types */ - bpf_error("unknown 802.11 type name"); + bpf_error(cstate, "unknown 802.11 type name"); break; } $$ = str2tok($1, ieee80211_type_subtypes[i].tok); @@ -579,6 +613,31 @@ type_subtype: ID { int i; } ; +pllc: LLC { $$ = gen_llc(cstate); } + | LLC ID { if (pcap_strcasecmp($2, "i") == 0) + $$ = gen_llc_i(cstate); + else if (pcap_strcasecmp($2, "s") == 0) + $$ = gen_llc_s(cstate); + else if (pcap_strcasecmp($2, "u") == 0) + $$ = gen_llc_u(cstate); + else { + int subtype; + + subtype = str2tok($2, llc_s_subtypes); + if (subtype != -1) + $$ = gen_llc_s_subtype(cstate, subtype); + else { + subtype = str2tok($2, llc_u_subtypes); + if (subtype == -1) + bpf_error(cstate, "unknown LLC type name \"%s\"", $2); + $$ = gen_llc_u_subtype(cstate, subtype); + } + } + } + /* sigh, "rnr" is already a keyword for PF */ + | LLC PF_RNR { $$ = gen_llc_s_subtype(cstate, LLC_RNR); } + ; + dir: NUM | ID { if (pcap_strcasecmp($1, "nods") == 0) $$ = IEEE80211_FC1_DIR_NODS; @@ -589,15 +648,15 @@ dir: NUM else if (pcap_strcasecmp($1, "dstods") == 0) $$ = IEEE80211_FC1_DIR_DSTODS; else - bpf_error("unknown 802.11 direction"); + bpf_error(cstate, "unknown 802.11 direction"); } ; reason: NUM { $$ = $1; } - | ID { $$ = pfreason_to_num($1); } + | ID { $$ = pfreason_to_num(cstate, $1); } ; -action: ID { $$ = pfaction_to_num($1); } +action: ID { $$ = pfaction_to_num(cstate, $1); } ; relop: '>' { $$ = BPF_JGT; } @@ -608,22 +667,24 @@ irelop: LEQ { $$ = BPF_JGT; } | '<' { $$ = BPF_JGE; } | NEQ { $$ = BPF_JEQ; } ; -arth: pnum { $$ = gen_loadi($1); } +arth: pnum { $$ = gen_loadi(cstate, $1); } | narth ; -narth: pname '[' arth ']' { $$ = gen_load($1, $3, 1); } - | pname '[' arth ':' NUM ']' { $$ = gen_load($1, $3, $5); } - | arth '+' arth { $$ = gen_arth(BPF_ADD, $1, $3); } - | arth '-' arth { $$ = gen_arth(BPF_SUB, $1, $3); } - | arth '*' arth { $$ = gen_arth(BPF_MUL, $1, $3); } - | arth '/' arth { $$ = gen_arth(BPF_DIV, $1, $3); } - | arth '&' arth { $$ = gen_arth(BPF_AND, $1, $3); } - | arth '|' arth { $$ = gen_arth(BPF_OR, $1, $3); } - | arth LSH arth { $$ = gen_arth(BPF_LSH, $1, $3); } - | arth RSH arth { $$ = gen_arth(BPF_RSH, $1, $3); } - | '-' arth %prec UMINUS { $$ = gen_neg($2); } +narth: pname '[' arth ']' { $$ = gen_load(cstate, $1, $3, 1); } + | pname '[' arth ':' NUM ']' { $$ = gen_load(cstate, $1, $3, $5); } + | arth '+' arth { $$ = gen_arth(cstate, BPF_ADD, $1, $3); } + | arth '-' arth { $$ = gen_arth(cstate, BPF_SUB, $1, $3); } + | arth '*' arth { $$ = gen_arth(cstate, BPF_MUL, $1, $3); } + | arth '/' arth { $$ = gen_arth(cstate, BPF_DIV, $1, $3); } + | arth '%' arth { $$ = gen_arth(cstate, BPF_MOD, $1, $3); } + | arth '&' arth { $$ = gen_arth(cstate, BPF_AND, $1, $3); } + | arth '|' arth { $$ = gen_arth(cstate, BPF_OR, $1, $3); } + | arth '^' arth { $$ = gen_arth(cstate, BPF_XOR, $1, $3); } + | arth LSH arth { $$ = gen_arth(cstate, BPF_LSH, $1, $3); } + | arth RSH arth { $$ = gen_arth(cstate, BPF_RSH, $1, $3); } + | '-' arth %prec UMINUS { $$ = gen_neg(cstate, $2); } | paren narth ')' { $$ = $2; } - | LEN { $$ = gen_loadlen(); } + | LEN { $$ = gen_loadlen(cstate); } ; byteop: '&' { $$ = '&'; } | '|' { $$ = '|'; } @@ -635,7 +696,6 @@ pnum: NUM | paren pnum ')' { $$ = $2; } ; atmtype: LANE { $$ = A_LANE; } - | LLC { $$ = A_LLC; } | METAC { $$ = A_METAC; } | BCC { $$ = A_BCC; } | OAMF4EC { $$ = A_OAMF4EC; } @@ -653,15 +713,15 @@ atmfield: VPI { $$.atmfieldtype = A_VPI; } | VCI { $$.atmfieldtype = A_VCI; } ; atmvalue: atmfieldvalue - | relop NUM { $$.b = gen_atmfield_code($<blk>0.atmfieldtype, (bpf_int32)$2, (bpf_u_int32)$1, 0); } - | irelop NUM { $$.b = gen_atmfield_code($<blk>0.atmfieldtype, (bpf_int32)$2, (bpf_u_int32)$1, 1); } + | relop NUM { $$.b = gen_atmfield_code(cstate, $<blk>0.atmfieldtype, (bpf_int32)$2, (bpf_u_int32)$1, 0); } + | irelop NUM { $$.b = gen_atmfield_code(cstate, $<blk>0.atmfieldtype, (bpf_int32)$2, (bpf_u_int32)$1, 1); } | paren atmlistvalue ')' { $$.b = $2.b; $$.q = qerr; } ; atmfieldvalue: NUM { $$.atmfieldtype = $<blk>0.atmfieldtype; if ($$.atmfieldtype == A_VPI || $$.atmfieldtype == A_VCI) - $$.b = gen_atmfield_code($$.atmfieldtype, (bpf_int32) $1, BPF_JEQ, 0); + $$.b = gen_atmfield_code(cstate, $$.atmfieldtype, (bpf_int32) $1, BPF_JEQ, 0); } ; atmlistvalue: atmfieldvalue @@ -671,16 +731,23 @@ atmlistvalue: atmfieldvalue mtp2type: FISU { $$ = M_FISU; } | LSSU { $$ = M_LSSU; } | MSU { $$ = M_MSU; } + | HFISU { $$ = MH_FISU; } + | HLSSU { $$ = MH_LSSU; } + | HMSU { $$ = MH_MSU; } ; /* MTP3 field types quantifier */ mtp3field: SIO { $$.mtp3fieldtype = M_SIO; } | OPC { $$.mtp3fieldtype = M_OPC; } | DPC { $$.mtp3fieldtype = M_DPC; } | SLS { $$.mtp3fieldtype = M_SLS; } + | HSIO { $$.mtp3fieldtype = MH_SIO; } + | HOPC { $$.mtp3fieldtype = MH_OPC; } + | HDPC { $$.mtp3fieldtype = MH_DPC; } + | HSLS { $$.mtp3fieldtype = MH_SLS; } ; mtp3value: mtp3fieldvalue - | relop NUM { $$.b = gen_mtp3field_code($<blk>0.mtp3fieldtype, (u_int)$2, (u_int)$1, 0); } - | irelop NUM { $$.b = gen_mtp3field_code($<blk>0.mtp3fieldtype, (u_int)$2, (u_int)$1, 1); } + | relop NUM { $$.b = gen_mtp3field_code(cstate, $<blk>0.mtp3fieldtype, (u_int)$2, (u_int)$1, 0); } + | irelop NUM { $$.b = gen_mtp3field_code(cstate, $<blk>0.mtp3fieldtype, (u_int)$2, (u_int)$1, 1); } | paren mtp3listvalue ')' { $$.b = $2.b; $$.q = qerr; } ; mtp3fieldvalue: NUM { @@ -688,8 +755,12 @@ mtp3fieldvalue: NUM { if ($$.mtp3fieldtype == M_SIO || $$.mtp3fieldtype == M_OPC || $$.mtp3fieldtype == M_DPC || - $$.mtp3fieldtype == M_SLS ) - $$.b = gen_mtp3field_code($$.mtp3fieldtype, (u_int) $1, BPF_JEQ, 0); + $$.mtp3fieldtype == M_SLS || + $$.mtp3fieldtype == MH_SIO || + $$.mtp3fieldtype == MH_OPC || + $$.mtp3fieldtype == MH_DPC || + $$.mtp3fieldtype == MH_SLS) + $$.b = gen_mtp3field_code(cstate, $$.mtp3fieldtype, (u_int) $1, BPF_JEQ, 0); } ; mtp3listvalue: mtp3fieldvalue |