1/* A Bison parser, made by GNU Bison 2.3.  */
2
3/* Skeleton implementation for Bison's Yacc-like parsers in C
4
5   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6   Free Software Foundation, 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 2, or (at your option)
11   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, write to the Free Software
20   Foundation, Inc., 51 Franklin Street, Fifth Floor,
21   Boston, MA 02110-1301, USA.  */
22
23/* As a special exception, you may create a larger work that contains
24   part or all of the Bison parser skeleton and distribute that work
25   under terms of your choice, so long as that work isn't itself a
26   parser generator using the skeleton or a modified version thereof
27   as a parser skeleton.  Alternatively, if you modify or redistribute
28   the parser skeleton itself, you may (at your option) remove this
29   special exception, which will cause the skeleton and the resulting
30   Bison output files to be licensed under the GNU General Public
31   License without this special exception.
32
33   This special exception was added by the Free Software Foundation in
34   version 2.2 of Bison.  */
35
36/* C LALR(1) parser skeleton written by Richard Stallman, by
37   simplifying the original so-called "semantic" parser.  */
38
39/* All symbols defined below should begin with yy or YY, to avoid
40   infringing on user name space.  This should be done even for local
41   variables, as they might otherwise be expanded by user macros.
42   There are some unavoidable exceptions within include files to
43   define necessary library symbols; they are noted "INFRINGES ON
44   USER NAME SPACE" below.  */
45
46/* Identify Bison output.  */
47#define YYBISON 1
48
49/* Bison version.  */
50#define YYBISON_VERSION "2.3"
51
52/* Skeleton name.  */
53#define YYSKELETON_NAME "yacc.c"
54
55/* Pure parsers.  */
56#define YYPURE 0
57
58/* Using locations.  */
59#define YYLSP_NEEDED 0
60
61
62
63/* Tokens.  */
64#ifndef YYTOKENTYPE
65# define YYTOKENTYPE
66   /* Put the tokens into the symbol table, so that GDB and other debuggers
67      know about them.  */
68   enum yytokentype {
69     T_INTERFACE = 258,
70     T_PREFIX = 259,
71     T_ROUTE = 260,
72     T_RDNSS = 261,
73     T_CLIENTS = 262,
74     STRING = 263,
75     NUMBER = 264,
76     SIGNEDNUMBER = 265,
77     DECIMAL = 266,
78     SWITCH = 267,
79     IPV6ADDR = 268,
80     INFINITY = 269,
81     T_IgnoreIfMissing = 270,
82     T_AdvSendAdvert = 271,
83     T_MaxRtrAdvInterval = 272,
84     T_MinRtrAdvInterval = 273,
85     T_MinDelayBetweenRAs = 274,
86     T_AdvManagedFlag = 275,
87     T_AdvOtherConfigFlag = 276,
88     T_AdvLinkMTU = 277,
89     T_AdvReachableTime = 278,
90     T_AdvRetransTimer = 279,
91     T_AdvCurHopLimit = 280,
92     T_AdvDefaultLifetime = 281,
93     T_AdvDefaultPreference = 282,
94     T_AdvSourceLLAddress = 283,
95     T_AdvOnLink = 284,
96     T_AdvAutonomous = 285,
97     T_AdvValidLifetime = 286,
98     T_AdvPreferredLifetime = 287,
99     T_AdvRouterAddr = 288,
100     T_AdvHomeAgentFlag = 289,
101     T_AdvIntervalOpt = 290,
102     T_AdvHomeAgentInfo = 291,
103     T_Base6to4Interface = 292,
104     T_UnicastOnly = 293,
105     T_HomeAgentPreference = 294,
106     T_HomeAgentLifetime = 295,
107     T_AdvRoutePreference = 296,
108     T_AdvRouteLifetime = 297,
109     T_AdvRDNSSPreference = 298,
110     T_AdvRDNSSOpenFlag = 299,
111     T_AdvRDNSSLifetime = 300,
112     T_AdvMobRtrSupportFlag = 301,
113     T_BAD_TOKEN = 302
114   };
115#endif
116/* Tokens.  */
117#define T_INTERFACE 258
118#define T_PREFIX 259
119#define T_ROUTE 260
120#define T_RDNSS 261
121#define T_CLIENTS 262
122#define STRING 263
123#define NUMBER 264
124#define SIGNEDNUMBER 265
125#define DECIMAL 266
126#define SWITCH 267
127#define IPV6ADDR 268
128#define INFINITY 269
129#define T_IgnoreIfMissing 270
130#define T_AdvSendAdvert 271
131#define T_MaxRtrAdvInterval 272
132#define T_MinRtrAdvInterval 273
133#define T_MinDelayBetweenRAs 274
134#define T_AdvManagedFlag 275
135#define T_AdvOtherConfigFlag 276
136#define T_AdvLinkMTU 277
137#define T_AdvReachableTime 278
138#define T_AdvRetransTimer 279
139#define T_AdvCurHopLimit 280
140#define T_AdvDefaultLifetime 281
141#define T_AdvDefaultPreference 282
142#define T_AdvSourceLLAddress 283
143#define T_AdvOnLink 284
144#define T_AdvAutonomous 285
145#define T_AdvValidLifetime 286
146#define T_AdvPreferredLifetime 287
147#define T_AdvRouterAddr 288
148#define T_AdvHomeAgentFlag 289
149#define T_AdvIntervalOpt 290
150#define T_AdvHomeAgentInfo 291
151#define T_Base6to4Interface 292
152#define T_UnicastOnly 293
153#define T_HomeAgentPreference 294
154#define T_HomeAgentLifetime 295
155#define T_AdvRoutePreference 296
156#define T_AdvRouteLifetime 297
157#define T_AdvRDNSSPreference 298
158#define T_AdvRDNSSOpenFlag 299
159#define T_AdvRDNSSLifetime 300
160#define T_AdvMobRtrSupportFlag 301
161#define T_BAD_TOKEN 302
162
163
164
165
166/* Copy the first part of user declarations.  */
167#line 16 "gram.y"
168
169#include <config.h>
170#include <includes.h>
171#include <radvd.h>
172#include <defaults.h>
173
174extern struct Interface *IfaceList;
175struct Interface *iface = NULL;
176struct AdvPrefix *prefix = NULL;
177struct AdvRoute *route = NULL;
178struct AdvRDNSS *rdnss = NULL;
179
180extern char *conf_file;
181extern int num_lines;
182extern char *yytext;
183extern int sock;
184
185static void cleanup(void);
186static void yyerror(char *msg);
187
188#if 0 /* no longer necessary? */
189#ifndef HAVE_IN6_ADDR_S6_ADDR
190# ifdef __FreeBSD__
191#  define s6_addr32 __u6_addr.__u6_addr32
192#  define s6_addr16 __u6_addr.__u6_addr16
193# endif
194#endif
195#endif
196
197#define ABORT	do { cleanup(); YYABORT; } while (0);
198
199
200
201/* Enabling traces.  */
202#ifndef YYDEBUG
203# define YYDEBUG 0
204#endif
205
206/* Enabling verbose error messages.  */
207#ifdef YYERROR_VERBOSE
208# undef YYERROR_VERBOSE
209# define YYERROR_VERBOSE 1
210#else
211# define YYERROR_VERBOSE 0
212#endif
213
214/* Enabling the token table.  */
215#ifndef YYTOKEN_TABLE
216# define YYTOKEN_TABLE 0
217#endif
218
219#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
220typedef union YYSTYPE
221#line 112 "gram.y"
222{
223	unsigned int		num;
224	int			snum;
225	double			dec;
226	struct in6_addr		*addr;
227	char			*str;
228	struct AdvPrefix	*pinfo;
229	struct AdvRoute		*rinfo;
230	struct AdvRDNSS		*rdnssinfo;
231	struct Clients		*ainfo;
232}
233/* Line 193 of yacc.c.  */
234#line 235 "gram.c"
235	YYSTYPE;
236# define yystype YYSTYPE /* obsolescent; will be withdrawn */
237# define YYSTYPE_IS_DECLARED 1
238# define YYSTYPE_IS_TRIVIAL 1
239#endif
240
241
242
243/* Copy the second part of user declarations.  */
244
245
246/* Line 216 of yacc.c.  */
247#line 248 "gram.c"
248
249#ifdef short
250# undef short
251#endif
252
253#ifdef YYTYPE_UINT8
254typedef YYTYPE_UINT8 yytype_uint8;
255#else
256typedef unsigned char yytype_uint8;
257#endif
258
259#ifdef YYTYPE_INT8
260typedef YYTYPE_INT8 yytype_int8;
261#elif (defined __STDC__ || defined __C99__FUNC__ \
262     || defined __cplusplus || defined _MSC_VER)
263typedef signed char yytype_int8;
264#else
265typedef short int yytype_int8;
266#endif
267
268#ifdef YYTYPE_UINT16
269typedef YYTYPE_UINT16 yytype_uint16;
270#else
271typedef unsigned short int yytype_uint16;
272#endif
273
274#ifdef YYTYPE_INT16
275typedef YYTYPE_INT16 yytype_int16;
276#else
277typedef short int yytype_int16;
278#endif
279
280#ifndef YYSIZE_T
281# ifdef __SIZE_TYPE__
282#  define YYSIZE_T __SIZE_TYPE__
283# elif defined size_t
284#  define YYSIZE_T size_t
285# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
286     || defined __cplusplus || defined _MSC_VER)
287#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
288#  define YYSIZE_T size_t
289# else
290#  define YYSIZE_T unsigned int
291# endif
292#endif
293
294#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
295
296#ifndef YY_
297# if YYENABLE_NLS
298#  if ENABLE_NLS
299#   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
300#   define YY_(msgid) dgettext ("bison-runtime", msgid)
301#  endif
302# endif
303# ifndef YY_
304#  define YY_(msgid) msgid
305# endif
306#endif
307
308/* Suppress unused-variable warnings by "using" E.  */
309#if ! defined lint || defined __GNUC__
310# define YYUSE(e) ((void) (e))
311#else
312# define YYUSE(e) /* empty */
313#endif
314
315/* Identity function, used to suppress warnings about constant conditions.  */
316#ifndef lint
317# define YYID(n) (n)
318#else
319#if (defined __STDC__ || defined __C99__FUNC__ \
320     || defined __cplusplus || defined _MSC_VER)
321static int
322YYID (int i)
323#else
324static int
325YYID (i)
326    int i;
327#endif
328{
329  return i;
330}
331#endif
332
333#if ! defined yyoverflow || YYERROR_VERBOSE
334
335/* The parser invokes alloca or malloc; define the necessary symbols.  */
336
337# ifdef YYSTACK_USE_ALLOCA
338#  if YYSTACK_USE_ALLOCA
339#   ifdef __GNUC__
340#    define YYSTACK_ALLOC __builtin_alloca
341#   elif defined __BUILTIN_VA_ARG_INCR
342#    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
343#   elif defined _AIX
344#    define YYSTACK_ALLOC __alloca
345#   elif defined _MSC_VER
346#    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
347#    define alloca _alloca
348#   else
349#    define YYSTACK_ALLOC alloca
350#    if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
351     || defined __cplusplus || defined _MSC_VER)
352#     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
353#     ifndef _STDLIB_H
354#      define _STDLIB_H 1
355#     endif
356#    endif
357#   endif
358#  endif
359# endif
360
361# ifdef YYSTACK_ALLOC
362   /* Pacify GCC's `empty if-body' warning.  */
363#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
364#  ifndef YYSTACK_ALLOC_MAXIMUM
365    /* The OS might guarantee only one guard page at the bottom of the stack,
366       and a page size can be as small as 4096 bytes.  So we cannot safely
367       invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
368       to allow for a few compiler-allocated temporary stack slots.  */
369#   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
370#  endif
371# else
372#  define YYSTACK_ALLOC YYMALLOC
373#  define YYSTACK_FREE YYFREE
374#  ifndef YYSTACK_ALLOC_MAXIMUM
375#   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
376#  endif
377#  if (defined __cplusplus && ! defined _STDLIB_H \
378       && ! ((defined YYMALLOC || defined malloc) \
379	     && (defined YYFREE || defined free)))
380#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
381#   ifndef _STDLIB_H
382#    define _STDLIB_H 1
383#   endif
384#  endif
385#  ifndef YYMALLOC
386#   define YYMALLOC malloc
387#   if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
388     || defined __cplusplus || defined _MSC_VER)
389void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
390#   endif
391#  endif
392#  ifndef YYFREE
393#   define YYFREE free
394#   if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
395     || defined __cplusplus || defined _MSC_VER)
396void free (void *); /* INFRINGES ON USER NAME SPACE */
397#   endif
398#  endif
399# endif
400#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
401
402
403#if (! defined yyoverflow \
404     && (! defined __cplusplus \
405	 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
406
407/* A type that is properly aligned for any stack member.  */
408union yyalloc
409{
410  yytype_int16 yyss;
411  YYSTYPE yyvs;
412  };
413
414/* The size of the maximum gap between one aligned stack and the next.  */
415# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
416
417/* The size of an array large to enough to hold all stacks, each with
418   N elements.  */
419# define YYSTACK_BYTES(N) \
420     ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
421      + YYSTACK_GAP_MAXIMUM)
422
423/* Copy COUNT objects from FROM to TO.  The source and destination do
424   not overlap.  */
425# ifndef YYCOPY
426#  if defined __GNUC__ && 1 < __GNUC__
427#   define YYCOPY(To, From, Count) \
428      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
429#  else
430#   define YYCOPY(To, From, Count)		\
431      do					\
432	{					\
433	  YYSIZE_T yyi;				\
434	  for (yyi = 0; yyi < (Count); yyi++)	\
435	    (To)[yyi] = (From)[yyi];		\
436	}					\
437      while (YYID (0))
438#  endif
439# endif
440
441/* Relocate STACK from its old location to the new one.  The
442   local variables YYSIZE and YYSTACKSIZE give the old and new number of
443   elements in the stack, and YYPTR gives the new location of the
444   stack.  Advance YYPTR to a properly aligned location for the next
445   stack.  */
446# define YYSTACK_RELOCATE(Stack)					\
447    do									\
448      {									\
449	YYSIZE_T yynewbytes;						\
450	YYCOPY (&yyptr->Stack, Stack, yysize);				\
451	Stack = &yyptr->Stack;						\
452	yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
453	yyptr += yynewbytes / sizeof (*yyptr);				\
454      }									\
455    while (YYID (0))
456
457#endif
458
459/* YYFINAL -- State number of the termination state.  */
460#define YYFINAL  7
461/* YYLAST -- Last index in YYTABLE.  */
462#define YYLAST   172
463
464/* YYNTOKENS -- Number of terminals.  */
465#define YYNTOKENS  52
466/* YYNNTS -- Number of nonterminals.  */
467#define YYNNTS  36
468/* YYNRULES -- Number of rules.  */
469#define YYNRULES  83
470/* YYNRULES -- Number of states.  */
471#define YYNSTATES  181
472
473/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
474#define YYUNDEFTOK  2
475#define YYMAXUTOK   302
476
477#define YYTRANSLATE(YYX)						\
478  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
479
480/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
481static const yytype_uint8 yytranslate[] =
482{
483       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
484       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
485       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
486       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
487       2,     2,     2,     2,     2,     2,     2,    51,     2,     2,
488       2,     2,     2,     2,     2,     2,     2,     2,     2,    50,
489       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
490       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
491       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
492       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
493       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
494       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
495       2,     2,     2,    48,     2,    49,     2,     2,     2,     2,
496       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
497       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
498       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
499       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
500       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
501       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
502       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
503       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
504       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
505       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
506       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
507       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
508       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
509       5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
510      15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
511      25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
512      35,    36,    37,    38,    39,    40,    41,    42,    43,    44,
513      45,    46,    47
514};
515
516#if YYDEBUG
517/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
518   YYRHS.  */
519static const yytype_uint16 yyprhs[] =
520{
521       0,     0,     3,     6,     8,    14,    17,    19,    25,    26,
522      28,    29,    31,    32,    34,    35,    37,    38,    40,    43,
523      45,    49,    53,    57,    61,    65,    69,    73,    77,    81,
524      85,    89,    93,    97,   101,   105,   109,   113,   117,   121,
525     125,   129,   133,   137,   141,   147,   150,   154,   157,   163,
526     168,   169,   171,   174,   176,   180,   184,   188,   192,   196,
527     200,   203,   209,   214,   215,   217,   220,   222,   226,   230,
528     233,   239,   242,   244,   246,   249,   250,   252,   255,   257,
529     261,   265,   269,   271
530};
531
532/* YYRHS -- A `-1'-separated list of the rules' RHS.  */
533static const yytype_int8 yyrhs[] =
534{
535      53,     0,    -1,    53,    54,    -1,    54,    -1,    55,    48,
536      57,    49,    50,    -1,     3,    56,    -1,     8,    -1,    58,
537      59,    60,    61,    62,    -1,    -1,    63,    -1,    -1,    67,
538      -1,    -1,    65,    -1,    -1,    73,    -1,    -1,    79,    -1,
539      63,    64,    -1,    64,    -1,    18,     9,    50,    -1,    17,
540       9,    50,    -1,    19,     9,    50,    -1,    18,    11,    50,
541      -1,    17,    11,    50,    -1,    19,    11,    50,    -1,    15,
542      12,    50,    -1,    16,    12,    50,    -1,    20,    12,    50,
543      -1,    21,    12,    50,    -1,    22,     9,    50,    -1,    23,
544       9,    50,    -1,    24,     9,    50,    -1,    26,     9,    50,
545      -1,    27,    10,    50,    -1,    25,     9,    50,    -1,    28,
546      12,    50,    -1,    35,    12,    50,    -1,    36,    12,    50,
547      -1,    34,    12,    50,    -1,    39,     9,    50,    -1,    40,
548       9,    50,    -1,    38,    12,    50,    -1,    46,    12,    50,
549      -1,     7,    48,    66,    49,    50,    -1,    13,    50,    -1,
550      66,    13,    50,    -1,    68,    59,    -1,    69,    48,    70,
551      49,    50,    -1,     4,    13,    51,     9,    -1,    -1,    71,
552      -1,    71,    72,    -1,    72,    -1,    29,    12,    50,    -1,
553      30,    12,    50,    -1,    33,    12,    50,    -1,    31,    87,
554      50,    -1,    32,    87,    50,    -1,    37,    56,    50,    -1,
555      74,    61,    -1,    75,    48,    76,    49,    50,    -1,     5,
556      13,    51,     9,    -1,    -1,    77,    -1,    77,    78,    -1,
557      78,    -1,    41,    10,    50,    -1,    42,    87,    50,    -1,
558      80,    62,    -1,    83,    48,    84,    49,    50,    -1,    81,
559      82,    -1,    82,    -1,    13,    -1,     6,    81,    -1,    -1,
560      85,    -1,    85,    86,    -1,    86,    -1,    43,     9,    50,
561      -1,    44,    12,    50,    -1,    45,    87,    50,    -1,     9,
562      -1,    14,    -1
563};
564
565/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
566static const yytype_uint16 yyrline[] =
567{
568       0,   126,   126,   127,   130,   174,   189,   196,   205,   206,
569     210,   213,   217,   220,   224,   227,   231,   234,   237,   238,
570     241,   245,   249,   253,   257,   261,   265,   269,   273,   277,
571     281,   285,   289,   293,   297,   301,   305,   309,   313,   317,
572     321,   325,   329,   333,   339,   345,   356,   371,   378,   409,
573     472,   473,   476,   477,   480,   484,   488,   495,   499,   503,
574     515,   522,   530,   554,   555,   558,   559,   563,   567,   573,
575     580,   587,   588,   591,   626,   635,   636,   639,   640,   644,
576     648,   652,   665,   669
577};
578#endif
579
580#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
581/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
582   First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
583static const char *const yytname[] =
584{
585  "$end", "error", "$undefined", "T_INTERFACE", "T_PREFIX", "T_ROUTE",
586  "T_RDNSS", "T_CLIENTS", "STRING", "NUMBER", "SIGNEDNUMBER", "DECIMAL",
587  "SWITCH", "IPV6ADDR", "INFINITY", "T_IgnoreIfMissing", "T_AdvSendAdvert",
588  "T_MaxRtrAdvInterval", "T_MinRtrAdvInterval", "T_MinDelayBetweenRAs",
589  "T_AdvManagedFlag", "T_AdvOtherConfigFlag", "T_AdvLinkMTU",
590  "T_AdvReachableTime", "T_AdvRetransTimer", "T_AdvCurHopLimit",
591  "T_AdvDefaultLifetime", "T_AdvDefaultPreference", "T_AdvSourceLLAddress",
592  "T_AdvOnLink", "T_AdvAutonomous", "T_AdvValidLifetime",
593  "T_AdvPreferredLifetime", "T_AdvRouterAddr", "T_AdvHomeAgentFlag",
594  "T_AdvIntervalOpt", "T_AdvHomeAgentInfo", "T_Base6to4Interface",
595  "T_UnicastOnly", "T_HomeAgentPreference", "T_HomeAgentLifetime",
596  "T_AdvRoutePreference", "T_AdvRouteLifetime", "T_AdvRDNSSPreference",
597  "T_AdvRDNSSOpenFlag", "T_AdvRDNSSLifetime", "T_AdvMobRtrSupportFlag",
598  "T_BAD_TOKEN", "'{'", "'}'", "';'", "'/'", "$accept", "grammar",
599  "ifacedef", "ifacehead", "name", "ifaceparams", "optional_ifacevlist",
600  "optional_prefixlist", "optional_clientslist", "optional_routelist",
601  "optional_rdnsslist", "ifacevlist", "ifaceval", "clientslist",
602  "v6addrlist", "prefixlist", "prefixdef", "prefixhead",
603  "optional_prefixplist", "prefixplist", "prefixparms", "routelist",
604  "routedef", "routehead", "optional_routeplist", "routeplist",
605  "routeparms", "rdnsslist", "rdnssdef", "rdnssaddrs", "rdnssaddr",
606  "rdnsshead", "optional_rdnssplist", "rdnssplist", "rdnssparms",
607  "number_or_infinity", 0
608};
609#endif
610
611# ifdef YYPRINT
612/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
613   token YYLEX-NUM.  */
614static const yytype_uint16 yytoknum[] =
615{
616       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
617     265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
618     275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
619     285,   286,   287,   288,   289,   290,   291,   292,   293,   294,
620     295,   296,   297,   298,   299,   300,   301,   302,   123,   125,
621      59,    47
622};
623# endif
624
625/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
626static const yytype_uint8 yyr1[] =
627{
628       0,    52,    53,    53,    54,    55,    56,    57,    58,    58,
629      59,    59,    60,    60,    61,    61,    62,    62,    63,    63,
630      64,    64,    64,    64,    64,    64,    64,    64,    64,    64,
631      64,    64,    64,    64,    64,    64,    64,    64,    64,    64,
632      64,    64,    64,    64,    65,    66,    66,    67,    68,    69,
633      70,    70,    71,    71,    72,    72,    72,    72,    72,    72,
634      73,    74,    75,    76,    76,    77,    77,    78,    78,    79,
635      80,    81,    81,    82,    83,    84,    84,    85,    85,    86,
636      86,    86,    87,    87
637};
638
639/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
640static const yytype_uint8 yyr2[] =
641{
642       0,     2,     2,     1,     5,     2,     1,     5,     0,     1,
643       0,     1,     0,     1,     0,     1,     0,     1,     2,     1,
644       3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
645       3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
646       3,     3,     3,     3,     5,     2,     3,     2,     5,     4,
647       0,     1,     2,     1,     3,     3,     3,     3,     3,     3,
648       2,     5,     4,     0,     1,     2,     1,     3,     3,     2,
649       5,     2,     1,     1,     2,     0,     1,     2,     1,     3,
650       3,     3,     1,     1
651};
652
653/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
654   STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
655   means the default is an error.  */
656static const yytype_uint8 yydefact[] =
657{
658       0,     0,     0,     3,     0,     6,     5,     1,     2,     8,
659       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
660       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
661       0,     0,    10,     9,    19,     0,     0,     0,     0,     0,
662       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
663       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
664       0,    12,    11,    10,     0,    18,    26,    27,    21,    24,
665      20,    23,    22,    25,    28,    29,    30,    31,    32,    35,
666      33,    34,    36,    39,    37,    38,    42,    40,    41,    43,
667       4,     0,     0,    14,    13,    47,    50,     0,     0,     0,
668      16,    15,    14,     0,     0,     0,     0,     0,     0,     0,
669       0,    51,    53,    49,     0,     0,     0,     0,     7,    17,
670      16,     0,    60,    63,     0,     0,    82,    83,     0,     0,
671       0,     0,     0,    52,    45,     0,     0,     0,    73,    74,
672      72,    69,    75,     0,     0,     0,    64,    66,    54,    55,
673      57,    58,    56,    59,    48,    46,    44,    62,    71,     0,
674       0,     0,     0,    76,    78,     0,     0,     0,    65,     0,
675       0,     0,     0,    77,    67,    68,    61,    79,    80,    81,
676      70
677};
678
679/* YYDEFGOTO[NTERM-NUM].  */
680static const yytype_int16 yydefgoto[] =
681{
682      -1,     2,     3,     4,     6,    31,    32,    61,    93,   100,
683     118,    33,    34,    94,   115,    62,    63,    64,   110,   111,
684     112,   101,   102,   103,   145,   146,   147,   119,   120,   139,
685     140,   121,   162,   163,   164,   128
686};
687
688/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
689   STATE-NUM.  */
690#define YYPACT_NINF -108
691static const yytype_int8 yypact[] =
692{
693      -2,    28,    18,  -108,   -16,  -108,  -108,  -108,  -108,   -12,
694      33,    38,     8,    24,    35,    39,    40,    44,    46,    47,
695      48,    49,    50,    51,    52,    53,    54,    55,    59,    60,
696      58,    12,    67,   -12,  -108,     9,    22,    23,    25,    26,
697      27,    29,    30,    31,    32,    34,    36,    37,    41,    42,
698      43,    45,    56,    57,    61,    62,    63,    64,    65,    66,
699      70,    71,  -108,    67,    14,  -108,  -108,  -108,  -108,  -108,
700    -108,  -108,  -108,  -108,  -108,  -108,  -108,  -108,  -108,  -108,
701    -108,  -108,  -108,  -108,  -108,  -108,  -108,  -108,  -108,  -108,
702    -108,    68,    69,    80,  -108,  -108,    10,    79,    76,    77,
703      88,  -108,    80,    72,    84,    85,    11,    11,    86,    28,
704      73,    10,  -108,  -108,    74,   -11,    75,    87,  -108,  -108,
705      88,    81,  -108,     7,    78,    82,  -108,  -108,    83,    89,
706      90,    91,    92,  -108,  -108,    93,    94,    95,  -108,    87,
707    -108,  -108,   -14,    98,    11,    96,     7,  -108,  -108,  -108,
708    -108,  -108,  -108,  -108,  -108,  -108,  -108,  -108,  -108,   100,
709     106,    11,    97,   -14,  -108,    99,   101,   102,  -108,   103,
710     104,   105,   107,  -108,  -108,  -108,  -108,  -108,  -108,  -108,
711    -108
712};
713
714/* YYPGOTO[NTERM-NUM].  */
715static const yytype_int8 yypgoto[] =
716{
717    -108,  -108,   108,  -108,   -35,  -108,  -108,   109,  -108,    -3,
718     -19,  -108,   114,  -108,  -108,  -108,  -108,  -108,  -108,  -108,
719      -9,  -108,  -108,  -108,  -108,  -108,   -43,  -108,  -108,  -108,
720     -34,  -108,  -108,  -108,   -42,  -107
721};
722
723/* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
724   positive, shift that token.  If negative, reduce the rule which
725   number is the opposite.  If zero, do what YYDEFACT says.
726   If YYTABLE_NINF, syntax error.  */
727#define YYTABLE_NINF -1
728static const yytype_uint8 yytable[] =
729{
730     129,     1,   135,    10,    11,    12,    13,    14,    15,    16,
731      17,    18,    19,    20,    21,    22,    23,    37,     7,    38,
732     126,     1,    24,    25,    26,   127,    27,    28,    29,   159,
733     160,   161,     9,    39,    30,    40,     5,   166,   136,   104,
734     105,   106,   107,   108,    41,    35,    42,   109,   143,   144,
735      36,    43,    44,    45,   171,    46,    47,    48,    49,    66,
736      50,    59,    96,    51,    52,    53,    54,    55,    56,    57,
737      58,    60,    67,    68,   131,    69,    70,    71,    92,    72,
738      73,    74,    75,    91,    76,    99,    77,    78,   113,   114,
739     116,    79,    80,    81,   117,    82,   124,   125,   130,   122,
740     138,   141,   133,   168,   157,   158,    83,    84,   165,   169,
741       8,    85,    86,    87,    88,    89,    90,    98,   170,    97,
742     123,   173,   132,     0,   134,     0,   137,     0,   148,   142,
743       0,     0,   149,   150,     0,     0,     0,     0,     0,   151,
744     152,   153,   154,   155,   156,   167,   172,    65,     0,   174,
745       0,   175,   176,   177,   178,   179,     0,   180,     0,     0,
746       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
747       0,     0,    95
748};
749
750static const yytype_int16 yycheck[] =
751{
752     107,     3,    13,    15,    16,    17,    18,    19,    20,    21,
753      22,    23,    24,    25,    26,    27,    28,     9,     0,    11,
754       9,     3,    34,    35,    36,    14,    38,    39,    40,    43,
755      44,    45,    48,     9,    46,    11,     8,   144,    49,    29,
756      30,    31,    32,    33,     9,    12,    11,    37,    41,    42,
757      12,    12,    12,     9,   161,     9,     9,     9,     9,    50,
758      10,    49,    48,    12,    12,    12,    12,    12,     9,     9,
759      12,     4,    50,    50,   109,    50,    50,    50,     7,    50,
760      50,    50,    50,    13,    50,     5,    50,    50,     9,    13,
761      13,    50,    50,    50,     6,    50,    12,    12,    12,   102,
762      13,   120,   111,   146,     9,   139,    50,    50,    10,     9,
763       2,    50,    50,    50,    50,    50,    50,    48,    12,    51,
764      48,   163,    49,    -1,    50,    -1,    51,    -1,    50,    48,
765      -1,    -1,    50,    50,    -1,    -1,    -1,    -1,    -1,    50,
766      50,    50,    50,    50,    50,    49,    49,    33,    -1,    50,
767      -1,    50,    50,    50,    50,    50,    -1,    50,    -1,    -1,
768      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
769      -1,    -1,    63
770};
771
772/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
773   symbol of state STATE-NUM.  */
774static const yytype_uint8 yystos[] =
775{
776       0,     3,    53,    54,    55,     8,    56,     0,    54,    48,
777      15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
778      25,    26,    27,    28,    34,    35,    36,    38,    39,    40,
779      46,    57,    58,    63,    64,    12,    12,     9,    11,     9,
780      11,     9,    11,    12,    12,     9,     9,     9,     9,     9,
781      10,    12,    12,    12,    12,    12,     9,     9,    12,    49,
782       4,    59,    67,    68,    69,    64,    50,    50,    50,    50,
783      50,    50,    50,    50,    50,    50,    50,    50,    50,    50,
784      50,    50,    50,    50,    50,    50,    50,    50,    50,    50,
785      50,    13,     7,    60,    65,    59,    48,    51,    48,     5,
786      61,    73,    74,    75,    29,    30,    31,    32,    33,    37,
787      70,    71,    72,     9,    13,    66,    13,     6,    62,    79,
788      80,    83,    61,    48,    12,    12,     9,    14,    87,    87,
789      12,    56,    49,    72,    50,    13,    49,    51,    13,    81,
790      82,    62,    48,    41,    42,    76,    77,    78,    50,    50,
791      50,    50,    50,    50,    50,    50,    50,     9,    82,    43,
792      44,    45,    84,    85,    86,    10,    87,    49,    78,     9,
793      12,    87,    49,    86,    50,    50,    50,    50,    50,    50,
794      50
795};
796
797#define yyerrok		(yyerrstatus = 0)
798#define yyclearin	(yychar = YYEMPTY)
799#define YYEMPTY		(-2)
800#define YYEOF		0
801
802#define YYACCEPT	goto yyacceptlab
803#define YYABORT		goto yyabortlab
804#define YYERROR		goto yyerrorlab
805
806
807/* Like YYERROR except do call yyerror.  This remains here temporarily
808   to ease the transition to the new meaning of YYERROR, for GCC.
809   Once GCC version 2 has supplanted version 1, this can go.  */
810
811#define YYFAIL		goto yyerrlab
812
813#define YYRECOVERING()  (!!yyerrstatus)
814
815#define YYBACKUP(Token, Value)					\
816do								\
817  if (yychar == YYEMPTY && yylen == 1)				\
818    {								\
819      yychar = (Token);						\
820      yylval = (Value);						\
821      yytoken = YYTRANSLATE (yychar);				\
822      YYPOPSTACK (1);						\
823      goto yybackup;						\
824    }								\
825  else								\
826    {								\
827      yyerror (YY_("syntax error: cannot back up")); \
828      YYERROR;							\
829    }								\
830while (YYID (0))
831
832
833#define YYTERROR	1
834#define YYERRCODE	256
835
836
837/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
838   If N is 0, then set CURRENT to the empty location which ends
839   the previous symbol: RHS[0] (always defined).  */
840
841#define YYRHSLOC(Rhs, K) ((Rhs)[K])
842#ifndef YYLLOC_DEFAULT
843# define YYLLOC_DEFAULT(Current, Rhs, N)				\
844    do									\
845      if (YYID (N))                                                    \
846	{								\
847	  (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;	\
848	  (Current).first_column = YYRHSLOC (Rhs, 1).first_column;	\
849	  (Current).last_line    = YYRHSLOC (Rhs, N).last_line;		\
850	  (Current).last_column  = YYRHSLOC (Rhs, N).last_column;	\
851	}								\
852      else								\
853	{								\
854	  (Current).first_line   = (Current).last_line   =		\
855	    YYRHSLOC (Rhs, 0).last_line;				\
856	  (Current).first_column = (Current).last_column =		\
857	    YYRHSLOC (Rhs, 0).last_column;				\
858	}								\
859    while (YYID (0))
860#endif
861
862
863/* YY_LOCATION_PRINT -- Print the location on the stream.
864   This macro was not mandated originally: define only if we know
865   we won't break user code: when these are the locations we know.  */
866
867#ifndef YY_LOCATION_PRINT
868# if YYLTYPE_IS_TRIVIAL
869#  define YY_LOCATION_PRINT(File, Loc)			\
870     fprintf (File, "%d.%d-%d.%d",			\
871	      (Loc).first_line, (Loc).first_column,	\
872	      (Loc).last_line,  (Loc).last_column)
873# else
874#  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
875# endif
876#endif
877
878
879/* YYLEX -- calling `yylex' with the right arguments.  */
880
881#ifdef YYLEX_PARAM
882# define YYLEX yylex (YYLEX_PARAM)
883#else
884# define YYLEX yylex ()
885#endif
886
887/* Enable debugging if requested.  */
888#if YYDEBUG
889
890# ifndef YYFPRINTF
891#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
892#  define YYFPRINTF fprintf
893# endif
894
895# define YYDPRINTF(Args)			\
896do {						\
897  if (yydebug)					\
898    YYFPRINTF Args;				\
899} while (YYID (0))
900
901# define YY_SYMBOL_PRINT(Title, Type, Value, Location)			  \
902do {									  \
903  if (yydebug)								  \
904    {									  \
905      YYFPRINTF (stderr, "%s ", Title);					  \
906      yy_symbol_print (stderr,						  \
907		  Type, Value); \
908      YYFPRINTF (stderr, "\n");						  \
909    }									  \
910} while (YYID (0))
911
912
913/*--------------------------------.
914| Print this symbol on YYOUTPUT.  |
915`--------------------------------*/
916
917/*ARGSUSED*/
918#if (defined __STDC__ || defined __C99__FUNC__ \
919     || defined __cplusplus || defined _MSC_VER)
920static void
921yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
922#else
923static void
924yy_symbol_value_print (yyoutput, yytype, yyvaluep)
925    FILE *yyoutput;
926    int yytype;
927    YYSTYPE const * const yyvaluep;
928#endif
929{
930  if (!yyvaluep)
931    return;
932# ifdef YYPRINT
933  if (yytype < YYNTOKENS)
934    YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
935# else
936  YYUSE (yyoutput);
937# endif
938  switch (yytype)
939    {
940      default:
941	break;
942    }
943}
944
945
946/*--------------------------------.
947| Print this symbol on YYOUTPUT.  |
948`--------------------------------*/
949
950#if (defined __STDC__ || defined __C99__FUNC__ \
951     || defined __cplusplus || defined _MSC_VER)
952static void
953yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
954#else
955static void
956yy_symbol_print (yyoutput, yytype, yyvaluep)
957    FILE *yyoutput;
958    int yytype;
959    YYSTYPE const * const yyvaluep;
960#endif
961{
962  if (yytype < YYNTOKENS)
963    YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
964  else
965    YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
966
967  yy_symbol_value_print (yyoutput, yytype, yyvaluep);
968  YYFPRINTF (yyoutput, ")");
969}
970
971/*------------------------------------------------------------------.
972| yy_stack_print -- Print the state stack from its BOTTOM up to its |
973| TOP (included).                                                   |
974`------------------------------------------------------------------*/
975
976#if (defined __STDC__ || defined __C99__FUNC__ \
977     || defined __cplusplus || defined _MSC_VER)
978static void
979yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
980#else
981static void
982yy_stack_print (bottom, top)
983    yytype_int16 *bottom;
984    yytype_int16 *top;
985#endif
986{
987  YYFPRINTF (stderr, "Stack now");
988  for (; bottom <= top; ++bottom)
989    YYFPRINTF (stderr, " %d", *bottom);
990  YYFPRINTF (stderr, "\n");
991}
992
993# define YY_STACK_PRINT(Bottom, Top)				\
994do {								\
995  if (yydebug)							\
996    yy_stack_print ((Bottom), (Top));				\
997} while (YYID (0))
998
999
1000/*------------------------------------------------.
1001| Report that the YYRULE is going to be reduced.  |
1002`------------------------------------------------*/
1003
1004#if (defined __STDC__ || defined __C99__FUNC__ \
1005     || defined __cplusplus || defined _MSC_VER)
1006static void
1007yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
1008#else
1009static void
1010yy_reduce_print (yyvsp, yyrule)
1011    YYSTYPE *yyvsp;
1012    int yyrule;
1013#endif
1014{
1015  int yynrhs = yyr2[yyrule];
1016  int yyi;
1017  unsigned long int yylno = yyrline[yyrule];
1018  YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1019	     yyrule - 1, yylno);
1020  /* The symbols being reduced.  */
1021  for (yyi = 0; yyi < yynrhs; yyi++)
1022    {
1023      fprintf (stderr, "   $%d = ", yyi + 1);
1024      yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1025		       &(yyvsp[(yyi + 1) - (yynrhs)])
1026		       		       );
1027      fprintf (stderr, "\n");
1028    }
1029}
1030
1031# define YY_REDUCE_PRINT(Rule)		\
1032do {					\
1033  if (yydebug)				\
1034    yy_reduce_print (yyvsp, Rule); \
1035} while (YYID (0))
1036
1037/* Nonzero means print parse trace.  It is left uninitialized so that
1038   multiple parsers can coexist.  */
1039int yydebug;
1040#else /* !YYDEBUG */
1041# define YYDPRINTF(Args)
1042# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1043# define YY_STACK_PRINT(Bottom, Top)
1044# define YY_REDUCE_PRINT(Rule)
1045#endif /* !YYDEBUG */
1046
1047
1048/* YYINITDEPTH -- initial size of the parser's stacks.  */
1049#ifndef	YYINITDEPTH
1050# define YYINITDEPTH 200
1051#endif
1052
1053/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1054   if the built-in stack extension method is used).
1055
1056   Do not make this value too large; the results are undefined if
1057   YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1058   evaluated with infinite-precision integer arithmetic.  */
1059
1060#ifndef YYMAXDEPTH
1061# define YYMAXDEPTH 10000
1062#endif
1063
1064
1065
1066#if YYERROR_VERBOSE
1067
1068# ifndef yystrlen
1069#  if defined __GLIBC__ && defined _STRING_H
1070#   define yystrlen strlen
1071#  else
1072/* Return the length of YYSTR.  */
1073#if (defined __STDC__ || defined __C99__FUNC__ \
1074     || defined __cplusplus || defined _MSC_VER)
1075static YYSIZE_T
1076yystrlen (const char *yystr)
1077#else
1078static YYSIZE_T
1079yystrlen (yystr)
1080    const char *yystr;
1081#endif
1082{
1083  YYSIZE_T yylen;
1084  for (yylen = 0; yystr[yylen]; yylen++)
1085    continue;
1086  return yylen;
1087}
1088#  endif
1089# endif
1090
1091# ifndef yystpcpy
1092#  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1093#   define yystpcpy stpcpy
1094#  else
1095/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1096   YYDEST.  */
1097#if (defined __STDC__ || defined __C99__FUNC__ \
1098     || defined __cplusplus || defined _MSC_VER)
1099static char *
1100yystpcpy (char *yydest, const char *yysrc)
1101#else
1102static char *
1103yystpcpy (yydest, yysrc)
1104    char *yydest;
1105    const char *yysrc;
1106#endif
1107{
1108  char *yyd = yydest;
1109  const char *yys = yysrc;
1110
1111  while ((*yyd++ = *yys++) != '\0')
1112    continue;
1113
1114  return yyd - 1;
1115}
1116#  endif
1117# endif
1118
1119# ifndef yytnamerr
1120/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1121   quotes and backslashes, so that it's suitable for yyerror.  The
1122   heuristic is that double-quoting is unnecessary unless the string
1123   contains an apostrophe, a comma, or backslash (other than
1124   backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
1125   null, do not copy; instead, return the length of what the result
1126   would have been.  */
1127static YYSIZE_T
1128yytnamerr (char *yyres, const char *yystr)
1129{
1130  if (*yystr == '"')
1131    {
1132      YYSIZE_T yyn = 0;
1133      char const *yyp = yystr;
1134
1135      for (;;)
1136	switch (*++yyp)
1137	  {
1138	  case '\'':
1139	  case ',':
1140	    goto do_not_strip_quotes;
1141
1142	  case '\\':
1143	    if (*++yyp != '\\')
1144	      goto do_not_strip_quotes;
1145	    /* Fall through.  */
1146	  default:
1147	    if (yyres)
1148	      yyres[yyn] = *yyp;
1149	    yyn++;
1150	    break;
1151
1152	  case '"':
1153	    if (yyres)
1154	      yyres[yyn] = '\0';
1155	    return yyn;
1156	  }
1157    do_not_strip_quotes: ;
1158    }
1159
1160  if (! yyres)
1161    return yystrlen (yystr);
1162
1163  return yystpcpy (yyres, yystr) - yyres;
1164}
1165# endif
1166
1167/* Copy into YYRESULT an error message about the unexpected token
1168   YYCHAR while in state YYSTATE.  Return the number of bytes copied,
1169   including the terminating null byte.  If YYRESULT is null, do not
1170   copy anything; just return the number of bytes that would be
1171   copied.  As a special case, return 0 if an ordinary "syntax error"
1172   message will do.  Return YYSIZE_MAXIMUM if overflow occurs during
1173   size calculation.  */
1174static YYSIZE_T
1175yysyntax_error (char *yyresult, int yystate, int yychar)
1176{
1177  int yyn = yypact[yystate];
1178
1179  if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1180    return 0;
1181  else
1182    {
1183      int yytype = YYTRANSLATE (yychar);
1184      YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1185      YYSIZE_T yysize = yysize0;
1186      YYSIZE_T yysize1;
1187      int yysize_overflow = 0;
1188      enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1189      char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1190      int yyx;
1191
1192# if 0
1193      /* This is so xgettext sees the translatable formats that are
1194	 constructed on the fly.  */
1195      YY_("syntax error, unexpected %s");
1196      YY_("syntax error, unexpected %s, expecting %s");
1197      YY_("syntax error, unexpected %s, expecting %s or %s");
1198      YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1199      YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1200# endif
1201      char *yyfmt;
1202      char const *yyf;
1203      static char const yyunexpected[] = "syntax error, unexpected %s";
1204      static char const yyexpecting[] = ", expecting %s";
1205      static char const yyor[] = " or %s";
1206      char yyformat[sizeof yyunexpected
1207		    + sizeof yyexpecting - 1
1208		    + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1209		       * (sizeof yyor - 1))];
1210      char const *yyprefix = yyexpecting;
1211
1212      /* Start YYX at -YYN if negative to avoid negative indexes in
1213	 YYCHECK.  */
1214      int yyxbegin = yyn < 0 ? -yyn : 0;
1215
1216      /* Stay within bounds of both yycheck and yytname.  */
1217      int yychecklim = YYLAST - yyn + 1;
1218      int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1219      int yycount = 1;
1220
1221      yyarg[0] = yytname[yytype];
1222      yyfmt = yystpcpy (yyformat, yyunexpected);
1223
1224      for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1225	if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1226	  {
1227	    if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1228	      {
1229		yycount = 1;
1230		yysize = yysize0;
1231		yyformat[sizeof yyunexpected - 1] = '\0';
1232		break;
1233	      }
1234	    yyarg[yycount++] = yytname[yyx];
1235	    yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1236	    yysize_overflow |= (yysize1 < yysize);
1237	    yysize = yysize1;
1238	    yyfmt = yystpcpy (yyfmt, yyprefix);
1239	    yyprefix = yyor;
1240	  }
1241
1242      yyf = YY_(yyformat);
1243      yysize1 = yysize + yystrlen (yyf);
1244      yysize_overflow |= (yysize1 < yysize);
1245      yysize = yysize1;
1246
1247      if (yysize_overflow)
1248	return YYSIZE_MAXIMUM;
1249
1250      if (yyresult)
1251	{
1252	  /* Avoid sprintf, as that infringes on the user's name space.
1253	     Don't have undefined behavior even if the translation
1254	     produced a string with the wrong number of "%s"s.  */
1255	  char *yyp = yyresult;
1256	  int yyi = 0;
1257	  while ((*yyp = *yyf) != '\0')
1258	    {
1259	      if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1260		{
1261		  yyp += yytnamerr (yyp, yyarg[yyi++]);
1262		  yyf += 2;
1263		}
1264	      else
1265		{
1266		  yyp++;
1267		  yyf++;
1268		}
1269	    }
1270	}
1271      return yysize;
1272    }
1273}
1274#endif /* YYERROR_VERBOSE */
1275
1276
1277/*-----------------------------------------------.
1278| Release the memory associated to this symbol.  |
1279`-----------------------------------------------*/
1280
1281/*ARGSUSED*/
1282#if (defined __STDC__ || defined __C99__FUNC__ \
1283     || defined __cplusplus || defined _MSC_VER)
1284static void
1285yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1286#else
1287static void
1288yydestruct (yymsg, yytype, yyvaluep)
1289    const char *yymsg;
1290    int yytype;
1291    YYSTYPE *yyvaluep;
1292#endif
1293{
1294  YYUSE (yyvaluep);
1295
1296  if (!yymsg)
1297    yymsg = "Deleting";
1298  YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1299
1300  switch (yytype)
1301    {
1302
1303      default:
1304	break;
1305    }
1306}
1307
1308
1309/* Prevent warnings from -Wmissing-prototypes.  */
1310
1311#ifdef YYPARSE_PARAM
1312#if defined __STDC__ || defined __cplusplus
1313int yyparse (void *YYPARSE_PARAM);
1314#else
1315int yyparse ();
1316#endif
1317#else /* ! YYPARSE_PARAM */
1318#if defined __STDC__ || defined __cplusplus
1319int yyparse (void);
1320#else
1321int yyparse ();
1322#endif
1323#endif /* ! YYPARSE_PARAM */
1324
1325
1326
1327/* The look-ahead symbol.  */
1328int yychar;
1329
1330/* The semantic value of the look-ahead symbol.  */
1331YYSTYPE yylval;
1332
1333/* Number of syntax errors so far.  */
1334int yynerrs;
1335
1336
1337
1338/*----------.
1339| yyparse.  |
1340`----------*/
1341
1342#ifdef YYPARSE_PARAM
1343#if (defined __STDC__ || defined __C99__FUNC__ \
1344     || defined __cplusplus || defined _MSC_VER)
1345int
1346yyparse (void *YYPARSE_PARAM)
1347#else
1348int
1349yyparse (YYPARSE_PARAM)
1350    void *YYPARSE_PARAM;
1351#endif
1352#else /* ! YYPARSE_PARAM */
1353#if (defined __STDC__ || defined __C99__FUNC__ \
1354     || defined __cplusplus || defined _MSC_VER)
1355int
1356yyparse (void)
1357#else
1358int
1359yyparse ()
1360
1361#endif
1362#endif
1363{
1364
1365  int yystate;
1366  int yyn;
1367  int yyresult;
1368  /* Number of tokens to shift before error messages enabled.  */
1369  int yyerrstatus;
1370  /* Look-ahead token as an internal (translated) token number.  */
1371  int yytoken = 0;
1372#if YYERROR_VERBOSE
1373  /* Buffer for error messages, and its allocated size.  */
1374  char yymsgbuf[128];
1375  char *yymsg = yymsgbuf;
1376  YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1377#endif
1378
1379  /* Three stacks and their tools:
1380     `yyss': related to states,
1381     `yyvs': related to semantic values,
1382     `yyls': related to locations.
1383
1384     Refer to the stacks thru separate pointers, to allow yyoverflow
1385     to reallocate them elsewhere.  */
1386
1387  /* The state stack.  */
1388  yytype_int16 yyssa[YYINITDEPTH];
1389  yytype_int16 *yyss = yyssa;
1390  yytype_int16 *yyssp;
1391
1392  /* The semantic value stack.  */
1393  YYSTYPE yyvsa[YYINITDEPTH];
1394  YYSTYPE *yyvs = yyvsa;
1395  YYSTYPE *yyvsp;
1396
1397
1398
1399#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
1400
1401  YYSIZE_T yystacksize = YYINITDEPTH;
1402
1403  /* The variables used to return semantic value and location from the
1404     action routines.  */
1405  YYSTYPE yyval;
1406
1407
1408  /* The number of symbols on the RHS of the reduced rule.
1409     Keep to zero when no symbol should be popped.  */
1410  int yylen = 0;
1411
1412  YYDPRINTF ((stderr, "Starting parse\n"));
1413
1414  yystate = 0;
1415  yyerrstatus = 0;
1416  yynerrs = 0;
1417  yychar = YYEMPTY;		/* Cause a token to be read.  */
1418
1419  /* Initialize stack pointers.
1420     Waste one element of value and location stack
1421     so that they stay on the same level as the state stack.
1422     The wasted elements are never initialized.  */
1423
1424  yyssp = yyss;
1425  yyvsp = yyvs;
1426
1427  goto yysetstate;
1428
1429/*------------------------------------------------------------.
1430| yynewstate -- Push a new state, which is found in yystate.  |
1431`------------------------------------------------------------*/
1432 yynewstate:
1433  /* In all cases, when you get here, the value and location stacks
1434     have just been pushed.  So pushing a state here evens the stacks.  */
1435  yyssp++;
1436
1437 yysetstate:
1438  *yyssp = yystate;
1439
1440  if (yyss + yystacksize - 1 <= yyssp)
1441    {
1442      /* Get the current used size of the three stacks, in elements.  */
1443      YYSIZE_T yysize = yyssp - yyss + 1;
1444
1445#ifdef yyoverflow
1446      {
1447	/* Give user a chance to reallocate the stack.  Use copies of
1448	   these so that the &'s don't force the real ones into
1449	   memory.  */
1450	YYSTYPE *yyvs1 = yyvs;
1451	yytype_int16 *yyss1 = yyss;
1452
1453
1454	/* Each stack pointer address is followed by the size of the
1455	   data in use in that stack, in bytes.  This used to be a
1456	   conditional around just the two extra args, but that might
1457	   be undefined if yyoverflow is a macro.  */
1458	yyoverflow (YY_("memory exhausted"),
1459		    &yyss1, yysize * sizeof (*yyssp),
1460		    &yyvs1, yysize * sizeof (*yyvsp),
1461
1462		    &yystacksize);
1463
1464	yyss = yyss1;
1465	yyvs = yyvs1;
1466      }
1467#else /* no yyoverflow */
1468# ifndef YYSTACK_RELOCATE
1469      goto yyexhaustedlab;
1470# else
1471      /* Extend the stack our own way.  */
1472      if (YYMAXDEPTH <= yystacksize)
1473	goto yyexhaustedlab;
1474      yystacksize *= 2;
1475      if (YYMAXDEPTH < yystacksize)
1476	yystacksize = YYMAXDEPTH;
1477
1478      {
1479	yytype_int16 *yyss1 = yyss;
1480	union yyalloc *yyptr =
1481	  (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1482	if (! yyptr)
1483	  goto yyexhaustedlab;
1484	YYSTACK_RELOCATE (yyss);
1485	YYSTACK_RELOCATE (yyvs);
1486
1487#  undef YYSTACK_RELOCATE
1488	if (yyss1 != yyssa)
1489	  YYSTACK_FREE (yyss1);
1490      }
1491# endif
1492#endif /* no yyoverflow */
1493
1494      yyssp = yyss + yysize - 1;
1495      yyvsp = yyvs + yysize - 1;
1496
1497
1498      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1499		  (unsigned long int) yystacksize));
1500
1501      if (yyss + yystacksize - 1 <= yyssp)
1502	YYABORT;
1503    }
1504
1505  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1506
1507  goto yybackup;
1508
1509/*-----------.
1510| yybackup.  |
1511`-----------*/
1512yybackup:
1513
1514  /* Do appropriate processing given the current state.  Read a
1515     look-ahead token if we need one and don't already have one.  */
1516
1517  /* First try to decide what to do without reference to look-ahead token.  */
1518  yyn = yypact[yystate];
1519  if (yyn == YYPACT_NINF)
1520    goto yydefault;
1521
1522  /* Not known => get a look-ahead token if don't already have one.  */
1523
1524  /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol.  */
1525  if (yychar == YYEMPTY)
1526    {
1527      YYDPRINTF ((stderr, "Reading a token: "));
1528      yychar = YYLEX;
1529    }
1530
1531  if (yychar <= YYEOF)
1532    {
1533      yychar = yytoken = YYEOF;
1534      YYDPRINTF ((stderr, "Now at end of input.\n"));
1535    }
1536  else
1537    {
1538      yytoken = YYTRANSLATE (yychar);
1539      YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1540    }
1541
1542  /* If the proper action on seeing token YYTOKEN is to reduce or to
1543     detect an error, take that action.  */
1544  yyn += yytoken;
1545  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1546    goto yydefault;
1547  yyn = yytable[yyn];
1548  if (yyn <= 0)
1549    {
1550      if (yyn == 0 || yyn == YYTABLE_NINF)
1551	goto yyerrlab;
1552      yyn = -yyn;
1553      goto yyreduce;
1554    }
1555
1556  if (yyn == YYFINAL)
1557    YYACCEPT;
1558
1559  /* Count tokens shifted since error; after three, turn off error
1560     status.  */
1561  if (yyerrstatus)
1562    yyerrstatus--;
1563
1564  /* Shift the look-ahead token.  */
1565  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1566
1567  /* Discard the shifted token unless it is eof.  */
1568  if (yychar != YYEOF)
1569    yychar = YYEMPTY;
1570
1571  yystate = yyn;
1572  *++yyvsp = yylval;
1573
1574  goto yynewstate;
1575
1576
1577/*-----------------------------------------------------------.
1578| yydefault -- do the default action for the current state.  |
1579`-----------------------------------------------------------*/
1580yydefault:
1581  yyn = yydefact[yystate];
1582  if (yyn == 0)
1583    goto yyerrlab;
1584  goto yyreduce;
1585
1586
1587/*-----------------------------.
1588| yyreduce -- Do a reduction.  |
1589`-----------------------------*/
1590yyreduce:
1591  /* yyn is the number of a rule to reduce with.  */
1592  yylen = yyr2[yyn];
1593
1594  /* If YYLEN is nonzero, implement the default value of the action:
1595     `$$ = $1'.
1596
1597     Otherwise, the following line sets YYVAL to garbage.
1598     This behavior is undocumented and Bison
1599     users should not rely upon it.  Assigning to YYVAL
1600     unconditionally makes the parser a bit smaller, and it avoids a
1601     GCC warning that YYVAL may be used uninitialized.  */
1602  yyval = yyvsp[1-yylen];
1603
1604
1605  YY_REDUCE_PRINT (yyn);
1606  switch (yyn)
1607    {
1608        case 4:
1609#line 131 "gram.y"
1610    {
1611			struct Interface *iface2;
1612
1613			iface2 = IfaceList;
1614			while (iface2)
1615			{
1616				if (!strcmp(iface2->Name, iface->Name))
1617				{
1618					flog(LOG_ERR, "duplicate interface "
1619						"definition for %s", iface->Name);
1620					ABORT;
1621				}
1622				iface2 = iface2->next;
1623			}
1624
1625			if (check_device(sock, iface) < 0) {
1626				if (iface->IgnoreIfMissing) {
1627					dlog(LOG_DEBUG, 4, "interface %s did not exist, ignoring the interface", iface->Name);
1628					goto skip_interface;
1629				}
1630				else {
1631					flog(LOG_ERR, "interface %s does not exist", iface->Name);
1632					ABORT;
1633				}
1634			}
1635			if (setup_deviceinfo(sock, iface) < 0)
1636				ABORT;
1637			if (check_iface(iface) < 0)
1638				ABORT;
1639			if (setup_linklocal_addr(sock, iface) < 0)
1640				ABORT;
1641			if (setup_allrouters_membership(sock, iface) < 0)
1642				ABORT;
1643
1644			iface->next = IfaceList;
1645			IfaceList = iface;
1646
1647			dlog(LOG_DEBUG, 4, "interface definition for %s is ok", iface->Name);
1648
1649skip_interface:
1650			iface = NULL;
1651		}
1652    break;
1653
1654  case 5:
1655#line 175 "gram.y"
1656    {
1657			iface = malloc(sizeof(struct Interface));
1658
1659			if (iface == NULL) {
1660				flog(LOG_CRIT, "malloc failed: %s", strerror(errno));
1661				ABORT;
1662			}
1663
1664			iface_init_defaults(iface);
1665			strncpy(iface->Name, (yyvsp[(2) - (2)].str), IFNAMSIZ-1);
1666			iface->Name[IFNAMSIZ-1] = '\0';
1667		}
1668    break;
1669
1670  case 6:
1671#line 190 "gram.y"
1672    {
1673			/* check vality */
1674			(yyval.str) = (yyvsp[(1) - (1)].str);
1675		}
1676    break;
1677
1678  case 7:
1679#line 197 "gram.y"
1680    {
1681			iface->AdvPrefixList = (yyvsp[(2) - (5)].pinfo);
1682			iface->ClientList = (yyvsp[(3) - (5)].ainfo);
1683			iface->AdvRouteList = (yyvsp[(4) - (5)].rinfo);
1684			iface->AdvRDNSSList = (yyvsp[(5) - (5)].rdnssinfo);
1685		}
1686    break;
1687
1688  case 10:
1689#line 210 "gram.y"
1690    {
1691			(yyval.pinfo) = NULL;
1692		}
1693    break;
1694
1695  case 12:
1696#line 217 "gram.y"
1697    {
1698			(yyval.ainfo) = NULL;
1699		}
1700    break;
1701
1702  case 14:
1703#line 224 "gram.y"
1704    {
1705			(yyval.rinfo) = NULL;
1706		}
1707    break;
1708
1709  case 16:
1710#line 231 "gram.y"
1711    {
1712			(yyval.rdnssinfo) = NULL;
1713		}
1714    break;
1715
1716  case 20:
1717#line 242 "gram.y"
1718    {
1719			iface->MinRtrAdvInterval = (yyvsp[(2) - (3)].num);
1720		}
1721    break;
1722
1723  case 21:
1724#line 246 "gram.y"
1725    {
1726			iface->MaxRtrAdvInterval = (yyvsp[(2) - (3)].num);
1727		}
1728    break;
1729
1730  case 22:
1731#line 250 "gram.y"
1732    {
1733			iface->MinDelayBetweenRAs = (yyvsp[(2) - (3)].num);
1734		}
1735    break;
1736
1737  case 23:
1738#line 254 "gram.y"
1739    {
1740			iface->MinRtrAdvInterval = (yyvsp[(2) - (3)].dec);
1741		}
1742    break;
1743
1744  case 24:
1745#line 258 "gram.y"
1746    {
1747			iface->MaxRtrAdvInterval = (yyvsp[(2) - (3)].dec);
1748		}
1749    break;
1750
1751  case 25:
1752#line 262 "gram.y"
1753    {
1754			iface->MinDelayBetweenRAs = (yyvsp[(2) - (3)].dec);
1755		}
1756    break;
1757
1758  case 26:
1759#line 266 "gram.y"
1760    {
1761			iface->IgnoreIfMissing = (yyvsp[(2) - (3)].num);
1762		}
1763    break;
1764
1765  case 27:
1766#line 270 "gram.y"
1767    {
1768			iface->AdvSendAdvert = (yyvsp[(2) - (3)].num);
1769		}
1770    break;
1771
1772  case 28:
1773#line 274 "gram.y"
1774    {
1775			iface->AdvManagedFlag = (yyvsp[(2) - (3)].num);
1776		}
1777    break;
1778
1779  case 29:
1780#line 278 "gram.y"
1781    {
1782			iface->AdvOtherConfigFlag = (yyvsp[(2) - (3)].num);
1783		}
1784    break;
1785
1786  case 30:
1787#line 282 "gram.y"
1788    {
1789			iface->AdvLinkMTU = (yyvsp[(2) - (3)].num);
1790		}
1791    break;
1792
1793  case 31:
1794#line 286 "gram.y"
1795    {
1796			iface->AdvReachableTime = (yyvsp[(2) - (3)].num);
1797		}
1798    break;
1799
1800  case 32:
1801#line 290 "gram.y"
1802    {
1803			iface->AdvRetransTimer = (yyvsp[(2) - (3)].num);
1804		}
1805    break;
1806
1807  case 33:
1808#line 294 "gram.y"
1809    {
1810			iface->AdvDefaultLifetime = (yyvsp[(2) - (3)].num);
1811		}
1812    break;
1813
1814  case 34:
1815#line 298 "gram.y"
1816    {
1817			iface->AdvDefaultPreference = (yyvsp[(2) - (3)].snum);
1818		}
1819    break;
1820
1821  case 35:
1822#line 302 "gram.y"
1823    {
1824			iface->AdvCurHopLimit = (yyvsp[(2) - (3)].num);
1825		}
1826    break;
1827
1828  case 36:
1829#line 306 "gram.y"
1830    {
1831			iface->AdvSourceLLAddress = (yyvsp[(2) - (3)].num);
1832		}
1833    break;
1834
1835  case 37:
1836#line 310 "gram.y"
1837    {
1838			iface->AdvIntervalOpt = (yyvsp[(2) - (3)].num);
1839		}
1840    break;
1841
1842  case 38:
1843#line 314 "gram.y"
1844    {
1845			iface->AdvHomeAgentInfo = (yyvsp[(2) - (3)].num);
1846		}
1847    break;
1848
1849  case 39:
1850#line 318 "gram.y"
1851    {
1852			iface->AdvHomeAgentFlag = (yyvsp[(2) - (3)].num);
1853		}
1854    break;
1855
1856  case 40:
1857#line 322 "gram.y"
1858    {
1859			iface->HomeAgentPreference = (yyvsp[(2) - (3)].num);
1860		}
1861    break;
1862
1863  case 41:
1864#line 326 "gram.y"
1865    {
1866			iface->HomeAgentLifetime = (yyvsp[(2) - (3)].num);
1867		}
1868    break;
1869
1870  case 42:
1871#line 330 "gram.y"
1872    {
1873			iface->UnicastOnly = (yyvsp[(2) - (3)].num);
1874		}
1875    break;
1876
1877  case 43:
1878#line 334 "gram.y"
1879    {
1880			iface->AdvMobRtrSupportFlag = (yyvsp[(2) - (3)].num);
1881		}
1882    break;
1883
1884  case 44:
1885#line 340 "gram.y"
1886    {
1887			(yyval.ainfo) = (yyvsp[(3) - (5)].ainfo);
1888		}
1889    break;
1890
1891  case 45:
1892#line 346 "gram.y"
1893    {
1894			struct Clients *new = calloc(1, sizeof(struct Clients));
1895			if (new == NULL) {
1896				flog(LOG_CRIT, "calloc failed: %s", strerror(errno));
1897				ABORT;
1898			}
1899
1900			memcpy(&(new->Address), (yyvsp[(1) - (2)].addr), sizeof(struct in6_addr));
1901			(yyval.ainfo) = new;
1902		}
1903    break;
1904
1905  case 46:
1906#line 357 "gram.y"
1907    {
1908			struct Clients *new = calloc(1, sizeof(struct Clients));
1909			if (new == NULL) {
1910				flog(LOG_CRIT, "calloc failed: %s", strerror(errno));
1911				ABORT;
1912			}
1913
1914			memcpy(&(new->Address), (yyvsp[(2) - (3)].addr), sizeof(struct in6_addr));
1915			new->next = (yyvsp[(1) - (3)].ainfo);
1916			(yyval.ainfo) = new;
1917		}
1918    break;
1919
1920  case 47:
1921#line 372 "gram.y"
1922    {
1923			(yyvsp[(1) - (2)].pinfo)->next = (yyvsp[(2) - (2)].pinfo);
1924			(yyval.pinfo) = (yyvsp[(1) - (2)].pinfo);
1925		}
1926    break;
1927
1928  case 48:
1929#line 379 "gram.y"
1930    {
1931			unsigned int dst;
1932
1933			if (prefix->AdvPreferredLifetime >
1934			    prefix->AdvValidLifetime)
1935			{
1936				flog(LOG_ERR, "AdvValidLifeTime must be "
1937					"greater than AdvPreferredLifetime in %s, line %d",
1938					conf_file, num_lines);
1939				ABORT;
1940			}
1941
1942			if( prefix->if6to4[0] )
1943			{
1944				if (get_v4addr(prefix->if6to4, &dst) < 0)
1945				{
1946					flog(LOG_ERR, "interface %s has no IPv4 addresses, disabling 6to4 prefix", prefix->if6to4 );
1947					prefix->enabled = 0;
1948				} else
1949				{
1950					*((uint16_t *)(prefix->Prefix.s6_addr)) = htons(0x2002);
1951					memcpy( prefix->Prefix.s6_addr + 2, &dst, sizeof( dst ) );
1952				}
1953			}
1954
1955			(yyval.pinfo) = prefix;
1956			prefix = NULL;
1957		}
1958    break;
1959
1960  case 49:
1961#line 410 "gram.y"
1962    {
1963			struct in6_addr zeroaddr;
1964			prefix = malloc(sizeof(struct AdvPrefix));
1965
1966			if (prefix == NULL) {
1967				flog(LOG_CRIT, "malloc failed: %s", strerror(errno));
1968				ABORT;
1969			}
1970
1971			prefix_init_defaults(prefix);
1972
1973			if ((yyvsp[(4) - (4)].num) > MAX_PrefixLen)
1974			{
1975				flog(LOG_ERR, "invalid prefix length in %s, line %d", conf_file, num_lines);
1976				ABORT;
1977			}
1978
1979			prefix->PrefixLen = (yyvsp[(4) - (4)].num);
1980
1981			memcpy(&prefix->Prefix, (yyvsp[(2) - (4)].addr), sizeof(struct in6_addr));
1982
1983			memset(&zeroaddr, 0, sizeof(zeroaddr));
1984			if (!memcmp((yyvsp[(2) - (4)].addr), &zeroaddr, sizeof(struct in6_addr))) {
1985#ifndef HAVE_IFADDRS_H
1986				flog(LOG_ERR, "invalid all-zeros prefix in %s, line %d", conf_file, num_lines);
1987				ABORT;
1988#else
1989				dlog(LOG_DEBUG, 5, "all-zeros prefix in %s, line %d, parsing..", conf_file, num_lines);
1990				struct ifaddrs *ifap, *ifa;
1991				if (getifaddrs(&ifap) != 0)
1992					flog(LOG_ERR, "getifaddrs failed: %s", strerror(errno));
1993			        for (ifa = ifap; ifa; ifa = ifa->ifa_next) {
1994				        struct sockaddr_in6 *s6;
1995					char buf[INET6_ADDRSTRLEN];
1996					if (strncmp(ifa->ifa_name, iface->Name, IFNAMSIZ))
1997						continue;
1998                			if (ifa->ifa_addr->sa_family != AF_INET6)
1999			                        continue;
2000					s6 = (struct sockaddr_in6 *)(ifa->ifa_addr);
2001	                		if (IN6_IS_ADDR_LINKLOCAL(&s6->sin6_addr))
2002						continue;
2003					if (inet_ntop(ifa->ifa_addr->sa_family, (void *)&(s6->sin6_addr), buf, sizeof(buf)) == NULL) {
2004						flog(LOG_ERR, "%s: inet_ntop failed in %s, line %d!", ifa->ifa_name, conf_file, num_lines);
2005					}
2006					else {
2007						dlog(LOG_DEBUG, 5, "auto-selected prefix %s on interface %s", buf, ifa->ifa_name);
2008						memcpy(&prefix->Prefix, &s6->sin6_addr, sizeof(struct in6_addr));
2009						prefix->AdvRouterAddr=1;
2010						prefix->AutoSelected=1;
2011					}
2012				}
2013				if (!memcmp(&prefix->Prefix, &zeroaddr, sizeof(struct in6_addr))) {
2014					prefix->enabled = 0;
2015					flog(LOG_WARNING, "no auto-selected prefix on interface %s, disabling advertisements",  iface->Name);
2016				}
2017				freeifaddrs(ifap);
2018				freeifaddrs(ifa);
2019#endif /* ifndef HAVE_IFADDRS_H */
2020			}
2021		}
2022    break;
2023
2024  case 54:
2025#line 481 "gram.y"
2026    {
2027			prefix->AdvOnLinkFlag = (yyvsp[(2) - (3)].num);
2028		}
2029    break;
2030
2031  case 55:
2032#line 485 "gram.y"
2033    {
2034			prefix->AdvAutonomousFlag = (yyvsp[(2) - (3)].num);
2035		}
2036    break;
2037
2038  case 56:
2039#line 489 "gram.y"
2040    {
2041			if (prefix->AutoSelected && (yyvsp[(2) - (3)].num) == 0)
2042				flog(LOG_WARNING, "prefix automatically selected, AdvRouterAddr always enabled, ignoring config line %d", num_lines);
2043			else
2044				prefix->AdvRouterAddr = (yyvsp[(2) - (3)].num);
2045		}
2046    break;
2047
2048  case 57:
2049#line 496 "gram.y"
2050    {
2051			prefix->AdvValidLifetime = (yyvsp[(2) - (3)].num);
2052		}
2053    break;
2054
2055  case 58:
2056#line 500 "gram.y"
2057    {
2058			prefix->AdvPreferredLifetime = (yyvsp[(2) - (3)].num);
2059		}
2060    break;
2061
2062  case 59:
2063#line 504 "gram.y"
2064    {
2065			if (prefix->AutoSelected) {
2066				flog(LOG_ERR, "automatically selecting the prefix and Base6to4Interface are mutually exclusive");
2067				ABORT;
2068			} /* fallthrough */
2069			dlog(LOG_DEBUG, 4, "using interface %s for 6to4", (yyvsp[(2) - (3)].str));
2070			strncpy(prefix->if6to4, (yyvsp[(2) - (3)].str), IFNAMSIZ-1);
2071			prefix->if6to4[IFNAMSIZ-1] = '\0';
2072		}
2073    break;
2074
2075  case 60:
2076#line 516 "gram.y"
2077    {
2078			(yyvsp[(1) - (2)].rinfo)->next = (yyvsp[(2) - (2)].rinfo);
2079			(yyval.rinfo) = (yyvsp[(1) - (2)].rinfo);
2080		}
2081    break;
2082
2083  case 61:
2084#line 523 "gram.y"
2085    {
2086			(yyval.rinfo) = route;
2087			route = NULL;
2088		}
2089    break;
2090
2091  case 62:
2092#line 531 "gram.y"
2093    {
2094			route = malloc(sizeof(struct AdvRoute));
2095
2096			if (route == NULL) {
2097				flog(LOG_CRIT, "malloc failed: %s", strerror(errno));
2098				ABORT;
2099			}
2100
2101			route_init_defaults(route, iface);
2102
2103			if ((yyvsp[(4) - (4)].num) > MAX_PrefixLen)
2104			{
2105				flog(LOG_ERR, "invalid route prefix length in %s, line %d", conf_file, num_lines);
2106				ABORT;
2107			}
2108
2109			route->PrefixLen = (yyvsp[(4) - (4)].num);
2110
2111			memcpy(&route->Prefix, (yyvsp[(2) - (4)].addr), sizeof(struct in6_addr));
2112		}
2113    break;
2114
2115  case 67:
2116#line 564 "gram.y"
2117    {
2118			route->AdvRoutePreference = (yyvsp[(2) - (3)].snum);
2119		}
2120    break;
2121
2122  case 68:
2123#line 568 "gram.y"
2124    {
2125			route->AdvRouteLifetime = (yyvsp[(2) - (3)].num);
2126		}
2127    break;
2128
2129  case 69:
2130#line 574 "gram.y"
2131    {
2132			(yyvsp[(1) - (2)].rdnssinfo)->next = (yyvsp[(2) - (2)].rdnssinfo);
2133			(yyval.rdnssinfo) = (yyvsp[(1) - (2)].rdnssinfo);
2134		}
2135    break;
2136
2137  case 70:
2138#line 581 "gram.y"
2139    {
2140			(yyval.rdnssinfo) = rdnss;
2141			rdnss = NULL;
2142		}
2143    break;
2144
2145  case 73:
2146#line 592 "gram.y"
2147    {
2148			if (!rdnss) {
2149				/* first IP found */
2150				rdnss = malloc(sizeof(struct AdvRDNSS));
2151
2152				if (rdnss == NULL) {
2153					flog(LOG_CRIT, "malloc failed: %s", strerror(errno));
2154					ABORT;
2155				}
2156
2157				rdnss_init_defaults(rdnss, iface);
2158			}
2159
2160			switch (rdnss->AdvRDNSSNumber) {
2161				case 0:
2162					memcpy(&rdnss->AdvRDNSSAddr1, (yyvsp[(1) - (1)].addr), sizeof(struct in6_addr));
2163					rdnss->AdvRDNSSNumber++;
2164					break;
2165				case 1:
2166					memcpy(&rdnss->AdvRDNSSAddr2, (yyvsp[(1) - (1)].addr), sizeof(struct in6_addr));
2167					rdnss->AdvRDNSSNumber++;
2168					break;
2169				case 2:
2170					memcpy(&rdnss->AdvRDNSSAddr3, (yyvsp[(1) - (1)].addr), sizeof(struct in6_addr));
2171					rdnss->AdvRDNSSNumber++;
2172					break;
2173				default:
2174					flog(LOG_CRIT, "Too many addresses in RDNSS section");
2175					ABORT;
2176			}
2177
2178		}
2179    break;
2180
2181  case 74:
2182#line 627 "gram.y"
2183    {
2184			if (!rdnss) {
2185				flog(LOG_CRIT, "No address specified in RDNSS section");
2186				ABORT;
2187			}
2188		}
2189    break;
2190
2191  case 79:
2192#line 645 "gram.y"
2193    {
2194			rdnss->AdvRDNSSPreference = (yyvsp[(2) - (3)].num);
2195		}
2196    break;
2197
2198  case 80:
2199#line 649 "gram.y"
2200    {
2201			rdnss->AdvRDNSSOpenFlag = (yyvsp[(2) - (3)].num);
2202		}
2203    break;
2204
2205  case 81:
2206#line 653 "gram.y"
2207    {
2208			if ((yyvsp[(2) - (3)].num) < iface->MaxRtrAdvInterval && (yyvsp[(2) - (3)].num) != 0) {
2209				flog(LOG_ERR, "AdvRDNSSLifetime must be at least MaxRtrAdvInterval");
2210				ABORT;
2211			}
2212			if ((yyvsp[(2) - (3)].num) > 2*(iface->MaxRtrAdvInterval))
2213				flog(LOG_WARNING, "Warning: AdvRDNSSLifetime <= 2*MaxRtrAdvInterval would allow stale DNS servers to be deleted faster");
2214
2215			rdnss->AdvRDNSSLifetime = (yyvsp[(2) - (3)].num);
2216		}
2217    break;
2218
2219  case 82:
2220#line 666 "gram.y"
2221    {
2222                                (yyval.num) = (yyvsp[(1) - (1)].num);
2223                        }
2224    break;
2225
2226  case 83:
2227#line 670 "gram.y"
2228    {
2229                                (yyval.num) = (uint32_t)~0;
2230                        }
2231    break;
2232
2233
2234/* Line 1267 of yacc.c.  */
2235#line 2236 "gram.c"
2236      default: break;
2237    }
2238  YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2239
2240  YYPOPSTACK (yylen);
2241  yylen = 0;
2242  YY_STACK_PRINT (yyss, yyssp);
2243
2244  *++yyvsp = yyval;
2245
2246
2247  /* Now `shift' the result of the reduction.  Determine what state
2248     that goes to, based on the state we popped back to and the rule
2249     number reduced by.  */
2250
2251  yyn = yyr1[yyn];
2252
2253  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2254  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2255    yystate = yytable[yystate];
2256  else
2257    yystate = yydefgoto[yyn - YYNTOKENS];
2258
2259  goto yynewstate;
2260
2261
2262/*------------------------------------.
2263| yyerrlab -- here on detecting error |
2264`------------------------------------*/
2265yyerrlab:
2266  /* If not already recovering from an error, report this error.  */
2267  if (!yyerrstatus)
2268    {
2269      ++yynerrs;
2270#if ! YYERROR_VERBOSE
2271      yyerror (YY_("syntax error"));
2272#else
2273      {
2274	YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
2275	if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
2276	  {
2277	    YYSIZE_T yyalloc = 2 * yysize;
2278	    if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
2279	      yyalloc = YYSTACK_ALLOC_MAXIMUM;
2280	    if (yymsg != yymsgbuf)
2281	      YYSTACK_FREE (yymsg);
2282	    yymsg = (char *) YYSTACK_ALLOC (yyalloc);
2283	    if (yymsg)
2284	      yymsg_alloc = yyalloc;
2285	    else
2286	      {
2287		yymsg = yymsgbuf;
2288		yymsg_alloc = sizeof yymsgbuf;
2289	      }
2290	  }
2291
2292	if (0 < yysize && yysize <= yymsg_alloc)
2293	  {
2294	    (void) yysyntax_error (yymsg, yystate, yychar);
2295	    yyerror (yymsg);
2296	  }
2297	else
2298	  {
2299	    yyerror (YY_("syntax error"));
2300	    if (yysize != 0)
2301	      goto yyexhaustedlab;
2302	  }
2303      }
2304#endif
2305    }
2306
2307
2308
2309  if (yyerrstatus == 3)
2310    {
2311      /* If just tried and failed to reuse look-ahead token after an
2312	 error, discard it.  */
2313
2314      if (yychar <= YYEOF)
2315	{
2316	  /* Return failure if at end of input.  */
2317	  if (yychar == YYEOF)
2318	    YYABORT;
2319	}
2320      else
2321	{
2322	  yydestruct ("Error: discarding",
2323		      yytoken, &yylval);
2324	  yychar = YYEMPTY;
2325	}
2326    }
2327
2328  /* Else will try to reuse look-ahead token after shifting the error
2329     token.  */
2330  goto yyerrlab1;
2331
2332
2333/*---------------------------------------------------.
2334| yyerrorlab -- error raised explicitly by YYERROR.  |
2335`---------------------------------------------------*/
2336yyerrorlab:
2337
2338  /* Pacify compilers like GCC when the user code never invokes
2339     YYERROR and the label yyerrorlab therefore never appears in user
2340     code.  */
2341  if (/*CONSTCOND*/ 0)
2342     goto yyerrorlab;
2343
2344  /* Do not reclaim the symbols of the rule which action triggered
2345     this YYERROR.  */
2346  YYPOPSTACK (yylen);
2347  yylen = 0;
2348  YY_STACK_PRINT (yyss, yyssp);
2349  yystate = *yyssp;
2350  goto yyerrlab1;
2351
2352
2353/*-------------------------------------------------------------.
2354| yyerrlab1 -- common code for both syntax error and YYERROR.  |
2355`-------------------------------------------------------------*/
2356yyerrlab1:
2357  yyerrstatus = 3;	/* Each real token shifted decrements this.  */
2358
2359  for (;;)
2360    {
2361      yyn = yypact[yystate];
2362      if (yyn != YYPACT_NINF)
2363	{
2364	  yyn += YYTERROR;
2365	  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2366	    {
2367	      yyn = yytable[yyn];
2368	      if (0 < yyn)
2369		break;
2370	    }
2371	}
2372
2373      /* Pop the current state because it cannot handle the error token.  */
2374      if (yyssp == yyss)
2375	YYABORT;
2376
2377
2378      yydestruct ("Error: popping",
2379		  yystos[yystate], yyvsp);
2380      YYPOPSTACK (1);
2381      yystate = *yyssp;
2382      YY_STACK_PRINT (yyss, yyssp);
2383    }
2384
2385  if (yyn == YYFINAL)
2386    YYACCEPT;
2387
2388  *++yyvsp = yylval;
2389
2390
2391  /* Shift the error token.  */
2392  YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2393
2394  yystate = yyn;
2395  goto yynewstate;
2396
2397
2398/*-------------------------------------.
2399| yyacceptlab -- YYACCEPT comes here.  |
2400`-------------------------------------*/
2401yyacceptlab:
2402  yyresult = 0;
2403  goto yyreturn;
2404
2405/*-----------------------------------.
2406| yyabortlab -- YYABORT comes here.  |
2407`-----------------------------------*/
2408yyabortlab:
2409  yyresult = 1;
2410  goto yyreturn;
2411
2412#ifndef yyoverflow
2413/*-------------------------------------------------.
2414| yyexhaustedlab -- memory exhaustion comes here.  |
2415`-------------------------------------------------*/
2416yyexhaustedlab:
2417  yyerror (YY_("memory exhausted"));
2418  yyresult = 2;
2419  /* Fall through.  */
2420#endif
2421
2422yyreturn:
2423  if (yychar != YYEOF && yychar != YYEMPTY)
2424     yydestruct ("Cleanup: discarding lookahead",
2425		 yytoken, &yylval);
2426  /* Do not reclaim the symbols of the rule which action triggered
2427     this YYABORT or YYACCEPT.  */
2428  YYPOPSTACK (yylen);
2429  YY_STACK_PRINT (yyss, yyssp);
2430  while (yyssp != yyss)
2431    {
2432      yydestruct ("Cleanup: popping",
2433		  yystos[*yyssp], yyvsp);
2434      YYPOPSTACK (1);
2435    }
2436#ifndef yyoverflow
2437  if (yyss != yyssa)
2438    YYSTACK_FREE (yyss);
2439#endif
2440#if YYERROR_VERBOSE
2441  if (yymsg != yymsgbuf)
2442    YYSTACK_FREE (yymsg);
2443#endif
2444  /* Make sure YYID is used.  */
2445  return YYID (yyresult);
2446}
2447
2448
2449#line 675 "gram.y"
2450
2451
2452static
2453void cleanup(void)
2454{
2455	if (iface)
2456		free(iface);
2457
2458	if (prefix)
2459		free(prefix);
2460
2461	if (route)
2462		free(route);
2463
2464	if (rdnss)
2465		free(rdnss);
2466}
2467
2468static void
2469yyerror(char *msg)
2470{
2471	cleanup();
2472	flog(LOG_ERR, "%s in %s, line %d: %s", msg, conf_file, num_lines, yytext);
2473}
2474
2475