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 0
59
60 /* Push parsers. */
61 #define YYPUSH 0
62
63 /* Pull parsers. */
64 #define YYPULL 1
65
66
67
68
69 /* First part of user prologue. */
70 #line 1 "external/iproute2/misc/ssfilter.y"
71
72
73 #include <stdio.h>
74 #include <stdlib.h>
75 #include <malloc.h>
76 #include <string.h>
77 /* NOTE: Android yacc build rules transform ssfilter.y into ssfilter.h, and
78 * #include "ssfilter.h" gets this file instead of the ssfilter.h in the
79 * source tree. This does not work. #include <ssfilter.h> instead. */
80 #include <ssfilter.h>
81
82 typedef struct ssfilter * ssfilter_t;
83
84 #define YYSTYPE ssfilter_t
85
alloc_node(int type,void * pred)86 static struct ssfilter * alloc_node(int type, void *pred)
87 {
88 struct ssfilter *n = malloc(sizeof(*n));
89 if (n == NULL)
90 abort();
91 n->type = type;
92 n->pred = pred;
93 n->post = NULL;
94 return n;
95 }
96
97 static char **yy_argv;
98 static int yy_argc;
99 static FILE *yy_fp;
100 static ssfilter_t *yy_ret;
101 static int tok_type = -1;
102
103 static int yylex(void);
104
yyerror(char * s)105 static void yyerror(char *s)
106 {
107 fprintf(stderr, "ss: bison bellows (while parsing filter): \"%s!\"", s);
108 }
109
110
111 #line 112 "out/soong/.intermediates/external/iproute2/misc/ss/android_arm64_armv8-2a_cortex-a55/gen/yacc/external/iproute2/misc/ssfilter.c"
112
113 # ifndef YY_CAST
114 # ifdef __cplusplus
115 # define YY_CAST(Type, Val) static_cast<Type> (Val)
116 # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
117 # else
118 # define YY_CAST(Type, Val) ((Type) (Val))
119 # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
120 # endif
121 # endif
122 # ifndef YY_NULLPTR
123 # if defined __cplusplus
124 # if 201103L <= __cplusplus
125 # define YY_NULLPTR nullptr
126 # else
127 # define YY_NULLPTR 0
128 # endif
129 # else
130 # define YY_NULLPTR ((void*)0)
131 # endif
132 # endif
133
134 #include "ssfilter.h"
135 /* Symbol kind. */
136 enum yysymbol_kind_t
137 {
138 YYSYMBOL_YYEMPTY = -2,
139 YYSYMBOL_YYEOF = 0, /* "end of file" */
140 YYSYMBOL_YYerror = 1, /* error */
141 YYSYMBOL_YYUNDEF = 2, /* "invalid token" */
142 YYSYMBOL_HOSTCOND = 3, /* HOSTCOND */
143 YYSYMBOL_DCOND = 4, /* DCOND */
144 YYSYMBOL_SCOND = 5, /* SCOND */
145 YYSYMBOL_DPORT = 6, /* DPORT */
146 YYSYMBOL_SPORT = 7, /* SPORT */
147 YYSYMBOL_LEQ = 8, /* LEQ */
148 YYSYMBOL_GEQ = 9, /* GEQ */
149 YYSYMBOL_NEQ = 10, /* NEQ */
150 YYSYMBOL_AUTOBOUND = 11, /* AUTOBOUND */
151 YYSYMBOL_DEVCOND = 12, /* DEVCOND */
152 YYSYMBOL_DEVNAME = 13, /* DEVNAME */
153 YYSYMBOL_MARKMASK = 14, /* MARKMASK */
154 YYSYMBOL_FWMARK = 15, /* FWMARK */
155 YYSYMBOL_16_ = 16, /* '|' */
156 YYSYMBOL_17_ = 17, /* '&' */
157 YYSYMBOL_18_ = 18, /* '!' */
158 YYSYMBOL_19_ = 19, /* '>' */
159 YYSYMBOL_20_ = 20, /* '<' */
160 YYSYMBOL_21_ = 21, /* '=' */
161 YYSYMBOL_22_ = 22, /* '(' */
162 YYSYMBOL_23_ = 23, /* ')' */
163 YYSYMBOL_YYACCEPT = 24, /* $accept */
164 YYSYMBOL_applet = 25, /* applet */
165 YYSYMBOL_null = 26, /* null */
166 YYSYMBOL_expr = 27 /* expr */
167 };
168 typedef enum yysymbol_kind_t yysymbol_kind_t;
169
170
171
172
173 #ifdef short
174 # undef short
175 #endif
176
177 /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
178 <limits.h> and (if available) <stdint.h> are included
179 so that the code can choose integer types of a good width. */
180
181 #ifndef __PTRDIFF_MAX__
182 # include <limits.h> /* INFRINGES ON USER NAME SPACE */
183 # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
184 # include <stdint.h> /* INFRINGES ON USER NAME SPACE */
185 # define YY_STDINT_H
186 # endif
187 #endif
188
189 /* Narrow types that promote to a signed type and that can represent a
190 signed or unsigned integer of at least N bits. In tables they can
191 save space and decrease cache pressure. Promoting to a signed type
192 helps avoid bugs in integer arithmetic. */
193
194 #ifdef __INT_LEAST8_MAX__
195 typedef __INT_LEAST8_TYPE__ yytype_int8;
196 #elif defined YY_STDINT_H
197 typedef int_least8_t yytype_int8;
198 #else
199 typedef signed char yytype_int8;
200 #endif
201
202 #ifdef __INT_LEAST16_MAX__
203 typedef __INT_LEAST16_TYPE__ yytype_int16;
204 #elif defined YY_STDINT_H
205 typedef int_least16_t yytype_int16;
206 #else
207 typedef short yytype_int16;
208 #endif
209
210 /* Work around bug in HP-UX 11.23, which defines these macros
211 incorrectly for preprocessor constants. This workaround can likely
212 be removed in 2023, as HPE has promised support for HP-UX 11.23
213 (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of
214 <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>. */
215 #ifdef __hpux
216 # undef UINT_LEAST8_MAX
217 # undef UINT_LEAST16_MAX
218 # define UINT_LEAST8_MAX 255
219 # define UINT_LEAST16_MAX 65535
220 #endif
221
222 #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
223 typedef __UINT_LEAST8_TYPE__ yytype_uint8;
224 #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
225 && UINT_LEAST8_MAX <= INT_MAX)
226 typedef uint_least8_t yytype_uint8;
227 #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
228 typedef unsigned char yytype_uint8;
229 #else
230 typedef short yytype_uint8;
231 #endif
232
233 #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
234 typedef __UINT_LEAST16_TYPE__ yytype_uint16;
235 #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
236 && UINT_LEAST16_MAX <= INT_MAX)
237 typedef uint_least16_t yytype_uint16;
238 #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
239 typedef unsigned short yytype_uint16;
240 #else
241 typedef int yytype_uint16;
242 #endif
243
244 #ifndef YYPTRDIFF_T
245 # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
246 # define YYPTRDIFF_T __PTRDIFF_TYPE__
247 # define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
248 # elif defined PTRDIFF_MAX
249 # ifndef ptrdiff_t
250 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
251 # endif
252 # define YYPTRDIFF_T ptrdiff_t
253 # define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
254 # else
255 # define YYPTRDIFF_T long
256 # define YYPTRDIFF_MAXIMUM LONG_MAX
257 # endif
258 #endif
259
260 #ifndef YYSIZE_T
261 # ifdef __SIZE_TYPE__
262 # define YYSIZE_T __SIZE_TYPE__
263 # elif defined size_t
264 # define YYSIZE_T size_t
265 # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
266 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
267 # define YYSIZE_T size_t
268 # else
269 # define YYSIZE_T unsigned
270 # endif
271 #endif
272
273 #define YYSIZE_MAXIMUM \
274 YY_CAST (YYPTRDIFF_T, \
275 (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \
276 ? YYPTRDIFF_MAXIMUM \
277 : YY_CAST (YYSIZE_T, -1)))
278
279 #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
280
281
282 /* Stored state numbers (used for stacks). */
283 typedef yytype_int8 yy_state_t;
284
285 /* State numbers in computations. */
286 typedef int yy_state_fast_t;
287
288 #ifndef YY_
289 # if defined YYENABLE_NLS && YYENABLE_NLS
290 # if ENABLE_NLS
291 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
292 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
293 # endif
294 # endif
295 # ifndef YY_
296 # define YY_(Msgid) Msgid
297 # endif
298 #endif
299
300
301 #ifndef YY_ATTRIBUTE_PURE
302 # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
303 # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
304 # else
305 # define YY_ATTRIBUTE_PURE
306 # endif
307 #endif
308
309 #ifndef YY_ATTRIBUTE_UNUSED
310 # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
311 # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
312 # else
313 # define YY_ATTRIBUTE_UNUSED
314 # endif
315 #endif
316
317 /* Suppress unused-variable warnings by "using" E. */
318 #if ! defined lint || defined __GNUC__
319 # define YY_USE(E) ((void) (E))
320 #else
321 # define YY_USE(E) /* empty */
322 #endif
323
324 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
325 #if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
326 # if __GNUC__ * 100 + __GNUC_MINOR__ < 407
327 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
328 _Pragma ("GCC diagnostic push") \
329 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")
330 # else
331 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
332 _Pragma ("GCC diagnostic push") \
333 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
334 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
335 # endif
336 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
337 _Pragma ("GCC diagnostic pop")
338 #else
339 # define YY_INITIAL_VALUE(Value) Value
340 #endif
341 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
342 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
343 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
344 #endif
345 #ifndef YY_INITIAL_VALUE
346 # define YY_INITIAL_VALUE(Value) /* Nothing. */
347 #endif
348
349 #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
350 # define YY_IGNORE_USELESS_CAST_BEGIN \
351 _Pragma ("GCC diagnostic push") \
352 _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
353 # define YY_IGNORE_USELESS_CAST_END \
354 _Pragma ("GCC diagnostic pop")
355 #endif
356 #ifndef YY_IGNORE_USELESS_CAST_BEGIN
357 # define YY_IGNORE_USELESS_CAST_BEGIN
358 # define YY_IGNORE_USELESS_CAST_END
359 #endif
360
361
362 #define YY_ASSERT(E) ((void) (0 && (E)))
363
364 #if !defined yyoverflow
365
366 /* The parser invokes alloca or malloc; define the necessary symbols. */
367
368 # ifdef YYSTACK_USE_ALLOCA
369 # if YYSTACK_USE_ALLOCA
370 # ifdef __GNUC__
371 # define YYSTACK_ALLOC __builtin_alloca
372 # elif defined __BUILTIN_VA_ARG_INCR
373 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
374 # elif defined _AIX
375 # define YYSTACK_ALLOC __alloca
376 # elif defined _MSC_VER
377 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
378 # define alloca _alloca
379 # else
380 # define YYSTACK_ALLOC alloca
381 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
382 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
383 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
384 # ifndef EXIT_SUCCESS
385 # define EXIT_SUCCESS 0
386 # endif
387 # endif
388 # endif
389 # endif
390 # endif
391
392 # ifdef YYSTACK_ALLOC
393 /* Pacify GCC's 'empty if-body' warning. */
394 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
395 # ifndef YYSTACK_ALLOC_MAXIMUM
396 /* The OS might guarantee only one guard page at the bottom of the stack,
397 and a page size can be as small as 4096 bytes. So we cannot safely
398 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
399 to allow for a few compiler-allocated temporary stack slots. */
400 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
401 # endif
402 # else
403 # define YYSTACK_ALLOC YYMALLOC
404 # define YYSTACK_FREE YYFREE
405 # ifndef YYSTACK_ALLOC_MAXIMUM
406 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
407 # endif
408 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
409 && ! ((defined YYMALLOC || defined malloc) \
410 && (defined YYFREE || defined free)))
411 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
412 # ifndef EXIT_SUCCESS
413 # define EXIT_SUCCESS 0
414 # endif
415 # endif
416 # ifndef YYMALLOC
417 # define YYMALLOC malloc
418 # if ! defined malloc && ! defined EXIT_SUCCESS
419 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
420 # endif
421 # endif
422 # ifndef YYFREE
423 # define YYFREE free
424 # if ! defined free && ! defined EXIT_SUCCESS
425 void free (void *); /* INFRINGES ON USER NAME SPACE */
426 # endif
427 # endif
428 # endif
429 #endif /* !defined yyoverflow */
430
431 #if (! defined yyoverflow \
432 && (! defined __cplusplus \
433 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
434
435 /* A type that is properly aligned for any stack member. */
436 union yyalloc
437 {
438 yy_state_t yyss_alloc;
439 YYSTYPE yyvs_alloc;
440 };
441
442 /* The size of the maximum gap between one aligned stack and the next. */
443 # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
444
445 /* The size of an array large to enough to hold all stacks, each with
446 N elements. */
447 # define YYSTACK_BYTES(N) \
448 ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
449 + YYSTACK_GAP_MAXIMUM)
450
451 # define YYCOPY_NEEDED 1
452
453 /* Relocate STACK from its old location to the new one. The
454 local variables YYSIZE and YYSTACKSIZE give the old and new number of
455 elements in the stack, and YYPTR gives the new location of the
456 stack. Advance YYPTR to a properly aligned location for the next
457 stack. */
458 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
459 do \
460 { \
461 YYPTRDIFF_T yynewbytes; \
462 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
463 Stack = &yyptr->Stack_alloc; \
464 yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
465 yyptr += yynewbytes / YYSIZEOF (*yyptr); \
466 } \
467 while (0)
468
469 #endif
470
471 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
472 /* Copy COUNT objects from SRC to DST. The source and destination do
473 not overlap. */
474 # ifndef YYCOPY
475 # if defined __GNUC__ && 1 < __GNUC__
476 # define YYCOPY(Dst, Src, Count) \
477 __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
478 # else
479 # define YYCOPY(Dst, Src, Count) \
480 do \
481 { \
482 YYPTRDIFF_T yyi; \
483 for (yyi = 0; yyi < (Count); yyi++) \
484 (Dst)[yyi] = (Src)[yyi]; \
485 } \
486 while (0)
487 # endif
488 # endif
489 #endif /* !YYCOPY_NEEDED */
490
491 /* YYFINAL -- State number of the termination state. */
492 #define YYFINAL 3
493 /* YYLAST -- Last index in YYTABLE. */
494 #define YYLAST 116
495
496 /* YYNTOKENS -- Number of terminals. */
497 #define YYNTOKENS 24
498 /* YYNNTS -- Number of nonterminals. */
499 #define YYNNTS 4
500 /* YYNRULES -- Number of rules. */
501 #define YYNRULES 28
502 /* YYNSTATES -- Number of states. */
503 #define YYNSTATES 56
504
505 /* YYMAXUTOK -- Last valid token kind. */
506 #define YYMAXUTOK 270
507
508
509 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
510 as returned by yylex, with out-of-bounds checking. */
511 #define YYTRANSLATE(YYX) \
512 (0 <= (YYX) && (YYX) <= YYMAXUTOK \
513 ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \
514 : YYSYMBOL_YYUNDEF)
515
516 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
517 as returned by yylex. */
518 static const yytype_int8 yytranslate[] =
519 {
520 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
521 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
522 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
523 2, 2, 2, 18, 2, 2, 2, 2, 17, 2,
524 22, 23, 2, 2, 2, 2, 2, 2, 2, 2,
525 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
526 20, 21, 19, 2, 2, 2, 2, 2, 2, 2,
527 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
528 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
529 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
530 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
531 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
532 2, 2, 2, 2, 16, 2, 2, 2, 2, 2,
533 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
534 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
535 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
536 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
537 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
538 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
539 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
540 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
541 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
542 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
543 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
544 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
545 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
546 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
547 15
548 };
549
550 #if YYDEBUG
551 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
552 static const yytype_uint8 yyrline[] =
553 {
554 0, 48, 48, 53, 55, 57, 61, 65, 69, 73,
555 77, 81, 85, 90, 94, 98, 102, 106, 110, 114,
556 118, 122, 126, 130, 134, 139, 144, 150, 154
557 };
558 #endif
559
560 /** Accessing symbol of state STATE. */
561 #define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
562
563 #if YYDEBUG || 0
564 /* The user-facing name of the symbol whose (internal) number is
565 YYSYMBOL. No bounds checking. */
566 static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
567
568 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
569 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
570 static const char *const yytname[] =
571 {
572 "\"end of file\"", "error", "\"invalid token\"", "HOSTCOND", "DCOND",
573 "SCOND", "DPORT", "SPORT", "LEQ", "GEQ", "NEQ", "AUTOBOUND", "DEVCOND",
574 "DEVNAME", "MARKMASK", "FWMARK", "'|'", "'&'", "'!'", "'>'", "'<'",
575 "'='", "'('", "')'", "$accept", "applet", "null", "expr", YY_NULLPTR
576 };
577
578 static const char *
yysymbol_name(yysymbol_kind_t yysymbol)579 yysymbol_name (yysymbol_kind_t yysymbol)
580 {
581 return yytname[yysymbol];
582 }
583 #endif
584
585 #define YYPACT_NINF (-10)
586
587 #define yypact_value_is_default(Yyn) \
588 ((Yyn) == YYPACT_NINF)
589
590 #define YYTABLE_NINF (-1)
591
592 #define yytable_value_is_error(Yyn) \
593 ((Yyn) == YYTABLE_NINF)
594
595 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
596 STATE-NUM. */
597 static const yytype_int8 yypact[] =
598 {
599 -10, 2, 61, -10, 5, 16, 91, 95, -10, -9,
600 -7, 61, 61, 23, -10, -10, 17, 18, 21, 22,
601 28, 32, 34, 39, 40, 41, 47, 48, 14, 44,
602 38, 49, 80, 0, 61, 61, 23, -10, -10, -10,
603 -10, -10, -10, -10, -10, -10, -10, -10, -10, -10,
604 -10, -10, -10, -10, 42, 61
605 };
606
607 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
608 Performed when YYTABLE does not specify something else to do. Zero
609 means the default is an error. */
610 static const yytype_int8 yydefact[] =
611 {
612 4, 0, 3, 1, 0, 0, 0, 0, 23, 0,
613 0, 0, 0, 2, 5, 6, 0, 0, 0, 0,
614 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
615 0, 0, 27, 0, 0, 0, 25, 8, 7, 12,
616 9, 10, 11, 14, 13, 18, 15, 16, 17, 20,
617 19, 22, 21, 28, 24, 26
618 };
619
620 /* YYPGOTO[NTERM-NUM]. */
621 static const yytype_int8 yypgoto[] =
622 {
623 -10, -10, -10, -2
624 };
625
626 /* YYDEFGOTO[NTERM-NUM]. */
627 static const yytype_int8 yydefgoto[] =
628 {
629 0, 1, 2, 36
630 };
631
632 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
633 positive, shift that token. If negative, reduce the rule whose
634 number is the opposite. If YYTABLE_NINF, syntax error. */
635 static const yytype_int8 yytable[] =
636 {
637 13, 28, 3, 30, 4, 5, 6, 7, 14, 32,
638 33, 8, 29, 9, 31, 10, 34, 35, 11, 15,
639 37, 38, 12, 53, 39, 40, 49, 4, 5, 6,
640 7, 41, 54, 55, 8, 42, 9, 43, 10, 34,
641 35, 11, 44, 45, 46, 12, 4, 5, 6, 7,
642 47, 48, 51, 8, 0, 9, 50, 10, 0, 35,
643 11, 0, 0, 52, 12, 4, 5, 6, 7, 0,
644 0, 0, 8, 0, 9, 0, 10, 0, 0, 11,
645 0, 0, 0, 12, 4, 5, 6, 7, 0, 0,
646 0, 8, 0, 9, 0, 10, 0, 0, -1, 16,
647 17, 18, 12, 22, 23, 24, 0, 0, 0, 0,
648 19, 20, 21, 0, 25, 26, 27
649 };
650
651 static const yytype_int8 yycheck[] =
652 {
653 2, 10, 0, 10, 4, 5, 6, 7, 3, 11,
654 12, 11, 21, 13, 21, 15, 16, 17, 18, 3,
655 3, 3, 22, 23, 3, 3, 12, 4, 5, 6,
656 7, 3, 34, 35, 11, 3, 13, 3, 15, 16,
657 17, 18, 3, 3, 3, 22, 4, 5, 6, 7,
658 3, 3, 14, 11, -1, 13, 12, 15, -1, 17,
659 18, -1, -1, 14, 22, 4, 5, 6, 7, -1,
660 -1, -1, 11, -1, 13, -1, 15, -1, -1, 18,
661 -1, -1, -1, 22, 4, 5, 6, 7, -1, -1,
662 -1, 11, -1, 13, -1, 15, -1, -1, 18, 8,
663 9, 10, 22, 8, 9, 10, -1, -1, -1, -1,
664 19, 20, 21, -1, 19, 20, 21
665 };
666
667 /* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
668 state STATE-NUM. */
669 static const yytype_int8 yystos[] =
670 {
671 0, 25, 26, 0, 4, 5, 6, 7, 11, 13,
672 15, 18, 22, 27, 3, 3, 8, 9, 10, 19,
673 20, 21, 8, 9, 10, 19, 20, 21, 10, 21,
674 10, 21, 27, 27, 16, 17, 27, 3, 3, 3,
675 3, 3, 3, 3, 3, 3, 3, 3, 3, 12,
676 12, 14, 14, 23, 27, 27
677 };
678
679 /* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */
680 static const yytype_int8 yyr1[] =
681 {
682 0, 24, 25, 25, 26, 27, 27, 27, 27, 27,
683 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
684 27, 27, 27, 27, 27, 27, 27, 27, 27
685 };
686
687 /* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */
688 static const yytype_int8 yyr2[] =
689 {
690 0, 2, 2, 1, 0, 2, 2, 3, 3, 3,
691 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
692 3, 3, 3, 1, 3, 2, 3, 2, 3
693 };
694
695
696 enum { YYENOMEM = -2 };
697
698 #define yyerrok (yyerrstatus = 0)
699 #define yyclearin (yychar = YYEMPTY)
700
701 #define YYACCEPT goto yyacceptlab
702 #define YYABORT goto yyabortlab
703 #define YYERROR goto yyerrorlab
704 #define YYNOMEM goto yyexhaustedlab
705
706
707 #define YYRECOVERING() (!!yyerrstatus)
708
709 #define YYBACKUP(Token, Value) \
710 do \
711 if (yychar == YYEMPTY) \
712 { \
713 yychar = (Token); \
714 yylval = (Value); \
715 YYPOPSTACK (yylen); \
716 yystate = *yyssp; \
717 goto yybackup; \
718 } \
719 else \
720 { \
721 yyerror (YY_("syntax error: cannot back up")); \
722 YYERROR; \
723 } \
724 while (0)
725
726 /* Backward compatibility with an undocumented macro.
727 Use YYerror or YYUNDEF. */
728 #define YYERRCODE YYUNDEF
729
730
731 /* Enable debugging if requested. */
732 #if YYDEBUG
733
734 # ifndef YYFPRINTF
735 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
736 # define YYFPRINTF fprintf
737 # endif
738
739 # define YYDPRINTF(Args) \
740 do { \
741 if (yydebug) \
742 YYFPRINTF Args; \
743 } while (0)
744
745
746
747
748 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \
749 do { \
750 if (yydebug) \
751 { \
752 YYFPRINTF (stderr, "%s ", Title); \
753 yy_symbol_print (stderr, \
754 Kind, Value); \
755 YYFPRINTF (stderr, "\n"); \
756 } \
757 } while (0)
758
759
760 /*-----------------------------------.
761 | Print this symbol's value on YYO. |
762 `-----------------------------------*/
763
764 static void
yy_symbol_value_print(FILE * yyo,yysymbol_kind_t yykind,YYSTYPE const * const yyvaluep)765 yy_symbol_value_print (FILE *yyo,
766 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
767 {
768 FILE *yyoutput = yyo;
769 YY_USE (yyoutput);
770 if (!yyvaluep)
771 return;
772 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
773 YY_USE (yykind);
774 YY_IGNORE_MAYBE_UNINITIALIZED_END
775 }
776
777
778 /*---------------------------.
779 | Print this symbol on YYO. |
780 `---------------------------*/
781
782 static void
yy_symbol_print(FILE * yyo,yysymbol_kind_t yykind,YYSTYPE const * const yyvaluep)783 yy_symbol_print (FILE *yyo,
784 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
785 {
786 YYFPRINTF (yyo, "%s %s (",
787 yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
788
789 yy_symbol_value_print (yyo, yykind, yyvaluep);
790 YYFPRINTF (yyo, ")");
791 }
792
793 /*------------------------------------------------------------------.
794 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
795 | TOP (included). |
796 `------------------------------------------------------------------*/
797
798 static void
yy_stack_print(yy_state_t * yybottom,yy_state_t * yytop)799 yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
800 {
801 YYFPRINTF (stderr, "Stack now");
802 for (; yybottom <= yytop; yybottom++)
803 {
804 int yybot = *yybottom;
805 YYFPRINTF (stderr, " %d", yybot);
806 }
807 YYFPRINTF (stderr, "\n");
808 }
809
810 # define YY_STACK_PRINT(Bottom, Top) \
811 do { \
812 if (yydebug) \
813 yy_stack_print ((Bottom), (Top)); \
814 } while (0)
815
816
817 /*------------------------------------------------.
818 | Report that the YYRULE is going to be reduced. |
819 `------------------------------------------------*/
820
821 static void
yy_reduce_print(yy_state_t * yyssp,YYSTYPE * yyvsp,int yyrule)822 yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,
823 int yyrule)
824 {
825 int yylno = yyrline[yyrule];
826 int yynrhs = yyr2[yyrule];
827 int yyi;
828 YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
829 yyrule - 1, yylno);
830 /* The symbols being reduced. */
831 for (yyi = 0; yyi < yynrhs; yyi++)
832 {
833 YYFPRINTF (stderr, " $%d = ", yyi + 1);
834 yy_symbol_print (stderr,
835 YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
836 &yyvsp[(yyi + 1) - (yynrhs)]);
837 YYFPRINTF (stderr, "\n");
838 }
839 }
840
841 # define YY_REDUCE_PRINT(Rule) \
842 do { \
843 if (yydebug) \
844 yy_reduce_print (yyssp, yyvsp, Rule); \
845 } while (0)
846
847 /* Nonzero means print parse trace. It is left uninitialized so that
848 multiple parsers can coexist. */
849 int yydebug;
850 #else /* !YYDEBUG */
851 # define YYDPRINTF(Args) ((void) 0)
852 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
853 # define YY_STACK_PRINT(Bottom, Top)
854 # define YY_REDUCE_PRINT(Rule)
855 #endif /* !YYDEBUG */
856
857
858 /* YYINITDEPTH -- initial size of the parser's stacks. */
859 #ifndef YYINITDEPTH
860 # define YYINITDEPTH 200
861 #endif
862
863 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
864 if the built-in stack extension method is used).
865
866 Do not make this value too large; the results are undefined if
867 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
868 evaluated with infinite-precision integer arithmetic. */
869
870 #ifndef YYMAXDEPTH
871 # define YYMAXDEPTH 10000
872 #endif
873
874
875
876
877
878
879 /*-----------------------------------------------.
880 | Release the memory associated to this symbol. |
881 `-----------------------------------------------*/
882
883 static void
yydestruct(const char * yymsg,yysymbol_kind_t yykind,YYSTYPE * yyvaluep)884 yydestruct (const char *yymsg,
885 yysymbol_kind_t yykind, YYSTYPE *yyvaluep)
886 {
887 YY_USE (yyvaluep);
888 if (!yymsg)
889 yymsg = "Deleting";
890 YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
891
892 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
893 YY_USE (yykind);
894 YY_IGNORE_MAYBE_UNINITIALIZED_END
895 }
896
897
898 /* Lookahead token kind. */
899 int yychar;
900
901 /* The semantic value of the lookahead symbol. */
902 YYSTYPE yylval;
903 /* Number of syntax errors so far. */
904 int yynerrs;
905
906
907
908
909 /*----------.
910 | yyparse. |
911 `----------*/
912
913 int
yyparse(void)914 yyparse (void)
915 {
916 yy_state_fast_t yystate = 0;
917 /* Number of tokens to shift before error messages enabled. */
918 int yyerrstatus = 0;
919
920 /* Refer to the stacks through separate pointers, to allow yyoverflow
921 to reallocate them elsewhere. */
922
923 /* Their size. */
924 YYPTRDIFF_T yystacksize = YYINITDEPTH;
925
926 /* The state stack: array, bottom, top. */
927 yy_state_t yyssa[YYINITDEPTH];
928 yy_state_t *yyss = yyssa;
929 yy_state_t *yyssp = yyss;
930
931 /* The semantic value stack: array, bottom, top. */
932 YYSTYPE yyvsa[YYINITDEPTH];
933 YYSTYPE *yyvs = yyvsa;
934 YYSTYPE *yyvsp = yyvs;
935
936 int yyn;
937 /* The return value of yyparse. */
938 int yyresult;
939 /* Lookahead symbol kind. */
940 yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
941 /* The variables used to return semantic value and location from the
942 action routines. */
943 YYSTYPE yyval;
944
945
946
947 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
948
949 /* The number of symbols on the RHS of the reduced rule.
950 Keep to zero when no symbol should be popped. */
951 int yylen = 0;
952
953 YYDPRINTF ((stderr, "Starting parse\n"));
954
955 yychar = YYEMPTY; /* Cause a token to be read. */
956
957 goto yysetstate;
958
959
960 /*------------------------------------------------------------.
961 | yynewstate -- push a new state, which is found in yystate. |
962 `------------------------------------------------------------*/
963 yynewstate:
964 /* In all cases, when you get here, the value and location stacks
965 have just been pushed. So pushing a state here evens the stacks. */
966 yyssp++;
967
968
969 /*--------------------------------------------------------------------.
970 | yysetstate -- set current state (the top of the stack) to yystate. |
971 `--------------------------------------------------------------------*/
972 yysetstate:
973 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
974 YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
975 YY_IGNORE_USELESS_CAST_BEGIN
976 *yyssp = YY_CAST (yy_state_t, yystate);
977 YY_IGNORE_USELESS_CAST_END
978 YY_STACK_PRINT (yyss, yyssp);
979
980 if (yyss + yystacksize - 1 <= yyssp)
981 #if !defined yyoverflow && !defined YYSTACK_RELOCATE
982 YYNOMEM;
983 #else
984 {
985 /* Get the current used size of the three stacks, in elements. */
986 YYPTRDIFF_T yysize = yyssp - yyss + 1;
987
988 # if defined yyoverflow
989 {
990 /* Give user a chance to reallocate the stack. Use copies of
991 these so that the &'s don't force the real ones into
992 memory. */
993 yy_state_t *yyss1 = yyss;
994 YYSTYPE *yyvs1 = yyvs;
995
996 /* Each stack pointer address is followed by the size of the
997 data in use in that stack, in bytes. This used to be a
998 conditional around just the two extra args, but that might
999 be undefined if yyoverflow is a macro. */
1000 yyoverflow (YY_("memory exhausted"),
1001 &yyss1, yysize * YYSIZEOF (*yyssp),
1002 &yyvs1, yysize * YYSIZEOF (*yyvsp),
1003 &yystacksize);
1004 yyss = yyss1;
1005 yyvs = yyvs1;
1006 }
1007 # else /* defined YYSTACK_RELOCATE */
1008 /* Extend the stack our own way. */
1009 if (YYMAXDEPTH <= yystacksize)
1010 YYNOMEM;
1011 yystacksize *= 2;
1012 if (YYMAXDEPTH < yystacksize)
1013 yystacksize = YYMAXDEPTH;
1014
1015 {
1016 yy_state_t *yyss1 = yyss;
1017 union yyalloc *yyptr =
1018 YY_CAST (union yyalloc *,
1019 YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
1020 if (! yyptr)
1021 YYNOMEM;
1022 YYSTACK_RELOCATE (yyss_alloc, yyss);
1023 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1024 # undef YYSTACK_RELOCATE
1025 if (yyss1 != yyssa)
1026 YYSTACK_FREE (yyss1);
1027 }
1028 # endif
1029
1030 yyssp = yyss + yysize - 1;
1031 yyvsp = yyvs + yysize - 1;
1032
1033 YY_IGNORE_USELESS_CAST_BEGIN
1034 YYDPRINTF ((stderr, "Stack size increased to %ld\n",
1035 YY_CAST (long, yystacksize)));
1036 YY_IGNORE_USELESS_CAST_END
1037
1038 if (yyss + yystacksize - 1 <= yyssp)
1039 YYABORT;
1040 }
1041 #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1042
1043
1044 if (yystate == YYFINAL)
1045 YYACCEPT;
1046
1047 goto yybackup;
1048
1049
1050 /*-----------.
1051 | yybackup. |
1052 `-----------*/
1053 yybackup:
1054 /* Do appropriate processing given the current state. Read a
1055 lookahead token if we need one and don't already have one. */
1056
1057 /* First try to decide what to do without reference to lookahead token. */
1058 yyn = yypact[yystate];
1059 if (yypact_value_is_default (yyn))
1060 goto yydefault;
1061
1062 /* Not known => get a lookahead token if don't already have one. */
1063
1064 /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */
1065 if (yychar == YYEMPTY)
1066 {
1067 YYDPRINTF ((stderr, "Reading a token\n"));
1068 yychar = yylex ();
1069 }
1070
1071 if (yychar <= YYEOF)
1072 {
1073 yychar = YYEOF;
1074 yytoken = YYSYMBOL_YYEOF;
1075 YYDPRINTF ((stderr, "Now at end of input.\n"));
1076 }
1077 else if (yychar == YYerror)
1078 {
1079 /* The scanner already issued an error message, process directly
1080 to error recovery. But do not keep the error token as
1081 lookahead, it is too special and may lead us to an endless
1082 loop in error recovery. */
1083 yychar = YYUNDEF;
1084 yytoken = YYSYMBOL_YYerror;
1085 goto yyerrlab1;
1086 }
1087 else
1088 {
1089 yytoken = YYTRANSLATE (yychar);
1090 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1091 }
1092
1093 /* If the proper action on seeing token YYTOKEN is to reduce or to
1094 detect an error, take that action. */
1095 yyn += yytoken;
1096 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1097 goto yydefault;
1098 yyn = yytable[yyn];
1099 if (yyn <= 0)
1100 {
1101 if (yytable_value_is_error (yyn))
1102 goto yyerrlab;
1103 yyn = -yyn;
1104 goto yyreduce;
1105 }
1106
1107 /* Count tokens shifted since error; after three, turn off error
1108 status. */
1109 if (yyerrstatus)
1110 yyerrstatus--;
1111
1112 /* Shift the lookahead token. */
1113 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1114 yystate = yyn;
1115 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1116 *++yyvsp = yylval;
1117 YY_IGNORE_MAYBE_UNINITIALIZED_END
1118
1119 /* Discard the shifted token. */
1120 yychar = YYEMPTY;
1121 goto yynewstate;
1122
1123
1124 /*-----------------------------------------------------------.
1125 | yydefault -- do the default action for the current state. |
1126 `-----------------------------------------------------------*/
1127 yydefault:
1128 yyn = yydefact[yystate];
1129 if (yyn == 0)
1130 goto yyerrlab;
1131 goto yyreduce;
1132
1133
1134 /*-----------------------------.
1135 | yyreduce -- do a reduction. |
1136 `-----------------------------*/
1137 yyreduce:
1138 /* yyn is the number of a rule to reduce with. */
1139 yylen = yyr2[yyn];
1140
1141 /* If YYLEN is nonzero, implement the default value of the action:
1142 '$$ = $1'.
1143
1144 Otherwise, the following line sets YYVAL to garbage.
1145 This behavior is undocumented and Bison
1146 users should not rely upon it. Assigning to YYVAL
1147 unconditionally makes the parser a bit smaller, and it avoids a
1148 GCC warning that YYVAL may be used uninitialized. */
1149 yyval = yyvsp[1-yylen];
1150
1151
1152 YY_REDUCE_PRINT (yyn);
1153 switch (yyn)
1154 {
1155 case 2: /* applet: null expr */
1156 #line 49 "external/iproute2/misc/ssfilter.y"
1157 {
1158 *yy_ret = yyvsp[0];
1159 yyval = yyvsp[0];
1160 }
1161 #line 1162 "out/soong/.intermediates/external/iproute2/misc/ss/android_arm64_armv8-2a_cortex-a55/gen/yacc/external/iproute2/misc/ssfilter.c"
1162 break;
1163
1164 case 4: /* null: %empty */
1165 #line 55 "external/iproute2/misc/ssfilter.y"
1166 { yyval = NULL; }
1167 #line 1168 "out/soong/.intermediates/external/iproute2/misc/ss/android_arm64_armv8-2a_cortex-a55/gen/yacc/external/iproute2/misc/ssfilter.c"
1168 break;
1169
1170 case 5: /* expr: DCOND HOSTCOND */
1171 #line 58 "external/iproute2/misc/ssfilter.y"
1172 {
1173 yyval = alloc_node(SSF_DCOND, yyvsp[0]);
1174 }
1175 #line 1176 "out/soong/.intermediates/external/iproute2/misc/ss/android_arm64_armv8-2a_cortex-a55/gen/yacc/external/iproute2/misc/ssfilter.c"
1176 break;
1177
1178 case 6: /* expr: SCOND HOSTCOND */
1179 #line 62 "external/iproute2/misc/ssfilter.y"
1180 {
1181 yyval = alloc_node(SSF_SCOND, yyvsp[0]);
1182 }
1183 #line 1184 "out/soong/.intermediates/external/iproute2/misc/ss/android_arm64_armv8-2a_cortex-a55/gen/yacc/external/iproute2/misc/ssfilter.c"
1184 break;
1185
1186 case 7: /* expr: DPORT GEQ HOSTCOND */
1187 #line 66 "external/iproute2/misc/ssfilter.y"
1188 {
1189 yyval = alloc_node(SSF_D_GE, yyvsp[0]);
1190 }
1191 #line 1192 "out/soong/.intermediates/external/iproute2/misc/ss/android_arm64_armv8-2a_cortex-a55/gen/yacc/external/iproute2/misc/ssfilter.c"
1192 break;
1193
1194 case 8: /* expr: DPORT LEQ HOSTCOND */
1195 #line 70 "external/iproute2/misc/ssfilter.y"
1196 {
1197 yyval = alloc_node(SSF_D_LE, yyvsp[0]);
1198 }
1199 #line 1200 "out/soong/.intermediates/external/iproute2/misc/ss/android_arm64_armv8-2a_cortex-a55/gen/yacc/external/iproute2/misc/ssfilter.c"
1200 break;
1201
1202 case 9: /* expr: DPORT '>' HOSTCOND */
1203 #line 74 "external/iproute2/misc/ssfilter.y"
1204 {
1205 yyval = alloc_node(SSF_NOT, alloc_node(SSF_D_LE, yyvsp[0]));
1206 }
1207 #line 1208 "out/soong/.intermediates/external/iproute2/misc/ss/android_arm64_armv8-2a_cortex-a55/gen/yacc/external/iproute2/misc/ssfilter.c"
1208 break;
1209
1210 case 10: /* expr: DPORT '<' HOSTCOND */
1211 #line 78 "external/iproute2/misc/ssfilter.y"
1212 {
1213 yyval = alloc_node(SSF_NOT, alloc_node(SSF_D_GE, yyvsp[0]));
1214 }
1215 #line 1216 "out/soong/.intermediates/external/iproute2/misc/ss/android_arm64_armv8-2a_cortex-a55/gen/yacc/external/iproute2/misc/ssfilter.c"
1216 break;
1217
1218 case 11: /* expr: DPORT '=' HOSTCOND */
1219 #line 82 "external/iproute2/misc/ssfilter.y"
1220 {
1221 yyval = alloc_node(SSF_DCOND, yyvsp[0]);
1222 }
1223 #line 1224 "out/soong/.intermediates/external/iproute2/misc/ss/android_arm64_armv8-2a_cortex-a55/gen/yacc/external/iproute2/misc/ssfilter.c"
1224 break;
1225
1226 case 12: /* expr: DPORT NEQ HOSTCOND */
1227 #line 86 "external/iproute2/misc/ssfilter.y"
1228 {
1229 yyval = alloc_node(SSF_NOT, alloc_node(SSF_DCOND, yyvsp[0]));
1230 }
1231 #line 1232 "out/soong/.intermediates/external/iproute2/misc/ss/android_arm64_armv8-2a_cortex-a55/gen/yacc/external/iproute2/misc/ssfilter.c"
1232 break;
1233
1234 case 13: /* expr: SPORT GEQ HOSTCOND */
1235 #line 91 "external/iproute2/misc/ssfilter.y"
1236 {
1237 yyval = alloc_node(SSF_S_GE, yyvsp[0]);
1238 }
1239 #line 1240 "out/soong/.intermediates/external/iproute2/misc/ss/android_arm64_armv8-2a_cortex-a55/gen/yacc/external/iproute2/misc/ssfilter.c"
1240 break;
1241
1242 case 14: /* expr: SPORT LEQ HOSTCOND */
1243 #line 95 "external/iproute2/misc/ssfilter.y"
1244 {
1245 yyval = alloc_node(SSF_S_LE, yyvsp[0]);
1246 }
1247 #line 1248 "out/soong/.intermediates/external/iproute2/misc/ss/android_arm64_armv8-2a_cortex-a55/gen/yacc/external/iproute2/misc/ssfilter.c"
1248 break;
1249
1250 case 15: /* expr: SPORT '>' HOSTCOND */
1251 #line 99 "external/iproute2/misc/ssfilter.y"
1252 {
1253 yyval = alloc_node(SSF_NOT, alloc_node(SSF_S_LE, yyvsp[0]));
1254 }
1255 #line 1256 "out/soong/.intermediates/external/iproute2/misc/ss/android_arm64_armv8-2a_cortex-a55/gen/yacc/external/iproute2/misc/ssfilter.c"
1256 break;
1257
1258 case 16: /* expr: SPORT '<' HOSTCOND */
1259 #line 103 "external/iproute2/misc/ssfilter.y"
1260 {
1261 yyval = alloc_node(SSF_NOT, alloc_node(SSF_S_GE, yyvsp[0]));
1262 }
1263 #line 1264 "out/soong/.intermediates/external/iproute2/misc/ss/android_arm64_armv8-2a_cortex-a55/gen/yacc/external/iproute2/misc/ssfilter.c"
1264 break;
1265
1266 case 17: /* expr: SPORT '=' HOSTCOND */
1267 #line 107 "external/iproute2/misc/ssfilter.y"
1268 {
1269 yyval = alloc_node(SSF_SCOND, yyvsp[0]);
1270 }
1271 #line 1272 "out/soong/.intermediates/external/iproute2/misc/ss/android_arm64_armv8-2a_cortex-a55/gen/yacc/external/iproute2/misc/ssfilter.c"
1272 break;
1273
1274 case 18: /* expr: SPORT NEQ HOSTCOND */
1275 #line 111 "external/iproute2/misc/ssfilter.y"
1276 {
1277 yyval = alloc_node(SSF_NOT, alloc_node(SSF_SCOND, yyvsp[0]));
1278 }
1279 #line 1280 "out/soong/.intermediates/external/iproute2/misc/ss/android_arm64_armv8-2a_cortex-a55/gen/yacc/external/iproute2/misc/ssfilter.c"
1280 break;
1281
1282 case 19: /* expr: DEVNAME '=' DEVCOND */
1283 #line 115 "external/iproute2/misc/ssfilter.y"
1284 {
1285 yyval = alloc_node(SSF_DEVCOND, yyvsp[0]);
1286 }
1287 #line 1288 "out/soong/.intermediates/external/iproute2/misc/ss/android_arm64_armv8-2a_cortex-a55/gen/yacc/external/iproute2/misc/ssfilter.c"
1288 break;
1289
1290 case 20: /* expr: DEVNAME NEQ DEVCOND */
1291 #line 119 "external/iproute2/misc/ssfilter.y"
1292 {
1293 yyval = alloc_node(SSF_NOT, alloc_node(SSF_DEVCOND, yyvsp[0]));
1294 }
1295 #line 1296 "out/soong/.intermediates/external/iproute2/misc/ss/android_arm64_armv8-2a_cortex-a55/gen/yacc/external/iproute2/misc/ssfilter.c"
1296 break;
1297
1298 case 21: /* expr: FWMARK '=' MARKMASK */
1299 #line 123 "external/iproute2/misc/ssfilter.y"
1300 {
1301 yyval = alloc_node(SSF_MARKMASK, yyvsp[0]);
1302 }
1303 #line 1304 "out/soong/.intermediates/external/iproute2/misc/ss/android_arm64_armv8-2a_cortex-a55/gen/yacc/external/iproute2/misc/ssfilter.c"
1304 break;
1305
1306 case 22: /* expr: FWMARK NEQ MARKMASK */
1307 #line 127 "external/iproute2/misc/ssfilter.y"
1308 {
1309 yyval = alloc_node(SSF_NOT, alloc_node(SSF_MARKMASK, yyvsp[0]));
1310 }
1311 #line 1312 "out/soong/.intermediates/external/iproute2/misc/ss/android_arm64_armv8-2a_cortex-a55/gen/yacc/external/iproute2/misc/ssfilter.c"
1312 break;
1313
1314 case 23: /* expr: AUTOBOUND */
1315 #line 131 "external/iproute2/misc/ssfilter.y"
1316 {
1317 yyval = alloc_node(SSF_S_AUTO, NULL);
1318 }
1319 #line 1320 "out/soong/.intermediates/external/iproute2/misc/ss/android_arm64_armv8-2a_cortex-a55/gen/yacc/external/iproute2/misc/ssfilter.c"
1320 break;
1321
1322 case 24: /* expr: expr '|' expr */
1323 #line 135 "external/iproute2/misc/ssfilter.y"
1324 {
1325 yyval = alloc_node(SSF_OR, yyvsp[-2]);
1326 yyval->post = yyvsp[0];
1327 }
1328 #line 1329 "out/soong/.intermediates/external/iproute2/misc/ss/android_arm64_armv8-2a_cortex-a55/gen/yacc/external/iproute2/misc/ssfilter.c"
1329 break;
1330
1331 case 25: /* expr: expr expr */
1332 #line 140 "external/iproute2/misc/ssfilter.y"
1333 {
1334 yyval = alloc_node(SSF_AND, yyvsp[-1]);
1335 yyval->post = yyvsp[0];
1336 }
1337 #line 1338 "out/soong/.intermediates/external/iproute2/misc/ss/android_arm64_armv8-2a_cortex-a55/gen/yacc/external/iproute2/misc/ssfilter.c"
1338 break;
1339
1340 case 26: /* expr: expr '&' expr */
1341 #line 146 "external/iproute2/misc/ssfilter.y"
1342 {
1343 yyval = alloc_node(SSF_AND, yyvsp[-2]);
1344 yyval->post = yyvsp[0];
1345 }
1346 #line 1347 "out/soong/.intermediates/external/iproute2/misc/ss/android_arm64_armv8-2a_cortex-a55/gen/yacc/external/iproute2/misc/ssfilter.c"
1347 break;
1348
1349 case 27: /* expr: '!' expr */
1350 #line 151 "external/iproute2/misc/ssfilter.y"
1351 {
1352 yyval = alloc_node(SSF_NOT, yyvsp[0]);
1353 }
1354 #line 1355 "out/soong/.intermediates/external/iproute2/misc/ss/android_arm64_armv8-2a_cortex-a55/gen/yacc/external/iproute2/misc/ssfilter.c"
1355 break;
1356
1357 case 28: /* expr: '(' expr ')' */
1358 #line 155 "external/iproute2/misc/ssfilter.y"
1359 {
1360 yyval = yyvsp[-1];
1361 }
1362 #line 1363 "out/soong/.intermediates/external/iproute2/misc/ss/android_arm64_armv8-2a_cortex-a55/gen/yacc/external/iproute2/misc/ssfilter.c"
1363 break;
1364
1365
1366 #line 1367 "out/soong/.intermediates/external/iproute2/misc/ss/android_arm64_armv8-2a_cortex-a55/gen/yacc/external/iproute2/misc/ssfilter.c"
1367
1368 default: break;
1369 }
1370 /* User semantic actions sometimes alter yychar, and that requires
1371 that yytoken be updated with the new translation. We take the
1372 approach of translating immediately before every use of yytoken.
1373 One alternative is translating here after every semantic action,
1374 but that translation would be missed if the semantic action invokes
1375 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1376 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
1377 incorrect destructor might then be invoked immediately. In the
1378 case of YYERROR or YYBACKUP, subsequent parser actions might lead
1379 to an incorrect destructor call or verbose syntax error message
1380 before the lookahead is translated. */
1381 YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
1382
1383 YYPOPSTACK (yylen);
1384 yylen = 0;
1385
1386 *++yyvsp = yyval;
1387
1388 /* Now 'shift' the result of the reduction. Determine what state
1389 that goes to, based on the state we popped back to and the rule
1390 number reduced by. */
1391 {
1392 const int yylhs = yyr1[yyn] - YYNTOKENS;
1393 const int yyi = yypgoto[yylhs] + *yyssp;
1394 yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
1395 ? yytable[yyi]
1396 : yydefgoto[yylhs]);
1397 }
1398
1399 goto yynewstate;
1400
1401
1402 /*--------------------------------------.
1403 | yyerrlab -- here on detecting error. |
1404 `--------------------------------------*/
1405 yyerrlab:
1406 /* Make sure we have latest lookahead translation. See comments at
1407 user semantic actions for why this is necessary. */
1408 yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
1409 /* If not already recovering from an error, report this error. */
1410 if (!yyerrstatus)
1411 {
1412 ++yynerrs;
1413 yyerror (YY_("syntax error"));
1414 }
1415
1416 if (yyerrstatus == 3)
1417 {
1418 /* If just tried and failed to reuse lookahead token after an
1419 error, discard it. */
1420
1421 if (yychar <= YYEOF)
1422 {
1423 /* Return failure if at end of input. */
1424 if (yychar == YYEOF)
1425 YYABORT;
1426 }
1427 else
1428 {
1429 yydestruct ("Error: discarding",
1430 yytoken, &yylval);
1431 yychar = YYEMPTY;
1432 }
1433 }
1434
1435 /* Else will try to reuse lookahead token after shifting the error
1436 token. */
1437 goto yyerrlab1;
1438
1439
1440 /*---------------------------------------------------.
1441 | yyerrorlab -- error raised explicitly by YYERROR. |
1442 `---------------------------------------------------*/
1443 yyerrorlab:
1444 /* Pacify compilers when the user code never invokes YYERROR and the
1445 label yyerrorlab therefore never appears in user code. */
1446 if (0)
1447 YYERROR;
1448 ++yynerrs;
1449
1450 /* Do not reclaim the symbols of the rule whose action triggered
1451 this YYERROR. */
1452 YYPOPSTACK (yylen);
1453 yylen = 0;
1454 YY_STACK_PRINT (yyss, yyssp);
1455 yystate = *yyssp;
1456 goto yyerrlab1;
1457
1458
1459 /*-------------------------------------------------------------.
1460 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1461 `-------------------------------------------------------------*/
1462 yyerrlab1:
1463 yyerrstatus = 3; /* Each real token shifted decrements this. */
1464
1465 /* Pop stack until we find a state that shifts the error token. */
1466 for (;;)
1467 {
1468 yyn = yypact[yystate];
1469 if (!yypact_value_is_default (yyn))
1470 {
1471 yyn += YYSYMBOL_YYerror;
1472 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
1473 {
1474 yyn = yytable[yyn];
1475 if (0 < yyn)
1476 break;
1477 }
1478 }
1479
1480 /* Pop the current state because it cannot handle the error token. */
1481 if (yyssp == yyss)
1482 YYABORT;
1483
1484
1485 yydestruct ("Error: popping",
1486 YY_ACCESSING_SYMBOL (yystate), yyvsp);
1487 YYPOPSTACK (1);
1488 yystate = *yyssp;
1489 YY_STACK_PRINT (yyss, yyssp);
1490 }
1491
1492 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1493 *++yyvsp = yylval;
1494 YY_IGNORE_MAYBE_UNINITIALIZED_END
1495
1496
1497 /* Shift the error token. */
1498 YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
1499
1500 yystate = yyn;
1501 goto yynewstate;
1502
1503
1504 /*-------------------------------------.
1505 | yyacceptlab -- YYACCEPT comes here. |
1506 `-------------------------------------*/
1507 yyacceptlab:
1508 yyresult = 0;
1509 goto yyreturnlab;
1510
1511
1512 /*-----------------------------------.
1513 | yyabortlab -- YYABORT comes here. |
1514 `-----------------------------------*/
1515 yyabortlab:
1516 yyresult = 1;
1517 goto yyreturnlab;
1518
1519
1520 /*-----------------------------------------------------------.
1521 | yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. |
1522 `-----------------------------------------------------------*/
1523 yyexhaustedlab:
1524 yyerror (YY_("memory exhausted"));
1525 yyresult = 2;
1526 goto yyreturnlab;
1527
1528
1529 /*----------------------------------------------------------.
1530 | yyreturnlab -- parsing is finished, clean up and return. |
1531 `----------------------------------------------------------*/
1532 yyreturnlab:
1533 if (yychar != YYEMPTY)
1534 {
1535 /* Make sure we have latest lookahead translation. See comments at
1536 user semantic actions for why this is necessary. */
1537 yytoken = YYTRANSLATE (yychar);
1538 yydestruct ("Cleanup: discarding lookahead",
1539 yytoken, &yylval);
1540 }
1541 /* Do not reclaim the symbols of the rule whose action triggered
1542 this YYABORT or YYACCEPT. */
1543 YYPOPSTACK (yylen);
1544 YY_STACK_PRINT (yyss, yyssp);
1545 while (yyssp != yyss)
1546 {
1547 yydestruct ("Cleanup: popping",
1548 YY_ACCESSING_SYMBOL (+*yyssp), yyvsp);
1549 YYPOPSTACK (1);
1550 }
1551 #ifndef yyoverflow
1552 if (yyss != yyssa)
1553 YYSTACK_FREE (yyss);
1554 #endif
1555
1556 return yyresult;
1557 }
1558
1559 #line 159 "external/iproute2/misc/ssfilter.y"
1560
1561
get_token_from_line(char ** ptr)1562 static char *get_token_from_line(char **ptr)
1563 {
1564 char *tok, *cp = *ptr;
1565
1566 while (*cp == ' ' || *cp == '\t') cp++;
1567
1568 if (*cp == 0) {
1569 *ptr = cp;
1570 return NULL;
1571 }
1572
1573 tok = cp;
1574
1575 while (*cp != 0 && *cp != ' ' && *cp != '\t') {
1576 /* Backslash escapes everything. */
1577 if (*cp == '\\') {
1578 char *tp;
1579 for (tp = cp; tp != tok; tp--)
1580 *tp = *(tp-1);
1581 cp++;
1582 tok++;
1583 if (*cp == 0)
1584 break;
1585 }
1586 cp++;
1587 }
1588 if (*cp)
1589 *cp++ = 0;
1590 *ptr = cp;
1591 return tok;
1592 }
1593
yylex(void)1594 int yylex(void)
1595 {
1596 static char argbuf[1024];
1597 static char *tokptr = argbuf;
1598 static int argc;
1599 char *curtok;
1600
1601 do {
1602 while (*tokptr == 0) {
1603 tokptr = NULL;
1604 if (argc < yy_argc) {
1605 tokptr = yy_argv[argc];
1606 argc++;
1607 } else if (yy_fp) {
1608 while (tokptr == NULL) {
1609 if (fgets(argbuf, sizeof(argbuf)-1, yy_fp) == NULL)
1610 return 0;
1611 argbuf[sizeof(argbuf)-1] = 0;
1612 if (strlen(argbuf) == sizeof(argbuf) - 1) {
1613 fprintf(stderr, "Too long line in filter");
1614 exit(-1);
1615 }
1616 if (argbuf[strlen(argbuf)-1] == '\n')
1617 argbuf[strlen(argbuf)-1] = 0;
1618 if (argbuf[0] == '#' || argbuf[0] == '0')
1619 continue;
1620 tokptr = argbuf;
1621 }
1622 } else {
1623 return 0;
1624 }
1625 }
1626 } while ((curtok = get_token_from_line(&tokptr)) == NULL);
1627
1628 if (strcmp(curtok, "!") == 0 ||
1629 strcmp(curtok, "not") == 0)
1630 return '!';
1631 if (strcmp(curtok, "&") == 0 ||
1632 strcmp(curtok, "&&") == 0 ||
1633 strcmp(curtok, "and") == 0)
1634 return '&';
1635 if (strcmp(curtok, "|") == 0 ||
1636 strcmp(curtok, "||") == 0 ||
1637 strcmp(curtok, "or") == 0)
1638 return '|';
1639 if (strcmp(curtok, "(") == 0)
1640 return '(';
1641 if (strcmp(curtok, ")") == 0)
1642 return ')';
1643 if (strcmp(curtok, "dst") == 0) {
1644 tok_type = DCOND;
1645 return DCOND;
1646 }
1647 if (strcmp(curtok, "src") == 0) {
1648 tok_type = SCOND;
1649 return SCOND;
1650 }
1651 if (strcmp(curtok, "dport") == 0) {
1652 tok_type = DPORT;
1653 return DPORT;
1654 }
1655 if (strcmp(curtok, "sport") == 0) {
1656 tok_type = SPORT;
1657 return SPORT;
1658 }
1659 if (strcmp(curtok, "dev") == 0) {
1660 tok_type = DEVNAME;
1661 return DEVNAME;
1662 }
1663 if (strcmp(curtok, "fwmark") == 0) {
1664 tok_type = FWMARK;
1665 return FWMARK;
1666 }
1667 if (strcmp(curtok, ">=") == 0 ||
1668 strcmp(curtok, "ge") == 0 ||
1669 strcmp(curtok, "geq") == 0)
1670 return GEQ;
1671 if (strcmp(curtok, "<=") == 0 ||
1672 strcmp(curtok, "le") == 0 ||
1673 strcmp(curtok, "leq") == 0)
1674 return LEQ;
1675 if (strcmp(curtok, "!=") == 0 ||
1676 strcmp(curtok, "ne") == 0 ||
1677 strcmp(curtok, "neq") == 0)
1678 return NEQ;
1679 if (strcmp(curtok, "=") == 0 ||
1680 strcmp(curtok, "==") == 0 ||
1681 strcmp(curtok, "eq") == 0)
1682 return '=';
1683 if (strcmp(curtok, ">") == 0 ||
1684 strcmp(curtok, "gt") == 0)
1685 return '>';
1686 if (strcmp(curtok, "<") == 0 ||
1687 strcmp(curtok, "lt") == 0)
1688 return '<';
1689 if (strcmp(curtok, "autobound") == 0) {
1690 tok_type = AUTOBOUND;
1691 return AUTOBOUND;
1692 }
1693 if (tok_type == DEVNAME) {
1694 yylval = (void*)parse_devcond(curtok);
1695 if (yylval == NULL) {
1696 fprintf(stderr, "Cannot parse device.\n");
1697 exit(1);
1698 }
1699 return DEVCOND;
1700 }
1701 if (tok_type == FWMARK) {
1702 yylval = (void*)parse_markmask(curtok);
1703 if (yylval == NULL) {
1704 fprintf(stderr, "Cannot parse mark %s.\n", curtok);
1705 exit(1);
1706 }
1707 return MARKMASK;
1708 }
1709 yylval = (void*)parse_hostcond(curtok, tok_type == SPORT || tok_type == DPORT);
1710 if (yylval == NULL) {
1711 fprintf(stderr, "Cannot parse dst/src address.\n");
1712 exit(1);
1713 }
1714 return HOSTCOND;
1715 }
1716
ssfilter_parse(struct ssfilter ** f,int argc,char ** argv,FILE * fp)1717 int ssfilter_parse(struct ssfilter **f, int argc, char **argv, FILE *fp)
1718 {
1719 yy_argc = argc;
1720 yy_argv = argv;
1721 yy_fp = fp;
1722 yy_ret = f;
1723
1724 if (yyparse()) {
1725 fprintf(stderr, " Sorry.\n");
1726 return -1;
1727 }
1728 return 0;
1729 }
1730