configparser.c revision 1.7 1 /* A Bison parser, made by GNU Bison 3.4.1. */
2
3 /* Bison implementation for Yacc-like parsers in C
4
5 Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 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 <http://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 /* All symbols defined below should begin with yy or YY, to avoid
38 infringing on user name space. This should be done even for local
39 variables, as they might otherwise be expanded by user macros.
40 There are some unavoidable exceptions within include files to
41 define necessary library symbols; they are noted "INFRINGES ON
42 USER NAME SPACE" below. */
43
44 /* Undocumented macros, especially those whose name start with YY_,
45 are private implementation details. Do not rely on them. */
46
47 /* Identify Bison output. */
48 #define YYBISON 1
49
50 /* Bison version. */
51 #define YYBISON_VERSION "3.4.1"
52
53 /* Skeleton name. */
54 #define YYSKELETON_NAME "yacc.c"
55
56 /* Pure parsers. */
57 #define YYPURE 0
58
59 /* Push parsers. */
60 #define YYPUSH 0
61
62 /* Pull parsers. */
63 #define YYPULL 1
64
65
66
67
68 /* First part of user prologue. */
69 #line 10 "configparser.y"
70
71 #include "config.h"
72
73 #include <assert.h>
74 #include <errno.h>
75 #include <stdio.h>
76 #include <string.h>
77
78 #include "options.h"
79 #include "util.h"
80 #include "dname.h"
81 #include "tsig.h"
82 #include "rrl.h"
83 #include "configyyrename.h"
84
85 int yylex(void);
86
87 #ifdef __cplusplus
88 extern "C"
89 #endif
90
91 /* these need to be global, otherwise they cannot be used inside yacc */
92 extern config_parser_state_type *cfg_parser;
93
94 static void append_acl(struct acl_options **list, struct acl_options *acl);
95 static int parse_boolean(const char *str, int *bln);
96 static int parse_expire_expr(const char *str, long long *num, uint8_t *expr);
97 static int parse_number(const char *str, long long *num);
98 static int parse_range(const char *str, long long *low, long long *high);
99
100 #line 101 "configparser.c"
101
102 # ifndef YY_NULLPTR
103 # if defined __cplusplus
104 # if 201103L <= __cplusplus
105 # define YY_NULLPTR nullptr
106 # else
107 # define YY_NULLPTR 0
108 # endif
109 # else
110 # define YY_NULLPTR ((void*)0)
111 # endif
112 # endif
113
114 /* Enabling verbose error messages. */
115 #ifdef YYERROR_VERBOSE
116 # undef YYERROR_VERBOSE
117 # define YYERROR_VERBOSE 1
118 #else
119 # define YYERROR_VERBOSE 0
120 #endif
121
122 /* Use api.header.include to #include this header
123 instead of duplicating it here. */
124 #ifndef YY_YY_CONFIGPARSER_H_INCLUDED
125 # define YY_YY_CONFIGPARSER_H_INCLUDED
126 /* Debug traces. */
127 #ifndef YYDEBUG
128 # define YYDEBUG 0
129 #endif
130 #if YYDEBUG
131 extern int yydebug;
132 #endif
133
134 /* Token type. */
135 #ifndef YYTOKENTYPE
136 # define YYTOKENTYPE
137 enum yytokentype
138 {
139 STRING = 258,
140 VAR_SERVER = 259,
141 VAR_SERVER_COUNT = 260,
142 VAR_IP_ADDRESS = 261,
143 VAR_IP_TRANSPARENT = 262,
144 VAR_IP_FREEBIND = 263,
145 VAR_REUSEPORT = 264,
146 VAR_SEND_BUFFER_SIZE = 265,
147 VAR_RECEIVE_BUFFER_SIZE = 266,
148 VAR_DEBUG_MODE = 267,
149 VAR_IP4_ONLY = 268,
150 VAR_IP6_ONLY = 269,
151 VAR_DO_IP4 = 270,
152 VAR_DO_IP6 = 271,
153 VAR_PORT = 272,
154 VAR_USE_SYSTEMD = 273,
155 VAR_VERBOSITY = 274,
156 VAR_USERNAME = 275,
157 VAR_CHROOT = 276,
158 VAR_ZONESDIR = 277,
159 VAR_ZONELISTFILE = 278,
160 VAR_DATABASE = 279,
161 VAR_LOGFILE = 280,
162 VAR_LOG_ONLY_SYSLOG = 281,
163 VAR_PIDFILE = 282,
164 VAR_DIFFFILE = 283,
165 VAR_XFRDFILE = 284,
166 VAR_XFRDIR = 285,
167 VAR_HIDE_VERSION = 286,
168 VAR_HIDE_IDENTITY = 287,
169 VAR_VERSION = 288,
170 VAR_IDENTITY = 289,
171 VAR_NSID = 290,
172 VAR_TCP_COUNT = 291,
173 VAR_TCP_REJECT_OVERFLOW = 292,
174 VAR_TCP_QUERY_COUNT = 293,
175 VAR_TCP_TIMEOUT = 294,
176 VAR_TCP_MSS = 295,
177 VAR_OUTGOING_TCP_MSS = 296,
178 VAR_IPV4_EDNS_SIZE = 297,
179 VAR_IPV6_EDNS_SIZE = 298,
180 VAR_STATISTICS = 299,
181 VAR_XFRD_RELOAD_TIMEOUT = 300,
182 VAR_LOG_TIME_ASCII = 301,
183 VAR_ROUND_ROBIN = 302,
184 VAR_MINIMAL_RESPONSES = 303,
185 VAR_CONFINE_TO_ZONE = 304,
186 VAR_REFUSE_ANY = 305,
187 VAR_ZONEFILES_CHECK = 306,
188 VAR_ZONEFILES_WRITE = 307,
189 VAR_RRL_SIZE = 308,
190 VAR_RRL_RATELIMIT = 309,
191 VAR_RRL_SLIP = 310,
192 VAR_RRL_IPV4_PREFIX_LENGTH = 311,
193 VAR_RRL_IPV6_PREFIX_LENGTH = 312,
194 VAR_RRL_WHITELIST_RATELIMIT = 313,
195 VAR_TLS_SERVICE_KEY = 314,
196 VAR_TLS_SERVICE_PEM = 315,
197 VAR_TLS_SERVICE_OCSP = 316,
198 VAR_TLS_PORT = 317,
199 VAR_CPU_AFFINITY = 318,
200 VAR_XFRD_CPU_AFFINITY = 319,
201 VAR_SERVER_CPU_AFFINITY = 320,
202 VAR_DROP_UPDATES = 321,
203 VAR_DNSTAP = 322,
204 VAR_DNSTAP_ENABLE = 323,
205 VAR_DNSTAP_SOCKET_PATH = 324,
206 VAR_DNSTAP_SEND_IDENTITY = 325,
207 VAR_DNSTAP_SEND_VERSION = 326,
208 VAR_DNSTAP_IDENTITY = 327,
209 VAR_DNSTAP_VERSION = 328,
210 VAR_DNSTAP_LOG_AUTH_QUERY_MESSAGES = 329,
211 VAR_DNSTAP_LOG_AUTH_RESPONSE_MESSAGES = 330,
212 VAR_REMOTE_CONTROL = 331,
213 VAR_CONTROL_ENABLE = 332,
214 VAR_CONTROL_INTERFACE = 333,
215 VAR_CONTROL_PORT = 334,
216 VAR_SERVER_KEY_FILE = 335,
217 VAR_SERVER_CERT_FILE = 336,
218 VAR_CONTROL_KEY_FILE = 337,
219 VAR_CONTROL_CERT_FILE = 338,
220 VAR_KEY = 339,
221 VAR_ALGORITHM = 340,
222 VAR_SECRET = 341,
223 VAR_PATTERN = 342,
224 VAR_NAME = 343,
225 VAR_ZONEFILE = 344,
226 VAR_NOTIFY = 345,
227 VAR_PROVIDE_XFR = 346,
228 VAR_AXFR = 347,
229 VAR_UDP = 348,
230 VAR_NOTIFY_RETRY = 349,
231 VAR_ALLOW_NOTIFY = 350,
232 VAR_REQUEST_XFR = 351,
233 VAR_ALLOW_AXFR_FALLBACK = 352,
234 VAR_OUTGOING_INTERFACE = 353,
235 VAR_MAX_REFRESH_TIME = 354,
236 VAR_MIN_REFRESH_TIME = 355,
237 VAR_MAX_RETRY_TIME = 356,
238 VAR_MIN_RETRY_TIME = 357,
239 VAR_MIN_EXPIRE_TIME = 358,
240 VAR_MULTI_MASTER_CHECK = 359,
241 VAR_SIZE_LIMIT_XFR = 360,
242 VAR_ZONESTATS = 361,
243 VAR_INCLUDE_PATTERN = 362,
244 VAR_ZONE = 363,
245 VAR_RRL_WHITELIST = 364,
246 VAR_SERVERS = 365,
247 VAR_BINDTODEVICE = 366,
248 VAR_SETFIB = 367
249 };
250 #endif
251 /* Tokens. */
252 #define STRING 258
253 #define VAR_SERVER 259
254 #define VAR_SERVER_COUNT 260
255 #define VAR_IP_ADDRESS 261
256 #define VAR_IP_TRANSPARENT 262
257 #define VAR_IP_FREEBIND 263
258 #define VAR_REUSEPORT 264
259 #define VAR_SEND_BUFFER_SIZE 265
260 #define VAR_RECEIVE_BUFFER_SIZE 266
261 #define VAR_DEBUG_MODE 267
262 #define VAR_IP4_ONLY 268
263 #define VAR_IP6_ONLY 269
264 #define VAR_DO_IP4 270
265 #define VAR_DO_IP6 271
266 #define VAR_PORT 272
267 #define VAR_USE_SYSTEMD 273
268 #define VAR_VERBOSITY 274
269 #define VAR_USERNAME 275
270 #define VAR_CHROOT 276
271 #define VAR_ZONESDIR 277
272 #define VAR_ZONELISTFILE 278
273 #define VAR_DATABASE 279
274 #define VAR_LOGFILE 280
275 #define VAR_LOG_ONLY_SYSLOG 281
276 #define VAR_PIDFILE 282
277 #define VAR_DIFFFILE 283
278 #define VAR_XFRDFILE 284
279 #define VAR_XFRDIR 285
280 #define VAR_HIDE_VERSION 286
281 #define VAR_HIDE_IDENTITY 287
282 #define VAR_VERSION 288
283 #define VAR_IDENTITY 289
284 #define VAR_NSID 290
285 #define VAR_TCP_COUNT 291
286 #define VAR_TCP_REJECT_OVERFLOW 292
287 #define VAR_TCP_QUERY_COUNT 293
288 #define VAR_TCP_TIMEOUT 294
289 #define VAR_TCP_MSS 295
290 #define VAR_OUTGOING_TCP_MSS 296
291 #define VAR_IPV4_EDNS_SIZE 297
292 #define VAR_IPV6_EDNS_SIZE 298
293 #define VAR_STATISTICS 299
294 #define VAR_XFRD_RELOAD_TIMEOUT 300
295 #define VAR_LOG_TIME_ASCII 301
296 #define VAR_ROUND_ROBIN 302
297 #define VAR_MINIMAL_RESPONSES 303
298 #define VAR_CONFINE_TO_ZONE 304
299 #define VAR_REFUSE_ANY 305
300 #define VAR_ZONEFILES_CHECK 306
301 #define VAR_ZONEFILES_WRITE 307
302 #define VAR_RRL_SIZE 308
303 #define VAR_RRL_RATELIMIT 309
304 #define VAR_RRL_SLIP 310
305 #define VAR_RRL_IPV4_PREFIX_LENGTH 311
306 #define VAR_RRL_IPV6_PREFIX_LENGTH 312
307 #define VAR_RRL_WHITELIST_RATELIMIT 313
308 #define VAR_TLS_SERVICE_KEY 314
309 #define VAR_TLS_SERVICE_PEM 315
310 #define VAR_TLS_SERVICE_OCSP 316
311 #define VAR_TLS_PORT 317
312 #define VAR_CPU_AFFINITY 318
313 #define VAR_XFRD_CPU_AFFINITY 319
314 #define VAR_SERVER_CPU_AFFINITY 320
315 #define VAR_DROP_UPDATES 321
316 #define VAR_DNSTAP 322
317 #define VAR_DNSTAP_ENABLE 323
318 #define VAR_DNSTAP_SOCKET_PATH 324
319 #define VAR_DNSTAP_SEND_IDENTITY 325
320 #define VAR_DNSTAP_SEND_VERSION 326
321 #define VAR_DNSTAP_IDENTITY 327
322 #define VAR_DNSTAP_VERSION 328
323 #define VAR_DNSTAP_LOG_AUTH_QUERY_MESSAGES 329
324 #define VAR_DNSTAP_LOG_AUTH_RESPONSE_MESSAGES 330
325 #define VAR_REMOTE_CONTROL 331
326 #define VAR_CONTROL_ENABLE 332
327 #define VAR_CONTROL_INTERFACE 333
328 #define VAR_CONTROL_PORT 334
329 #define VAR_SERVER_KEY_FILE 335
330 #define VAR_SERVER_CERT_FILE 336
331 #define VAR_CONTROL_KEY_FILE 337
332 #define VAR_CONTROL_CERT_FILE 338
333 #define VAR_KEY 339
334 #define VAR_ALGORITHM 340
335 #define VAR_SECRET 341
336 #define VAR_PATTERN 342
337 #define VAR_NAME 343
338 #define VAR_ZONEFILE 344
339 #define VAR_NOTIFY 345
340 #define VAR_PROVIDE_XFR 346
341 #define VAR_AXFR 347
342 #define VAR_UDP 348
343 #define VAR_NOTIFY_RETRY 349
344 #define VAR_ALLOW_NOTIFY 350
345 #define VAR_REQUEST_XFR 351
346 #define VAR_ALLOW_AXFR_FALLBACK 352
347 #define VAR_OUTGOING_INTERFACE 353
348 #define VAR_MAX_REFRESH_TIME 354
349 #define VAR_MIN_REFRESH_TIME 355
350 #define VAR_MAX_RETRY_TIME 356
351 #define VAR_MIN_RETRY_TIME 357
352 #define VAR_MIN_EXPIRE_TIME 358
353 #define VAR_MULTI_MASTER_CHECK 359
354 #define VAR_SIZE_LIMIT_XFR 360
355 #define VAR_ZONESTATS 361
356 #define VAR_INCLUDE_PATTERN 362
357 #define VAR_ZONE 363
358 #define VAR_RRL_WHITELIST 364
359 #define VAR_SERVERS 365
360 #define VAR_BINDTODEVICE 366
361 #define VAR_SETFIB 367
362
363 /* Value type. */
364 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
365 union YYSTYPE
366 {
367 #line 41 "configparser.y"
368
369 char *str;
370 long long llng;
371 int bln;
372 struct ip_address_option *ip;
373 struct range_option *range;
374 struct cpu_option *cpu;
375
376 #line 377 "configparser.c"
377
378 };
379 typedef union YYSTYPE YYSTYPE;
380 # define YYSTYPE_IS_TRIVIAL 1
381 # define YYSTYPE_IS_DECLARED 1
382 #endif
383
384
385 extern YYSTYPE yylval;
386
387 int yyparse (void);
388
389 #endif /* !YY_YY_CONFIGPARSER_H_INCLUDED */
390
391
392
393 #ifdef short
394 # undef short
395 #endif
396
397 #ifdef YYTYPE_UINT8
398 typedef YYTYPE_UINT8 yytype_uint8;
399 #else
400 typedef unsigned char yytype_uint8;
401 #endif
402
403 #ifdef YYTYPE_INT8
404 typedef YYTYPE_INT8 yytype_int8;
405 #else
406 typedef signed char yytype_int8;
407 #endif
408
409 #ifdef YYTYPE_UINT16
410 typedef YYTYPE_UINT16 yytype_uint16;
411 #else
412 typedef unsigned short yytype_uint16;
413 #endif
414
415 #ifdef YYTYPE_INT16
416 typedef YYTYPE_INT16 yytype_int16;
417 #else
418 typedef short yytype_int16;
419 #endif
420
421 #ifndef YYSIZE_T
422 # ifdef __SIZE_TYPE__
423 # define YYSIZE_T __SIZE_TYPE__
424 # elif defined size_t
425 # define YYSIZE_T size_t
426 # elif ! defined YYSIZE_T
427 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
428 # define YYSIZE_T size_t
429 # else
430 # define YYSIZE_T unsigned
431 # endif
432 #endif
433
434 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
435
436 #ifndef YY_
437 # if defined YYENABLE_NLS && YYENABLE_NLS
438 # if ENABLE_NLS
439 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
440 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
441 # endif
442 # endif
443 # ifndef YY_
444 # define YY_(Msgid) Msgid
445 # endif
446 #endif
447
448 #ifndef YY_ATTRIBUTE
449 # if (defined __GNUC__ \
450 && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
451 || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
452 # define YY_ATTRIBUTE(Spec) __attribute__(Spec)
453 # else
454 # define YY_ATTRIBUTE(Spec) /* empty */
455 # endif
456 #endif
457
458 #ifndef YY_ATTRIBUTE_PURE
459 # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
460 #endif
461
462 #ifndef YY_ATTRIBUTE_UNUSED
463 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
464 #endif
465
466 /* Suppress unused-variable warnings by "using" E. */
467 #if ! defined lint || defined __GNUC__
468 # define YYUSE(E) ((void) (E))
469 #else
470 # define YYUSE(E) /* empty */
471 #endif
472
473 #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
474 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
475 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
476 _Pragma ("GCC diagnostic push") \
477 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
478 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
479 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
480 _Pragma ("GCC diagnostic pop")
481 #else
482 # define YY_INITIAL_VALUE(Value) Value
483 #endif
484 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
485 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
486 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
487 #endif
488 #ifndef YY_INITIAL_VALUE
489 # define YY_INITIAL_VALUE(Value) /* Nothing. */
490 #endif
491
492
493 #define YY_ASSERT(E) ((void) (0 && (E)))
494
495 #if ! defined yyoverflow || YYERROR_VERBOSE
496
497 /* The parser invokes alloca or malloc; define the necessary symbols. */
498
499 # ifdef YYSTACK_USE_ALLOCA
500 # if YYSTACK_USE_ALLOCA
501 # ifdef __GNUC__
502 # define YYSTACK_ALLOC __builtin_alloca
503 # elif defined __BUILTIN_VA_ARG_INCR
504 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
505 # elif defined _AIX
506 # define YYSTACK_ALLOC __alloca
507 # elif defined _MSC_VER
508 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
509 # define alloca _alloca
510 # else
511 # define YYSTACK_ALLOC alloca
512 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
513 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
514 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
515 # ifndef EXIT_SUCCESS
516 # define EXIT_SUCCESS 0
517 # endif
518 # endif
519 # endif
520 # endif
521 # endif
522
523 # ifdef YYSTACK_ALLOC
524 /* Pacify GCC's 'empty if-body' warning. */
525 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
526 # ifndef YYSTACK_ALLOC_MAXIMUM
527 /* The OS might guarantee only one guard page at the bottom of the stack,
528 and a page size can be as small as 4096 bytes. So we cannot safely
529 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
530 to allow for a few compiler-allocated temporary stack slots. */
531 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
532 # endif
533 # else
534 # define YYSTACK_ALLOC YYMALLOC
535 # define YYSTACK_FREE YYFREE
536 # ifndef YYSTACK_ALLOC_MAXIMUM
537 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
538 # endif
539 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
540 && ! ((defined YYMALLOC || defined malloc) \
541 && (defined YYFREE || defined free)))
542 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
543 # ifndef EXIT_SUCCESS
544 # define EXIT_SUCCESS 0
545 # endif
546 # endif
547 # ifndef YYMALLOC
548 # define YYMALLOC malloc
549 # if ! defined malloc && ! defined EXIT_SUCCESS
550 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
551 # endif
552 # endif
553 # ifndef YYFREE
554 # define YYFREE free
555 # if ! defined free && ! defined EXIT_SUCCESS
556 void free (void *); /* INFRINGES ON USER NAME SPACE */
557 # endif
558 # endif
559 # endif
560 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
561
562
563 #if (! defined yyoverflow \
564 && (! defined __cplusplus \
565 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
566
567 /* A type that is properly aligned for any stack member. */
568 union yyalloc
569 {
570 yytype_int16 yyss_alloc;
571 YYSTYPE yyvs_alloc;
572 };
573
574 /* The size of the maximum gap between one aligned stack and the next. */
575 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
576
577 /* The size of an array large to enough to hold all stacks, each with
578 N elements. */
579 # define YYSTACK_BYTES(N) \
580 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
581 + YYSTACK_GAP_MAXIMUM)
582
583 # define YYCOPY_NEEDED 1
584
585 /* Relocate STACK from its old location to the new one. The
586 local variables YYSIZE and YYSTACKSIZE give the old and new number of
587 elements in the stack, and YYPTR gives the new location of the
588 stack. Advance YYPTR to a properly aligned location for the next
589 stack. */
590 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
591 do \
592 { \
593 YYSIZE_T yynewbytes; \
594 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
595 Stack = &yyptr->Stack_alloc; \
596 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
597 yyptr += yynewbytes / sizeof (*yyptr); \
598 } \
599 while (0)
600
601 #endif
602
603 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
604 /* Copy COUNT objects from SRC to DST. The source and destination do
605 not overlap. */
606 # ifndef YYCOPY
607 # if defined __GNUC__ && 1 < __GNUC__
608 # define YYCOPY(Dst, Src, Count) \
609 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
610 # else
611 # define YYCOPY(Dst, Src, Count) \
612 do \
613 { \
614 YYSIZE_T yyi; \
615 for (yyi = 0; yyi < (Count); yyi++) \
616 (Dst)[yyi] = (Src)[yyi]; \
617 } \
618 while (0)
619 # endif
620 # endif
621 #endif /* !YYCOPY_NEEDED */
622
623 /* YYFINAL -- State number of the termination state. */
624 #define YYFINAL 2
625 /* YYLAST -- Last index in YYTABLE. */
626 #define YYLAST 329
627
628 /* YYNTOKENS -- Number of terminals. */
629 #define YYNTOKENS 113
630 /* YYNNTS -- Number of nonterminals. */
631 #define YYNNTS 33
632 /* YYNRULES -- Number of rules. */
633 #define YYNRULES 146
634 /* YYNSTATES -- Number of states. */
635 #define YYNSTATES 256
636
637 #define YYUNDEFTOK 2
638 #define YYMAXUTOK 367
639
640 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
641 as returned by yylex, with out-of-bounds checking. */
642 #define YYTRANSLATE(YYX) \
643 ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
644
645 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
646 as returned by yylex. */
647 static const yytype_uint8 yytranslate[] =
648 {
649 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
650 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
651 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
652 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
653 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
654 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
655 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
656 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
657 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
658 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
659 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
660 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
661 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
662 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
663 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
664 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
665 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
666 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
667 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
668 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
669 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
670 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
671 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
672 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
673 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
674 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
675 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
676 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
677 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
678 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
679 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
680 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
681 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
682 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
683 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
684 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
685 105, 106, 107, 108, 109, 110, 111, 112
686 };
687
688 #if YYDEBUG
689 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
690 static const yytype_uint16 yyrline[] =
691 {
692 0, 182, 182, 184, 187, 188, 189, 190, 191, 192,
693 195, 198, 198, 202, 201, 218, 226, 228, 230, 232,
694 234, 236, 238, 240, 242, 244, 246, 248, 250, 252,
695 261, 263, 265, 295, 297, 299, 307, 309, 311, 313,
696 315, 317, 319, 321, 323, 330, 332, 334, 336, 338,
697 340, 342, 344, 346, 348, 350, 352, 362, 368, 374,
698 384, 394, 400, 402, 404, 409, 414, 419, 421, 423,
699 425, 427, 429, 436, 440, 470, 471, 474, 501, 503,
700 508, 509, 543, 545, 556, 559, 559, 562, 564, 566,
701 568, 570, 572, 574, 576, 581, 584, 584, 587, 589,
702 599, 607, 609, 611, 613, 619, 618, 643, 643, 646,
703 658, 666, 685, 684, 709, 709, 712, 725, 729, 728,
704 745, 745, 748, 755, 758, 764, 766, 768, 776, 778,
705 780, 789, 799, 809, 814, 823, 828, 833, 838, 843,
706 848, 853, 858, 863, 877, 887, 896
707 };
708 #endif
709
710 #if YYDEBUG || YYERROR_VERBOSE || 0
711 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
712 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
713 static const char *const yytname[] =
714 {
715 "$end", "error", "$undefined", "STRING", "VAR_SERVER",
716 "VAR_SERVER_COUNT", "VAR_IP_ADDRESS", "VAR_IP_TRANSPARENT",
717 "VAR_IP_FREEBIND", "VAR_REUSEPORT", "VAR_SEND_BUFFER_SIZE",
718 "VAR_RECEIVE_BUFFER_SIZE", "VAR_DEBUG_MODE", "VAR_IP4_ONLY",
719 "VAR_IP6_ONLY", "VAR_DO_IP4", "VAR_DO_IP6", "VAR_PORT",
720 "VAR_USE_SYSTEMD", "VAR_VERBOSITY", "VAR_USERNAME", "VAR_CHROOT",
721 "VAR_ZONESDIR", "VAR_ZONELISTFILE", "VAR_DATABASE", "VAR_LOGFILE",
722 "VAR_LOG_ONLY_SYSLOG", "VAR_PIDFILE", "VAR_DIFFFILE", "VAR_XFRDFILE",
723 "VAR_XFRDIR", "VAR_HIDE_VERSION", "VAR_HIDE_IDENTITY", "VAR_VERSION",
724 "VAR_IDENTITY", "VAR_NSID", "VAR_TCP_COUNT", "VAR_TCP_REJECT_OVERFLOW",
725 "VAR_TCP_QUERY_COUNT", "VAR_TCP_TIMEOUT", "VAR_TCP_MSS",
726 "VAR_OUTGOING_TCP_MSS", "VAR_IPV4_EDNS_SIZE", "VAR_IPV6_EDNS_SIZE",
727 "VAR_STATISTICS", "VAR_XFRD_RELOAD_TIMEOUT", "VAR_LOG_TIME_ASCII",
728 "VAR_ROUND_ROBIN", "VAR_MINIMAL_RESPONSES", "VAR_CONFINE_TO_ZONE",
729 "VAR_REFUSE_ANY", "VAR_ZONEFILES_CHECK", "VAR_ZONEFILES_WRITE",
730 "VAR_RRL_SIZE", "VAR_RRL_RATELIMIT", "VAR_RRL_SLIP",
731 "VAR_RRL_IPV4_PREFIX_LENGTH", "VAR_RRL_IPV6_PREFIX_LENGTH",
732 "VAR_RRL_WHITELIST_RATELIMIT", "VAR_TLS_SERVICE_KEY",
733 "VAR_TLS_SERVICE_PEM", "VAR_TLS_SERVICE_OCSP", "VAR_TLS_PORT",
734 "VAR_CPU_AFFINITY", "VAR_XFRD_CPU_AFFINITY", "VAR_SERVER_CPU_AFFINITY",
735 "VAR_DROP_UPDATES", "VAR_DNSTAP", "VAR_DNSTAP_ENABLE",
736 "VAR_DNSTAP_SOCKET_PATH", "VAR_DNSTAP_SEND_IDENTITY",
737 "VAR_DNSTAP_SEND_VERSION", "VAR_DNSTAP_IDENTITY", "VAR_DNSTAP_VERSION",
738 "VAR_DNSTAP_LOG_AUTH_QUERY_MESSAGES",
739 "VAR_DNSTAP_LOG_AUTH_RESPONSE_MESSAGES", "VAR_REMOTE_CONTROL",
740 "VAR_CONTROL_ENABLE", "VAR_CONTROL_INTERFACE", "VAR_CONTROL_PORT",
741 "VAR_SERVER_KEY_FILE", "VAR_SERVER_CERT_FILE", "VAR_CONTROL_KEY_FILE",
742 "VAR_CONTROL_CERT_FILE", "VAR_KEY", "VAR_ALGORITHM", "VAR_SECRET",
743 "VAR_PATTERN", "VAR_NAME", "VAR_ZONEFILE", "VAR_NOTIFY",
744 "VAR_PROVIDE_XFR", "VAR_AXFR", "VAR_UDP", "VAR_NOTIFY_RETRY",
745 "VAR_ALLOW_NOTIFY", "VAR_REQUEST_XFR", "VAR_ALLOW_AXFR_FALLBACK",
746 "VAR_OUTGOING_INTERFACE", "VAR_MAX_REFRESH_TIME", "VAR_MIN_REFRESH_TIME",
747 "VAR_MAX_RETRY_TIME", "VAR_MIN_RETRY_TIME", "VAR_MIN_EXPIRE_TIME",
748 "VAR_MULTI_MASTER_CHECK", "VAR_SIZE_LIMIT_XFR", "VAR_ZONESTATS",
749 "VAR_INCLUDE_PATTERN", "VAR_ZONE", "VAR_RRL_WHITELIST", "VAR_SERVERS",
750 "VAR_BINDTODEVICE", "VAR_SETFIB", "$accept", "blocks", "block", "server",
751 "server_block", "server_option", "$@1", "socket_options",
752 "socket_option", "cpus", "service_cpu_affinity", "dnstap",
753 "dnstap_block", "dnstap_option", "remote_control",
754 "remote_control_block", "remote_control_option", "key", "$@2",
755 "key_block", "key_option", "zone", "$@3", "zone_block", "zone_option",
756 "pattern", "$@4", "pattern_block", "pattern_option",
757 "pattern_or_zone_option", "ip_address", "number", "boolean", YY_NULLPTR
758 };
759 #endif
760
761 # ifdef YYPRINT
762 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
763 (internal) symbol number NUM (which must be that of a token). */
764 static const yytype_uint16 yytoknum[] =
765 {
766 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
767 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
768 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
769 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
770 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
771 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
772 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
773 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
774 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
775 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
776 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
777 365, 366, 367
778 };
779 # endif
780
781 #define YYPACT_NINF -92
782
783 #define yypact_value_is_default(Yystate) \
784 (!!((Yystate) == (-92)))
785
786 #define YYTABLE_NINF -1
787
788 #define yytable_value_is_error(Yytable_value) \
789 0
790
791 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
792 STATE-NUM. */
793 static const yytype_int16 yypact[] =
794 {
795 -92, 32, -92, -92, -92, -92, -92, -92, -92, -92,
796 -92, -92, -92, -92, -92, -92, 263, 52, 51, -92,
797 -92, -92, -1, 0, 6, 6, 6, -1, -1, 6,
798 6, 6, 6, 6, -1, 6, -1, 11, 13, 14,
799 19, 22, 23, 6, 24, 25, 27, 28, 6, 6,
800 30, 31, 34, -1, 6, -1, -1, -1, -1, -1,
801 -1, -1, -1, 6, 6, 6, 6, 6, 6, -1,
802 -1, -1, -1, -1, -1, -1, 41, 44, 45, -1,
803 -92, -92, -92, 6, -92, -1, 6, 46, 6, 6,
804 48, 50, 6, 6, -92, 6, 0, -1, 53, 54,
805 56, 57, -92, -73, 47, 85, -92, -92, -92, -92,
806 -92, -92, -92, -92, -92, -92, -92, -92, -92, -92,
807 -92, -92, -92, -92, -92, -92, -92, -92, -92, -92,
808 -92, -92, -92, -92, -92, -92, -92, -92, -92, -92,
809 -92, -92, -92, -92, -92, -92, -92, -92, -92, -92,
810 -92, -92, -92, -92, -92, -92, -92, -92, -92, -92,
811 -92, -92, -92, -92, -92, -92, -92, 59, -92, -92,
812 -92, -92, -92, -92, -92, -92, -92, -92, -92, -92,
813 -92, -92, -92, -92, -92, 62, 63, 66, -92, 69,
814 78, 79, 80, -1, 81, 8, 6, 82, -1, -1,
815 -1, -1, 83, 6, -1, 91, 92, 93, -92, -92,
816 95, -92, -92, -92, -92, -92, -92, -92, -92, -92,
817 99, 101, -92, 102, 103, 104, 106, -92, -92, -92,
818 -92, -92, -92, -92, -92, -92, -92, -92, -92, -92,
819 -91, -92, -92, -92, -92, 107, 108, 109, 6, -1,
820 -92, -92, -92, -92, -92, -92
821 };
822
823 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
824 Performed when YYTABLE does not specify something else to do. Zero
825 means the default is an error. */
826 static const yytype_uint8 yydefact[] =
827 {
828 2, 0, 1, 12, 86, 97, 105, 118, 112, 3,
829 4, 5, 6, 7, 9, 8, 10, 84, 95, 108,
830 121, 115, 0, 0, 0, 0, 0, 0, 0, 0,
831 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
832 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
833 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
834 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
835 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
836 80, 82, 83, 0, 11, 0, 0, 0, 0, 0,
837 0, 0, 0, 0, 85, 0, 0, 0, 0, 0,
838 0, 0, 96, 106, 119, 113, 145, 15, 144, 13,
839 146, 16, 17, 45, 18, 19, 20, 25, 26, 27,
840 28, 44, 21, 55, 48, 47, 49, 50, 29, 33,
841 34, 43, 51, 52, 53, 22, 23, 31, 30, 32,
842 35, 36, 37, 38, 39, 40, 41, 42, 46, 54,
843 64, 65, 66, 67, 68, 62, 63, 56, 57, 58,
844 59, 60, 61, 69, 71, 70, 72, 73, 24, 74,
845 87, 88, 89, 90, 91, 92, 93, 94, 98, 99,
846 100, 101, 102, 103, 104, 0, 0, 0, 107, 0,
847 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
848 0, 0, 0, 0, 0, 0, 0, 0, 120, 123,
849 0, 114, 117, 75, 81, 110, 111, 109, 122, 125,
850 0, 0, 138, 0, 0, 0, 0, 137, 136, 139,
851 140, 141, 142, 143, 128, 127, 126, 129, 124, 116,
852 14, 134, 135, 133, 130, 0, 0, 0, 0, 0,
853 76, 131, 132, 77, 78, 79
854 };
855
856 /* YYPGOTO[NTERM-NUM]. */
857 static const yytype_int8 yypgoto[] =
858 {
859 -92, -92, -92, -92, -92, -92, -92, -92, -92, -92,
860 -92, -92, -92, -92, -92, -92, -92, -92, -92, -92,
861 -92, -92, -92, -92, -92, -92, -92, -92, -92, -70,
862 -46, 18, -25
863 };
864
865 /* YYDEFGOTO[NTERM-NUM]. */
866 static const yytype_int16 yydefgoto[] =
867 {
868 -1, 1, 9, 10, 16, 84, 213, 240, 250, 167,
869 85, 11, 17, 94, 12, 18, 102, 13, 19, 103,
870 188, 14, 21, 105, 211, 15, 20, 104, 208, 209,
871 109, 107, 111
872 };
873
874 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
875 positive, shift that token. If negative, reduce the rule whose
876 number is the opposite. If YYTABLE_NINF, syntax error. */
877 static const yytype_uint8 yytable[] =
878 {
879 112, 113, 106, 108, 116, 117, 118, 119, 120, 110,
880 122, 224, 185, 186, 124, 187, 125, 126, 130, 247,
881 248, 249, 127, 135, 136, 128, 129, 131, 132, 141,
882 133, 134, 2, 137, 138, 212, 3, 139, 150, 151,
883 152, 153, 154, 155, 163, 114, 115, 164, 165, 171,
884 179, 174, 121, 175, 123, 0, 181, 182, 168, 183,
885 184, 170, 214, 172, 173, 215, 216, 176, 177, 217,
886 178, 140, 218, 142, 143, 144, 145, 146, 147, 148,
887 149, 219, 220, 221, 223, 228, 233, 156, 157, 158,
888 159, 160, 161, 162, 236, 237, 238, 166, 239, 4,
889 225, 226, 241, 169, 242, 243, 244, 245, 5, 246,
890 251, 252, 253, 0, 0, 180, 6, 0, 0, 7,
891 86, 87, 88, 89, 90, 91, 92, 93, 95, 96,
892 97, 98, 99, 100, 101, 189, 190, 191, 192, 0,
893 8, 193, 194, 195, 196, 197, 198, 199, 200, 201,
894 202, 203, 204, 205, 206, 0, 207, 0, 0, 0,
895 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
896 0, 227, 0, 210, 190, 191, 192, 0, 234, 193,
897 194, 195, 196, 197, 198, 199, 200, 201, 202, 203,
898 204, 205, 206, 0, 207, 0, 0, 0, 0, 0,
899 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
900 0, 222, 0, 0, 0, 0, 229, 230, 231, 232,
901 0, 0, 235, 254, 0, 0, 0, 0, 0, 0,
902 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
903 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
904 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
905 0, 0, 0, 0, 0, 0, 0, 255, 22, 23,
906 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
907 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
908 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
909 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
910 64, 65, 66, 67, 68, 69, 70, 71, 72, 73,
911 74, 75, 76, 77, 78, 79, 80, 81, 82, 83
912 };
913
914 static const yytype_int16 yycheck[] =
915 {
916 25, 26, 3, 3, 29, 30, 31, 32, 33, 3,
917 35, 3, 85, 86, 3, 88, 3, 3, 43, 110,
918 111, 112, 3, 48, 49, 3, 3, 3, 3, 54,
919 3, 3, 0, 3, 3, 105, 4, 3, 63, 64,
920 65, 66, 67, 68, 3, 27, 28, 3, 3, 3,
921 96, 3, 34, 3, 36, -1, 3, 3, 83, 3,
922 3, 86, 3, 88, 89, 3, 3, 92, 93, 3,
923 95, 53, 3, 55, 56, 57, 58, 59, 60, 61,
924 62, 3, 3, 3, 3, 3, 3, 69, 70, 71,
925 72, 73, 74, 75, 3, 3, 3, 79, 3, 67,
926 92, 93, 3, 85, 3, 3, 3, 3, 76, 3,
927 3, 3, 3, -1, -1, 97, 84, -1, -1, 87,
928 68, 69, 70, 71, 72, 73, 74, 75, 77, 78,
929 79, 80, 81, 82, 83, 88, 89, 90, 91, -1,
930 108, 94, 95, 96, 97, 98, 99, 100, 101, 102,
931 103, 104, 105, 106, 107, -1, 109, -1, -1, -1,
932 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
933 -1, 196, -1, 88, 89, 90, 91, -1, 203, 94,
934 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
935 105, 106, 107, -1, 109, -1, -1, -1, -1, -1,
936 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
937 -1, 193, -1, -1, -1, -1, 198, 199, 200, 201,
938 -1, -1, 204, 248, -1, -1, -1, -1, -1, -1,
939 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
940 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
941 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
942 -1, -1, -1, -1, -1, -1, -1, 249, 5, 6,
943 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
944 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
945 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
946 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
947 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
948 57, 58, 59, 60, 61, 62, 63, 64, 65, 66
949 };
950
951 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
952 symbol of state STATE-NUM. */
953 static const yytype_uint8 yystos[] =
954 {
955 0, 114, 0, 4, 67, 76, 84, 87, 108, 115,
956 116, 124, 127, 130, 134, 138, 117, 125, 128, 131,
957 139, 135, 5, 6, 7, 8, 9, 10, 11, 12,
958 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
959 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
960 33, 34, 35, 36, 37, 38, 39, 40, 41, 42,
961 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
962 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
963 63, 64, 65, 66, 118, 123, 68, 69, 70, 71,
964 72, 73, 74, 75, 126, 77, 78, 79, 80, 81,
965 82, 83, 129, 132, 140, 136, 3, 144, 3, 143,
966 3, 145, 145, 145, 144, 144, 145, 145, 145, 145,
967 145, 144, 145, 144, 3, 3, 3, 3, 3, 3,
968 145, 3, 3, 3, 3, 145, 145, 3, 3, 3,
969 144, 145, 144, 144, 144, 144, 144, 144, 144, 144,
970 145, 145, 145, 145, 145, 145, 144, 144, 144, 144,
971 144, 144, 144, 3, 3, 3, 144, 122, 145, 144,
972 145, 3, 145, 145, 3, 3, 145, 145, 145, 143,
973 144, 3, 3, 3, 3, 85, 86, 88, 133, 88,
974 89, 90, 91, 94, 95, 96, 97, 98, 99, 100,
975 101, 102, 103, 104, 105, 106, 107, 109, 141, 142,
976 88, 137, 142, 119, 3, 3, 3, 3, 3, 3,
977 3, 3, 144, 3, 3, 92, 93, 145, 3, 144,
978 144, 144, 144, 3, 145, 144, 3, 3, 3, 3,
979 120, 3, 3, 3, 3, 3, 3, 110, 111, 112,
980 121, 3, 3, 3, 145, 144
981 };
982
983 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
984 static const yytype_uint8 yyr1[] =
985 {
986 0, 113, 114, 114, 115, 115, 115, 115, 115, 115,
987 116, 117, 117, 119, 118, 118, 118, 118, 118, 118,
988 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
989 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
990 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
991 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
992 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
993 118, 118, 118, 118, 118, 120, 120, 121, 121, 121,
994 122, 122, 123, 123, 124, 125, 125, 126, 126, 126,
995 126, 126, 126, 126, 126, 127, 128, 128, 129, 129,
996 129, 129, 129, 129, 129, 131, 130, 132, 132, 133,
997 133, 133, 135, 134, 136, 136, 137, 137, 139, 138,
998 140, 140, 141, 141, 142, 142, 142, 142, 142, 142,
999 142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
1000 142, 142, 142, 142, 143, 144, 145
1001 };
1002
1003 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
1004 static const yytype_uint8 yyr2[] =
1005 {
1006 0, 2, 0, 2, 1, 1, 1, 1, 1, 1,
1007 2, 2, 0, 0, 4, 2, 2, 2, 2, 2,
1008 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1009 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1010 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1011 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1012 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1013 2, 2, 2, 2, 2, 0, 2, 2, 2, 2,
1014 0, 2, 1, 1, 2, 2, 0, 2, 2, 2,
1015 2, 2, 2, 2, 2, 2, 2, 0, 2, 2,
1016 2, 2, 2, 2, 2, 0, 3, 2, 0, 2,
1017 2, 2, 0, 3, 2, 0, 2, 1, 0, 3,
1018 2, 0, 2, 1, 2, 2, 2, 2, 2, 2,
1019 3, 4, 4, 3, 3, 3, 2, 2, 2, 2,
1020 2, 2, 2, 2, 1, 1, 1
1021 };
1022
1023
1024 #define yyerrok (yyerrstatus = 0)
1025 #define yyclearin (yychar = YYEMPTY)
1026 #define YYEMPTY (-2)
1027 #define YYEOF 0
1028
1029 #define YYACCEPT goto yyacceptlab
1030 #define YYABORT goto yyabortlab
1031 #define YYERROR goto yyerrorlab
1032
1033
1034 #define YYRECOVERING() (!!yyerrstatus)
1035
1036 #define YYBACKUP(Token, Value) \
1037 do \
1038 if (yychar == YYEMPTY) \
1039 { \
1040 yychar = (Token); \
1041 yylval = (Value); \
1042 YYPOPSTACK (yylen); \
1043 yystate = *yyssp; \
1044 goto yybackup; \
1045 } \
1046 else \
1047 { \
1048 yyerror (YY_("syntax error: cannot back up")); \
1049 YYERROR; \
1050 } \
1051 while (0)
1052
1053 /* Error token number */
1054 #define YYTERROR 1
1055 #define YYERRCODE 256
1056
1057
1058
1059 /* Enable debugging if requested. */
1060 #if YYDEBUG
1061
1062 # ifndef YYFPRINTF
1063 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1064 # define YYFPRINTF fprintf
1065 # endif
1066
1067 # define YYDPRINTF(Args) \
1068 do { \
1069 if (yydebug) \
1070 YYFPRINTF Args; \
1071 } while (0)
1072
1073 /* This macro is provided for backward compatibility. */
1074 #ifndef YY_LOCATION_PRINT
1075 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1076 #endif
1077
1078
1079 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
1080 do { \
1081 if (yydebug) \
1082 { \
1083 YYFPRINTF (stderr, "%s ", Title); \
1084 yy_symbol_print (stderr, \
1085 Type, Value); \
1086 YYFPRINTF (stderr, "\n"); \
1087 } \
1088 } while (0)
1089
1090
1091 /*-----------------------------------.
1092 | Print this symbol's value on YYO. |
1093 `-----------------------------------*/
1094
1095 static void
1096 yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep)
1097 {
1098 FILE *yyoutput = yyo;
1099 YYUSE (yyoutput);
1100 if (!yyvaluep)
1101 return;
1102 # ifdef YYPRINT
1103 if (yytype < YYNTOKENS)
1104 YYPRINT (yyo, yytoknum[yytype], *yyvaluep);
1105 # endif
1106 YYUSE (yytype);
1107 }
1108
1109
1110 /*---------------------------.
1111 | Print this symbol on YYO. |
1112 `---------------------------*/
1113
1114 static void
1115 yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep)
1116 {
1117 YYFPRINTF (yyo, "%s %s (",
1118 yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
1119
1120 yy_symbol_value_print (yyo, yytype, yyvaluep);
1121 YYFPRINTF (yyo, ")");
1122 }
1123
1124 /*------------------------------------------------------------------.
1125 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1126 | TOP (included). |
1127 `------------------------------------------------------------------*/
1128
1129 static void
1130 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
1131 {
1132 YYFPRINTF (stderr, "Stack now");
1133 for (; yybottom <= yytop; yybottom++)
1134 {
1135 int yybot = *yybottom;
1136 YYFPRINTF (stderr, " %d", yybot);
1137 }
1138 YYFPRINTF (stderr, "\n");
1139 }
1140
1141 # define YY_STACK_PRINT(Bottom, Top) \
1142 do { \
1143 if (yydebug) \
1144 yy_stack_print ((Bottom), (Top)); \
1145 } while (0)
1146
1147
1148 /*------------------------------------------------.
1149 | Report that the YYRULE is going to be reduced. |
1150 `------------------------------------------------*/
1151
1152 static void
1153 yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
1154 {
1155 unsigned long yylno = yyrline[yyrule];
1156 int yynrhs = yyr2[yyrule];
1157 int yyi;
1158 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1159 yyrule - 1, yylno);
1160 /* The symbols being reduced. */
1161 for (yyi = 0; yyi < yynrhs; yyi++)
1162 {
1163 YYFPRINTF (stderr, " $%d = ", yyi + 1);
1164 yy_symbol_print (stderr,
1165 yystos[yyssp[yyi + 1 - yynrhs]],
1166 &yyvsp[(yyi + 1) - (yynrhs)]
1167 );
1168 YYFPRINTF (stderr, "\n");
1169 }
1170 }
1171
1172 # define YY_REDUCE_PRINT(Rule) \
1173 do { \
1174 if (yydebug) \
1175 yy_reduce_print (yyssp, yyvsp, Rule); \
1176 } while (0)
1177
1178 /* Nonzero means print parse trace. It is left uninitialized so that
1179 multiple parsers can coexist. */
1180 int yydebug;
1181 #else /* !YYDEBUG */
1182 # define YYDPRINTF(Args)
1183 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1184 # define YY_STACK_PRINT(Bottom, Top)
1185 # define YY_REDUCE_PRINT(Rule)
1186 #endif /* !YYDEBUG */
1187
1188
1189 /* YYINITDEPTH -- initial size of the parser's stacks. */
1190 #ifndef YYINITDEPTH
1191 # define YYINITDEPTH 200
1192 #endif
1193
1194 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1195 if the built-in stack extension method is used).
1196
1197 Do not make this value too large; the results are undefined if
1198 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1199 evaluated with infinite-precision integer arithmetic. */
1200
1201 #ifndef YYMAXDEPTH
1202 # define YYMAXDEPTH 10000
1203 #endif
1204
1205
1206 #if YYERROR_VERBOSE
1207
1208 # ifndef yystrlen
1209 # if defined __GLIBC__ && defined _STRING_H
1210 # define yystrlen strlen
1211 # else
1212 /* Return the length of YYSTR. */
1213 static YYSIZE_T
1214 yystrlen (const char *yystr)
1215 {
1216 YYSIZE_T yylen;
1217 for (yylen = 0; yystr[yylen]; yylen++)
1218 continue;
1219 return yylen;
1220 }
1221 # endif
1222 # endif
1223
1224 # ifndef yystpcpy
1225 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1226 # define yystpcpy stpcpy
1227 # else
1228 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1229 YYDEST. */
1230 static char *
1231 yystpcpy (char *yydest, const char *yysrc)
1232 {
1233 char *yyd = yydest;
1234 const char *yys = yysrc;
1235
1236 while ((*yyd++ = *yys++) != '\0')
1237 continue;
1238
1239 return yyd - 1;
1240 }
1241 # endif
1242 # endif
1243
1244 # ifndef yytnamerr
1245 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1246 quotes and backslashes, so that it's suitable for yyerror. The
1247 heuristic is that double-quoting is unnecessary unless the string
1248 contains an apostrophe, a comma, or backslash (other than
1249 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1250 null, do not copy; instead, return the length of what the result
1251 would have been. */
1252 static YYSIZE_T
1253 yytnamerr (char *yyres, const char *yystr)
1254 {
1255 if (*yystr == '"')
1256 {
1257 YYSIZE_T yyn = 0;
1258 char const *yyp = yystr;
1259
1260 for (;;)
1261 switch (*++yyp)
1262 {
1263 case '\'':
1264 case ',':
1265 goto do_not_strip_quotes;
1266
1267 case '\\':
1268 if (*++yyp != '\\')
1269 goto do_not_strip_quotes;
1270 else
1271 goto append;
1272
1273 append:
1274 default:
1275 if (yyres)
1276 yyres[yyn] = *yyp;
1277 yyn++;
1278 break;
1279
1280 case '"':
1281 if (yyres)
1282 yyres[yyn] = '\0';
1283 return yyn;
1284 }
1285 do_not_strip_quotes: ;
1286 }
1287
1288 if (! yyres)
1289 return yystrlen (yystr);
1290
1291 return (YYSIZE_T) (yystpcpy (yyres, yystr) - yyres);
1292 }
1293 # endif
1294
1295 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1296 about the unexpected token YYTOKEN for the state stack whose top is
1297 YYSSP.
1298
1299 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1300 not large enough to hold the message. In that case, also set
1301 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1302 required number of bytes is too large to store. */
1303 static int
1304 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1305 yytype_int16 *yyssp, int yytoken)
1306 {
1307 YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
1308 YYSIZE_T yysize = yysize0;
1309 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1310 /* Internationalized format string. */
1311 const char *yyformat = YY_NULLPTR;
1312 /* Arguments of yyformat. */
1313 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1314 /* Number of reported tokens (one for the "unexpected", one per
1315 "expected"). */
1316 int yycount = 0;
1317
1318 /* There are many possibilities here to consider:
1319 - If this state is a consistent state with a default action, then
1320 the only way this function was invoked is if the default action
1321 is an error action. In that case, don't check for expected
1322 tokens because there are none.
1323 - The only way there can be no lookahead present (in yychar) is if
1324 this state is a consistent state with a default action. Thus,
1325 detecting the absence of a lookahead is sufficient to determine
1326 that there is no unexpected or expected token to report. In that
1327 case, just report a simple "syntax error".
1328 - Don't assume there isn't a lookahead just because this state is a
1329 consistent state with a default action. There might have been a
1330 previous inconsistent state, consistent state with a non-default
1331 action, or user semantic action that manipulated yychar.
1332 - Of course, the expected token list depends on states to have
1333 correct lookahead information, and it depends on the parser not
1334 to perform extra reductions after fetching a lookahead from the
1335 scanner and before detecting a syntax error. Thus, state merging
1336 (from LALR or IELR) and default reductions corrupt the expected
1337 token list. However, the list is correct for canonical LR with
1338 one exception: it will still contain any token that will not be
1339 accepted due to an error action in a later state.
1340 */
1341 if (yytoken != YYEMPTY)
1342 {
1343 int yyn = yypact[*yyssp];
1344 yyarg[yycount++] = yytname[yytoken];
1345 if (!yypact_value_is_default (yyn))
1346 {
1347 /* Start YYX at -YYN if negative to avoid negative indexes in
1348 YYCHECK. In other words, skip the first -YYN actions for
1349 this state because they are default actions. */
1350 int yyxbegin = yyn < 0 ? -yyn : 0;
1351 /* Stay within bounds of both yycheck and yytname. */
1352 int yychecklim = YYLAST - yyn + 1;
1353 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1354 int yyx;
1355
1356 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1357 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1358 && !yytable_value_is_error (yytable[yyx + yyn]))
1359 {
1360 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1361 {
1362 yycount = 1;
1363 yysize = yysize0;
1364 break;
1365 }
1366 yyarg[yycount++] = yytname[yyx];
1367 {
1368 YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
1369 if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
1370 yysize = yysize1;
1371 else
1372 return 2;
1373 }
1374 }
1375 }
1376 }
1377
1378 switch (yycount)
1379 {
1380 # define YYCASE_(N, S) \
1381 case N: \
1382 yyformat = S; \
1383 break
1384 default: /* Avoid compiler warnings. */
1385 YYCASE_(0, YY_("syntax error"));
1386 YYCASE_(1, YY_("syntax error, unexpected %s"));
1387 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1388 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1389 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1390 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1391 # undef YYCASE_
1392 }
1393
1394 {
1395 YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
1396 if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
1397 yysize = yysize1;
1398 else
1399 return 2;
1400 }
1401
1402 if (*yymsg_alloc < yysize)
1403 {
1404 *yymsg_alloc = 2 * yysize;
1405 if (! (yysize <= *yymsg_alloc
1406 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1407 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1408 return 1;
1409 }
1410
1411 /* Avoid sprintf, as that infringes on the user's name space.
1412 Don't have undefined behavior even if the translation
1413 produced a string with the wrong number of "%s"s. */
1414 {
1415 char *yyp = *yymsg;
1416 int yyi = 0;
1417 while ((*yyp = *yyformat) != '\0')
1418 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1419 {
1420 yyp += yytnamerr (yyp, yyarg[yyi++]);
1421 yyformat += 2;
1422 }
1423 else
1424 {
1425 yyp++;
1426 yyformat++;
1427 }
1428 }
1429 return 0;
1430 }
1431 #endif /* YYERROR_VERBOSE */
1432
1433 /*-----------------------------------------------.
1434 | Release the memory associated to this symbol. |
1435 `-----------------------------------------------*/
1436
1437 static void
1438 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1439 {
1440 YYUSE (yyvaluep);
1441 if (!yymsg)
1442 yymsg = "Deleting";
1443 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1444
1445 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1446 YYUSE (yytype);
1447 YY_IGNORE_MAYBE_UNINITIALIZED_END
1448 }
1449
1450
1451
1452
1453 /* The lookahead symbol. */
1454 int yychar;
1455
1456 /* The semantic value of the lookahead symbol. */
1457 YYSTYPE yylval;
1458 /* Number of syntax errors so far. */
1459 int yynerrs;
1460
1461
1462 /*----------.
1463 | yyparse. |
1464 `----------*/
1465
1466 int
1467 yyparse (void)
1468 {
1469 int yystate;
1470 /* Number of tokens to shift before error messages enabled. */
1471 int yyerrstatus;
1472
1473 /* The stacks and their tools:
1474 'yyss': related to states.
1475 'yyvs': related to semantic values.
1476
1477 Refer to the stacks through separate pointers, to allow yyoverflow
1478 to reallocate them elsewhere. */
1479
1480 /* The state stack. */
1481 yytype_int16 yyssa[YYINITDEPTH];
1482 yytype_int16 *yyss;
1483 yytype_int16 *yyssp;
1484
1485 /* The semantic value stack. */
1486 YYSTYPE yyvsa[YYINITDEPTH];
1487 YYSTYPE *yyvs;
1488 YYSTYPE *yyvsp;
1489
1490 YYSIZE_T yystacksize;
1491
1492 int yyn;
1493 int yyresult;
1494 /* Lookahead token as an internal (translated) token number. */
1495 int yytoken = 0;
1496 /* The variables used to return semantic value and location from the
1497 action routines. */
1498 YYSTYPE yyval;
1499
1500 #if YYERROR_VERBOSE
1501 /* Buffer for error messages, and its allocated size. */
1502 char yymsgbuf[128];
1503 char *yymsg = yymsgbuf;
1504 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1505 #endif
1506
1507 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1508
1509 /* The number of symbols on the RHS of the reduced rule.
1510 Keep to zero when no symbol should be popped. */
1511 int yylen = 0;
1512
1513 yyssp = yyss = yyssa;
1514 yyvsp = yyvs = yyvsa;
1515 yystacksize = YYINITDEPTH;
1516
1517 YYDPRINTF ((stderr, "Starting parse\n"));
1518
1519 yystate = 0;
1520 yyerrstatus = 0;
1521 yynerrs = 0;
1522 yychar = YYEMPTY; /* Cause a token to be read. */
1523 goto yysetstate;
1524
1525
1526 /*------------------------------------------------------------.
1527 | yynewstate -- push a new state, which is found in yystate. |
1528 `------------------------------------------------------------*/
1529 yynewstate:
1530 /* In all cases, when you get here, the value and location stacks
1531 have just been pushed. So pushing a state here evens the stacks. */
1532 yyssp++;
1533
1534
1535 /*--------------------------------------------------------------------.
1536 | yynewstate -- set current state (the top of the stack) to yystate. |
1537 `--------------------------------------------------------------------*/
1538 yysetstate:
1539 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1540 YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
1541 *yyssp = (yytype_int16) yystate;
1542
1543 if (yyss + yystacksize - 1 <= yyssp)
1544 #if !defined yyoverflow && !defined YYSTACK_RELOCATE
1545 goto yyexhaustedlab;
1546 #else
1547 {
1548 /* Get the current used size of the three stacks, in elements. */
1549 YYSIZE_T yysize = (YYSIZE_T) (yyssp - yyss + 1);
1550
1551 # if defined yyoverflow
1552 {
1553 /* Give user a chance to reallocate the stack. Use copies of
1554 these so that the &'s don't force the real ones into
1555 memory. */
1556 YYSTYPE *yyvs1 = yyvs;
1557 yytype_int16 *yyss1 = yyss;
1558
1559 /* Each stack pointer address is followed by the size of the
1560 data in use in that stack, in bytes. This used to be a
1561 conditional around just the two extra args, but that might
1562 be undefined if yyoverflow is a macro. */
1563 yyoverflow (YY_("memory exhausted"),
1564 &yyss1, yysize * sizeof (*yyssp),
1565 &yyvs1, yysize * sizeof (*yyvsp),
1566 &yystacksize);
1567 yyss = yyss1;
1568 yyvs = yyvs1;
1569 }
1570 # else /* defined YYSTACK_RELOCATE */
1571 /* Extend the stack our own way. */
1572 if (YYMAXDEPTH <= yystacksize)
1573 goto yyexhaustedlab;
1574 yystacksize *= 2;
1575 if (YYMAXDEPTH < yystacksize)
1576 yystacksize = YYMAXDEPTH;
1577
1578 {
1579 yytype_int16 *yyss1 = yyss;
1580 union yyalloc *yyptr =
1581 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1582 if (! yyptr)
1583 goto yyexhaustedlab;
1584 YYSTACK_RELOCATE (yyss_alloc, yyss);
1585 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1586 # undef YYSTACK_RELOCATE
1587 if (yyss1 != yyssa)
1588 YYSTACK_FREE (yyss1);
1589 }
1590 # endif
1591
1592 yyssp = yyss + yysize - 1;
1593 yyvsp = yyvs + yysize - 1;
1594
1595 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1596 (unsigned long) yystacksize));
1597
1598 if (yyss + yystacksize - 1 <= yyssp)
1599 YYABORT;
1600 }
1601 #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1602
1603 if (yystate == YYFINAL)
1604 YYACCEPT;
1605
1606 goto yybackup;
1607
1608
1609 /*-----------.
1610 | yybackup. |
1611 `-----------*/
1612 yybackup:
1613 /* Do appropriate processing given the current state. Read a
1614 lookahead token if we need one and don't already have one. */
1615
1616 /* First try to decide what to do without reference to lookahead token. */
1617 yyn = yypact[yystate];
1618 if (yypact_value_is_default (yyn))
1619 goto yydefault;
1620
1621 /* Not known => get a lookahead token if don't already have one. */
1622
1623 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1624 if (yychar == YYEMPTY)
1625 {
1626 YYDPRINTF ((stderr, "Reading a token: "));
1627 yychar = yylex ();
1628 }
1629
1630 if (yychar <= YYEOF)
1631 {
1632 yychar = yytoken = YYEOF;
1633 YYDPRINTF ((stderr, "Now at end of input.\n"));
1634 }
1635 else
1636 {
1637 yytoken = YYTRANSLATE (yychar);
1638 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1639 }
1640
1641 /* If the proper action on seeing token YYTOKEN is to reduce or to
1642 detect an error, take that action. */
1643 yyn += yytoken;
1644 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1645 goto yydefault;
1646 yyn = yytable[yyn];
1647 if (yyn <= 0)
1648 {
1649 if (yytable_value_is_error (yyn))
1650 goto yyerrlab;
1651 yyn = -yyn;
1652 goto yyreduce;
1653 }
1654
1655 /* Count tokens shifted since error; after three, turn off error
1656 status. */
1657 if (yyerrstatus)
1658 yyerrstatus--;
1659
1660 /* Shift the lookahead token. */
1661 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1662
1663 /* Discard the shifted token. */
1664 yychar = YYEMPTY;
1665
1666 yystate = yyn;
1667 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1668 *++yyvsp = yylval;
1669 YY_IGNORE_MAYBE_UNINITIALIZED_END
1670 goto yynewstate;
1671
1672
1673 /*-----------------------------------------------------------.
1674 | yydefault -- do the default action for the current state. |
1675 `-----------------------------------------------------------*/
1676 yydefault:
1677 yyn = yydefact[yystate];
1678 if (yyn == 0)
1679 goto yyerrlab;
1680 goto yyreduce;
1681
1682
1683 /*-----------------------------.
1684 | yyreduce -- do a reduction. |
1685 `-----------------------------*/
1686 yyreduce:
1687 /* yyn is the number of a rule to reduce with. */
1688 yylen = yyr2[yyn];
1689
1690 /* If YYLEN is nonzero, implement the default value of the action:
1691 '$$ = $1'.
1692
1693 Otherwise, the following line sets YYVAL to garbage.
1694 This behavior is undocumented and Bison
1695 users should not rely upon it. Assigning to YYVAL
1696 unconditionally makes the parser a bit smaller, and it avoids a
1697 GCC warning that YYVAL may be used uninitialized. */
1698 yyval = yyvsp[1-yylen];
1699
1700
1701 YY_REDUCE_PRINT (yyn);
1702 switch (yyn)
1703 {
1704 case 13:
1705 #line 202 "configparser.y"
1706 {
1707 struct ip_address_option *ip = cfg_parser->opt->ip_addresses;
1708
1709 if(ip == NULL) {
1710 cfg_parser->opt->ip_addresses = (yyvsp[0].ip);
1711 } else {
1712 while(ip->next) { ip = ip->next; }
1713 ip->next = (yyvsp[0].ip);
1714 }
1715
1716 cfg_parser->ip = (yyvsp[0].ip);
1717 }
1718 #line 1719 "configparser.c"
1719 break;
1720
1721 case 14:
1722 #line 215 "configparser.y"
1723 {
1724 cfg_parser->ip = NULL;
1725 }
1726 #line 1727 "configparser.c"
1727 break;
1728
1729 case 15:
1730 #line 219 "configparser.y"
1731 {
1732 if ((yyvsp[0].llng) > 0) {
1733 cfg_parser->opt->server_count = (int)(yyvsp[0].llng);
1734 } else {
1735 yyerror("expected a number greater than zero");
1736 }
1737 }
1738 #line 1739 "configparser.c"
1739 break;
1740
1741 case 16:
1742 #line 227 "configparser.y"
1743 { cfg_parser->opt->ip_transparent = (yyvsp[0].bln); }
1744 #line 1745 "configparser.c"
1745 break;
1746
1747 case 17:
1748 #line 229 "configparser.y"
1749 { cfg_parser->opt->ip_freebind = (yyvsp[0].bln); }
1750 #line 1751 "configparser.c"
1751 break;
1752
1753 case 18:
1754 #line 231 "configparser.y"
1755 { cfg_parser->opt->send_buffer_size = (int)(yyvsp[0].llng); }
1756 #line 1757 "configparser.c"
1757 break;
1758
1759 case 19:
1760 #line 233 "configparser.y"
1761 { cfg_parser->opt->receive_buffer_size = (int)(yyvsp[0].llng); }
1762 #line 1763 "configparser.c"
1763 break;
1764
1765 case 20:
1766 #line 235 "configparser.y"
1767 { cfg_parser->opt->debug_mode = (yyvsp[0].bln); }
1768 #line 1769 "configparser.c"
1769 break;
1770
1771 case 21:
1772 #line 237 "configparser.y"
1773 { /* ignored, deprecated */ }
1774 #line 1775 "configparser.c"
1775 break;
1776
1777 case 22:
1778 #line 239 "configparser.y"
1779 { cfg_parser->opt->hide_version = (yyvsp[0].bln); }
1780 #line 1781 "configparser.c"
1781 break;
1782
1783 case 23:
1784 #line 241 "configparser.y"
1785 { cfg_parser->opt->hide_identity = (yyvsp[0].bln); }
1786 #line 1787 "configparser.c"
1787 break;
1788
1789 case 24:
1790 #line 243 "configparser.y"
1791 { cfg_parser->opt->drop_updates = (yyvsp[0].bln); }
1792 #line 1793 "configparser.c"
1793 break;
1794
1795 case 25:
1796 #line 245 "configparser.y"
1797 { if((yyvsp[0].bln)) { cfg_parser->opt->do_ip4 = 1; cfg_parser->opt->do_ip6 = 0; } }
1798 #line 1799 "configparser.c"
1799 break;
1800
1801 case 26:
1802 #line 247 "configparser.y"
1803 { if((yyvsp[0].bln)) { cfg_parser->opt->do_ip4 = 0; cfg_parser->opt->do_ip6 = 1; } }
1804 #line 1805 "configparser.c"
1805 break;
1806
1807 case 27:
1808 #line 249 "configparser.y"
1809 { cfg_parser->opt->do_ip4 = (yyvsp[0].bln); }
1810 #line 1811 "configparser.c"
1811 break;
1812
1813 case 28:
1814 #line 251 "configparser.y"
1815 { cfg_parser->opt->do_ip6 = (yyvsp[0].bln); }
1816 #line 1817 "configparser.c"
1817 break;
1818
1819 case 29:
1820 #line 253 "configparser.y"
1821 {
1822 cfg_parser->opt->database = region_strdup(cfg_parser->opt->region, (yyvsp[0].str));
1823 if(cfg_parser->opt->database[0] == 0 &&
1824 cfg_parser->opt->zonefiles_write == 0)
1825 {
1826 cfg_parser->opt->zonefiles_write = ZONEFILES_WRITE_INTERVAL;
1827 }
1828 }
1829 #line 1830 "configparser.c"
1830 break;
1831
1832 case 30:
1833 #line 262 "configparser.y"
1834 { cfg_parser->opt->identity = region_strdup(cfg_parser->opt->region, (yyvsp[0].str)); }
1835 #line 1836 "configparser.c"
1836 break;
1837
1838 case 31:
1839 #line 264 "configparser.y"
1840 { cfg_parser->opt->version = region_strdup(cfg_parser->opt->region, (yyvsp[0].str)); }
1841 #line 1842 "configparser.c"
1842 break;
1843
1844 case 32:
1845 #line 266 "configparser.y"
1846 {
1847 unsigned char* nsid = 0;
1848 size_t nsid_len = strlen((yyvsp[0].str));
1849
1850 if (strncasecmp((yyvsp[0].str), "ascii_", 6) == 0) {
1851 nsid_len -= 6; /* discard "ascii_" */
1852 if(nsid_len < 65535) {
1853 cfg_parser->opt->nsid = region_alloc(cfg_parser->opt->region, nsid_len*2+1);
1854 hex_ntop((uint8_t*)(yyvsp[0].str)+6, nsid_len, (char*)cfg_parser->opt->nsid, nsid_len*2+1);
1855 } else {
1856 yyerror("NSID too long");
1857 }
1858 } else if (nsid_len % 2 != 0) {
1859 yyerror("the NSID must be a hex string of an even length.");
1860 } else {
1861 nsid_len = nsid_len / 2;
1862 if(nsid_len < 65535) {
1863 nsid = xalloc(nsid_len);
1864 if (hex_pton((yyvsp[0].str), nsid, nsid_len) == -1) {
1865 yyerror("hex string cannot be parsed in NSID.");
1866 } else {
1867 cfg_parser->opt->nsid = region_strdup(cfg_parser->opt->region, (yyvsp[0].str));
1868 }
1869 free(nsid);
1870 } else {
1871 yyerror("NSID too long");
1872 }
1873 }
1874 }
1875 #line 1876 "configparser.c"
1876 break;
1877
1878 case 33:
1879 #line 296 "configparser.y"
1880 { cfg_parser->opt->logfile = region_strdup(cfg_parser->opt->region, (yyvsp[0].str)); }
1881 #line 1882 "configparser.c"
1882 break;
1883
1884 case 34:
1885 #line 298 "configparser.y"
1886 { cfg_parser->opt->log_only_syslog = (yyvsp[0].bln); }
1887 #line 1888 "configparser.c"
1888 break;
1889
1890 case 35:
1891 #line 300 "configparser.y"
1892 {
1893 if ((yyvsp[0].llng) > 0) {
1894 cfg_parser->opt->tcp_count = (int)(yyvsp[0].llng);
1895 } else {
1896 yyerror("expected a number greater than zero");
1897 }
1898 }
1899 #line 1900 "configparser.c"
1900 break;
1901
1902 case 36:
1903 #line 308 "configparser.y"
1904 { cfg_parser->opt->tcp_reject_overflow = (yyvsp[0].bln); }
1905 #line 1906 "configparser.c"
1906 break;
1907
1908 case 37:
1909 #line 310 "configparser.y"
1910 { cfg_parser->opt->tcp_query_count = (int)(yyvsp[0].llng); }
1911 #line 1912 "configparser.c"
1912 break;
1913
1914 case 38:
1915 #line 312 "configparser.y"
1916 { cfg_parser->opt->tcp_timeout = (int)(yyvsp[0].llng); }
1917 #line 1918 "configparser.c"
1918 break;
1919
1920 case 39:
1921 #line 314 "configparser.y"
1922 { cfg_parser->opt->tcp_mss = (int)(yyvsp[0].llng); }
1923 #line 1924 "configparser.c"
1924 break;
1925
1926 case 40:
1927 #line 316 "configparser.y"
1928 { cfg_parser->opt->outgoing_tcp_mss = (int)(yyvsp[0].llng); }
1929 #line 1930 "configparser.c"
1930 break;
1931
1932 case 41:
1933 #line 318 "configparser.y"
1934 { cfg_parser->opt->ipv4_edns_size = (size_t)(yyvsp[0].llng); }
1935 #line 1936 "configparser.c"
1936 break;
1937
1938 case 42:
1939 #line 320 "configparser.y"
1940 { cfg_parser->opt->ipv6_edns_size = (size_t)(yyvsp[0].llng); }
1941 #line 1942 "configparser.c"
1942 break;
1943
1944 case 43:
1945 #line 322 "configparser.y"
1946 { cfg_parser->opt->pidfile = region_strdup(cfg_parser->opt->region, (yyvsp[0].str)); }
1947 #line 1948 "configparser.c"
1948 break;
1949
1950 case 44:
1951 #line 324 "configparser.y"
1952 {
1953 /* port number, stored as a string */
1954 char buf[16];
1955 (void)snprintf(buf, sizeof(buf), "%lld", (yyvsp[0].llng));
1956 cfg_parser->opt->port = region_strdup(cfg_parser->opt->region, buf);
1957 }
1958 #line 1959 "configparser.c"
1959 break;
1960
1961 case 45:
1962 #line 331 "configparser.y"
1963 { cfg_parser->opt->reuseport = (yyvsp[0].bln); }
1964 #line 1965 "configparser.c"
1965 break;
1966
1967 case 46:
1968 #line 333 "configparser.y"
1969 { cfg_parser->opt->statistics = (int)(yyvsp[0].llng); }
1970 #line 1971 "configparser.c"
1971 break;
1972
1973 case 47:
1974 #line 335 "configparser.y"
1975 { cfg_parser->opt->chroot = region_strdup(cfg_parser->opt->region, (yyvsp[0].str)); }
1976 #line 1977 "configparser.c"
1977 break;
1978
1979 case 48:
1980 #line 337 "configparser.y"
1981 { cfg_parser->opt->username = region_strdup(cfg_parser->opt->region, (yyvsp[0].str)); }
1982 #line 1983 "configparser.c"
1983 break;
1984
1985 case 49:
1986 #line 339 "configparser.y"
1987 { cfg_parser->opt->zonesdir = region_strdup(cfg_parser->opt->region, (yyvsp[0].str)); }
1988 #line 1989 "configparser.c"
1989 break;
1990
1991 case 50:
1992 #line 341 "configparser.y"
1993 { cfg_parser->opt->zonelistfile = region_strdup(cfg_parser->opt->region, (yyvsp[0].str)); }
1994 #line 1995 "configparser.c"
1995 break;
1996
1997 case 51:
1998 #line 343 "configparser.y"
1999 { /* ignored, deprecated */ }
2000 #line 2001 "configparser.c"
2001 break;
2002
2003 case 52:
2004 #line 345 "configparser.y"
2005 { cfg_parser->opt->xfrdfile = region_strdup(cfg_parser->opt->region, (yyvsp[0].str)); }
2006 #line 2007 "configparser.c"
2007 break;
2008
2009 case 53:
2010 #line 347 "configparser.y"
2011 { cfg_parser->opt->xfrdir = region_strdup(cfg_parser->opt->region, (yyvsp[0].str)); }
2012 #line 2013 "configparser.c"
2013 break;
2014
2015 case 54:
2016 #line 349 "configparser.y"
2017 { cfg_parser->opt->xfrd_reload_timeout = (int)(yyvsp[0].llng); }
2018 #line 2019 "configparser.c"
2019 break;
2020
2021 case 55:
2022 #line 351 "configparser.y"
2023 { cfg_parser->opt->verbosity = (int)(yyvsp[0].llng); }
2024 #line 2025 "configparser.c"
2025 break;
2026
2027 case 56:
2028 #line 353 "configparser.y"
2029 {
2030 #ifdef RATELIMIT
2031 if ((yyvsp[0].llng) > 0) {
2032 cfg_parser->opt->rrl_size = (size_t)(yyvsp[0].llng);
2033 } else {
2034 yyerror("expected a number greater than zero");
2035 }
2036 #endif
2037 }
2038 #line 2039 "configparser.c"
2039 break;
2040
2041 case 57:
2042 #line 363 "configparser.y"
2043 {
2044 #ifdef RATELIMIT
2045 cfg_parser->opt->rrl_ratelimit = (size_t)(yyvsp[0].llng);
2046 #endif
2047 }
2048 #line 2049 "configparser.c"
2049 break;
2050
2051 case 58:
2052 #line 369 "configparser.y"
2053 {
2054 #ifdef RATELIMIT
2055 cfg_parser->opt->rrl_slip = (size_t)(yyvsp[0].llng);
2056 #endif
2057 }
2058 #line 2059 "configparser.c"
2059 break;
2060
2061 case 59:
2062 #line 375 "configparser.y"
2063 {
2064 #ifdef RATELIMIT
2065 if ((yyvsp[0].llng) > 32) {
2066 yyerror("invalid IPv4 prefix length");
2067 } else {
2068 cfg_parser->opt->rrl_ipv4_prefix_length = (size_t)(yyvsp[0].llng);
2069 }
2070 #endif
2071 }
2072 #line 2073 "configparser.c"
2073 break;
2074
2075 case 60:
2076 #line 385 "configparser.y"
2077 {
2078 #ifdef RATELIMIT
2079 if ((yyvsp[0].llng) > 64) {
2080 yyerror("invalid IPv6 prefix length");
2081 } else {
2082 cfg_parser->opt->rrl_ipv6_prefix_length = (size_t)(yyvsp[0].llng);
2083 }
2084 #endif
2085 }
2086 #line 2087 "configparser.c"
2087 break;
2088
2089 case 61:
2090 #line 395 "configparser.y"
2091 {
2092 #ifdef RATELIMIT
2093 cfg_parser->opt->rrl_whitelist_ratelimit = (size_t)(yyvsp[0].llng);
2094 #endif
2095 }
2096 #line 2097 "configparser.c"
2097 break;
2098
2099 case 62:
2100 #line 401 "configparser.y"
2101 { cfg_parser->opt->zonefiles_check = (yyvsp[0].bln); }
2102 #line 2103 "configparser.c"
2103 break;
2104
2105 case 63:
2106 #line 403 "configparser.y"
2107 { cfg_parser->opt->zonefiles_write = (int)(yyvsp[0].llng); }
2108 #line 2109 "configparser.c"
2109 break;
2110
2111 case 64:
2112 #line 405 "configparser.y"
2113 {
2114 cfg_parser->opt->log_time_ascii = (yyvsp[0].bln);
2115 log_time_asc = cfg_parser->opt->log_time_ascii;
2116 }
2117 #line 2118 "configparser.c"
2118 break;
2119
2120 case 65:
2121 #line 410 "configparser.y"
2122 {
2123 cfg_parser->opt->round_robin = (yyvsp[0].bln);
2124 round_robin = cfg_parser->opt->round_robin;
2125 }
2126 #line 2127 "configparser.c"
2127 break;
2128
2129 case 66:
2130 #line 415 "configparser.y"
2131 {
2132 cfg_parser->opt->minimal_responses = (yyvsp[0].bln);
2133 minimal_responses = cfg_parser->opt->minimal_responses;
2134 }
2135 #line 2136 "configparser.c"
2136 break;
2137
2138 case 67:
2139 #line 420 "configparser.y"
2140 { cfg_parser->opt->confine_to_zone = (yyvsp[0].bln); }
2141 #line 2142 "configparser.c"
2142 break;
2143
2144 case 68:
2145 #line 422 "configparser.y"
2146 { cfg_parser->opt->refuse_any = (yyvsp[0].bln); }
2147 #line 2148 "configparser.c"
2148 break;
2149
2150 case 69:
2151 #line 424 "configparser.y"
2152 { cfg_parser->opt->tls_service_key = region_strdup(cfg_parser->opt->region, (yyvsp[0].str)); }
2153 #line 2154 "configparser.c"
2154 break;
2155
2156 case 70:
2157 #line 426 "configparser.y"
2158 { cfg_parser->opt->tls_service_ocsp = region_strdup(cfg_parser->opt->region, (yyvsp[0].str)); }
2159 #line 2160 "configparser.c"
2160 break;
2161
2162 case 71:
2163 #line 428 "configparser.y"
2164 { cfg_parser->opt->tls_service_pem = region_strdup(cfg_parser->opt->region, (yyvsp[0].str)); }
2165 #line 2166 "configparser.c"
2166 break;
2167
2168 case 72:
2169 #line 430 "configparser.y"
2170 {
2171 /* port number, stored as string */
2172 char buf[16];
2173 (void)snprintf(buf, sizeof(buf), "%lld", (yyvsp[0].llng));
2174 cfg_parser->opt->tls_port = region_strdup(cfg_parser->opt->region, buf);
2175 }
2176 #line 2177 "configparser.c"
2177 break;
2178
2179 case 73:
2180 #line 437 "configparser.y"
2181 {
2182 cfg_parser->opt->cpu_affinity = (yyvsp[0].cpu);
2183 }
2184 #line 2185 "configparser.c"
2185 break;
2186
2187 case 74:
2188 #line 441 "configparser.y"
2189 {
2190 if((yyvsp[0].llng) < 0) {
2191 yyerror("expected a non-negative number");
2192 YYABORT;
2193 } else {
2194 struct cpu_map_option *opt, *tail;
2195
2196 opt = cfg_parser->opt->service_cpu_affinity;
2197 while(opt && opt->service != (yyvsp[-1].llng)) { opt = opt->next; }
2198
2199 if(opt) {
2200 opt->cpu = (yyvsp[0].llng);
2201 } else {
2202 opt = region_alloc_zero(cfg_parser->opt->region, sizeof(*opt));
2203 opt->service = (int)(yyvsp[-1].llng);
2204 opt->cpu = (int)(yyvsp[0].llng);
2205
2206 tail = cfg_parser->opt->service_cpu_affinity;
2207 if(tail) {
2208 while(tail->next) { tail = tail->next; }
2209 tail->next = opt;
2210 } else {
2211 cfg_parser->opt->service_cpu_affinity = opt;
2212 }
2213 }
2214 }
2215 }
2216 #line 2217 "configparser.c"
2217 break;
2218
2219 case 77:
2220 #line 475 "configparser.y"
2221 {
2222 char *tok, *ptr, *str;
2223 struct range_option *servers = NULL;
2224 long long first, last;
2225
2226 /* user may specify "0 1", "0" "1", 0 1 or a combination thereof */
2227 for(str = (yyvsp[0].str); (tok = strtok_r(str, " \t", &ptr)); str = NULL) {
2228 struct range_option *opt =
2229 region_alloc(cfg_parser->opt->region, sizeof(*opt));
2230 first = last = 0;
2231 if(!parse_range(tok, &first, &last)) {
2232 yyerror("invalid server range '%s'", tok);
2233 YYABORT;
2234 }
2235 assert(first >= 0);
2236 assert(last >= 0);
2237 opt->next = NULL;
2238 opt->first = (int)first;
2239 opt->last = (int)last;
2240 if(servers) {
2241 servers = servers->next = opt;
2242 } else {
2243 servers = cfg_parser->ip->servers = opt;
2244 }
2245 }
2246 }
2247 #line 2248 "configparser.c"
2248 break;
2249
2250 case 78:
2251 #line 502 "configparser.y"
2252 { cfg_parser->ip->dev = (yyvsp[0].bln); }
2253 #line 2254 "configparser.c"
2254 break;
2255
2256 case 79:
2257 #line 504 "configparser.y"
2258 { cfg_parser->ip->fib = (yyvsp[0].llng); }
2259 #line 2260 "configparser.c"
2260 break;
2261
2262 case 80:
2263 #line 508 "configparser.y"
2264 { (yyval.cpu) = NULL; }
2265 #line 2266 "configparser.c"
2266 break;
2267
2268 case 81:
2269 #line 510 "configparser.y"
2270 {
2271 char *tok, *ptr, *str;
2272 struct cpu_option *tail;
2273 long long cpu;
2274
2275 str = (yyvsp[0].str);
2276 (yyval.cpu) = tail = (yyvsp[-1].cpu);
2277 if(tail) {
2278 while(tail->next) { tail = tail->next; }
2279 }
2280
2281 /* Users may specify "0 1", "0" "1", 0 1 or a combination thereof. */
2282 for(str = (yyvsp[0].str); (tok = strtok_r(str, " \t", &ptr)); str = NULL) {
2283 struct cpu_option *opt =
2284 region_alloc(cfg_parser->opt->region, sizeof(*opt));
2285 cpu = 0;
2286 if(!parse_number(tok, &cpu) || opt->cpu < 0) {
2287 yyerror("expected a positive number");
2288 YYABORT;
2289 }
2290 assert(cpu >=0);
2291 opt->cpu = (int)cpu;
2292 if(tail) {
2293 tail->next = opt;
2294 tail = opt;
2295 } else {
2296 (yyval.cpu) = tail = opt;
2297 }
2298 }
2299 }
2300 #line 2301 "configparser.c"
2301 break;
2302
2303 case 82:
2304 #line 544 "configparser.y"
2305 { (yyval.llng) = -1; }
2306 #line 2307 "configparser.c"
2307 break;
2308
2309 case 83:
2310 #line 546 "configparser.y"
2311 {
2312 if((yyvsp[0].llng) <= 0) {
2313 yyerror("invalid server identifier");
2314 YYABORT;
2315 }
2316 (yyval.llng) = (yyvsp[0].llng);
2317 }
2318 #line 2319 "configparser.c"
2319 break;
2320
2321 case 87:
2322 #line 563 "configparser.y"
2323 { cfg_parser->opt->dnstap_enable = (yyvsp[0].bln); }
2324 #line 2325 "configparser.c"
2325 break;
2326
2327 case 88:
2328 #line 565 "configparser.y"
2329 { cfg_parser->opt->dnstap_socket_path = region_strdup(cfg_parser->opt->region, (yyvsp[0].str)); }
2330 #line 2331 "configparser.c"
2331 break;
2332
2333 case 89:
2334 #line 567 "configparser.y"
2335 { cfg_parser->opt->dnstap_send_identity = (yyvsp[0].bln); }
2336 #line 2337 "configparser.c"
2337 break;
2338
2339 case 90:
2340 #line 569 "configparser.y"
2341 { cfg_parser->opt->dnstap_send_version = (yyvsp[0].bln); }
2342 #line 2343 "configparser.c"
2343 break;
2344
2345 case 91:
2346 #line 571 "configparser.y"
2347 { cfg_parser->opt->dnstap_identity = region_strdup(cfg_parser->opt->region, (yyvsp[0].str)); }
2348 #line 2349 "configparser.c"
2349 break;
2350
2351 case 92:
2352 #line 573 "configparser.y"
2353 { cfg_parser->opt->dnstap_version = region_strdup(cfg_parser->opt->region, (yyvsp[0].str)); }
2354 #line 2355 "configparser.c"
2355 break;
2356
2357 case 93:
2358 #line 575 "configparser.y"
2359 { cfg_parser->opt->dnstap_log_auth_query_messages = (yyvsp[0].bln); }
2360 #line 2361 "configparser.c"
2361 break;
2362
2363 case 94:
2364 #line 577 "configparser.y"
2365 { cfg_parser->opt->dnstap_log_auth_response_messages = (yyvsp[0].bln); }
2366 #line 2367 "configparser.c"
2367 break;
2368
2369 case 98:
2370 #line 588 "configparser.y"
2371 { cfg_parser->opt->control_enable = (yyvsp[0].bln); }
2372 #line 2373 "configparser.c"
2373 break;
2374
2375 case 99:
2376 #line 590 "configparser.y"
2377 {
2378 struct ip_address_option *ip = cfg_parser->opt->control_interface;
2379 if(ip == NULL) {
2380 cfg_parser->opt->control_interface = (yyvsp[0].ip);
2381 } else {
2382 while(ip->next != NULL) { ip = ip->next; }
2383 ip->next = (yyvsp[0].ip);
2384 }
2385 }
2386 #line 2387 "configparser.c"
2387 break;
2388
2389 case 100:
2390 #line 600 "configparser.y"
2391 {
2392 if((yyvsp[0].llng) == 0) {
2393 yyerror("control port number expected");
2394 } else {
2395 cfg_parser->opt->control_port = (int)(yyvsp[0].llng);
2396 }
2397 }
2398 #line 2399 "configparser.c"
2399 break;
2400
2401 case 101:
2402 #line 608 "configparser.y"
2403 { cfg_parser->opt->server_key_file = region_strdup(cfg_parser->opt->region, (yyvsp[0].str)); }
2404 #line 2405 "configparser.c"
2405 break;
2406
2407 case 102:
2408 #line 610 "configparser.y"
2409 { cfg_parser->opt->server_cert_file = region_strdup(cfg_parser->opt->region, (yyvsp[0].str)); }
2410 #line 2411 "configparser.c"
2411 break;
2412
2413 case 103:
2414 #line 612 "configparser.y"
2415 { cfg_parser->opt->control_key_file = region_strdup(cfg_parser->opt->region, (yyvsp[0].str)); }
2416 #line 2417 "configparser.c"
2417 break;
2418
2419 case 104:
2420 #line 614 "configparser.y"
2421 { cfg_parser->opt->control_cert_file = region_strdup(cfg_parser->opt->region, (yyvsp[0].str)); }
2422 #line 2423 "configparser.c"
2423 break;
2424
2425 case 105:
2426 #line 619 "configparser.y"
2427 {
2428 key_options_type *key = key_options_create(cfg_parser->opt->region);
2429 key->algorithm = region_strdup(cfg_parser->opt->region, "sha256");
2430 assert(cfg_parser->key == NULL);
2431 cfg_parser->key = key;
2432 }
2433 #line 2434 "configparser.c"
2434 break;
2435
2436 case 106:
2437 #line 626 "configparser.y"
2438 {
2439 struct key_options *key = cfg_parser->key;
2440 if(key->name == NULL) {
2441 yyerror("tsig key has no name");
2442 } else if(key->algorithm == NULL) {
2443 yyerror("tsig key %s has no algorithm", key->name);
2444 } else if(key->secret == NULL) {
2445 yyerror("tsig key %s has no secret blob", key->name);
2446 } else if(key_options_find(cfg_parser->opt, key->name)) {
2447 yyerror("duplicate tsig key %s", key->name);
2448 } else {
2449 key_options_insert(cfg_parser->opt, key);
2450 cfg_parser->key = NULL;
2451 }
2452 }
2453 #line 2454 "configparser.c"
2454 break;
2455
2456 case 109:
2457 #line 647 "configparser.y"
2458 {
2459 dname_type *dname;
2460
2461 dname = (dname_type *)dname_parse(cfg_parser->opt->region, (yyvsp[0].str));
2462 cfg_parser->key->name = region_strdup(cfg_parser->opt->region, (yyvsp[0].str));
2463 if(dname == NULL) {
2464 yyerror("bad tsig key name %s", (yyvsp[0].str));
2465 } else {
2466 region_recycle(cfg_parser->opt->region, dname, dname_total_size(dname));
2467 }
2468 }
2469 #line 2470 "configparser.c"
2470 break;
2471
2472 case 110:
2473 #line 659 "configparser.y"
2474 {
2475 if(tsig_get_algorithm_by_name((yyvsp[0].str)) == NULL) {
2476 yyerror("bad tsig key algorithm %s", (yyvsp[0].str));
2477 } else {
2478 cfg_parser->key->algorithm = region_strdup(cfg_parser->opt->region, (yyvsp[0].str));
2479 }
2480 }
2481 #line 2482 "configparser.c"
2482 break;
2483
2484 case 111:
2485 #line 667 "configparser.y"
2486 {
2487 uint8_t data[16384];
2488 int size;
2489
2490 cfg_parser->key->secret = region_strdup(cfg_parser->opt->region, (yyvsp[0].str));
2491 size = b64_pton((yyvsp[0].str), data, sizeof(data));
2492 if(size == -1) {
2493 yyerror("cannot base64 decode tsig secret %s",
2494 cfg_parser->key->name?
2495 cfg_parser->key->name:"");
2496 } else if(size != 0) {
2497 memset(data, 0xdd, size); /* wipe secret */
2498 }
2499 }
2500 #line 2501 "configparser.c"
2501 break;
2502
2503 case 112:
2504 #line 685 "configparser.y"
2505 {
2506 assert(cfg_parser->pattern == NULL);
2507 assert(cfg_parser->zone == NULL);
2508 cfg_parser->zone = zone_options_create(cfg_parser->opt->region);
2509 cfg_parser->zone->part_of_config = 1;
2510 cfg_parser->zone->pattern = cfg_parser->pattern =
2511 pattern_options_create(cfg_parser->opt->region);
2512 cfg_parser->zone->pattern->implicit = 1;
2513 }
2514 #line 2515 "configparser.c"
2515 break;
2516
2517 case 113:
2518 #line 695 "configparser.y"
2519 {
2520 assert(cfg_parser->zone != NULL);
2521 if(cfg_parser->zone->name == NULL) {
2522 yyerror("zone has no name");
2523 } else if(!nsd_options_insert_zone(cfg_parser->opt, cfg_parser->zone)) {
2524 yyerror("duplicate zone %s", cfg_parser->zone->name);
2525 } else if(!nsd_options_insert_pattern(cfg_parser->opt, cfg_parser->zone->pattern)) {
2526 yyerror("duplicate pattern %s", cfg_parser->zone->pattern->pname);
2527 }
2528 cfg_parser->pattern = NULL;
2529 cfg_parser->zone = NULL;
2530 }
2531 #line 2532 "configparser.c"
2532 break;
2533
2534 case 116:
2535 #line 713 "configparser.y"
2536 {
2537 const char *marker = PATTERN_IMPLICIT_MARKER;
2538 char *pname = region_alloc(cfg_parser->opt->region, strlen((yyvsp[0].str)) + strlen(marker) + 1);
2539 memmove(pname, marker, strlen(marker));
2540 memmove(pname + strlen(marker), (yyvsp[0].str), strlen((yyvsp[0].str)) + 1);
2541 cfg_parser->zone->pattern->pname = pname;
2542 cfg_parser->zone->name = region_strdup(cfg_parser->opt->region, (yyvsp[0].str));
2543 if(pattern_options_find(cfg_parser->opt, pname)) {
2544 yyerror("zone %s cannot be created because implicit pattern %s "
2545 "already exists", (yyvsp[0].str), pname);
2546 }
2547 }
2548 #line 2549 "configparser.c"
2549 break;
2550
2551 case 118:
2552 #line 729 "configparser.y"
2553 {
2554 assert(cfg_parser->pattern == NULL);
2555 cfg_parser->pattern = pattern_options_create(cfg_parser->opt->region);
2556 }
2557 #line 2558 "configparser.c"
2558 break;
2559
2560 case 119:
2561 #line 734 "configparser.y"
2562 {
2563 pattern_options_type *pattern = cfg_parser->pattern;
2564 if(pattern->pname == NULL) {
2565 yyerror("pattern has no name");
2566 } else if(!nsd_options_insert_pattern(cfg_parser->opt, pattern)) {
2567 yyerror("duplicate pattern %s", pattern->pname);
2568 }
2569 cfg_parser->pattern = NULL;
2570 }
2571 #line 2572 "configparser.c"
2572 break;
2573
2574 case 122:
2575 #line 749 "configparser.y"
2576 {
2577 if(strchr((yyvsp[0].str), ' ')) {
2578 yyerror("space is not allowed in pattern name: '%s'", (yyvsp[0].str));
2579 }
2580 cfg_parser->pattern->pname = region_strdup(cfg_parser->opt->region, (yyvsp[0].str));
2581 }
2582 #line 2583 "configparser.c"
2583 break;
2584
2585 case 124:
2586 #line 759 "configparser.y"
2587 {
2588 #ifdef RATELIMIT
2589 cfg_parser->pattern->rrl_whitelist |= rrlstr2type((yyvsp[0].str));
2590 #endif
2591 }
2592 #line 2593 "configparser.c"
2593 break;
2594
2595 case 125:
2596 #line 765 "configparser.y"
2597 { cfg_parser->pattern->zonefile = region_strdup(cfg_parser->opt->region, (yyvsp[0].str)); }
2598 #line 2599 "configparser.c"
2599 break;
2600
2601 case 126:
2602 #line 767 "configparser.y"
2603 { cfg_parser->pattern->zonestats = region_strdup(cfg_parser->opt->region, (yyvsp[0].str)); }
2604 #line 2605 "configparser.c"
2605 break;
2606
2607 case 127:
2608 #line 769 "configparser.y"
2609 {
2610 if((yyvsp[0].llng) > 0) {
2611 cfg_parser->pattern->size_limit_xfr = (int)(yyvsp[0].llng);
2612 } else {
2613 yyerror("expected a number greater than zero");
2614 }
2615 }
2616 #line 2617 "configparser.c"
2617 break;
2618
2619 case 128:
2620 #line 777 "configparser.y"
2621 { cfg_parser->pattern->multi_master_check = (int)(yyvsp[0].bln); }
2622 #line 2623 "configparser.c"
2623 break;
2624
2625 case 129:
2626 #line 779 "configparser.y"
2627 { config_apply_pattern(cfg_parser->pattern, (yyvsp[0].str)); }
2628 #line 2629 "configparser.c"
2629 break;
2630
2631 case 130:
2632 #line 781 "configparser.y"
2633 {
2634 acl_options_type *acl = parse_acl_info(cfg_parser->opt->region, (yyvsp[-1].str), (yyvsp[0].str));
2635 if(acl->blocked)
2636 yyerror("blocked address used for request-xfr");
2637 if(acl->rangetype != acl_range_single)
2638 yyerror("address range used for request-xfr");
2639 append_acl(&cfg_parser->pattern->request_xfr, acl);
2640 }
2641 #line 2642 "configparser.c"
2642 break;
2643
2644 case 131:
2645 #line 790 "configparser.y"
2646 {
2647 acl_options_type *acl = parse_acl_info(cfg_parser->opt->region, (yyvsp[-1].str), (yyvsp[0].str));
2648 acl->use_axfr_only = 1;
2649 if(acl->blocked)
2650 yyerror("blocked address used for request-xfr");
2651 if(acl->rangetype != acl_range_single)
2652 yyerror("address range used for request-xfr");
2653 append_acl(&cfg_parser->pattern->request_xfr, acl);
2654 }
2655 #line 2656 "configparser.c"
2656 break;
2657
2658 case 132:
2659 #line 800 "configparser.y"
2660 {
2661 acl_options_type *acl = parse_acl_info(cfg_parser->opt->region, (yyvsp[-1].str), (yyvsp[0].str));
2662 acl->allow_udp = 1;
2663 if(acl->blocked)
2664 yyerror("blocked address used for request-xfr");
2665 if(acl->rangetype != acl_range_single)
2666 yyerror("address range used for request-xfr");
2667 append_acl(&cfg_parser->pattern->request_xfr, acl);
2668 }
2669 #line 2670 "configparser.c"
2670 break;
2671
2672 case 133:
2673 #line 810 "configparser.y"
2674 {
2675 acl_options_type *acl = parse_acl_info(cfg_parser->opt->region, (yyvsp[-1].str), (yyvsp[0].str));
2676 append_acl(&cfg_parser->pattern->allow_notify, acl);
2677 }
2678 #line 2679 "configparser.c"
2679 break;
2680
2681 case 134:
2682 #line 815 "configparser.y"
2683 {
2684 acl_options_type *acl = parse_acl_info(cfg_parser->opt->region, (yyvsp[-1].str), (yyvsp[0].str));
2685 if(acl->blocked)
2686 yyerror("blocked address used for notify");
2687 if(acl->rangetype != acl_range_single)
2688 yyerror("address range used for notify");
2689 append_acl(&cfg_parser->pattern->notify, acl);
2690 }
2691 #line 2692 "configparser.c"
2692 break;
2693
2694 case 135:
2695 #line 824 "configparser.y"
2696 {
2697 acl_options_type *acl = parse_acl_info(cfg_parser->opt->region, (yyvsp[-1].str), (yyvsp[0].str));
2698 append_acl(&cfg_parser->pattern->provide_xfr, acl);
2699 }
2700 #line 2701 "configparser.c"
2701 break;
2702
2703 case 136:
2704 #line 829 "configparser.y"
2705 {
2706 acl_options_type *acl = parse_acl_info(cfg_parser->opt->region, (yyvsp[0].str), "NOKEY");
2707 append_acl(&cfg_parser->pattern->outgoing_interface, acl);
2708 }
2709 #line 2710 "configparser.c"
2710 break;
2711
2712 case 137:
2713 #line 834 "configparser.y"
2714 {
2715 cfg_parser->pattern->allow_axfr_fallback = (yyvsp[0].bln);
2716 cfg_parser->pattern->allow_axfr_fallback_is_default = 0;
2717 }
2718 #line 2719 "configparser.c"
2719 break;
2720
2721 case 138:
2722 #line 839 "configparser.y"
2723 {
2724 cfg_parser->pattern->notify_retry = (yyvsp[0].llng);
2725 cfg_parser->pattern->notify_retry_is_default = 0;
2726 }
2727 #line 2728 "configparser.c"
2728 break;
2729
2730 case 139:
2731 #line 844 "configparser.y"
2732 {
2733 cfg_parser->pattern->max_refresh_time = (yyvsp[0].llng);
2734 cfg_parser->pattern->max_refresh_time_is_default = 0;
2735 }
2736 #line 2737 "configparser.c"
2737 break;
2738
2739 case 140:
2740 #line 849 "configparser.y"
2741 {
2742 cfg_parser->pattern->min_refresh_time = (yyvsp[0].llng);
2743 cfg_parser->pattern->min_refresh_time_is_default = 0;
2744 }
2745 #line 2746 "configparser.c"
2746 break;
2747
2748 case 141:
2749 #line 854 "configparser.y"
2750 {
2751 cfg_parser->pattern->max_retry_time = (yyvsp[0].llng);
2752 cfg_parser->pattern->max_retry_time_is_default = 0;
2753 }
2754 #line 2755 "configparser.c"
2755 break;
2756
2757 case 142:
2758 #line 859 "configparser.y"
2759 {
2760 cfg_parser->pattern->min_retry_time = (yyvsp[0].llng);
2761 cfg_parser->pattern->min_retry_time_is_default = 0;
2762 }
2763 #line 2764 "configparser.c"
2764 break;
2765
2766 case 143:
2767 #line 864 "configparser.y"
2768 {
2769 long long num;
2770 uint8_t expr;
2771
2772 if (!parse_expire_expr((yyvsp[0].str), &num, &expr)) {
2773 yyerror("expected an expire time in seconds or \"refresh+retry+1\"");
2774 YYABORT; /* trigger a parser error */
2775 }
2776 cfg_parser->pattern->min_expire_time = num;
2777 cfg_parser->pattern->min_expire_time_expr = expr;
2778 }
2779 #line 2780 "configparser.c"
2780 break;
2781
2782 case 144:
2783 #line 878 "configparser.y"
2784 {
2785 struct ip_address_option *ip = region_alloc_zero(
2786 cfg_parser->opt->region, sizeof(*ip));
2787 ip->address = region_strdup(cfg_parser->opt->region, (yyvsp[0].str));
2788 ip->fib = -1;
2789 (yyval.ip) = ip;
2790 }
2791 #line 2792 "configparser.c"
2792 break;
2793
2794 case 145:
2795 #line 888 "configparser.y"
2796 {
2797 if(!parse_number((yyvsp[0].str), &(yyval.llng))) {
2798 yyerror("expected a number");
2799 YYABORT; /* trigger a parser error */
2800 }
2801 }
2802 #line 2803 "configparser.c"
2803 break;
2804
2805 case 146:
2806 #line 897 "configparser.y"
2807 {
2808 if(!parse_boolean((yyvsp[0].str), &(yyval.bln))) {
2809 yyerror("expected yes or no");
2810 YYABORT; /* trigger a parser error */
2811 }
2812 }
2813 #line 2814 "configparser.c"
2814 break;
2815
2816
2817 #line 2818 "configparser.c"
2818
2819 default: break;
2820 }
2821 /* User semantic actions sometimes alter yychar, and that requires
2822 that yytoken be updated with the new translation. We take the
2823 approach of translating immediately before every use of yytoken.
2824 One alternative is translating here after every semantic action,
2825 but that translation would be missed if the semantic action invokes
2826 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2827 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2828 incorrect destructor might then be invoked immediately. In the
2829 case of YYERROR or YYBACKUP, subsequent parser actions might lead
2830 to an incorrect destructor call or verbose syntax error message
2831 before the lookahead is translated. */
2832 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2833
2834 YYPOPSTACK (yylen);
2835 yylen = 0;
2836 YY_STACK_PRINT (yyss, yyssp);
2837
2838 *++yyvsp = yyval;
2839
2840 /* Now 'shift' the result of the reduction. Determine what state
2841 that goes to, based on the state we popped back to and the rule
2842 number reduced by. */
2843 {
2844 const int yylhs = yyr1[yyn] - YYNTOKENS;
2845 const int yyi = yypgoto[yylhs] + *yyssp;
2846 yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
2847 ? yytable[yyi]
2848 : yydefgoto[yylhs]);
2849 }
2850
2851 goto yynewstate;
2852
2853
2854 /*--------------------------------------.
2855 | yyerrlab -- here on detecting error. |
2856 `--------------------------------------*/
2857 yyerrlab:
2858 /* Make sure we have latest lookahead translation. See comments at
2859 user semantic actions for why this is necessary. */
2860 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
2861
2862 /* If not already recovering from an error, report this error. */
2863 if (!yyerrstatus)
2864 {
2865 ++yynerrs;
2866 #if ! YYERROR_VERBOSE
2867 yyerror (YY_("syntax error"));
2868 #else
2869 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
2870 yyssp, yytoken)
2871 {
2872 char const *yymsgp = YY_("syntax error");
2873 int yysyntax_error_status;
2874 yysyntax_error_status = YYSYNTAX_ERROR;
2875 if (yysyntax_error_status == 0)
2876 yymsgp = yymsg;
2877 else if (yysyntax_error_status == 1)
2878 {
2879 if (yymsg != yymsgbuf)
2880 YYSTACK_FREE (yymsg);
2881 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
2882 if (!yymsg)
2883 {
2884 yymsg = yymsgbuf;
2885 yymsg_alloc = sizeof yymsgbuf;
2886 yysyntax_error_status = 2;
2887 }
2888 else
2889 {
2890 yysyntax_error_status = YYSYNTAX_ERROR;
2891 yymsgp = yymsg;
2892 }
2893 }
2894 yyerror (yymsgp);
2895 if (yysyntax_error_status == 2)
2896 goto yyexhaustedlab;
2897 }
2898 # undef YYSYNTAX_ERROR
2899 #endif
2900 }
2901
2902
2903
2904 if (yyerrstatus == 3)
2905 {
2906 /* If just tried and failed to reuse lookahead token after an
2907 error, discard it. */
2908
2909 if (yychar <= YYEOF)
2910 {
2911 /* Return failure if at end of input. */
2912 if (yychar == YYEOF)
2913 YYABORT;
2914 }
2915 else
2916 {
2917 yydestruct ("Error: discarding",
2918 yytoken, &yylval);
2919 yychar = YYEMPTY;
2920 }
2921 }
2922
2923 /* Else will try to reuse lookahead token after shifting the error
2924 token. */
2925 goto yyerrlab1;
2926
2927
2928 /*---------------------------------------------------.
2929 | yyerrorlab -- error raised explicitly by YYERROR. |
2930 `---------------------------------------------------*/
2931 yyerrorlab:
2932 /* Pacify compilers when the user code never invokes YYERROR and the
2933 label yyerrorlab therefore never appears in user code. */
2934 if (0)
2935 YYERROR;
2936
2937 /* Do not reclaim the symbols of the rule whose action triggered
2938 this YYERROR. */
2939 YYPOPSTACK (yylen);
2940 yylen = 0;
2941 YY_STACK_PRINT (yyss, yyssp);
2942 yystate = *yyssp;
2943 goto yyerrlab1;
2944
2945
2946 /*-------------------------------------------------------------.
2947 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2948 `-------------------------------------------------------------*/
2949 yyerrlab1:
2950 yyerrstatus = 3; /* Each real token shifted decrements this. */
2951
2952 for (;;)
2953 {
2954 yyn = yypact[yystate];
2955 if (!yypact_value_is_default (yyn))
2956 {
2957 yyn += YYTERROR;
2958 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2959 {
2960 yyn = yytable[yyn];
2961 if (0 < yyn)
2962 break;
2963 }
2964 }
2965
2966 /* Pop the current state because it cannot handle the error token. */
2967 if (yyssp == yyss)
2968 YYABORT;
2969
2970
2971 yydestruct ("Error: popping",
2972 yystos[yystate], yyvsp);
2973 YYPOPSTACK (1);
2974 yystate = *yyssp;
2975 YY_STACK_PRINT (yyss, yyssp);
2976 }
2977
2978 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2979 *++yyvsp = yylval;
2980 YY_IGNORE_MAYBE_UNINITIALIZED_END
2981
2982
2983 /* Shift the error token. */
2984 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2985
2986 yystate = yyn;
2987 goto yynewstate;
2988
2989
2990 /*-------------------------------------.
2991 | yyacceptlab -- YYACCEPT comes here. |
2992 `-------------------------------------*/
2993 yyacceptlab:
2994 yyresult = 0;
2995 goto yyreturn;
2996
2997
2998 /*-----------------------------------.
2999 | yyabortlab -- YYABORT comes here. |
3000 `-----------------------------------*/
3001 yyabortlab:
3002 yyresult = 1;
3003 goto yyreturn;
3004
3005
3006 #if !defined yyoverflow || YYERROR_VERBOSE
3007 /*-------------------------------------------------.
3008 | yyexhaustedlab -- memory exhaustion comes here. |
3009 `-------------------------------------------------*/
3010 yyexhaustedlab:
3011 yyerror (YY_("memory exhausted"));
3012 yyresult = 2;
3013 /* Fall through. */
3014 #endif
3015
3016
3017 /*-----------------------------------------------------.
3018 | yyreturn -- parsing is finished, return the result. |
3019 `-----------------------------------------------------*/
3020 yyreturn:
3021 if (yychar != YYEMPTY)
3022 {
3023 /* Make sure we have latest lookahead translation. See comments at
3024 user semantic actions for why this is necessary. */
3025 yytoken = YYTRANSLATE (yychar);
3026 yydestruct ("Cleanup: discarding lookahead",
3027 yytoken, &yylval);
3028 }
3029 /* Do not reclaim the symbols of the rule whose action triggered
3030 this YYABORT or YYACCEPT. */
3031 YYPOPSTACK (yylen);
3032 YY_STACK_PRINT (yyss, yyssp);
3033 while (yyssp != yyss)
3034 {
3035 yydestruct ("Cleanup: popping",
3036 yystos[*yyssp], yyvsp);
3037 YYPOPSTACK (1);
3038 }
3039 #ifndef yyoverflow
3040 if (yyss != yyssa)
3041 YYSTACK_FREE (yyss);
3042 #endif
3043 #if YYERROR_VERBOSE
3044 if (yymsg != yymsgbuf)
3045 YYSTACK_FREE (yymsg);
3046 #endif
3047 return yyresult;
3048 }
3049 #line 904 "configparser.y"
3050
3051
3052 static void
3053 append_acl(struct acl_options **list, struct acl_options *acl)
3054 {
3055 assert(list != NULL);
3056
3057 if(*list == NULL) {
3058 *list = acl;
3059 } else {
3060 struct acl_options *tail = *list;
3061 while(tail->next != NULL)
3062 tail = tail->next;
3063 tail->next = acl;
3064 }
3065 }
3066
3067 static int
3068 parse_boolean(const char *str, int *bln)
3069 {
3070 if(strcmp(str, "yes") == 0) {
3071 *bln = 1;
3072 } else if(strcmp(str, "no") == 0) {
3073 *bln = 0;
3074 } else {
3075 return 0;
3076 }
3077
3078 return 1;
3079 }
3080
3081 static int
3082 parse_expire_expr(const char *str, long long *num, uint8_t *expr)
3083 {
3084 if(parse_number(str, num)) {
3085 *expr = EXPIRE_TIME_HAS_VALUE;
3086 return 1;
3087 }
3088 if(strcmp(str, REFRESHPLUSRETRYPLUS1_STR) == 0) {
3089 *num = 0;
3090 *expr = REFRESHPLUSRETRYPLUS1;
3091 return 1;
3092 }
3093 return 0;
3094 }
3095
3096 static int
3097 parse_number(const char *str, long long *num)
3098 {
3099 /* ensure string consists entirely of digits */
3100 size_t pos = 0;
3101 while(str[pos] >= '0' && str[pos] <= '9') {
3102 pos++;
3103 }
3104
3105 if(pos != 0 && str[pos] == '\0') {
3106 *num = strtoll(str, NULL, 10);
3107 return 1;
3108 }
3109
3110 return 0;
3111 }
3112
3113 static int
3114 parse_range(const char *str, long long *low, long long *high)
3115 {
3116 const char *ptr = str;
3117 long long num[2];
3118
3119 /* require range to begin with a number */
3120 if(*ptr < '0' || *ptr > '9') {
3121 return 0;
3122 }
3123
3124 num[0] = strtoll(ptr, (char **)&ptr, 10);
3125
3126 /* require number to be followed by nothing at all or a dash */
3127 if(*ptr == '\0') {
3128 *low = num[0];
3129 *high = num[0];
3130 return 1;
3131 } else if(*ptr != '-') {
3132 return 0;
3133 }
3134
3135 ++ptr;
3136 /* require dash to be followed by a number */
3137 if(*ptr < '0' || *ptr > '9') {
3138 return 0;
3139 }
3140
3141 num[1] = strtoll(ptr, (char **)&ptr, 10);
3142
3143 /* require number to be followed by nothing at all */
3144 if(*ptr == '\0') {
3145 if(num[0] < num[1]) {
3146 *low = num[0];
3147 *high = num[1];
3148 } else {
3149 *low = num[1];
3150 *high = num[0];
3151 }
3152 return 1;
3153 }
3154
3155 return 0;
3156 }
3157