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