libnl  3.6.0
ematch_syntax.c
1 /* A Bison parser, made by GNU Bison 3.7.6. */
2 
3 /* Bison implementation for Yacc-like parsers in C
4 
5  Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation,
6  Inc.
7 
8  This program is free software: you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation, either version 3 of the License, or
11  (at your option) any later version.
12 
13  This program is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with this program. If not, see <https://www.gnu.org/licenses/>. */
20 
21 /* As a special exception, you may create a larger work that contains
22  part or all of the Bison parser skeleton and distribute that work
23  under terms of your choice, so long as that work isn't itself a
24  parser generator using the skeleton or a modified version thereof
25  as a parser skeleton. Alternatively, if you modify or redistribute
26  the parser skeleton itself, you may (at your option) remove this
27  special exception, which will cause the skeleton and the resulting
28  Bison output files to be licensed under the GNU General Public
29  License without this special exception.
30 
31  This special exception was added by the Free Software Foundation in
32  version 2.2 of Bison. */
33 
34 /* C LALR(1) parser skeleton written by Richard Stallman, by
35  simplifying the original so-called "semantic" parser. */
36 
37 /* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
38  especially those whose name start with YY_ or yy_. They are
39  private implementation details that can be changed or removed. */
40 
41 /* All symbols defined below should begin with yy or YY, to avoid
42  infringing on user name space. This should be done even for local
43  variables, as they might otherwise be expanded by user macros.
44  There are some unavoidable exceptions within include files to
45  define necessary library symbols; they are noted "INFRINGES ON
46  USER NAME SPACE" below. */
47 
48 /* Identify Bison output, and Bison version. */
49 #define YYBISON 30706
50 
51 /* Bison version string. */
52 #define YYBISON_VERSION "3.7.6"
53 
54 /* Skeleton name. */
55 #define YYSKELETON_NAME "yacc.c"
56 
57 /* Pure parsers. */
58 #define YYPURE 1
59 
60 /* Push parsers. */
61 #define YYPUSH 0
62 
63 /* Pull parsers. */
64 #define YYPULL 1
65 
66 
67 /* Substitute the variable and function names. */
68 #define yyparse ematch_parse
69 #define yylex ematch_lex
70 #define yyerror ematch_error
71 #define yydebug ematch_debug
72 #define yynerrs ematch_nerrs
73 
74 /* First part of user prologue. */
75 #line 6 "lib/route/cls/ematch_syntax.y"
76 
77 #include <netlink-private/netlink.h>
78 #include <netlink-private/tc.h>
79 #include <netlink/netlink.h>
80 #include <netlink/utils.h>
81 #include <netlink/route/pktloc.h>
82 #include <netlink/route/cls/ematch.h>
83 #include <netlink/route/cls/ematch/cmp.h>
84 #include <netlink/route/cls/ematch/nbyte.h>
85 #include <netlink/route/cls/ematch/text.h>
86 #include <netlink/route/cls/ematch/meta.h>
87 #include <linux/tc_ematch/tc_em_meta.h>
88 #include <linux/tc_ematch/tc_em_cmp.h>
89 
90 #define META_ALLOC rtnl_meta_value_alloc_id
91 #define META_ID(name) TCF_META_ID_##name
92 #define META_INT TCF_META_TYPE_INT
93 #define META_VAR TCF_META_TYPE_VAR
94 
95 #line 96 "lib/route/cls/ematch_syntax.c"
96 
97 # ifndef YY_CAST
98 # ifdef __cplusplus
99 # define YY_CAST(Type, Val) static_cast<Type> (Val)
100 # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
101 # else
102 # define YY_CAST(Type, Val) ((Type) (Val))
103 # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
104 # endif
105 # endif
106 # ifndef YY_NULLPTR
107 # if defined __cplusplus
108 # if 201103L <= __cplusplus
109 # define YY_NULLPTR nullptr
110 # else
111 # define YY_NULLPTR 0
112 # endif
113 # else
114 # define YY_NULLPTR ((void*)0)
115 # endif
116 # endif
117 
118 #include "ematch_syntax.h"
119 /* Symbol kind. */
120 enum yysymbol_kind_t
121 {
122  YYSYMBOL_YYEMPTY = -2,
123  YYSYMBOL_YYEOF = 0, /* "end of file" */
124  YYSYMBOL_YYerror = 1, /* error */
125  YYSYMBOL_YYUNDEF = 2, /* "invalid token" */
126  YYSYMBOL_ERROR = 3, /* ERROR */
127  YYSYMBOL_LOGIC = 4, /* LOGIC */
128  YYSYMBOL_NOT = 5, /* NOT */
129  YYSYMBOL_OPERAND = 6, /* OPERAND */
130  YYSYMBOL_NUMBER = 7, /* NUMBER */
131  YYSYMBOL_ALIGN = 8, /* ALIGN */
132  YYSYMBOL_LAYER = 9, /* LAYER */
133  YYSYMBOL_KW_OPEN = 10, /* "(" */
134  YYSYMBOL_KW_CLOSE = 11, /* ")" */
135  YYSYMBOL_KW_PLUS = 12, /* "+" */
136  YYSYMBOL_KW_MASK = 13, /* "mask" */
137  YYSYMBOL_KW_SHIFT = 14, /* ">>" */
138  YYSYMBOL_KW_AT = 15, /* "at" */
139  YYSYMBOL_EMATCH_CMP = 16, /* "cmp" */
140  YYSYMBOL_EMATCH_NBYTE = 17, /* "pattern" */
141  YYSYMBOL_EMATCH_TEXT = 18, /* "text" */
142  YYSYMBOL_EMATCH_META = 19, /* "meta" */
143  YYSYMBOL_KW_EQ = 20, /* "=" */
144  YYSYMBOL_KW_GT = 21, /* ">" */
145  YYSYMBOL_KW_LT = 22, /* "<" */
146  YYSYMBOL_KW_FROM = 23, /* "from" */
147  YYSYMBOL_KW_TO = 24, /* "to" */
148  YYSYMBOL_META_RANDOM = 25, /* "random" */
149  YYSYMBOL_META_LOADAVG_0 = 26, /* "loadavg_0" */
150  YYSYMBOL_META_LOADAVG_1 = 27, /* "loadavg_1" */
151  YYSYMBOL_META_LOADAVG_2 = 28, /* "loadavg_2" */
152  YYSYMBOL_META_DEV = 29, /* "dev" */
153  YYSYMBOL_META_PRIO = 30, /* "prio" */
154  YYSYMBOL_META_PROTO = 31, /* "proto" */
155  YYSYMBOL_META_PKTTYPE = 32, /* "pkttype" */
156  YYSYMBOL_META_PKTLEN = 33, /* "pktlen" */
157  YYSYMBOL_META_DATALEN = 34, /* "datalen" */
158  YYSYMBOL_META_MACLEN = 35, /* "maclen" */
159  YYSYMBOL_META_MARK = 36, /* "mark" */
160  YYSYMBOL_META_TCINDEX = 37, /* "tcindex" */
161  YYSYMBOL_META_RTCLASSID = 38, /* "rtclassid" */
162  YYSYMBOL_META_RTIIF = 39, /* "rtiif" */
163  YYSYMBOL_META_SK_FAMILY = 40, /* "sk_family" */
164  YYSYMBOL_META_SK_STATE = 41, /* "sk_state" */
165  YYSYMBOL_META_SK_REUSE = 42, /* "sk_reuse" */
166  YYSYMBOL_META_SK_REFCNT = 43, /* "sk_refcnt" */
167  YYSYMBOL_META_SK_RCVBUF = 44, /* "sk_rcvbuf" */
168  YYSYMBOL_META_SK_SNDBUF = 45, /* "sk_sndbuf" */
169  YYSYMBOL_META_SK_SHUTDOWN = 46, /* "sk_shutdown" */
170  YYSYMBOL_META_SK_PROTO = 47, /* "sk_proto" */
171  YYSYMBOL_META_SK_TYPE = 48, /* "sk_type" */
172  YYSYMBOL_META_SK_RMEM_ALLOC = 49, /* "sk_rmem_alloc" */
173  YYSYMBOL_META_SK_WMEM_ALLOC = 50, /* "sk_wmem_alloc" */
174  YYSYMBOL_META_SK_WMEM_QUEUED = 51, /* "sk_wmem_queued" */
175  YYSYMBOL_META_SK_RCV_QLEN = 52, /* "sk_rcv_qlen" */
176  YYSYMBOL_META_SK_SND_QLEN = 53, /* "sk_snd_qlen" */
177  YYSYMBOL_META_SK_ERR_QLEN = 54, /* "sk_err_qlen" */
178  YYSYMBOL_META_SK_FORWARD_ALLOCS = 55, /* "sk_forward_allocs" */
179  YYSYMBOL_META_SK_ALLOCS = 56, /* "sk_allocs" */
180  YYSYMBOL_META_SK_ROUTE_CAPS = 57, /* "sk_route_caps" */
181  YYSYMBOL_META_SK_HASH = 58, /* "sk_hash" */
182  YYSYMBOL_META_SK_LINGERTIME = 59, /* "sk_lingertime" */
183  YYSYMBOL_META_SK_ACK_BACKLOG = 60, /* "sk_ack_backlog" */
184  YYSYMBOL_META_SK_MAX_ACK_BACKLOG = 61, /* "sk_max_ack_backlog" */
185  YYSYMBOL_META_SK_PRIO = 62, /* "sk_prio" */
186  YYSYMBOL_META_SK_RCVLOWAT = 63, /* "sk_rcvlowat" */
187  YYSYMBOL_META_SK_RCVTIMEO = 64, /* "sk_rcvtimeo" */
188  YYSYMBOL_META_SK_SNDTIMEO = 65, /* "sk_sndtimeo" */
189  YYSYMBOL_META_SK_SENDMSG_OFF = 66, /* "sk_sendmsg_off" */
190  YYSYMBOL_META_SK_WRITE_PENDING = 67, /* "sk_write_pending" */
191  YYSYMBOL_META_VLAN = 68, /* "vlan" */
192  YYSYMBOL_META_RXHASH = 69, /* "rxhash" */
193  YYSYMBOL_META_DEVNAME = 70, /* "devname" */
194  YYSYMBOL_META_SK_BOUND_IF = 71, /* "sk_bound_if" */
195  YYSYMBOL_STR = 72, /* STR */
196  YYSYMBOL_QUOTED = 73, /* QUOTED */
197  YYSYMBOL_YYACCEPT = 74, /* $accept */
198  YYSYMBOL_input = 75, /* input */
199  YYSYMBOL_expr = 76, /* expr */
200  YYSYMBOL_match = 77, /* match */
201  YYSYMBOL_ematch = 78, /* ematch */
202  YYSYMBOL_cmp_match = 79, /* cmp_match */
203  YYSYMBOL_cmp_expr = 80, /* cmp_expr */
204  YYSYMBOL_text_from = 81, /* text_from */
205  YYSYMBOL_text_to = 82, /* text_to */
206  YYSYMBOL_meta_value = 83, /* meta_value */
207  YYSYMBOL_meta_int_id = 84, /* meta_int_id */
208  YYSYMBOL_meta_var_id = 85, /* meta_var_id */
209  YYSYMBOL_pattern = 86, /* pattern */
210  YYSYMBOL_pktloc = 87, /* pktloc */
211  YYSYMBOL_align = 88, /* align */
212  YYSYMBOL_mask = 89, /* mask */
213  YYSYMBOL_shift = 90, /* shift */
214  YYSYMBOL_operand = 91 /* operand */
215 };
216 typedef enum yysymbol_kind_t yysymbol_kind_t;
217 
218 
219 /* Second part of user prologue. */
220 #line 46 "lib/route/cls/ematch_syntax.y"
221 
222 extern int ematch_lex(YYSTYPE *, void *);
223 
224 #define ematch_error yyerror
225 static void yyerror(void *scanner, char **errp, struct nl_list_head *root, const char *msg)
226 {
227  if (msg)
228  *errp = strdup(msg);
229  else
230  *errp = NULL;
231 }
232 
233 #line 234 "lib/route/cls/ematch_syntax.c"
234 
235 
236 #ifdef short
237 # undef short
238 #endif
239 
240 /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
241  <limits.h> and (if available) <stdint.h> are included
242  so that the code can choose integer types of a good width. */
243 
244 #ifndef __PTRDIFF_MAX__
245 # include <limits.h> /* INFRINGES ON USER NAME SPACE */
246 # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
247 # include <stdint.h> /* INFRINGES ON USER NAME SPACE */
248 # define YY_STDINT_H
249 # endif
250 #endif
251 
252 /* Narrow types that promote to a signed type and that can represent a
253  signed or unsigned integer of at least N bits. In tables they can
254  save space and decrease cache pressure. Promoting to a signed type
255  helps avoid bugs in integer arithmetic. */
256 
257 #ifdef __INT_LEAST8_MAX__
258 typedef __INT_LEAST8_TYPE__ yytype_int8;
259 #elif defined YY_STDINT_H
260 typedef int_least8_t yytype_int8;
261 #else
262 typedef signed char yytype_int8;
263 #endif
264 
265 #ifdef __INT_LEAST16_MAX__
266 typedef __INT_LEAST16_TYPE__ yytype_int16;
267 #elif defined YY_STDINT_H
268 typedef int_least16_t yytype_int16;
269 #else
270 typedef short yytype_int16;
271 #endif
272 
273 /* Work around bug in HP-UX 11.23, which defines these macros
274  incorrectly for preprocessor constants. This workaround can likely
275  be removed in 2023, as HPE has promised support for HP-UX 11.23
276  (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of
277  <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>. */
278 #ifdef __hpux
279 # undef UINT_LEAST8_MAX
280 # undef UINT_LEAST16_MAX
281 # define UINT_LEAST8_MAX 255
282 # define UINT_LEAST16_MAX 65535
283 #endif
284 
285 #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
286 typedef __UINT_LEAST8_TYPE__ yytype_uint8;
287 #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
288  && UINT_LEAST8_MAX <= INT_MAX)
289 typedef uint_least8_t yytype_uint8;
290 #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
291 typedef unsigned char yytype_uint8;
292 #else
293 typedef short yytype_uint8;
294 #endif
295 
296 #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
297 typedef __UINT_LEAST16_TYPE__ yytype_uint16;
298 #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
299  && UINT_LEAST16_MAX <= INT_MAX)
300 typedef uint_least16_t yytype_uint16;
301 #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
302 typedef unsigned short yytype_uint16;
303 #else
304 typedef int yytype_uint16;
305 #endif
306 
307 #ifndef YYPTRDIFF_T
308 # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
309 # define YYPTRDIFF_T __PTRDIFF_TYPE__
310 # define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
311 # elif defined PTRDIFF_MAX
312 # ifndef ptrdiff_t
313 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
314 # endif
315 # define YYPTRDIFF_T ptrdiff_t
316 # define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
317 # else
318 # define YYPTRDIFF_T long
319 # define YYPTRDIFF_MAXIMUM LONG_MAX
320 # endif
321 #endif
322 
323 #ifndef YYSIZE_T
324 # ifdef __SIZE_TYPE__
325 # define YYSIZE_T __SIZE_TYPE__
326 # elif defined size_t
327 # define YYSIZE_T size_t
328 # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
329 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
330 # define YYSIZE_T size_t
331 # else
332 # define YYSIZE_T unsigned
333 # endif
334 #endif
335 
336 #define YYSIZE_MAXIMUM \
337  YY_CAST (YYPTRDIFF_T, \
338  (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \
339  ? YYPTRDIFF_MAXIMUM \
340  : YY_CAST (YYSIZE_T, -1)))
341 
342 #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
343 
344 
345 /* Stored state numbers (used for stacks). */
346 typedef yytype_int8 yy_state_t;
347 
348 /* State numbers in computations. */
349 typedef int yy_state_fast_t;
350 
351 #ifndef YY_
352 # if defined YYENABLE_NLS && YYENABLE_NLS
353 # if ENABLE_NLS
354 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
355 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
356 # endif
357 # endif
358 # ifndef YY_
359 # define YY_(Msgid) Msgid
360 # endif
361 #endif
362 
363 
364 #ifndef YY_ATTRIBUTE_PURE
365 # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
366 # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
367 # else
368 # define YY_ATTRIBUTE_PURE
369 # endif
370 #endif
371 
372 #ifndef YY_ATTRIBUTE_UNUSED
373 # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
374 # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
375 # else
376 # define YY_ATTRIBUTE_UNUSED
377 # endif
378 #endif
379 
380 /* Suppress unused-variable warnings by "using" E. */
381 #if ! defined lint || defined __GNUC__
382 # define YY_USE(E) ((void) (E))
383 #else
384 # define YY_USE(E) /* empty */
385 #endif
386 
387 #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
388 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
389 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
390  _Pragma ("GCC diagnostic push") \
391  _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
392  _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
393 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
394  _Pragma ("GCC diagnostic pop")
395 #else
396 # define YY_INITIAL_VALUE(Value) Value
397 #endif
398 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
399 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
400 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
401 #endif
402 #ifndef YY_INITIAL_VALUE
403 # define YY_INITIAL_VALUE(Value) /* Nothing. */
404 #endif
405 
406 #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
407 # define YY_IGNORE_USELESS_CAST_BEGIN \
408  _Pragma ("GCC diagnostic push") \
409  _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
410 # define YY_IGNORE_USELESS_CAST_END \
411  _Pragma ("GCC diagnostic pop")
412 #endif
413 #ifndef YY_IGNORE_USELESS_CAST_BEGIN
414 # define YY_IGNORE_USELESS_CAST_BEGIN
415 # define YY_IGNORE_USELESS_CAST_END
416 #endif
417 
418 
419 #define YY_ASSERT(E) ((void) (0 && (E)))
420 
421 #if 1
422 
423 /* The parser invokes alloca or malloc; define the necessary symbols. */
424 
425 # ifdef YYSTACK_USE_ALLOCA
426 # if YYSTACK_USE_ALLOCA
427 # ifdef __GNUC__
428 # define YYSTACK_ALLOC __builtin_alloca
429 # elif defined __BUILTIN_VA_ARG_INCR
430 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
431 # elif defined _AIX
432 # define YYSTACK_ALLOC __alloca
433 # elif defined _MSC_VER
434 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
435 # define alloca _alloca
436 # else
437 # define YYSTACK_ALLOC alloca
438 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
439 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
440  /* Use EXIT_SUCCESS as a witness for stdlib.h. */
441 # ifndef EXIT_SUCCESS
442 # define EXIT_SUCCESS 0
443 # endif
444 # endif
445 # endif
446 # endif
447 # endif
448 
449 # ifdef YYSTACK_ALLOC
450  /* Pacify GCC's 'empty if-body' warning. */
451 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
452 # ifndef YYSTACK_ALLOC_MAXIMUM
453  /* The OS might guarantee only one guard page at the bottom of the stack,
454  and a page size can be as small as 4096 bytes. So we cannot safely
455  invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
456  to allow for a few compiler-allocated temporary stack slots. */
457 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
458 # endif
459 # else
460 # define YYSTACK_ALLOC YYMALLOC
461 # define YYSTACK_FREE YYFREE
462 # ifndef YYSTACK_ALLOC_MAXIMUM
463 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
464 # endif
465 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
466  && ! ((defined YYMALLOC || defined malloc) \
467  && (defined YYFREE || defined free)))
468 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
469 # ifndef EXIT_SUCCESS
470 # define EXIT_SUCCESS 0
471 # endif
472 # endif
473 # ifndef YYMALLOC
474 # define YYMALLOC malloc
475 # if ! defined malloc && ! defined EXIT_SUCCESS
476 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
477 # endif
478 # endif
479 # ifndef YYFREE
480 # define YYFREE free
481 # if ! defined free && ! defined EXIT_SUCCESS
482 void free (void *); /* INFRINGES ON USER NAME SPACE */
483 # endif
484 # endif
485 # endif
486 #endif /* 1 */
487 
488 #if (! defined yyoverflow \
489  && (! defined __cplusplus \
490  || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
491 
492 /* A type that is properly aligned for any stack member. */
493 union yyalloc
494 {
495  yy_state_t yyss_alloc;
496  YYSTYPE yyvs_alloc;
497 };
498 
499 /* The size of the maximum gap between one aligned stack and the next. */
500 # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
501 
502 /* The size of an array large to enough to hold all stacks, each with
503  N elements. */
504 # define YYSTACK_BYTES(N) \
505  ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
506  + YYSTACK_GAP_MAXIMUM)
507 
508 # define YYCOPY_NEEDED 1
509 
510 /* Relocate STACK from its old location to the new one. The
511  local variables YYSIZE and YYSTACKSIZE give the old and new number of
512  elements in the stack, and YYPTR gives the new location of the
513  stack. Advance YYPTR to a properly aligned location for the next
514  stack. */
515 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
516  do \
517  { \
518  YYPTRDIFF_T yynewbytes; \
519  YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
520  Stack = &yyptr->Stack_alloc; \
521  yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
522  yyptr += yynewbytes / YYSIZEOF (*yyptr); \
523  } \
524  while (0)
525 
526 #endif
527 
528 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
529 /* Copy COUNT objects from SRC to DST. The source and destination do
530  not overlap. */
531 # ifndef YYCOPY
532 # if defined __GNUC__ && 1 < __GNUC__
533 # define YYCOPY(Dst, Src, Count) \
534  __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
535 # else
536 # define YYCOPY(Dst, Src, Count) \
537  do \
538  { \
539  YYPTRDIFF_T yyi; \
540  for (yyi = 0; yyi < (Count); yyi++) \
541  (Dst)[yyi] = (Src)[yyi]; \
542  } \
543  while (0)
544 # endif
545 # endif
546 #endif /* !YYCOPY_NEEDED */
547 
548 /* YYFINAL -- State number of the termination state. */
549 #define YYFINAL 26
550 /* YYLAST -- Last index in YYTABLE. */
551 #define YYLAST 138
552 
553 /* YYNTOKENS -- Number of terminals. */
554 #define YYNTOKENS 74
555 /* YYNNTS -- Number of nonterminals. */
556 #define YYNNTS 18
557 /* YYNRULES -- Number of rules. */
558 #define YYNRULES 84
559 /* YYNSTATES -- Number of states. */
560 #define YYNSTATES 118
561 
562 /* YYMAXUTOK -- Last valid token kind. */
563 #define YYMAXUTOK 328
564 
565 
566 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
567  as returned by yylex, with out-of-bounds checking. */
568 #define YYTRANSLATE(YYX) \
569  (0 <= (YYX) && (YYX) <= YYMAXUTOK \
570  ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \
571  : YYSYMBOL_YYUNDEF)
572 
573 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
574  as returned by yylex. */
575 static const yytype_int8 yytranslate[] =
576 {
577  0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
578  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
579  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
580  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
581  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
582  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
583  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
584  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
585  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
586  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
587  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
588  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
589  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
590  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
591  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
592  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
593  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
594  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
595  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
596  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
597  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
598  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
599  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
600  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
601  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
602  2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
603  5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
604  15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
605  25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
606  35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
607  45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
608  55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
609  65, 66, 67, 68, 69, 70, 71, 72, 73
610 };
611 
612 #if YYDEBUG
613  /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
614 static const yytype_int16 yyrline[] =
615 {
616  0, 145, 145, 147, 154, 158, 170, 175, 183, 198,
617  216, 243, 262, 290, 292, 297, 318, 319, 325, 326,
618  331, 333, 335, 337, 342, 343, 344, 345, 346, 347,
619  348, 349, 350, 351, 352, 353, 354, 355, 356, 357,
620  358, 359, 360, 361, 362, 363, 364, 365, 366, 367,
621  368, 369, 370, 371, 372, 373, 374, 375, 376, 377,
622  378, 379, 380, 381, 382, 383, 384, 385, 386, 390,
623  391, 398, 402, 431, 444, 470, 471, 473, 479, 480,
624  486, 487, 492, 494, 496
625 };
626 #endif
627 
628 /** Accessing symbol of state STATE. */
629 #define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
630 
631 #if 1
632 /* The user-facing name of the symbol whose (internal) number is
633  YYSYMBOL. No bounds checking. */
634 static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
635 
636 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
637  First, the terminals, then, starting at YYNTOKENS, nonterminals. */
638 static const char *const yytname[] =
639 {
640  "\"end of file\"", "error", "\"invalid token\"", "ERROR", "LOGIC",
641  "NOT", "OPERAND", "NUMBER", "ALIGN", "LAYER", "\"(\"", "\")\"", "\"+\"",
642  "\"mask\"", "\">>\"", "\"at\"", "\"cmp\"", "\"pattern\"", "\"text\"",
643  "\"meta\"", "\"=\"", "\">\"", "\"<\"", "\"from\"", "\"to\"",
644  "\"random\"", "\"loadavg_0\"", "\"loadavg_1\"", "\"loadavg_2\"",
645  "\"dev\"", "\"prio\"", "\"proto\"", "\"pkttype\"", "\"pktlen\"",
646  "\"datalen\"", "\"maclen\"", "\"mark\"", "\"tcindex\"", "\"rtclassid\"",
647  "\"rtiif\"", "\"sk_family\"", "\"sk_state\"", "\"sk_reuse\"",
648  "\"sk_refcnt\"", "\"sk_rcvbuf\"", "\"sk_sndbuf\"", "\"sk_shutdown\"",
649  "\"sk_proto\"", "\"sk_type\"", "\"sk_rmem_alloc\"", "\"sk_wmem_alloc\"",
650  "\"sk_wmem_queued\"", "\"sk_rcv_qlen\"", "\"sk_snd_qlen\"",
651  "\"sk_err_qlen\"", "\"sk_forward_allocs\"", "\"sk_allocs\"",
652  "\"sk_route_caps\"", "\"sk_hash\"", "\"sk_lingertime\"",
653  "\"sk_ack_backlog\"", "\"sk_max_ack_backlog\"", "\"sk_prio\"",
654  "\"sk_rcvlowat\"", "\"sk_rcvtimeo\"", "\"sk_sndtimeo\"",
655  "\"sk_sendmsg_off\"", "\"sk_write_pending\"", "\"vlan\"", "\"rxhash\"",
656  "\"devname\"", "\"sk_bound_if\"", "STR", "QUOTED", "$accept", "input",
657  "expr", "match", "ematch", "cmp_match", "cmp_expr", "text_from",
658  "text_to", "meta_value", "meta_int_id", "meta_var_id", "pattern",
659  "pktloc", "align", "mask", "shift", "operand", YY_NULLPTR
660 };
661 
662 static const char *
663 yysymbol_name (yysymbol_kind_t yysymbol)
664 {
665  return yytname[yysymbol];
666 }
667 #endif
668 
669 #ifdef YYPRINT
670 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
671  (internal) symbol number NUM (which must be that of a token). */
672 static const yytype_int16 yytoknum[] =
673 {
674  0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
675  265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
676  275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
677  285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
678  295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
679  305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
680  315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
681  325, 326, 327, 328
682 };
683 #endif
684 
685 #define YYPACT_NINF (-63)
686 
687 #define yypact_value_is_default(Yyn) \
688  ((Yyn) == YYPACT_NINF)
689 
690 #define YYTABLE_NINF (-76)
691 
692 #define yytable_value_is_error(Yyn) \
693  0
694 
695  /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
696  STATE-NUM. */
697 static const yytype_int8 yypact[] =
698 {
699  -4, 15, -13, -8, 11, 10, 14, 25, 29, -63,
700  26, -63, 37, -63, -63, -63, 16, 33, -63, -63,
701  -63, 32, 1, 1, -28, 65, -63, 11, -63, -63,
702  -63, 38, 34, -63, 36, 28, -24, -63, -63, -63,
703  -63, -63, -63, -63, -63, -63, -63, -63, -63, -63,
704  -63, -63, -63, -63, -63, -63, -63, -63, -63, -63,
705  -63, -63, -63, -63, -63, -63, -63, -63, -63, -63,
706  -63, -63, -63, -63, -63, -63, -63, -63, -63, -63,
707  -63, -63, -63, -63, -63, -63, 16, 39, 39, -63,
708  -63, 43, -63, -62, 31, 65, 44, 42, -63, 42,
709  -63, -63, 41, 1, 35, 45, -63, 50, -63, -63,
710  -63, -63, 1, 47, -63, -63, -63, -63
711 };
712 
713  /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
714  Performed when YYTABLE does not specify something else to do. Zero
715  means the default is an error. */
716 static const yytype_int8 yydefact[] =
717 {
718  2, 75, 0, 0, 75, 0, 0, 0, 0, 73,
719  0, 3, 4, 7, 8, 14, 0, 0, 6, 77,
720  76, 0, 75, 75, 0, 0, 1, 75, 82, 83,
721  84, 0, 0, 12, 0, 0, 0, 21, 24, 25,
722  26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
723  36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
724  46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
725  56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
726  66, 67, 68, 69, 70, 20, 0, 80, 80, 5,
727  15, 0, 13, 0, 16, 0, 0, 78, 23, 78,
728  72, 71, 0, 75, 18, 0, 81, 0, 22, 74,
729  9, 17, 75, 0, 11, 79, 19, 10
730 };
731 
732  /* YYPGOTO[NTERM-NUM]. */
733 static const yytype_int8 yypgoto[] =
734 {
735  -63, -63, 13, -63, 59, -63, 40, -63, -63, -34,
736  -63, -63, -63, -23, -63, -36, -22, -21
737 };
738 
739  /* YYDEFGOTO[NTERM-NUM]. */
740 static const yytype_int8 yydefgoto[] =
741 {
742  0, 10, 11, 12, 13, 14, 15, 104, 113, 86,
743  87, 88, 102, 16, 17, 108, 97, 31
744 };
745 
746  /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
747  positive, shift that token. If negative, reduce the rule whose
748  number is the opposite. If YYTABLE_NINF, syntax error. */
749 static const yytype_int8 yytable[] =
750 {
751  35, 1, 19, 2, 3, -75, 4, 20, 2, 3,
752  100, 101, 5, 6, 7, 8, 1, 21, 2, 3,
753  22, 4, 2, 3, 23, 4, 26, 5, 6, 7,
754  8, 5, 6, 7, 8, 24, 28, 29, 30, 25,
755  89, 27, 32, 33, 36, 90, 91, 92, 93, 94,
756  99, 106, 110, 96, 103, 107, 114, 115, 117, 112,
757  18, 105, 34, 109, 0, 95, 98, 0, 9, 0,
758  0, 0, 37, 9, 0, 0, 0, 0, 0, 0,
759  111, 0, 0, 9, 0, 0, 0, 9, 0, 116,
760  38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
761  48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
762  58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
763  68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
764  78, 79, 80, 81, 82, 83, 84, 0, 85
765 };
766 
767 static const yytype_int8 yycheck[] =
768 {
769  23, 5, 15, 7, 8, 9, 10, 15, 7, 8,
770  72, 73, 16, 17, 18, 19, 5, 4, 7, 8,
771  10, 10, 7, 8, 10, 10, 0, 16, 17, 18,
772  19, 16, 17, 18, 19, 10, 20, 21, 22, 10,
773  27, 4, 9, 11, 72, 7, 12, 11, 20, 73,
774  7, 7, 11, 14, 23, 13, 11, 7, 11, 24,
775  1, 95, 22, 99, -1, 86, 88, -1, 72, -1,
776  -1, -1, 7, 72, -1, -1, -1, -1, -1, -1,
777  103, -1, -1, 72, -1, -1, -1, 72, -1, 112,
778  25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
779  35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
780  45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
781  55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
782  65, 66, 67, 68, 69, 70, 71, -1, 73
783 };
784 
785  /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
786  symbol of state STATE-NUM. */
787 static const yytype_int8 yystos[] =
788 {
789  0, 5, 7, 8, 10, 16, 17, 18, 19, 72,
790  75, 76, 77, 78, 79, 80, 87, 88, 78, 15,
791  15, 76, 10, 10, 10, 10, 0, 4, 20, 21,
792  22, 91, 9, 11, 80, 87, 72, 7, 25, 26,
793  27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
794  37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
795  47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
796  57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
797  67, 68, 69, 70, 71, 73, 83, 84, 85, 76,
798  7, 12, 11, 20, 73, 91, 14, 90, 90, 7,
799  72, 73, 86, 23, 81, 83, 7, 13, 89, 89,
800  11, 87, 24, 82, 11, 7, 87, 11
801 };
802 
803  /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
804 static const yytype_int8 yyr1[] =
805 {
806  0, 74, 75, 75, 76, 76, 77, 77, 78, 78,
807  78, 78, 78, 79, 79, 80, 81, 81, 82, 82,
808  83, 83, 83, 83, 84, 84, 84, 84, 84, 84,
809  84, 84, 84, 84, 84, 84, 84, 84, 84, 84,
810  84, 84, 84, 84, 84, 84, 84, 84, 84, 84,
811  84, 84, 84, 84, 84, 84, 84, 84, 84, 84,
812  84, 84, 84, 84, 84, 84, 84, 84, 84, 85,
813  85, 86, 86, 87, 87, 88, 88, 88, 89, 89,
814  90, 90, 91, 91, 91
815 };
816 
817  /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
818 static const yytype_int8 yyr2[] =
819 {
820  0, 2, 0, 1, 1, 3, 2, 1, 1, 6,
821  7, 6, 3, 4, 1, 3, 0, 2, 0, 2,
822  1, 1, 3, 2, 1, 1, 1, 1, 1, 1,
823  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
824  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
825  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
826  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
827  1, 1, 1, 1, 5, 0, 2, 2, 0, 2,
828  0, 2, 1, 1, 1
829 };
830 
831 
832 enum { YYENOMEM = -2 };
833 
834 #define yyerrok (yyerrstatus = 0)
835 #define yyclearin (yychar = YYEMPTY)
836 
837 #define YYACCEPT goto yyacceptlab
838 #define YYABORT goto yyabortlab
839 #define YYERROR goto yyerrorlab
840 
841 
842 #define YYRECOVERING() (!!yyerrstatus)
843 
844 #define YYBACKUP(Token, Value) \
845  do \
846  if (yychar == YYEMPTY) \
847  { \
848  yychar = (Token); \
849  yylval = (Value); \
850  YYPOPSTACK (yylen); \
851  yystate = *yyssp; \
852  goto yybackup; \
853  } \
854  else \
855  { \
856  yyerror (scanner, errp, root, YY_("syntax error: cannot back up")); \
857  YYERROR; \
858  } \
859  while (0)
860 
861 /* Backward compatibility with an undocumented macro.
862  Use YYerror or YYUNDEF. */
863 #define YYERRCODE YYUNDEF
864 
865 
866 /* Enable debugging if requested. */
867 #if YYDEBUG
868 
869 # ifndef YYFPRINTF
870 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
871 # define YYFPRINTF fprintf
872 # endif
873 
874 # define YYDPRINTF(Args) \
875 do { \
876  if (yydebug) \
877  YYFPRINTF Args; \
878 } while (0)
879 
880 /* This macro is provided for backward compatibility. */
881 # ifndef YY_LOCATION_PRINT
882 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
883 # endif
884 
885 
886 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \
887 do { \
888  if (yydebug) \
889  { \
890  YYFPRINTF (stderr, "%s ", Title); \
891  yy_symbol_print (stderr, \
892  Kind, Value, scanner, errp, root); \
893  YYFPRINTF (stderr, "\n"); \
894  } \
895 } while (0)
896 
897 
898 /*-----------------------------------.
899 | Print this symbol's value on YYO. |
900 `-----------------------------------*/
901 
902 static void
903 yy_symbol_value_print (FILE *yyo,
904  yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, void *scanner, char **errp, struct nl_list_head *root)
905 {
906  FILE *yyoutput = yyo;
907  YY_USE (yyoutput);
908  YY_USE (scanner);
909  YY_USE (errp);
910  YY_USE (root);
911  if (!yyvaluep)
912  return;
913 # ifdef YYPRINT
914  if (yykind < YYNTOKENS)
915  YYPRINT (yyo, yytoknum[yykind], *yyvaluep);
916 # endif
917  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
918  YY_USE (yykind);
919  YY_IGNORE_MAYBE_UNINITIALIZED_END
920 }
921 
922 
923 /*---------------------------.
924 | Print this symbol on YYO. |
925 `---------------------------*/
926 
927 static void
928 yy_symbol_print (FILE *yyo,
929  yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, void *scanner, char **errp, struct nl_list_head *root)
930 {
931  YYFPRINTF (yyo, "%s %s (",
932  yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
933 
934  yy_symbol_value_print (yyo, yykind, yyvaluep, scanner, errp, root);
935  YYFPRINTF (yyo, ")");
936 }
937 
938 /*------------------------------------------------------------------.
939 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
940 | TOP (included). |
941 `------------------------------------------------------------------*/
942 
943 static void
944 yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
945 {
946  YYFPRINTF (stderr, "Stack now");
947  for (; yybottom <= yytop; yybottom++)
948  {
949  int yybot = *yybottom;
950  YYFPRINTF (stderr, " %d", yybot);
951  }
952  YYFPRINTF (stderr, "\n");
953 }
954 
955 # define YY_STACK_PRINT(Bottom, Top) \
956 do { \
957  if (yydebug) \
958  yy_stack_print ((Bottom), (Top)); \
959 } while (0)
960 
961 
962 /*------------------------------------------------.
963 | Report that the YYRULE is going to be reduced. |
964 `------------------------------------------------*/
965 
966 static void
967 yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,
968  int yyrule, void *scanner, char **errp, struct nl_list_head *root)
969 {
970  int yylno = yyrline[yyrule];
971  int yynrhs = yyr2[yyrule];
972  int yyi;
973  YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
974  yyrule - 1, yylno);
975  /* The symbols being reduced. */
976  for (yyi = 0; yyi < yynrhs; yyi++)
977  {
978  YYFPRINTF (stderr, " $%d = ", yyi + 1);
979  yy_symbol_print (stderr,
980  YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
981  &yyvsp[(yyi + 1) - (yynrhs)], scanner, errp, root);
982  YYFPRINTF (stderr, "\n");
983  }
984 }
985 
986 # define YY_REDUCE_PRINT(Rule) \
987 do { \
988  if (yydebug) \
989  yy_reduce_print (yyssp, yyvsp, Rule, scanner, errp, root); \
990 } while (0)
991 
992 /* Nonzero means print parse trace. It is left uninitialized so that
993  multiple parsers can coexist. */
994 int yydebug;
995 #else /* !YYDEBUG */
996 # define YYDPRINTF(Args) ((void) 0)
997 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
998 # define YY_STACK_PRINT(Bottom, Top)
999 # define YY_REDUCE_PRINT(Rule)
1000 #endif /* !YYDEBUG */
1001 
1002 
1003 /* YYINITDEPTH -- initial size of the parser's stacks. */
1004 #ifndef YYINITDEPTH
1005 # define YYINITDEPTH 200
1006 #endif
1007 
1008 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1009  if the built-in stack extension method is used).
1010 
1011  Do not make this value too large; the results are undefined if
1012  YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1013  evaluated with infinite-precision integer arithmetic. */
1014 
1015 #ifndef YYMAXDEPTH
1016 # define YYMAXDEPTH 10000
1017 #endif
1018 
1019 
1020 /* Context of a parse error. */
1021 typedef struct
1022 {
1023  yy_state_t *yyssp;
1024  yysymbol_kind_t yytoken;
1025 } yypcontext_t;
1026 
1027 /* Put in YYARG at most YYARGN of the expected tokens given the
1028  current YYCTX, and return the number of tokens stored in YYARG. If
1029  YYARG is null, return the number of expected tokens (guaranteed to
1030  be less than YYNTOKENS). Return YYENOMEM on memory exhaustion.
1031  Return 0 if there are more than YYARGN expected tokens, yet fill
1032  YYARG up to YYARGN. */
1033 static int
1034 yypcontext_expected_tokens (const yypcontext_t *yyctx,
1035  yysymbol_kind_t yyarg[], int yyargn)
1036 {
1037  /* Actual size of YYARG. */
1038  int yycount = 0;
1039  int yyn = yypact[+*yyctx->yyssp];
1040  if (!yypact_value_is_default (yyn))
1041  {
1042  /* Start YYX at -YYN if negative to avoid negative indexes in
1043  YYCHECK. In other words, skip the first -YYN actions for
1044  this state because they are default actions. */
1045  int yyxbegin = yyn < 0 ? -yyn : 0;
1046  /* Stay within bounds of both yycheck and yytname. */
1047  int yychecklim = YYLAST - yyn + 1;
1048  int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1049  int yyx;
1050  for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1051  if (yycheck[yyx + yyn] == yyx && yyx != YYSYMBOL_YYerror
1052  && !yytable_value_is_error (yytable[yyx + yyn]))
1053  {
1054  if (!yyarg)
1055  ++yycount;
1056  else if (yycount == yyargn)
1057  return 0;
1058  else
1059  yyarg[yycount++] = YY_CAST (yysymbol_kind_t, yyx);
1060  }
1061  }
1062  if (yyarg && yycount == 0 && 0 < yyargn)
1063  yyarg[0] = YYSYMBOL_YYEMPTY;
1064  return yycount;
1065 }
1066 
1067 
1068 
1069 
1070 #ifndef yystrlen
1071 # if defined __GLIBC__ && defined _STRING_H
1072 # define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S)))
1073 # else
1074 /* Return the length of YYSTR. */
1075 static YYPTRDIFF_T
1076 yystrlen (const char *yystr)
1077 {
1078  YYPTRDIFF_T yylen;
1079  for (yylen = 0; yystr[yylen]; yylen++)
1080  continue;
1081  return yylen;
1082 }
1083 # endif
1084 #endif
1085 
1086 #ifndef yystpcpy
1087 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1088 # define yystpcpy stpcpy
1089 # else
1090 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1091  YYDEST. */
1092 static char *
1093 yystpcpy (char *yydest, const char *yysrc)
1094 {
1095  char *yyd = yydest;
1096  const char *yys = yysrc;
1097 
1098  while ((*yyd++ = *yys++) != '\0')
1099  continue;
1100 
1101  return yyd - 1;
1102 }
1103 # endif
1104 #endif
1105 
1106 #ifndef yytnamerr
1107 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1108  quotes and backslashes, so that it's suitable for yyerror. The
1109  heuristic is that double-quoting is unnecessary unless the string
1110  contains an apostrophe, a comma, or backslash (other than
1111  backslash-backslash). YYSTR is taken from yytname. If YYRES is
1112  null, do not copy; instead, return the length of what the result
1113  would have been. */
1114 static YYPTRDIFF_T
1115 yytnamerr (char *yyres, const char *yystr)
1116 {
1117  if (*yystr == '"')
1118  {
1119  YYPTRDIFF_T yyn = 0;
1120  char const *yyp = yystr;
1121  for (;;)
1122  switch (*++yyp)
1123  {
1124  case '\'':
1125  case ',':
1126  goto do_not_strip_quotes;
1127 
1128  case '\\':
1129  if (*++yyp != '\\')
1130  goto do_not_strip_quotes;
1131  else
1132  goto append;
1133 
1134  append:
1135  default:
1136  if (yyres)
1137  yyres[yyn] = *yyp;
1138  yyn++;
1139  break;
1140 
1141  case '"':
1142  if (yyres)
1143  yyres[yyn] = '\0';
1144  return yyn;
1145  }
1146  do_not_strip_quotes: ;
1147  }
1148 
1149  if (yyres)
1150  return yystpcpy (yyres, yystr) - yyres;
1151  else
1152  return yystrlen (yystr);
1153 }
1154 #endif
1155 
1156 
1157 static int
1158 yy_syntax_error_arguments (const yypcontext_t *yyctx,
1159  yysymbol_kind_t yyarg[], int yyargn)
1160 {
1161  /* Actual size of YYARG. */
1162  int yycount = 0;
1163  /* There are many possibilities here to consider:
1164  - If this state is a consistent state with a default action, then
1165  the only way this function was invoked is if the default action
1166  is an error action. In that case, don't check for expected
1167  tokens because there are none.
1168  - The only way there can be no lookahead present (in yychar) is if
1169  this state is a consistent state with a default action. Thus,
1170  detecting the absence of a lookahead is sufficient to determine
1171  that there is no unexpected or expected token to report. In that
1172  case, just report a simple "syntax error".
1173  - Don't assume there isn't a lookahead just because this state is a
1174  consistent state with a default action. There might have been a
1175  previous inconsistent state, consistent state with a non-default
1176  action, or user semantic action that manipulated yychar.
1177  - Of course, the expected token list depends on states to have
1178  correct lookahead information, and it depends on the parser not
1179  to perform extra reductions after fetching a lookahead from the
1180  scanner and before detecting a syntax error. Thus, state merging
1181  (from LALR or IELR) and default reductions corrupt the expected
1182  token list. However, the list is correct for canonical LR with
1183  one exception: it will still contain any token that will not be
1184  accepted due to an error action in a later state.
1185  */
1186  if (yyctx->yytoken != YYSYMBOL_YYEMPTY)
1187  {
1188  int yyn;
1189  if (yyarg)
1190  yyarg[yycount] = yyctx->yytoken;
1191  ++yycount;
1192  yyn = yypcontext_expected_tokens (yyctx,
1193  yyarg ? yyarg + 1 : yyarg, yyargn - 1);
1194  if (yyn == YYENOMEM)
1195  return YYENOMEM;
1196  else
1197  yycount += yyn;
1198  }
1199  return yycount;
1200 }
1201 
1202 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1203  about the unexpected token YYTOKEN for the state stack whose top is
1204  YYSSP.
1205 
1206  Return 0 if *YYMSG was successfully written. Return -1 if *YYMSG is
1207  not large enough to hold the message. In that case, also set
1208  *YYMSG_ALLOC to the required number of bytes. Return YYENOMEM if the
1209  required number of bytes is too large to store. */
1210 static int
1211 yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
1212  const yypcontext_t *yyctx)
1213 {
1214  enum { YYARGS_MAX = 5 };
1215  /* Internationalized format string. */
1216  const char *yyformat = YY_NULLPTR;
1217  /* Arguments of yyformat: reported tokens (one for the "unexpected",
1218  one per "expected"). */
1219  yysymbol_kind_t yyarg[YYARGS_MAX];
1220  /* Cumulated lengths of YYARG. */
1221  YYPTRDIFF_T yysize = 0;
1222 
1223  /* Actual size of YYARG. */
1224  int yycount = yy_syntax_error_arguments (yyctx, yyarg, YYARGS_MAX);
1225  if (yycount == YYENOMEM)
1226  return YYENOMEM;
1227 
1228  switch (yycount)
1229  {
1230 #define YYCASE_(N, S) \
1231  case N: \
1232  yyformat = S; \
1233  break
1234  default: /* Avoid compiler warnings. */
1235  YYCASE_(0, YY_("syntax error"));
1236  YYCASE_(1, YY_("syntax error, unexpected %s"));
1237  YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1238  YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1239  YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1240  YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1241 #undef YYCASE_
1242  }
1243 
1244  /* Compute error message size. Don't count the "%s"s, but reserve
1245  room for the terminator. */
1246  yysize = yystrlen (yyformat) - 2 * yycount + 1;
1247  {
1248  int yyi;
1249  for (yyi = 0; yyi < yycount; ++yyi)
1250  {
1251  YYPTRDIFF_T yysize1
1252  = yysize + yytnamerr (YY_NULLPTR, yytname[yyarg[yyi]]);
1253  if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
1254  yysize = yysize1;
1255  else
1256  return YYENOMEM;
1257  }
1258  }
1259 
1260  if (*yymsg_alloc < yysize)
1261  {
1262  *yymsg_alloc = 2 * yysize;
1263  if (! (yysize <= *yymsg_alloc
1264  && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1265  *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1266  return -1;
1267  }
1268 
1269  /* Avoid sprintf, as that infringes on the user's name space.
1270  Don't have undefined behavior even if the translation
1271  produced a string with the wrong number of "%s"s. */
1272  {
1273  char *yyp = *yymsg;
1274  int yyi = 0;
1275  while ((*yyp = *yyformat) != '\0')
1276  if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1277  {
1278  yyp += yytnamerr (yyp, yytname[yyarg[yyi++]]);
1279  yyformat += 2;
1280  }
1281  else
1282  {
1283  ++yyp;
1284  ++yyformat;
1285  }
1286  }
1287  return 0;
1288 }
1289 
1290 
1291 /*-----------------------------------------------.
1292 | Release the memory associated to this symbol. |
1293 `-----------------------------------------------*/
1294 
1295 static void
1296 yydestruct (const char *yymsg,
1297  yysymbol_kind_t yykind, YYSTYPE *yyvaluep, void *scanner, char **errp, struct nl_list_head *root)
1298 {
1299  YY_USE (yyvaluep);
1300  YY_USE (scanner);
1301  YY_USE (errp);
1302  YY_USE (root);
1303  if (!yymsg)
1304  yymsg = "Deleting";
1305  YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
1306 
1307  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1308  switch (yykind)
1309  {
1310  case YYSYMBOL_STR: /* STR */
1311 #line 136 "lib/route/cls/ematch_syntax.y"
1312  { free(((*yyvaluep).s)); NL_DBG(2, "string destructor\n"); }
1313 #line 1314 "lib/route/cls/ematch_syntax.c"
1314  break;
1315 
1316  case YYSYMBOL_QUOTED: /* QUOTED */
1317 #line 138 "lib/route/cls/ematch_syntax.y"
1318  { free(((*yyvaluep).q).data); NL_DBG(2, "quoted destructor\n"); }
1319 #line 1320 "lib/route/cls/ematch_syntax.c"
1320  break;
1321 
1322  case YYSYMBOL_text_from: /* text_from */
1323 #line 137 "lib/route/cls/ematch_syntax.y"
1324  { rtnl_pktloc_put(((*yyvaluep).loc)); NL_DBG(2, "pktloc destructor\n"); }
1325 #line 1326 "lib/route/cls/ematch_syntax.c"
1326  break;
1327 
1328  case YYSYMBOL_text_to: /* text_to */
1329 #line 137 "lib/route/cls/ematch_syntax.y"
1330  { rtnl_pktloc_put(((*yyvaluep).loc)); NL_DBG(2, "pktloc destructor\n"); }
1331 #line 1332 "lib/route/cls/ematch_syntax.c"
1332  break;
1333 
1334  case YYSYMBOL_meta_value: /* meta_value */
1335 #line 139 "lib/route/cls/ematch_syntax.y"
1336  { rtnl_meta_value_put(((*yyvaluep).mv)); NL_DBG(2, "meta value destructor\n"); }
1337 #line 1338 "lib/route/cls/ematch_syntax.c"
1338  break;
1339 
1340  case YYSYMBOL_pattern: /* pattern */
1341 #line 138 "lib/route/cls/ematch_syntax.y"
1342  { free(((*yyvaluep).q).data); NL_DBG(2, "quoted destructor\n"); }
1343 #line 1344 "lib/route/cls/ematch_syntax.c"
1344  break;
1345 
1346  case YYSYMBOL_pktloc: /* pktloc */
1347 #line 137 "lib/route/cls/ematch_syntax.y"
1348  { rtnl_pktloc_put(((*yyvaluep).loc)); NL_DBG(2, "pktloc destructor\n"); }
1349 #line 1350 "lib/route/cls/ematch_syntax.c"
1350  break;
1351 
1352  default:
1353  break;
1354  }
1355  YY_IGNORE_MAYBE_UNINITIALIZED_END
1356 }
1357 
1358 
1359 
1360 
1361 
1362 
1363 /*----------.
1364 | yyparse. |
1365 `----------*/
1366 
1367 int
1368 yyparse (void *scanner, char **errp, struct nl_list_head *root)
1369 {
1370 /* Lookahead token kind. */
1371 int yychar;
1372 
1373 
1374 /* The semantic value of the lookahead symbol. */
1375 /* Default value used for initialization, for pacifying older GCCs
1376  or non-GCC compilers. */
1377 YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
1378 YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
1379 
1380  /* Number of syntax errors so far. */
1381  int yynerrs = 0;
1382 
1383  yy_state_fast_t yystate = 0;
1384  /* Number of tokens to shift before error messages enabled. */
1385  int yyerrstatus = 0;
1386 
1387  /* Refer to the stacks through separate pointers, to allow yyoverflow
1388  to reallocate them elsewhere. */
1389 
1390  /* Their size. */
1391  YYPTRDIFF_T yystacksize = YYINITDEPTH;
1392 
1393  /* The state stack: array, bottom, top. */
1394  yy_state_t yyssa[YYINITDEPTH];
1395  yy_state_t *yyss = yyssa;
1396  yy_state_t *yyssp = yyss;
1397 
1398  /* The semantic value stack: array, bottom, top. */
1399  YYSTYPE yyvsa[YYINITDEPTH];
1400  YYSTYPE *yyvs = yyvsa;
1401  YYSTYPE *yyvsp = yyvs;
1402 
1403  int yyn;
1404  /* The return value of yyparse. */
1405  int yyresult;
1406  /* Lookahead symbol kind. */
1407  yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
1408  /* The variables used to return semantic value and location from the
1409  action routines. */
1410  YYSTYPE yyval;
1411 
1412  /* Buffer for error messages, and its allocated size. */
1413  char yymsgbuf[128];
1414  char *yymsg = yymsgbuf;
1415  YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf;
1416 
1417 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1418 
1419  /* The number of symbols on the RHS of the reduced rule.
1420  Keep to zero when no symbol should be popped. */
1421  int yylen = 0;
1422 
1423  YYDPRINTF ((stderr, "Starting parse\n"));
1424 
1425  yychar = YYEMPTY; /* Cause a token to be read. */
1426  goto yysetstate;
1427 
1428 
1429 /*------------------------------------------------------------.
1430 | yynewstate -- push a new state, which is found in yystate. |
1431 `------------------------------------------------------------*/
1432 yynewstate:
1433  /* In all cases, when you get here, the value and location stacks
1434  have just been pushed. So pushing a state here evens the stacks. */
1435  yyssp++;
1436 
1437 
1438 /*--------------------------------------------------------------------.
1439 | yysetstate -- set current state (the top of the stack) to yystate. |
1440 `--------------------------------------------------------------------*/
1441 yysetstate:
1442  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1443  YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
1444  YY_IGNORE_USELESS_CAST_BEGIN
1445  *yyssp = YY_CAST (yy_state_t, yystate);
1446  YY_IGNORE_USELESS_CAST_END
1447  YY_STACK_PRINT (yyss, yyssp);
1448 
1449  if (yyss + yystacksize - 1 <= yyssp)
1450 #if !defined yyoverflow && !defined YYSTACK_RELOCATE
1451  goto yyexhaustedlab;
1452 #else
1453  {
1454  /* Get the current used size of the three stacks, in elements. */
1455  YYPTRDIFF_T yysize = yyssp - yyss + 1;
1456 
1457 # if defined yyoverflow
1458  {
1459  /* Give user a chance to reallocate the stack. Use copies of
1460  these so that the &'s don't force the real ones into
1461  memory. */
1462  yy_state_t *yyss1 = yyss;
1463  YYSTYPE *yyvs1 = yyvs;
1464 
1465  /* Each stack pointer address is followed by the size of the
1466  data in use in that stack, in bytes. This used to be a
1467  conditional around just the two extra args, but that might
1468  be undefined if yyoverflow is a macro. */
1469  yyoverflow (YY_("memory exhausted"),
1470  &yyss1, yysize * YYSIZEOF (*yyssp),
1471  &yyvs1, yysize * YYSIZEOF (*yyvsp),
1472  &yystacksize);
1473  yyss = yyss1;
1474  yyvs = yyvs1;
1475  }
1476 # else /* defined YYSTACK_RELOCATE */
1477  /* Extend the stack our own way. */
1478  if (YYMAXDEPTH <= yystacksize)
1479  goto yyexhaustedlab;
1480  yystacksize *= 2;
1481  if (YYMAXDEPTH < yystacksize)
1482  yystacksize = YYMAXDEPTH;
1483 
1484  {
1485  yy_state_t *yyss1 = yyss;
1486  union yyalloc *yyptr =
1487  YY_CAST (union yyalloc *,
1488  YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
1489  if (! yyptr)
1490  goto yyexhaustedlab;
1491  YYSTACK_RELOCATE (yyss_alloc, yyss);
1492  YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1493 # undef YYSTACK_RELOCATE
1494  if (yyss1 != yyssa)
1495  YYSTACK_FREE (yyss1);
1496  }
1497 # endif
1498 
1499  yyssp = yyss + yysize - 1;
1500  yyvsp = yyvs + yysize - 1;
1501 
1502  YY_IGNORE_USELESS_CAST_BEGIN
1503  YYDPRINTF ((stderr, "Stack size increased to %ld\n",
1504  YY_CAST (long, yystacksize)));
1505  YY_IGNORE_USELESS_CAST_END
1506 
1507  if (yyss + yystacksize - 1 <= yyssp)
1508  YYABORT;
1509  }
1510 #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1511 
1512  if (yystate == YYFINAL)
1513  YYACCEPT;
1514 
1515  goto yybackup;
1516 
1517 
1518 /*-----------.
1519 | yybackup. |
1520 `-----------*/
1521 yybackup:
1522  /* Do appropriate processing given the current state. Read a
1523  lookahead token if we need one and don't already have one. */
1524 
1525  /* First try to decide what to do without reference to lookahead token. */
1526  yyn = yypact[yystate];
1527  if (yypact_value_is_default (yyn))
1528  goto yydefault;
1529 
1530  /* Not known => get a lookahead token if don't already have one. */
1531 
1532  /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */
1533  if (yychar == YYEMPTY)
1534  {
1535  YYDPRINTF ((stderr, "Reading a token\n"));
1536  yychar = yylex (&yylval, scanner);
1537  }
1538 
1539  if (yychar <= YYEOF)
1540  {
1541  yychar = YYEOF;
1542  yytoken = YYSYMBOL_YYEOF;
1543  YYDPRINTF ((stderr, "Now at end of input.\n"));
1544  }
1545  else if (yychar == YYerror)
1546  {
1547  /* The scanner already issued an error message, process directly
1548  to error recovery. But do not keep the error token as
1549  lookahead, it is too special and may lead us to an endless
1550  loop in error recovery. */
1551  yychar = YYUNDEF;
1552  yytoken = YYSYMBOL_YYerror;
1553  goto yyerrlab1;
1554  }
1555  else
1556  {
1557  yytoken = YYTRANSLATE (yychar);
1558  YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1559  }
1560 
1561  /* If the proper action on seeing token YYTOKEN is to reduce or to
1562  detect an error, take that action. */
1563  yyn += yytoken;
1564  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1565  goto yydefault;
1566  yyn = yytable[yyn];
1567  if (yyn <= 0)
1568  {
1569  if (yytable_value_is_error (yyn))
1570  goto yyerrlab;
1571  yyn = -yyn;
1572  goto yyreduce;
1573  }
1574 
1575  /* Count tokens shifted since error; after three, turn off error
1576  status. */
1577  if (yyerrstatus)
1578  yyerrstatus--;
1579 
1580  /* Shift the lookahead token. */
1581  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1582  yystate = yyn;
1583  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1584  *++yyvsp = yylval;
1585  YY_IGNORE_MAYBE_UNINITIALIZED_END
1586 
1587  /* Discard the shifted token. */
1588  yychar = YYEMPTY;
1589  goto yynewstate;
1590 
1591 
1592 /*-----------------------------------------------------------.
1593 | yydefault -- do the default action for the current state. |
1594 `-----------------------------------------------------------*/
1595 yydefault:
1596  yyn = yydefact[yystate];
1597  if (yyn == 0)
1598  goto yyerrlab;
1599  goto yyreduce;
1600 
1601 
1602 /*-----------------------------.
1603 | yyreduce -- do a reduction. |
1604 `-----------------------------*/
1605 yyreduce:
1606  /* yyn is the number of a rule to reduce with. */
1607  yylen = yyr2[yyn];
1608 
1609  /* If YYLEN is nonzero, implement the default value of the action:
1610  '$$ = $1'.
1611 
1612  Otherwise, the following line sets YYVAL to garbage.
1613  This behavior is undocumented and Bison
1614  users should not rely upon it. Assigning to YYVAL
1615  unconditionally makes the parser a bit smaller, and it avoids a
1616  GCC warning that YYVAL may be used uninitialized. */
1617  yyval = yyvsp[1-yylen];
1618 
1619 
1620  YY_REDUCE_PRINT (yyn);
1621  switch (yyn)
1622  {
1623  case 3: /* input: expr */
1624 #line 148 "lib/route/cls/ematch_syntax.y"
1625  {
1626  nl_list_add_tail(root, &(yyvsp[0].e)->e_list);
1627  }
1628 #line 1629 "lib/route/cls/ematch_syntax.c"
1629  break;
1630 
1631  case 4: /* expr: match */
1632 #line 155 "lib/route/cls/ematch_syntax.y"
1633  {
1634  (yyval.e) = (yyvsp[0].e);
1635  }
1636 #line 1637 "lib/route/cls/ematch_syntax.c"
1637  break;
1638 
1639  case 5: /* expr: match LOGIC expr */
1640 #line 159 "lib/route/cls/ematch_syntax.y"
1641  {
1642  rtnl_ematch_set_flags((yyvsp[-2].e), (yyvsp[-1].i));
1643 
1644  /* make ematch new head */
1645  nl_list_add_tail(&(yyvsp[-2].e)->e_list, &(yyvsp[0].e)->e_list);
1646 
1647  (yyval.e) = (yyvsp[-2].e);
1648  }
1649 #line 1650 "lib/route/cls/ematch_syntax.c"
1650  break;
1651 
1652  case 6: /* match: NOT ematch */
1653 #line 171 "lib/route/cls/ematch_syntax.y"
1654  {
1655  rtnl_ematch_set_flags((yyvsp[0].e), TCF_EM_INVERT);
1656  (yyval.e) = (yyvsp[0].e);
1657  }
1658 #line 1659 "lib/route/cls/ematch_syntax.c"
1659  break;
1660 
1661  case 7: /* match: ematch */
1662 #line 176 "lib/route/cls/ematch_syntax.y"
1663  {
1664  (yyval.e) = (yyvsp[0].e);
1665  }
1666 #line 1667 "lib/route/cls/ematch_syntax.c"
1667  break;
1668 
1669  case 8: /* ematch: cmp_match */
1670 #line 184 "lib/route/cls/ematch_syntax.y"
1671  {
1672  struct rtnl_ematch *e;
1673 
1674  if (!(e = rtnl_ematch_alloc())) {
1675  *errp = strdup("Unable to allocate ematch object");
1676  YYABORT;
1677  }
1678 
1679  if (rtnl_ematch_set_kind(e, TCF_EM_CMP) < 0)
1680  BUG();
1681 
1682  rtnl_ematch_cmp_set(e, &(yyvsp[0].cmp));
1683  (yyval.e) = e;
1684  }
1685 #line 1686 "lib/route/cls/ematch_syntax.c"
1686  break;
1687 
1688  case 9: /* ematch: "pattern" "(" pktloc "=" pattern ")" */
1689 #line 199 "lib/route/cls/ematch_syntax.y"
1690  {
1691  struct rtnl_ematch *e;
1692 
1693  if (!(e = rtnl_ematch_alloc())) {
1694  *errp = strdup("Unable to allocate ematch object");
1695  YYABORT;
1696  }
1697 
1698  if (rtnl_ematch_set_kind(e, TCF_EM_NBYTE) < 0)
1699  BUG();
1700 
1701  rtnl_ematch_nbyte_set_offset(e, (yyvsp[-3].loc)->layer, (yyvsp[-3].loc)->offset);
1702  rtnl_pktloc_put((yyvsp[-3].loc));
1703  rtnl_ematch_nbyte_set_pattern(e, (uint8_t *) (yyvsp[-1].q).data, (yyvsp[-1].q).index);
1704 
1705  (yyval.e) = e;
1706  }
1707 #line 1708 "lib/route/cls/ematch_syntax.c"
1708  break;
1709 
1710  case 10: /* ematch: "text" "(" STR QUOTED text_from text_to ")" */
1711 #line 217 "lib/route/cls/ematch_syntax.y"
1712  {
1713  struct rtnl_ematch *e;
1714 
1715  if (!(e = rtnl_ematch_alloc())) {
1716  *errp = strdup("Unable to allocate ematch object");
1717  YYABORT;
1718  }
1719 
1720  if (rtnl_ematch_set_kind(e, TCF_EM_TEXT) < 0)
1721  BUG();
1722 
1723  rtnl_ematch_text_set_algo(e, (yyvsp[-4].s));
1724  rtnl_ematch_text_set_pattern(e, (yyvsp[-3].q).data, (yyvsp[-3].q).index);
1725 
1726  if ((yyvsp[-2].loc)) {
1727  rtnl_ematch_text_set_from(e, (yyvsp[-2].loc)->layer, (yyvsp[-2].loc)->offset);
1728  rtnl_pktloc_put((yyvsp[-2].loc));
1729  }
1730 
1731  if ((yyvsp[-1].loc)) {
1732  rtnl_ematch_text_set_to(e, (yyvsp[-1].loc)->layer, (yyvsp[-1].loc)->offset);
1733  rtnl_pktloc_put((yyvsp[-1].loc));
1734  }
1735 
1736  (yyval.e) = e;
1737  }
1738 #line 1739 "lib/route/cls/ematch_syntax.c"
1739  break;
1740 
1741  case 11: /* ematch: "meta" "(" meta_value operand meta_value ")" */
1742 #line 244 "lib/route/cls/ematch_syntax.y"
1743  {
1744  struct rtnl_ematch *e;
1745 
1746  if (!(e = rtnl_ematch_alloc())) {
1747  *errp = strdup("Unable to allocate ematch object");
1748  YYABORT;
1749  }
1750 
1751  if (rtnl_ematch_set_kind(e, TCF_EM_META) < 0)
1752  BUG();
1753 
1754  rtnl_ematch_meta_set_lvalue(e, (yyvsp[-3].mv));
1755  rtnl_ematch_meta_set_rvalue(e, (yyvsp[-1].mv));
1756  rtnl_ematch_meta_set_operand(e, (yyvsp[-2].i));
1757 
1758  (yyval.e) = e;
1759  }
1760 #line 1761 "lib/route/cls/ematch_syntax.c"
1761  break;
1762 
1763  case 12: /* ematch: "(" expr ")" */
1764 #line 263 "lib/route/cls/ematch_syntax.y"
1765  {
1766  struct rtnl_ematch *e;
1767 
1768  if (!(e = rtnl_ematch_alloc())) {
1769  *errp = strdup("Unable to allocate ematch object");
1770  YYABORT;
1771  }
1772 
1773  if (rtnl_ematch_set_kind(e, TCF_EM_CONTAINER) < 0)
1774  BUG();
1775 
1776  /* Make e->childs the list head of a the ematch sequence */
1777  nl_list_add_tail(&e->e_childs, &(yyvsp[-1].e)->e_list);
1778 
1779  (yyval.e) = e;
1780  }
1781 #line 1782 "lib/route/cls/ematch_syntax.c"
1782  break;
1783 
1784  case 13: /* cmp_match: "cmp" "(" cmp_expr ")" */
1785 #line 291 "lib/route/cls/ematch_syntax.y"
1786  { (yyval.cmp) = (yyvsp[-1].cmp); }
1787 #line 1788 "lib/route/cls/ematch_syntax.c"
1788  break;
1789 
1790  case 14: /* cmp_match: cmp_expr */
1791 #line 293 "lib/route/cls/ematch_syntax.y"
1792  { (yyval.cmp) = (yyvsp[0].cmp); }
1793 #line 1794 "lib/route/cls/ematch_syntax.c"
1794  break;
1795 
1796  case 15: /* cmp_expr: pktloc operand NUMBER */
1797 #line 298 "lib/route/cls/ematch_syntax.y"
1798  {
1799  if ((yyvsp[-2].loc)->align == TCF_EM_ALIGN_U16 ||
1800  (yyvsp[-2].loc)->align == TCF_EM_ALIGN_U32)
1801  (yyval.cmp).flags = TCF_EM_CMP_TRANS;
1802 
1803  memset(&(yyval.cmp), 0, sizeof((yyval.cmp)));
1804 
1805  (yyval.cmp).mask = (yyvsp[-2].loc)->mask;
1806  (yyval.cmp).off = (yyvsp[-2].loc)->offset;
1807  (yyval.cmp).align = (yyvsp[-2].loc)->align;
1808  (yyval.cmp).layer = (yyvsp[-2].loc)->layer;
1809  (yyval.cmp).opnd = (yyvsp[-1].i);
1810  (yyval.cmp).val = (yyvsp[0].i);
1811 
1812  rtnl_pktloc_put((yyvsp[-2].loc));
1813  }
1814 #line 1815 "lib/route/cls/ematch_syntax.c"
1815  break;
1816 
1817  case 16: /* text_from: %empty */
1818 #line 318 "lib/route/cls/ematch_syntax.y"
1819  { (yyval.loc) = NULL; }
1820 #line 1821 "lib/route/cls/ematch_syntax.c"
1821  break;
1822 
1823  case 17: /* text_from: "from" pktloc */
1824 #line 320 "lib/route/cls/ematch_syntax.y"
1825  { (yyval.loc) = (yyvsp[0].loc); }
1826 #line 1827 "lib/route/cls/ematch_syntax.c"
1827  break;
1828 
1829  case 18: /* text_to: %empty */
1830 #line 325 "lib/route/cls/ematch_syntax.y"
1831  { (yyval.loc) = NULL; }
1832 #line 1833 "lib/route/cls/ematch_syntax.c"
1833  break;
1834 
1835  case 19: /* text_to: "to" pktloc */
1836 #line 327 "lib/route/cls/ematch_syntax.y"
1837  { (yyval.loc) = (yyvsp[0].loc); }
1838 #line 1839 "lib/route/cls/ematch_syntax.c"
1839  break;
1840 
1841  case 20: /* meta_value: QUOTED */
1842 #line 332 "lib/route/cls/ematch_syntax.y"
1843  { (yyval.mv) = rtnl_meta_value_alloc_var((yyvsp[0].q).data, (yyvsp[0].q).len); }
1844 #line 1845 "lib/route/cls/ematch_syntax.c"
1845  break;
1846 
1847  case 21: /* meta_value: NUMBER */
1848 #line 334 "lib/route/cls/ematch_syntax.y"
1849  { (yyval.mv) = rtnl_meta_value_alloc_int((yyvsp[0].i)); }
1850 #line 1851 "lib/route/cls/ematch_syntax.c"
1851  break;
1852 
1853  case 22: /* meta_value: meta_int_id shift mask */
1854 #line 336 "lib/route/cls/ematch_syntax.y"
1855  { (yyval.mv) = META_ALLOC(META_INT, (yyvsp[-2].i), (yyvsp[-1].i), (yyvsp[0].i64)); }
1856 #line 1857 "lib/route/cls/ematch_syntax.c"
1857  break;
1858 
1859  case 23: /* meta_value: meta_var_id shift */
1860 #line 338 "lib/route/cls/ematch_syntax.y"
1861  { (yyval.mv) = META_ALLOC(META_VAR, (yyvsp[-1].i), (yyvsp[0].i), 0); }
1862 #line 1863 "lib/route/cls/ematch_syntax.c"
1863  break;
1864 
1865  case 24: /* meta_int_id: "random" */
1866 #line 342 "lib/route/cls/ematch_syntax.y"
1867  { (yyval.i) = META_ID(RANDOM); }
1868 #line 1869 "lib/route/cls/ematch_syntax.c"
1869  break;
1870 
1871  case 25: /* meta_int_id: "loadavg_0" */
1872 #line 343 "lib/route/cls/ematch_syntax.y"
1873  { (yyval.i) = META_ID(LOADAVG_0); }
1874 #line 1875 "lib/route/cls/ematch_syntax.c"
1875  break;
1876 
1877  case 26: /* meta_int_id: "loadavg_1" */
1878 #line 344 "lib/route/cls/ematch_syntax.y"
1879  { (yyval.i) = META_ID(LOADAVG_1); }
1880 #line 1881 "lib/route/cls/ematch_syntax.c"
1881  break;
1882 
1883  case 27: /* meta_int_id: "loadavg_2" */
1884 #line 345 "lib/route/cls/ematch_syntax.y"
1885  { (yyval.i) = META_ID(LOADAVG_2); }
1886 #line 1887 "lib/route/cls/ematch_syntax.c"
1887  break;
1888 
1889  case 28: /* meta_int_id: "dev" */
1890 #line 346 "lib/route/cls/ematch_syntax.y"
1891  { (yyval.i) = META_ID(DEV); }
1892 #line 1893 "lib/route/cls/ematch_syntax.c"
1893  break;
1894 
1895  case 29: /* meta_int_id: "prio" */
1896 #line 347 "lib/route/cls/ematch_syntax.y"
1897  { (yyval.i) = META_ID(PRIORITY); }
1898 #line 1899 "lib/route/cls/ematch_syntax.c"
1899  break;
1900 
1901  case 30: /* meta_int_id: "proto" */
1902 #line 348 "lib/route/cls/ematch_syntax.y"
1903  { (yyval.i) = META_ID(PROTOCOL); }
1904 #line 1905 "lib/route/cls/ematch_syntax.c"
1905  break;
1906 
1907  case 31: /* meta_int_id: "pkttype" */
1908 #line 349 "lib/route/cls/ematch_syntax.y"
1909  { (yyval.i) = META_ID(PKTTYPE); }
1910 #line 1911 "lib/route/cls/ematch_syntax.c"
1911  break;
1912 
1913  case 32: /* meta_int_id: "pktlen" */
1914 #line 350 "lib/route/cls/ematch_syntax.y"
1915  { (yyval.i) = META_ID(PKTLEN); }
1916 #line 1917 "lib/route/cls/ematch_syntax.c"
1917  break;
1918 
1919  case 33: /* meta_int_id: "datalen" */
1920 #line 351 "lib/route/cls/ematch_syntax.y"
1921  { (yyval.i) = META_ID(DATALEN); }
1922 #line 1923 "lib/route/cls/ematch_syntax.c"
1923  break;
1924 
1925  case 34: /* meta_int_id: "maclen" */
1926 #line 352 "lib/route/cls/ematch_syntax.y"
1927  { (yyval.i) = META_ID(MACLEN); }
1928 #line 1929 "lib/route/cls/ematch_syntax.c"
1929  break;
1930 
1931  case 35: /* meta_int_id: "mark" */
1932 #line 353 "lib/route/cls/ematch_syntax.y"
1933  { (yyval.i) = META_ID(NFMARK); }
1934 #line 1935 "lib/route/cls/ematch_syntax.c"
1935  break;
1936 
1937  case 36: /* meta_int_id: "tcindex" */
1938 #line 354 "lib/route/cls/ematch_syntax.y"
1939  { (yyval.i) = META_ID(TCINDEX); }
1940 #line 1941 "lib/route/cls/ematch_syntax.c"
1941  break;
1942 
1943  case 37: /* meta_int_id: "rtclassid" */
1944 #line 355 "lib/route/cls/ematch_syntax.y"
1945  { (yyval.i) = META_ID(RTCLASSID); }
1946 #line 1947 "lib/route/cls/ematch_syntax.c"
1947  break;
1948 
1949  case 38: /* meta_int_id: "rtiif" */
1950 #line 356 "lib/route/cls/ematch_syntax.y"
1951  { (yyval.i) = META_ID(RTIIF); }
1952 #line 1953 "lib/route/cls/ematch_syntax.c"
1953  break;
1954 
1955  case 39: /* meta_int_id: "sk_family" */
1956 #line 357 "lib/route/cls/ematch_syntax.y"
1957  { (yyval.i) = META_ID(SK_FAMILY); }
1958 #line 1959 "lib/route/cls/ematch_syntax.c"
1959  break;
1960 
1961  case 40: /* meta_int_id: "sk_state" */
1962 #line 358 "lib/route/cls/ematch_syntax.y"
1963  { (yyval.i) = META_ID(SK_STATE); }
1964 #line 1965 "lib/route/cls/ematch_syntax.c"
1965  break;
1966 
1967  case 41: /* meta_int_id: "sk_reuse" */
1968 #line 359 "lib/route/cls/ematch_syntax.y"
1969  { (yyval.i) = META_ID(SK_REUSE); }
1970 #line 1971 "lib/route/cls/ematch_syntax.c"
1971  break;
1972 
1973  case 42: /* meta_int_id: "sk_refcnt" */
1974 #line 360 "lib/route/cls/ematch_syntax.y"
1975  { (yyval.i) = META_ID(SK_REFCNT); }
1976 #line 1977 "lib/route/cls/ematch_syntax.c"
1977  break;
1978 
1979  case 43: /* meta_int_id: "sk_rcvbuf" */
1980 #line 361 "lib/route/cls/ematch_syntax.y"
1981  { (yyval.i) = META_ID(SK_RCVBUF); }
1982 #line 1983 "lib/route/cls/ematch_syntax.c"
1983  break;
1984 
1985  case 44: /* meta_int_id: "sk_sndbuf" */
1986 #line 362 "lib/route/cls/ematch_syntax.y"
1987  { (yyval.i) = META_ID(SK_SNDBUF); }
1988 #line 1989 "lib/route/cls/ematch_syntax.c"
1989  break;
1990 
1991  case 45: /* meta_int_id: "sk_shutdown" */
1992 #line 363 "lib/route/cls/ematch_syntax.y"
1993  { (yyval.i) = META_ID(SK_SHUTDOWN); }
1994 #line 1995 "lib/route/cls/ematch_syntax.c"
1995  break;
1996 
1997  case 46: /* meta_int_id: "sk_proto" */
1998 #line 364 "lib/route/cls/ematch_syntax.y"
1999  { (yyval.i) = META_ID(SK_PROTO); }
2000 #line 2001 "lib/route/cls/ematch_syntax.c"
2001  break;
2002 
2003  case 47: /* meta_int_id: "sk_type" */
2004 #line 365 "lib/route/cls/ematch_syntax.y"
2005  { (yyval.i) = META_ID(SK_TYPE); }
2006 #line 2007 "lib/route/cls/ematch_syntax.c"
2007  break;
2008 
2009  case 48: /* meta_int_id: "sk_rmem_alloc" */
2010 #line 366 "lib/route/cls/ematch_syntax.y"
2011  { (yyval.i) = META_ID(SK_RMEM_ALLOC); }
2012 #line 2013 "lib/route/cls/ematch_syntax.c"
2013  break;
2014 
2015  case 49: /* meta_int_id: "sk_wmem_alloc" */
2016 #line 367 "lib/route/cls/ematch_syntax.y"
2017  { (yyval.i) = META_ID(SK_WMEM_ALLOC); }
2018 #line 2019 "lib/route/cls/ematch_syntax.c"
2019  break;
2020 
2021  case 50: /* meta_int_id: "sk_wmem_queued" */
2022 #line 368 "lib/route/cls/ematch_syntax.y"
2023  { (yyval.i) = META_ID(SK_WMEM_QUEUED); }
2024 #line 2025 "lib/route/cls/ematch_syntax.c"
2025  break;
2026 
2027  case 51: /* meta_int_id: "sk_rcv_qlen" */
2028 #line 369 "lib/route/cls/ematch_syntax.y"
2029  { (yyval.i) = META_ID(SK_RCV_QLEN); }
2030 #line 2031 "lib/route/cls/ematch_syntax.c"
2031  break;
2032 
2033  case 52: /* meta_int_id: "sk_snd_qlen" */
2034 #line 370 "lib/route/cls/ematch_syntax.y"
2035  { (yyval.i) = META_ID(SK_SND_QLEN); }
2036 #line 2037 "lib/route/cls/ematch_syntax.c"
2037  break;
2038 
2039  case 53: /* meta_int_id: "sk_err_qlen" */
2040 #line 371 "lib/route/cls/ematch_syntax.y"
2041  { (yyval.i) = META_ID(SK_ERR_QLEN); }
2042 #line 2043 "lib/route/cls/ematch_syntax.c"
2043  break;
2044 
2045  case 54: /* meta_int_id: "sk_forward_allocs" */
2046 #line 372 "lib/route/cls/ematch_syntax.y"
2047  { (yyval.i) = META_ID(SK_FORWARD_ALLOCS); }
2048 #line 2049 "lib/route/cls/ematch_syntax.c"
2049  break;
2050 
2051  case 55: /* meta_int_id: "sk_allocs" */
2052 #line 373 "lib/route/cls/ematch_syntax.y"
2053  { (yyval.i) = META_ID(SK_ALLOCS); }
2054 #line 2055 "lib/route/cls/ematch_syntax.c"
2055  break;
2056 
2057  case 56: /* meta_int_id: "sk_route_caps" */
2058 #line 374 "lib/route/cls/ematch_syntax.y"
2059  { (yyval.i) = __TCF_META_ID_SK_ROUTE_CAPS; }
2060 #line 2061 "lib/route/cls/ematch_syntax.c"
2061  break;
2062 
2063  case 57: /* meta_int_id: "sk_hash" */
2064 #line 375 "lib/route/cls/ematch_syntax.y"
2065  { (yyval.i) = META_ID(SK_HASH); }
2066 #line 2067 "lib/route/cls/ematch_syntax.c"
2067  break;
2068 
2069  case 58: /* meta_int_id: "sk_lingertime" */
2070 #line 376 "lib/route/cls/ematch_syntax.y"
2071  { (yyval.i) = META_ID(SK_LINGERTIME); }
2072 #line 2073 "lib/route/cls/ematch_syntax.c"
2073  break;
2074 
2075  case 59: /* meta_int_id: "sk_ack_backlog" */
2076 #line 377 "lib/route/cls/ematch_syntax.y"
2077  { (yyval.i) = META_ID(SK_ACK_BACKLOG); }
2078 #line 2079 "lib/route/cls/ematch_syntax.c"
2079  break;
2080 
2081  case 60: /* meta_int_id: "sk_max_ack_backlog" */
2082 #line 378 "lib/route/cls/ematch_syntax.y"
2083  { (yyval.i) = META_ID(SK_MAX_ACK_BACKLOG); }
2084 #line 2085 "lib/route/cls/ematch_syntax.c"
2085  break;
2086 
2087  case 61: /* meta_int_id: "sk_prio" */
2088 #line 379 "lib/route/cls/ematch_syntax.y"
2089  { (yyval.i) = META_ID(SK_PRIO); }
2090 #line 2091 "lib/route/cls/ematch_syntax.c"
2091  break;
2092 
2093  case 62: /* meta_int_id: "sk_rcvlowat" */
2094 #line 380 "lib/route/cls/ematch_syntax.y"
2095  { (yyval.i) = META_ID(SK_RCVLOWAT); }
2096 #line 2097 "lib/route/cls/ematch_syntax.c"
2097  break;
2098 
2099  case 63: /* meta_int_id: "sk_rcvtimeo" */
2100 #line 381 "lib/route/cls/ematch_syntax.y"
2101  { (yyval.i) = META_ID(SK_RCVTIMEO); }
2102 #line 2103 "lib/route/cls/ematch_syntax.c"
2103  break;
2104 
2105  case 64: /* meta_int_id: "sk_sndtimeo" */
2106 #line 382 "lib/route/cls/ematch_syntax.y"
2107  { (yyval.i) = META_ID(SK_SNDTIMEO); }
2108 #line 2109 "lib/route/cls/ematch_syntax.c"
2109  break;
2110 
2111  case 65: /* meta_int_id: "sk_sendmsg_off" */
2112 #line 383 "lib/route/cls/ematch_syntax.y"
2113  { (yyval.i) = META_ID(SK_SENDMSG_OFF); }
2114 #line 2115 "lib/route/cls/ematch_syntax.c"
2115  break;
2116 
2117  case 66: /* meta_int_id: "sk_write_pending" */
2118 #line 384 "lib/route/cls/ematch_syntax.y"
2119  { (yyval.i) = META_ID(SK_WRITE_PENDING); }
2120 #line 2121 "lib/route/cls/ematch_syntax.c"
2121  break;
2122 
2123  case 67: /* meta_int_id: "vlan" */
2124 #line 385 "lib/route/cls/ematch_syntax.y"
2125  { (yyval.i) = META_ID(VLAN_TAG); }
2126 #line 2127 "lib/route/cls/ematch_syntax.c"
2127  break;
2128 
2129  case 68: /* meta_int_id: "rxhash" */
2130 #line 386 "lib/route/cls/ematch_syntax.y"
2131  { (yyval.i) = META_ID(RXHASH); }
2132 #line 2133 "lib/route/cls/ematch_syntax.c"
2133  break;
2134 
2135  case 69: /* meta_var_id: "devname" */
2136 #line 390 "lib/route/cls/ematch_syntax.y"
2137  { (yyval.i) = META_ID(DEV); }
2138 #line 2139 "lib/route/cls/ematch_syntax.c"
2139  break;
2140 
2141  case 70: /* meta_var_id: "sk_bound_if" */
2142 #line 391 "lib/route/cls/ematch_syntax.y"
2143  { (yyval.i) = META_ID(SK_BOUND_IF); }
2144 #line 2145 "lib/route/cls/ematch_syntax.c"
2145  break;
2146 
2147  case 71: /* pattern: QUOTED */
2148 #line 399 "lib/route/cls/ematch_syntax.y"
2149  {
2150  (yyval.q) = (yyvsp[0].q);
2151  }
2152 #line 2153 "lib/route/cls/ematch_syntax.c"
2153  break;
2154 
2155  case 72: /* pattern: STR */
2156 #line 403 "lib/route/cls/ematch_syntax.y"
2157  {
2158  struct nl_addr *addr;
2159 
2160  if (nl_addr_parse((yyvsp[0].s), AF_UNSPEC, &addr) == 0) {
2161  (yyval.q).len = nl_addr_get_len(addr);
2162 
2163  (yyval.q).index = min_t(int, (yyval.q).len, nl_addr_get_prefixlen(addr)/8);
2164 
2165  if (!((yyval.q).data = calloc(1, (yyval.q).len))) {
2166  nl_addr_put(addr);
2167  YYABORT;
2168  }
2169 
2170  memcpy((yyval.q).data, nl_addr_get_binary_addr(addr), (yyval.q).len);
2171  nl_addr_put(addr);
2172  } else {
2173  if (asprintf(errp, "invalid pattern \"%s\"", (yyvsp[0].s)) == -1)
2174  *errp = NULL;
2175  YYABORT;
2176  }
2177  }
2178 #line 2179 "lib/route/cls/ematch_syntax.c"
2179  break;
2180 
2181  case 73: /* pktloc: STR */
2182 #line 432 "lib/route/cls/ematch_syntax.y"
2183  {
2184  struct rtnl_pktloc *loc;
2185 
2186  if (rtnl_pktloc_lookup((yyvsp[0].s), &loc) < 0) {
2187  if (asprintf(errp, "Packet location \"%s\" not found", (yyvsp[0].s)) == -1)
2188  *errp = NULL;
2189  YYABORT;
2190  }
2191 
2192  (yyval.loc) = loc;
2193  }
2194 #line 2195 "lib/route/cls/ematch_syntax.c"
2195  break;
2196 
2197  case 74: /* pktloc: align LAYER "+" NUMBER mask */
2198 #line 445 "lib/route/cls/ematch_syntax.y"
2199  {
2200  struct rtnl_pktloc *loc;
2201 
2202  if ((yyvsp[0].i64) && (!(yyvsp[-4].i) || (yyvsp[-4].i) > TCF_EM_ALIGN_U32)) {
2203  *errp = strdup("mask only allowed for alignments u8|u16|u32");
2204  YYABORT;
2205  }
2206 
2207  if (!(loc = rtnl_pktloc_alloc())) {
2208  *errp = strdup("Unable to allocate packet location object");
2209  YYABORT;
2210  }
2211 
2212  loc->name = strdup("<USER-DEFINED>");
2213  loc->align = (yyvsp[-4].i);
2214  loc->layer = (yyvsp[-3].i);
2215  loc->offset = (yyvsp[-1].i);
2216  loc->mask = (yyvsp[0].i64);
2217 
2218  (yyval.loc) = loc;
2219  }
2220 #line 2221 "lib/route/cls/ematch_syntax.c"
2221  break;
2222 
2223  case 75: /* align: %empty */
2224 #line 470 "lib/route/cls/ematch_syntax.y"
2225  { (yyval.i) = 0; }
2226 #line 2227 "lib/route/cls/ematch_syntax.c"
2227  break;
2228 
2229  case 76: /* align: ALIGN "at" */
2230 #line 472 "lib/route/cls/ematch_syntax.y"
2231  { (yyval.i) = (yyvsp[-1].i); }
2232 #line 2233 "lib/route/cls/ematch_syntax.c"
2233  break;
2234 
2235  case 77: /* align: NUMBER "at" */
2236 #line 474 "lib/route/cls/ematch_syntax.y"
2237  { (yyval.i) = (yyvsp[-1].i); }
2238 #line 2239 "lib/route/cls/ematch_syntax.c"
2239  break;
2240 
2241  case 78: /* mask: %empty */
2242 #line 479 "lib/route/cls/ematch_syntax.y"
2243  { (yyval.i64) = 0; }
2244 #line 2245 "lib/route/cls/ematch_syntax.c"
2245  break;
2246 
2247  case 79: /* mask: "mask" NUMBER */
2248 #line 481 "lib/route/cls/ematch_syntax.y"
2249  { (yyval.i64) = (yyvsp[0].i); }
2250 #line 2251 "lib/route/cls/ematch_syntax.c"
2251  break;
2252 
2253  case 80: /* shift: %empty */
2254 #line 486 "lib/route/cls/ematch_syntax.y"
2255  { (yyval.i) = 0; }
2256 #line 2257 "lib/route/cls/ematch_syntax.c"
2257  break;
2258 
2259  case 81: /* shift: ">>" NUMBER */
2260 #line 488 "lib/route/cls/ematch_syntax.y"
2261  { (yyval.i) = (yyvsp[0].i); }
2262 #line 2263 "lib/route/cls/ematch_syntax.c"
2263  break;
2264 
2265  case 82: /* operand: "=" */
2266 #line 493 "lib/route/cls/ematch_syntax.y"
2267  { (yyval.i) = TCF_EM_OPND_EQ; }
2268 #line 2269 "lib/route/cls/ematch_syntax.c"
2269  break;
2270 
2271  case 83: /* operand: ">" */
2272 #line 495 "lib/route/cls/ematch_syntax.y"
2273  { (yyval.i) = TCF_EM_OPND_GT; }
2274 #line 2275 "lib/route/cls/ematch_syntax.c"
2275  break;
2276 
2277  case 84: /* operand: "<" */
2278 #line 497 "lib/route/cls/ematch_syntax.y"
2279  { (yyval.i) = TCF_EM_OPND_LT; }
2280 #line 2281 "lib/route/cls/ematch_syntax.c"
2281  break;
2282 
2283 
2284 #line 2285 "lib/route/cls/ematch_syntax.c"
2285 
2286  default: break;
2287  }
2288  /* User semantic actions sometimes alter yychar, and that requires
2289  that yytoken be updated with the new translation. We take the
2290  approach of translating immediately before every use of yytoken.
2291  One alternative is translating here after every semantic action,
2292  but that translation would be missed if the semantic action invokes
2293  YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2294  if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2295  incorrect destructor might then be invoked immediately. In the
2296  case of YYERROR or YYBACKUP, subsequent parser actions might lead
2297  to an incorrect destructor call or verbose syntax error message
2298  before the lookahead is translated. */
2299  YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
2300 
2301  YYPOPSTACK (yylen);
2302  yylen = 0;
2303 
2304  *++yyvsp = yyval;
2305 
2306  /* Now 'shift' the result of the reduction. Determine what state
2307  that goes to, based on the state we popped back to and the rule
2308  number reduced by. */
2309  {
2310  const int yylhs = yyr1[yyn] - YYNTOKENS;
2311  const int yyi = yypgoto[yylhs] + *yyssp;
2312  yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
2313  ? yytable[yyi]
2314  : yydefgoto[yylhs]);
2315  }
2316 
2317  goto yynewstate;
2318 
2319 
2320 /*--------------------------------------.
2321 | yyerrlab -- here on detecting error. |
2322 `--------------------------------------*/
2323 yyerrlab:
2324  /* Make sure we have latest lookahead translation. See comments at
2325  user semantic actions for why this is necessary. */
2326  yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
2327  /* If not already recovering from an error, report this error. */
2328  if (!yyerrstatus)
2329  {
2330  ++yynerrs;
2331  {
2332  yypcontext_t yyctx
2333  = {yyssp, yytoken};
2334  char const *yymsgp = YY_("syntax error");
2335  int yysyntax_error_status;
2336  yysyntax_error_status = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx);
2337  if (yysyntax_error_status == 0)
2338  yymsgp = yymsg;
2339  else if (yysyntax_error_status == -1)
2340  {
2341  if (yymsg != yymsgbuf)
2342  YYSTACK_FREE (yymsg);
2343  yymsg = YY_CAST (char *,
2344  YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc)));
2345  if (yymsg)
2346  {
2347  yysyntax_error_status
2348  = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx);
2349  yymsgp = yymsg;
2350  }
2351  else
2352  {
2353  yymsg = yymsgbuf;
2354  yymsg_alloc = sizeof yymsgbuf;
2355  yysyntax_error_status = YYENOMEM;
2356  }
2357  }
2358  yyerror (scanner, errp, root, yymsgp);
2359  if (yysyntax_error_status == YYENOMEM)
2360  goto yyexhaustedlab;
2361  }
2362  }
2363 
2364  if (yyerrstatus == 3)
2365  {
2366  /* If just tried and failed to reuse lookahead token after an
2367  error, discard it. */
2368 
2369  if (yychar <= YYEOF)
2370  {
2371  /* Return failure if at end of input. */
2372  if (yychar == YYEOF)
2373  YYABORT;
2374  }
2375  else
2376  {
2377  yydestruct ("Error: discarding",
2378  yytoken, &yylval, scanner, errp, root);
2379  yychar = YYEMPTY;
2380  }
2381  }
2382 
2383  /* Else will try to reuse lookahead token after shifting the error
2384  token. */
2385  goto yyerrlab1;
2386 
2387 
2388 /*---------------------------------------------------.
2389 | yyerrorlab -- error raised explicitly by YYERROR. |
2390 `---------------------------------------------------*/
2391 yyerrorlab:
2392  /* Pacify compilers when the user code never invokes YYERROR and the
2393  label yyerrorlab therefore never appears in user code. */
2394  if (0)
2395  YYERROR;
2396 
2397  /* Do not reclaim the symbols of the rule whose action triggered
2398  this YYERROR. */
2399  YYPOPSTACK (yylen);
2400  yylen = 0;
2401  YY_STACK_PRINT (yyss, yyssp);
2402  yystate = *yyssp;
2403  goto yyerrlab1;
2404 
2405 
2406 /*-------------------------------------------------------------.
2407 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2408 `-------------------------------------------------------------*/
2409 yyerrlab1:
2410  yyerrstatus = 3; /* Each real token shifted decrements this. */
2411 
2412  /* Pop stack until we find a state that shifts the error token. */
2413  for (;;)
2414  {
2415  yyn = yypact[yystate];
2416  if (!yypact_value_is_default (yyn))
2417  {
2418  yyn += YYSYMBOL_YYerror;
2419  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
2420  {
2421  yyn = yytable[yyn];
2422  if (0 < yyn)
2423  break;
2424  }
2425  }
2426 
2427  /* Pop the current state because it cannot handle the error token. */
2428  if (yyssp == yyss)
2429  YYABORT;
2430 
2431 
2432  yydestruct ("Error: popping",
2433  YY_ACCESSING_SYMBOL (yystate), yyvsp, scanner, errp, root);
2434  YYPOPSTACK (1);
2435  yystate = *yyssp;
2436  YY_STACK_PRINT (yyss, yyssp);
2437  }
2438 
2439  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2440  *++yyvsp = yylval;
2441  YY_IGNORE_MAYBE_UNINITIALIZED_END
2442 
2443 
2444  /* Shift the error token. */
2445  YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
2446 
2447  yystate = yyn;
2448  goto yynewstate;
2449 
2450 
2451 /*-------------------------------------.
2452 | yyacceptlab -- YYACCEPT comes here. |
2453 `-------------------------------------*/
2454 yyacceptlab:
2455  yyresult = 0;
2456  goto yyreturn;
2457 
2458 
2459 /*-----------------------------------.
2460 | yyabortlab -- YYABORT comes here. |
2461 `-----------------------------------*/
2462 yyabortlab:
2463  yyresult = 1;
2464  goto yyreturn;
2465 
2466 
2467 #if 1
2468 /*-------------------------------------------------.
2469 | yyexhaustedlab -- memory exhaustion comes here. |
2470 `-------------------------------------------------*/
2471 yyexhaustedlab:
2472  yyerror (scanner, errp, root, YY_("memory exhausted"));
2473  yyresult = 2;
2474  goto yyreturn;
2475 #endif
2476 
2477 
2478 /*-------------------------------------------------------.
2479 | yyreturn -- parsing is finished, clean up and return. |
2480 `-------------------------------------------------------*/
2481 yyreturn:
2482  if (yychar != YYEMPTY)
2483  {
2484  /* Make sure we have latest lookahead translation. See comments at
2485  user semantic actions for why this is necessary. */
2486  yytoken = YYTRANSLATE (yychar);
2487  yydestruct ("Cleanup: discarding lookahead",
2488  yytoken, &yylval, scanner, errp, root);
2489  }
2490  /* Do not reclaim the symbols of the rule whose action triggered
2491  this YYABORT or YYACCEPT. */
2492  YYPOPSTACK (yylen);
2493  YY_STACK_PRINT (yyss, yyssp);
2494  while (yyssp != yyss)
2495  {
2496  yydestruct ("Cleanup: popping",
2497  YY_ACCESSING_SYMBOL (+*yyssp), yyvsp, scanner, errp, root);
2498  YYPOPSTACK (1);
2499  }
2500 #ifndef yyoverflow
2501  if (yyss != yyssa)
2502  YYSTACK_FREE (yyss);
2503 #endif
2504  if (yymsg != yymsgbuf)
2505  YYSTACK_FREE (yymsg);
2506  return yyresult;
2507 }
2508 
void * nl_addr_get_binary_addr(const struct nl_addr *addr)
Get binary address of abstract address object.
Definition: addr.c:935
int nl_addr_parse(const char *addrstr, int hint, struct nl_addr **result)
Allocate abstract address based on character string.
Definition: addr.c:292
unsigned int nl_addr_get_prefixlen(const struct nl_addr *addr)
Return prefix length of abstract address object.
Definition: addr.c:970
unsigned int nl_addr_get_len(const struct nl_addr *addr)
Get length of binary address of abstract address object.
Definition: addr.c:947
void nl_addr_put(struct nl_addr *addr)
Decrease the reference counter of an abstract address.
Definition: addr.c:533
struct rtnl_ematch * rtnl_ematch_alloc(void)
Allocate ematch object.
Definition: ematch.c:103
int rtnl_pktloc_lookup(const char *name, struct rtnl_pktloc **result)
Lookup packet location alias.
Definition: pktloc.c:167
struct rtnl_pktloc * rtnl_pktloc_alloc(void)
Allocate packet location object.
Definition: pktloc.c:180
void rtnl_pktloc_put(struct rtnl_pktloc *loc)
Return reference of a packet location.
Definition: pktloc.c:197