3 * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996
4 * The Regents of the University of California. All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that: (1) source code distributions
8 * retain the above copyright notice and this paragraph in its entirety, (2)
9 * distributions including binary code include the above copyright notice and
10 * this paragraph in its entirety in the documentation or other materials
11 * provided with the distribution, and (3) all advertising materials mentioning
12 * features or use of this software display the following acknowledgement:
13 * ``This product includes software developed by the University of California,
14 * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
15 * the University nor the names of its contributors may be used to endorse
16 * or promote products derived from this software without specific prior
18 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
19 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
20 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
24 static const char rcsid[] _U_ =
25 "@(#) $Header: /tcpdump/master/libpcap/grammar.y,v 1.99.2.2 2007-11-18 02:04:55 guy Exp $ (LBL)";
33 #include <pcap-stdinc.h>
35 #include <sys/types.h>
36 #include <sys/socket.h>
47 #include <netinet/in.h>
55 #ifdef HAVE_NET_PFVAR_H
57 #include <net/pfvar.h>
58 #include <net/if_pflog.h>
60 #include "ieee80211.h"
61 #include <pcap/namedb.h>
63 #ifdef HAVE_OS_PROTO_H
67 #define QSET(q, p, d, a) (q).proto = (p),\
73 const char *s; /* string */
76 static const struct tok ieee80211_types[] = {
77 { IEEE80211_FC0_TYPE_DATA, "data" },
78 { IEEE80211_FC0_TYPE_MGT, "mgt" },
79 { IEEE80211_FC0_TYPE_MGT, "management" },
80 { IEEE80211_FC0_TYPE_CTL, "ctl" },
81 { IEEE80211_FC0_TYPE_CTL, "control" },
84 static const struct tok ieee80211_mgt_subtypes[] = {
85 { IEEE80211_FC0_SUBTYPE_ASSOC_REQ, "assocreq" },
86 { IEEE80211_FC0_SUBTYPE_ASSOC_REQ, "assoc-req" },
87 { IEEE80211_FC0_SUBTYPE_ASSOC_RESP, "assocresp" },
88 { IEEE80211_FC0_SUBTYPE_ASSOC_RESP, "assoc-resp" },
89 { IEEE80211_FC0_SUBTYPE_REASSOC_REQ, "reassocreq" },
90 { IEEE80211_FC0_SUBTYPE_REASSOC_REQ, "reassoc-req" },
91 { IEEE80211_FC0_SUBTYPE_REASSOC_RESP, "reassocresp" },
92 { IEEE80211_FC0_SUBTYPE_REASSOC_RESP, "reassoc-resp" },
93 { IEEE80211_FC0_SUBTYPE_PROBE_REQ, "probereq" },
94 { IEEE80211_FC0_SUBTYPE_PROBE_REQ, "probe-req" },
95 { IEEE80211_FC0_SUBTYPE_PROBE_RESP, "proberesp" },
96 { IEEE80211_FC0_SUBTYPE_PROBE_RESP, "probe-resp" },
97 { IEEE80211_FC0_SUBTYPE_BEACON, "beacon" },
98 { IEEE80211_FC0_SUBTYPE_ATIM, "atim" },
99 { IEEE80211_FC0_SUBTYPE_DISASSOC, "disassoc" },
100 { IEEE80211_FC0_SUBTYPE_DISASSOC, "disassociation" },
101 { IEEE80211_FC0_SUBTYPE_AUTH, "auth" },
102 { IEEE80211_FC0_SUBTYPE_AUTH, "authentication" },
103 { IEEE80211_FC0_SUBTYPE_DEAUTH, "deauth" },
104 { IEEE80211_FC0_SUBTYPE_DEAUTH, "deauthentication" },
107 static const struct tok ieee80211_ctl_subtypes[] = {
108 { IEEE80211_FC0_SUBTYPE_PS_POLL, "ps-poll" },
109 { IEEE80211_FC0_SUBTYPE_RTS, "rts" },
110 { IEEE80211_FC0_SUBTYPE_CTS, "cts" },
111 { IEEE80211_FC0_SUBTYPE_ACK, "ack" },
112 { IEEE80211_FC0_SUBTYPE_CF_END, "cf-end" },
113 { IEEE80211_FC0_SUBTYPE_CF_END_ACK, "cf-end-ack" },
116 static const struct tok ieee80211_data_subtypes[] = {
117 { IEEE80211_FC0_SUBTYPE_DATA, "data" },
118 { IEEE80211_FC0_SUBTYPE_CF_ACK, "data-cf-ack" },
119 { IEEE80211_FC0_SUBTYPE_CF_POLL, "data-cf-poll" },
120 { IEEE80211_FC0_SUBTYPE_CF_ACPL, "data-cf-ack-poll" },
121 { IEEE80211_FC0_SUBTYPE_NODATA, "null" },
122 { IEEE80211_FC0_SUBTYPE_NODATA_CF_ACK, "cf-ack" },
123 { IEEE80211_FC0_SUBTYPE_NODATA_CF_POLL, "cf-poll" },
124 { IEEE80211_FC0_SUBTYPE_NODATA_CF_ACPL, "cf-ack-poll" },
125 { IEEE80211_FC0_SUBTYPE_QOS|IEEE80211_FC0_SUBTYPE_DATA, "qos-data" },
126 { IEEE80211_FC0_SUBTYPE_QOS|IEEE80211_FC0_SUBTYPE_CF_ACK, "qos-data-cf-ack" },
127 { IEEE80211_FC0_SUBTYPE_QOS|IEEE80211_FC0_SUBTYPE_CF_POLL, "qos-data-cf-poll" },
128 { IEEE80211_FC0_SUBTYPE_QOS|IEEE80211_FC0_SUBTYPE_CF_ACPL, "qos-data-cf-ack-poll" },
129 { IEEE80211_FC0_SUBTYPE_QOS|IEEE80211_FC0_SUBTYPE_NODATA, "qos" },
130 { IEEE80211_FC0_SUBTYPE_QOS|IEEE80211_FC0_SUBTYPE_NODATA_CF_POLL, "qos-cf-poll" },
131 { IEEE80211_FC0_SUBTYPE_QOS|IEEE80211_FC0_SUBTYPE_NODATA_CF_ACPL, "qos-cf-ack-poll" },
136 const struct tok *tok;
138 static const struct type2tok ieee80211_type_subtypes[] = {
139 { IEEE80211_FC0_TYPE_MGT, ieee80211_mgt_subtypes },
140 { IEEE80211_FC0_TYPE_CTL, ieee80211_ctl_subtypes },
141 { IEEE80211_FC0_TYPE_DATA, ieee80211_data_subtypes },
146 str2tok(const char *str, const struct tok *toks)
150 for (i = 0; toks[i].s != NULL; i++) {
151 if (pcap_strcasecmp(toks[i].s, str) == 0)
159 static struct qual qerr = { Q_UNDEF, Q_UNDEF, Q_UNDEF, Q_UNDEF };
162 yyerror(const char *msg)
165 bpf_error("%s", msg);
179 #ifdef HAVE_NET_PFVAR_H
181 pfreason_to_num(const char *reason)
183 const char *reasons[] = PFRES_NAMES;
186 for (i = 0; reasons[i]; i++) {
187 if (pcap_strcasecmp(reason, reasons[i]) == 0)
190 bpf_error("unknown PF reason");
195 pfaction_to_num(const char *action)
197 if (pcap_strcasecmp(action, "pass") == 0 ||
198 pcap_strcasecmp(action, "accept") == 0)
200 else if (pcap_strcasecmp(action, "drop") == 0 ||
201 pcap_strcasecmp(action, "block") == 0)
203 #if HAVE_PF_NAT_THROUGH_PF_NORDR
204 else if (pcap_strcasecmp(action, "rdr") == 0)
206 else if (pcap_strcasecmp(action, "nat") == 0)
208 else if (pcap_strcasecmp(action, "binat") == 0)
210 else if (pcap_strcasecmp(action, "nordr") == 0)
214 bpf_error("unknown PF action");
218 #else /* !HAVE_NET_PFVAR_H */
220 pfreason_to_num(const char *reason)
222 bpf_error("libpcap was compiled on a machine without pf support");
225 /* this is to make the VC compiler happy */
230 pfaction_to_num(const char *action)
232 bpf_error("libpcap was compiled on a machine without pf support");
235 /* this is to make the VC compiler happy */
238 #endif /* HAVE_NET_PFVAR_H */
257 %type <blk> expr id nid pid term rterm qid
259 %type <i> pqual dqual aqual ndaqual
261 %type <i> byteop pname pnum relop irelop
262 %type <blk> and or paren not null prog
263 %type <rblk> other pfvar p80211
264 %type <i> atmtype atmmultitype
266 %type <blk> atmfieldvalue atmvalue atmlistvalue
268 %type <blk> mtp3field
269 %type <blk> mtp3fieldvalue mtp3value mtp3listvalue
272 %token DST SRC HOST GATEWAY
273 %token NET NETMASK PORT PORTRANGE LESS GREATER PROTO PROTOCHAIN CBYTE
274 %token ARP RARP IP SCTP TCP UDP ICMP IGMP IGRP PIM VRRP
275 %token ATALK AARP DECNET LAT SCA MOPRC MOPDL
276 %token TK_BROADCAST TK_MULTICAST
277 %token NUM INBOUND OUTBOUND
278 %token PF_IFNAME PF_RSET PF_RNR PF_SRNR PF_REASON PF_ACTION
279 %token TYPE SUBTYPE DIR ADDR1 ADDR2 ADDR3 ADDR4
282 %token ID EID HID HID6 AID
285 %token IPV6 ICMPV6 AH ESP
288 %token ISO ESIS CLNP ISIS L1 L2 IIH LSP SNP CSNP PSNP
292 %token LANE LLC METAC BCC SC ILMIC OAMF4EC OAMF4SC
293 %token OAM OAMF4 CONNECTMSG METACONNECT
297 %token SIO OPC DPC SLS
303 %type <i> NUM action reason type subtype type_subtype dir
320 null: /* null */ { $$.q = qerr; }
323 | expr and term { gen_and($1.b, $3.b); $$ = $3; }
324 | expr and id { gen_and($1.b, $3.b); $$ = $3; }
325 | expr or term { gen_or($1.b, $3.b); $$ = $3; }
326 | expr or id { gen_or($1.b, $3.b); $$ = $3; }
328 and: AND { $$ = $<blk>0; }
330 or: OR { $$ = $<blk>0; }
333 | pnum { $$.b = gen_ncode(NULL, (bpf_u_int32)$1,
335 | paren pid ')' { $$ = $2; }
337 nid: ID { $$.b = gen_scode($1, $$.q = $<blk>0.q); }
338 | HID '/' NUM { $$.b = gen_mcode($1, NULL, $3,
340 | HID NETMASK HID { $$.b = gen_mcode($1, $3, 0,
343 /* Decide how to parse HID based on proto */
345 if ($$.q.addr == Q_PORT)
346 bpf_error("'port' modifier applied to ip host");
347 else if ($$.q.addr == Q_PORTRANGE)
348 bpf_error("'portrange' modifier applied to ip host");
349 else if ($$.q.addr == Q_PROTO)
350 bpf_error("'proto' modifier applied to ip host");
351 else if ($$.q.addr == Q_PROTOCHAIN)
352 bpf_error("'protochain' modifier applied to ip host");
353 $$.b = gen_ncode($1, 0, $$.q);
357 $$.b = gen_mcode6($1, NULL, $3,
360 bpf_error("'ip6addr/prefixlen' not supported "
361 "in this configuration");
366 $$.b = gen_mcode6($1, 0, 128,
369 bpf_error("'ip6addr' not supported "
370 "in this configuration");
374 $$.b = gen_ecode($1, $$.q = $<blk>0.q);
376 * $1 was allocated by "pcap_ether_aton()",
377 * so we must free it now that we're done
383 $$.b = gen_acode($1, $$.q = $<blk>0.q);
385 * $1 was allocated by "pcap_ether_aton()",
386 * so we must free it now that we're done
391 | not id { gen_not($2.b); $$ = $2; }
393 not: '!' { $$ = $<blk>0; }
395 paren: '(' { $$ = $<blk>0; }
398 | qid and id { gen_and($1.b, $3.b); $$ = $3; }
399 | qid or id { gen_or($1.b, $3.b); $$ = $3; }
401 qid: pnum { $$.b = gen_ncode(NULL, (bpf_u_int32)$1,
406 | not term { gen_not($2.b); $$ = $2; }
408 head: pqual dqual aqual { QSET($$.q, $1, $2, $3); }
409 | pqual dqual { QSET($$.q, $1, $2, Q_DEFAULT); }
410 | pqual aqual { QSET($$.q, $1, Q_DEFAULT, $2); }
411 | pqual PROTO { QSET($$.q, $1, Q_DEFAULT, Q_PROTO); }
412 | pqual PROTOCHAIN { QSET($$.q, $1, Q_DEFAULT, Q_PROTOCHAIN); }
413 | pqual ndaqual { QSET($$.q, $1, Q_DEFAULT, $2); }
415 rterm: head id { $$ = $2; }
416 | paren expr ')' { $$.b = $2.b; $$.q = $1.q; }
417 | pname { $$.b = gen_proto_abbrev($1); $$.q = qerr; }
418 | arth relop arth { $$.b = gen_relation($2, $1, $3, 0);
420 | arth irelop arth { $$.b = gen_relation($2, $1, $3, 1);
422 | other { $$.b = $1; $$.q = qerr; }
423 | atmtype { $$.b = gen_atmtype_abbrev($1); $$.q = qerr; }
424 | atmmultitype { $$.b = gen_atmmulti_abbrev($1); $$.q = qerr; }
425 | atmfield atmvalue { $$.b = $2.b; $$.q = qerr; }
426 | mtp2type { $$.b = gen_mtp2type_abbrev($1); $$.q = qerr; }
427 | mtp3field mtp3value { $$.b = $2.b; $$.q = qerr; }
429 /* protocol level qualifiers */
431 | { $$ = Q_DEFAULT; }
433 /* 'direction' qualifiers */
434 dqual: SRC { $$ = Q_SRC; }
435 | DST { $$ = Q_DST; }
436 | SRC OR DST { $$ = Q_OR; }
437 | DST OR SRC { $$ = Q_OR; }
438 | SRC AND DST { $$ = Q_AND; }
439 | DST AND SRC { $$ = Q_AND; }
440 | ADDR1 { $$ = Q_ADDR1; }
441 | ADDR2 { $$ = Q_ADDR2; }
442 | ADDR3 { $$ = Q_ADDR3; }
443 | ADDR4 { $$ = Q_ADDR4; }
445 /* address type qualifiers */
446 aqual: HOST { $$ = Q_HOST; }
447 | NET { $$ = Q_NET; }
448 | PORT { $$ = Q_PORT; }
449 | PORTRANGE { $$ = Q_PORTRANGE; }
451 /* non-directional address type qualifiers */
452 ndaqual: GATEWAY { $$ = Q_GATEWAY; }
454 pname: LINK { $$ = Q_LINK; }
456 | ARP { $$ = Q_ARP; }
457 | RARP { $$ = Q_RARP; }
458 | SCTP { $$ = Q_SCTP; }
459 | TCP { $$ = Q_TCP; }
460 | UDP { $$ = Q_UDP; }
461 | ICMP { $$ = Q_ICMP; }
462 | IGMP { $$ = Q_IGMP; }
463 | IGRP { $$ = Q_IGRP; }
464 | PIM { $$ = Q_PIM; }
465 | VRRP { $$ = Q_VRRP; }
466 | ATALK { $$ = Q_ATALK; }
467 | AARP { $$ = Q_AARP; }
468 | DECNET { $$ = Q_DECNET; }
469 | LAT { $$ = Q_LAT; }
470 | SCA { $$ = Q_SCA; }
471 | MOPDL { $$ = Q_MOPDL; }
472 | MOPRC { $$ = Q_MOPRC; }
473 | IPV6 { $$ = Q_IPV6; }
474 | ICMPV6 { $$ = Q_ICMPV6; }
476 | ESP { $$ = Q_ESP; }
477 | ISO { $$ = Q_ISO; }
478 | ESIS { $$ = Q_ESIS; }
479 | ISIS { $$ = Q_ISIS; }
480 | L1 { $$ = Q_ISIS_L1; }
481 | L2 { $$ = Q_ISIS_L2; }
482 | IIH { $$ = Q_ISIS_IIH; }
483 | LSP { $$ = Q_ISIS_LSP; }
484 | SNP { $$ = Q_ISIS_SNP; }
485 | PSNP { $$ = Q_ISIS_PSNP; }
486 | CSNP { $$ = Q_ISIS_CSNP; }
487 | CLNP { $$ = Q_CLNP; }
488 | STP { $$ = Q_STP; }
489 | IPX { $$ = Q_IPX; }
490 | NETBEUI { $$ = Q_NETBEUI; }
491 | RADIO { $$ = Q_RADIO; }
493 other: pqual TK_BROADCAST { $$ = gen_broadcast($1); }
494 | pqual TK_MULTICAST { $$ = gen_multicast($1); }
495 | LESS NUM { $$ = gen_less($2); }
496 | GREATER NUM { $$ = gen_greater($2); }
497 | CBYTE NUM byteop NUM { $$ = gen_byteop($3, $2, $4); }
498 | INBOUND { $$ = gen_inbound(0); }
499 | OUTBOUND { $$ = gen_inbound(1); }
500 | VLAN pnum { $$ = gen_vlan($2); }
501 | VLAN { $$ = gen_vlan(-1); }
502 | MPLS pnum { $$ = gen_mpls($2); }
503 | MPLS { $$ = gen_mpls(-1); }
504 | PPPOED { $$ = gen_pppoed(); }
505 | PPPOES { $$ = gen_pppoes(); }
507 | pqual p80211 { $$ = $2; }
510 pfvar: PF_IFNAME ID { $$ = gen_pf_ifname($2); }
511 | PF_RSET ID { $$ = gen_pf_ruleset($2); }
512 | PF_RNR NUM { $$ = gen_pf_rnr($2); }
513 | PF_SRNR NUM { $$ = gen_pf_srnr($2); }
514 | PF_REASON reason { $$ = gen_pf_reason($2); }
515 | PF_ACTION action { $$ = gen_pf_action($2); }
518 p80211: TYPE type SUBTYPE subtype
519 { $$ = gen_p80211_type($2 | $4,
520 IEEE80211_FC0_TYPE_MASK |
521 IEEE80211_FC0_SUBTYPE_MASK);
523 | TYPE type { $$ = gen_p80211_type($2,
524 IEEE80211_FC0_TYPE_MASK);
526 | SUBTYPE type_subtype { $$ = gen_p80211_type($2,
527 IEEE80211_FC0_TYPE_MASK |
528 IEEE80211_FC0_SUBTYPE_MASK);
530 | DIR dir { $$ = gen_p80211_fcdir($2); }
534 | ID { $$ = str2tok($1, ieee80211_types);
536 bpf_error("unknown 802.11 type name");
541 | ID { const struct tok *types = NULL;
544 if (ieee80211_type_subtypes[i].tok == NULL) {
545 /* Ran out of types */
546 bpf_error("unknown 802.11 type");
549 if ($<i>-1 == ieee80211_type_subtypes[i].type) {
550 types = ieee80211_type_subtypes[i].tok;
555 $$ = str2tok($1, types);
557 bpf_error("unknown 802.11 subtype name");
561 type_subtype: ID { int i;
563 if (ieee80211_type_subtypes[i].tok == NULL) {
564 /* Ran out of types */
565 bpf_error("unknown 802.11 type name");
568 $$ = str2tok($1, ieee80211_type_subtypes[i].tok);
570 $$ |= ieee80211_type_subtypes[i].type;
578 | ID { if (pcap_strcasecmp($1, "nods") == 0)
579 $$ = IEEE80211_FC1_DIR_NODS;
580 else if (pcap_strcasecmp($1, "tods") == 0)
581 $$ = IEEE80211_FC1_DIR_TODS;
582 else if (pcap_strcasecmp($1, "fromds") == 0)
583 $$ = IEEE80211_FC1_DIR_FROMDS;
584 else if (pcap_strcasecmp($1, "dstods") == 0)
585 $$ = IEEE80211_FC1_DIR_DSTODS;
587 bpf_error("unknown 802.11 direction");
591 reason: NUM { $$ = $1; }
592 | ID { $$ = pfreason_to_num($1); }
595 action: ID { $$ = pfaction_to_num($1); }
598 relop: '>' { $$ = BPF_JGT; }
599 | GEQ { $$ = BPF_JGE; }
600 | '=' { $$ = BPF_JEQ; }
602 irelop: LEQ { $$ = BPF_JGT; }
603 | '<' { $$ = BPF_JGE; }
604 | NEQ { $$ = BPF_JEQ; }
606 arth: pnum { $$ = gen_loadi($1); }
609 narth: pname '[' arth ']' { $$ = gen_load($1, $3, 1); }
610 | pname '[' arth ':' NUM ']' { $$ = gen_load($1, $3, $5); }
611 | arth '+' arth { $$ = gen_arth(BPF_ADD, $1, $3); }
612 | arth '-' arth { $$ = gen_arth(BPF_SUB, $1, $3); }
613 | arth '*' arth { $$ = gen_arth(BPF_MUL, $1, $3); }
614 | arth '/' arth { $$ = gen_arth(BPF_DIV, $1, $3); }
615 | arth '&' arth { $$ = gen_arth(BPF_AND, $1, $3); }
616 | arth '|' arth { $$ = gen_arth(BPF_OR, $1, $3); }
617 | arth LSH arth { $$ = gen_arth(BPF_LSH, $1, $3); }
618 | arth RSH arth { $$ = gen_arth(BPF_RSH, $1, $3); }
619 | '-' arth %prec UMINUS { $$ = gen_neg($2); }
620 | paren narth ')' { $$ = $2; }
621 | LEN { $$ = gen_loadlen(); }
623 byteop: '&' { $$ = '&'; }
630 | paren pnum ')' { $$ = $2; }
632 atmtype: LANE { $$ = A_LANE; }
633 | LLC { $$ = A_LLC; }
634 | METAC { $$ = A_METAC; }
635 | BCC { $$ = A_BCC; }
636 | OAMF4EC { $$ = A_OAMF4EC; }
637 | OAMF4SC { $$ = A_OAMF4SC; }
639 | ILMIC { $$ = A_ILMIC; }
641 atmmultitype: OAM { $$ = A_OAM; }
642 | OAMF4 { $$ = A_OAMF4; }
643 | CONNECTMSG { $$ = A_CONNECTMSG; }
644 | METACONNECT { $$ = A_METACONNECT; }
646 /* ATM field types quantifier */
647 atmfield: VPI { $$.atmfieldtype = A_VPI; }
648 | VCI { $$.atmfieldtype = A_VCI; }
650 atmvalue: atmfieldvalue
651 | relop NUM { $$.b = gen_atmfield_code($<blk>0.atmfieldtype, (bpf_int32)$2, (bpf_u_int32)$1, 0); }
652 | irelop NUM { $$.b = gen_atmfield_code($<blk>0.atmfieldtype, (bpf_int32)$2, (bpf_u_int32)$1, 1); }
653 | paren atmlistvalue ')' { $$.b = $2.b; $$.q = qerr; }
656 $$.atmfieldtype = $<blk>0.atmfieldtype;
657 if ($$.atmfieldtype == A_VPI ||
658 $$.atmfieldtype == A_VCI)
659 $$.b = gen_atmfield_code($$.atmfieldtype, (bpf_int32) $1, BPF_JEQ, 0);
662 atmlistvalue: atmfieldvalue
663 | atmlistvalue or atmfieldvalue { gen_or($1.b, $3.b); $$ = $3; }
665 /* MTP2 types quantifier */
666 mtp2type: FISU { $$ = M_FISU; }
667 | LSSU { $$ = M_LSSU; }
668 | MSU { $$ = M_MSU; }
670 /* MTP3 field types quantifier */
671 mtp3field: SIO { $$.mtp3fieldtype = M_SIO; }
672 | OPC { $$.mtp3fieldtype = M_OPC; }
673 | DPC { $$.mtp3fieldtype = M_DPC; }
674 | SLS { $$.mtp3fieldtype = M_SLS; }
676 mtp3value: mtp3fieldvalue
677 | relop NUM { $$.b = gen_mtp3field_code($<blk>0.mtp3fieldtype, (u_int)$2, (u_int)$1, 0); }
678 | irelop NUM { $$.b = gen_mtp3field_code($<blk>0.mtp3fieldtype, (u_int)$2, (u_int)$1, 1); }
679 | paren mtp3listvalue ')' { $$.b = $2.b; $$.q = qerr; }
681 mtp3fieldvalue: NUM {
682 $$.mtp3fieldtype = $<blk>0.mtp3fieldtype;
683 if ($$.mtp3fieldtype == M_SIO ||
684 $$.mtp3fieldtype == M_OPC ||
685 $$.mtp3fieldtype == M_DPC ||
686 $$.mtp3fieldtype == M_SLS )
687 $$.b = gen_mtp3field_code($$.mtp3fieldtype, (u_int) $1, BPF_JEQ, 0);
690 mtp3listvalue: mtp3fieldvalue
691 | mtp3listvalue or mtp3fieldvalue { gen_or($1.b, $3.b); $$ = $3; }