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