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