1 
2 # line 2 "../ippool_y.y"
3 /*
4  * Copyright (C) 2003 by Darren Reed.
5  *
6  * See the IPFILTER.LICENCE file for details on licencing.
7  *
8  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
9  * Use is subject to license terms.
10  */
11 
12 #pragma ident	"%Z%%M%	%I%	%E% SMI"
13 
14 #include <sys/types.h>
15 #include <sys/time.h>
16 #include <sys/param.h>
17 #include <sys/socket.h>
18 #if defined(BSD) && (BSD >= 199306)
19 # include <sys/cdefs.h>
20 #endif
21 #include <sys/ioctl.h>
22 
23 #include <net/if.h>
24 #if __FreeBSD_version >= 300000
25 # include <net/if_var.h>
26 #endif
27 #include <netinet/in.h>
28 
29 #include <arpa/inet.h>
30 
31 #include <stdio.h>
32 #include <fcntl.h>
33 #include <stdlib.h>
34 #include <string.h>
35 #include <netdb.h>
36 #include <ctype.h>
37 #include <unistd.h>
38 
39 #include "ipf.h"
40 #include "netinet/ip_lookup.h"
41 #include "netinet/ip_pool.h"
42 #include "netinet/ip_htable.h"
43 #include "ippool_l.h"
44 #include "kmem.h"
45 
46 #define	YYDEBUG	1
47 
48 extern	int	yyparse __P((void));
49 extern	int	yydebug;
50 extern	FILE	*yyin;
51 
52 static	iphtable_t	ipht;
53 static	iphtent_t	iphte;
54 static	ip_pool_t	iplo;
55 static	ioctlfunc_t	poolioctl = NULL;
56 static	char		poolname[FR_GROUPLEN];
57 static	int		set_ipv6_addr = 0;
58 
59 
60 # line 60 "../ippool_y.y"
61 typedef union
62 #ifdef __cplusplus
63 	YYSTYPE
64 #endif
65 	{
66 	char	*str;
67 	u_32_t	num;
68 	struct	in_addr	addr;
69 	struct	alist_s	*alist;
70 	union   i6addr	adrmsk[2];
71 	iphtent_t	*ipe;
72 	ip_pool_node_t	*ipp;
73 	union	i6addr	ip6;
74 } YYSTYPE;
75 # define YY_NUMBER 257
76 # define YY_HEX 258
77 # define YY_STR 259
78 # define YY_COMMENT 260
79 # define YY_CMP_EQ 261
80 # define YY_CMP_NE 262
81 # define YY_CMP_LE 263
82 # define YY_CMP_GE 264
83 # define YY_CMP_LT 265
84 # define YY_CMP_GT 266
85 # define YY_RANGE_OUT 267
86 # define YY_RANGE_IN 268
87 # define YY_IPV6 269
88 # define IPT_IPF 270
89 # define IPT_NAT 271
90 # define IPT_COUNT 272
91 # define IPT_AUTH 273
92 # define IPT_IN 274
93 # define IPT_OUT 275
94 # define IPT_TABLE 276
95 # define IPT_GROUPMAP 277
96 # define IPT_HASH 278
97 # define IPT_ROLE 279
98 # define IPT_TYPE 280
99 # define IPT_TREE 281
100 # define IPT_GROUP 282
101 # define IPT_SIZE 283
102 # define IPT_SEED 284
103 # define IPT_NUM 285
104 # define IPT_NAME 286
105 
106 #include <inttypes.h>
107 
108 #ifdef __STDC__
109 #include <stdlib.h>
110 #include <string.h>
111 #define	YYCONST	const
112 #else
113 #include <malloc.h>
114 #include <memory.h>
115 #define	YYCONST
116 #endif
117 
118 #include <values.h>
119 
120 #if defined(__cplusplus) || defined(__STDC__)
121 
122 #if defined(__cplusplus) && defined(__EXTERN_C__)
123 extern "C" {
124 #endif
125 #ifndef yyerror
126 #if defined(__cplusplus)
127 	void yyerror(YYCONST char *);
128 #endif
129 #endif
130 #ifndef yylex
131 	int yylex(void);
132 #endif
133 	int yyparse(void);
134 #if defined(__cplusplus) && defined(__EXTERN_C__)
135 }
136 #endif
137 
138 #endif
139 
140 #define yyclearin yychar = -1
141 #define yyerrok yyerrflag = 0
142 extern int yychar;
143 extern int yyerrflag;
144 YYSTYPE yylval;
145 YYSTYPE yyval;
146 typedef int yytabelem;
147 #ifndef YYMAXDEPTH
148 #define YYMAXDEPTH 150
149 #endif
150 #if YYMAXDEPTH > 0
151 int yy_yys[YYMAXDEPTH], *yys = yy_yys;
152 YYSTYPE yy_yyv[YYMAXDEPTH], *yyv = yy_yyv;
153 #else	/* user does initial allocation */
154 int *yys;
155 YYSTYPE *yyv;
156 #endif
157 static int yymaxdepth = YYMAXDEPTH;
158 # define YYERRCODE 256
159 
160 # line 399 "../ippool_y.y"
161 
162 static	wordtab_t	yywords[] = {
163 	{ "auth",	IPT_AUTH },
164 	{ "count",	IPT_COUNT },
165 	{ "group",	IPT_GROUP },
166 	{ "group-map",	IPT_GROUPMAP },
167 	{ "hash",	IPT_HASH },
168 	{ "in",		IPT_IN },
169 	{ "ipf",	IPT_IPF },
170 	{ "name",	IPT_NAME },
171 	{ "nat",	IPT_NAT },
172 	{ "number",	IPT_NUM },
173 	{ "out",	IPT_OUT },
174 	{ "role",	IPT_ROLE },
175 	{ "seed",	IPT_SEED },
176 	{ "size",	IPT_SIZE },
177 	{ "table",	IPT_TABLE },
178 	{ "tree",	IPT_TREE },
179 	{ "type",	IPT_TYPE },
180 	{ NULL,		0 }
181 };
182 
183 
184 int ippool_parsefile(fd, filename, iocfunc)
185 int fd;
186 char *filename;
187 ioctlfunc_t iocfunc;
188 {
189 	FILE *fp = NULL;
190 	char *s;
191 
192 	yylineNum = 1;
193 	(void) yysettab(yywords);
194 
195 	s = getenv("YYDEBUG");
196 	if (s)
197 		yydebug = atoi(s);
198 	else
199 		yydebug = 0;
200 
201 	if (strcmp(filename, "-")) {
202 		fp = fopen(filename, "r");
203 		if (!fp) {
204 			fprintf(stderr, "fopen(%s) failed: %s\n", filename,
205 				STRERROR(errno));
206 			return -1;
207 		}
208 	} else
209 		fp = stdin;
210 
211 	while (ippool_parsesome(fd, fp, iocfunc) == 1)
212 		;
213 	if (fp != NULL)
214 		fclose(fp);
215 	return 0;
216 }
217 
218 
219 int ippool_parsesome(fd, fp, iocfunc)
220 int fd;
221 FILE *fp;
222 ioctlfunc_t iocfunc;
223 {
224 	char *s;
225 	int i;
226 
227 	poolioctl = iocfunc;
228 
229 	if (feof(fp))
230 		return 0;
231 	i = fgetc(fp);
232 	if (i == EOF)
233 		return 0;
234 	if (ungetc(i, fp) == EOF)
235 		return 0;
236 	if (feof(fp))
237 		return 0;
238 	s = getenv("YYDEBUG");
239 	if (s)
240 		yydebug = atoi(s);
241 	else
242 		yydebug = 0;
243 
244 	yyin = fp;
245 	yyparse();
246 	return 1;
247 }
248 static YYCONST yytabelem yyexca[] ={
249 -1, 1,
250 	0, -1,
251 	-2, 0,
252 	};
253 # define YYNPROD 67
254 # define YYLAST 256
255 static YYCONST yytabelem yyact[]={
256 
257     25,    26,    39,    42,    43,    42,    43,    43,    39,    48,
258     22,    13,    47,     7,     6,    32,    33,    35,    34,    93,
259     18,    19,   109,    78,    58,    68,    63,    70,    27,   121,
260      8,     9,    72,   118,    71,   104,   102,    69,    74,    73,
261     57,    82,    80,    52,   108,    90,    89,    83,    77,    79,
262     67,    62,    81,    56,    51,    38,    55,    53,    45,    44,
263     31,    23,    16,    84,    98,    29,    46,    41,    87,   120,
264    114,    24,    88,    86,    28,   100,    12,    40,    85,    85,
265     15,     3,    14,    11,     2,     5,    10,     1,   101,    66,
266    110,    21,    36,    50,    65,    91,    30,    20,    17,     4,
267     37,    64,     0,     0,     0,    61,     0,     0,    54,     0,
268      0,    49,     0,     0,    75,     0,    76,     0,    92,    59,
269     60,     0,     0,     0,     0,     0,    65,    96,    97,     0,
270     95,    94,     0,    64,     0,    99,   107,   111,   103,   106,
271      0,     0,   105,     0,     0,   112,   113,     0,     0,    92,
272      0,     0,     0,   115,     0,     0,     0,     0,   117,     0,
273    111,   116,   119,     0,     0,     0,     0,     0,     0,     0,
274      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
275      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
276      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
277      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
278      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
279     68,    68,    70,    70,    68,     0,    70,     0,     0,     0,
280      0,     0,    69,    69,     0,     0,    69,     0,     0,     0,
281      0,     0,     0,    68,     0,    70,     0,     0,     0,     0,
282      0,     0,     0,     0,     0,    69 };
283 static YYCONST yytabelem yypact[]={
284 
285   -246,  -246,-10000000,-10000000,  -268,  -268,-10000000,     1,-10000000,  -254,
286 -10000000,-10000000,  -270,     0,  -285,  -231,-10000000,-10000000,-10000000,-10000000,
287      6,     6,    -1,  -255,  -280,    -2,    -3,     7,-10000000,-10000000,
288 -10000000,  -269,-10000000,-10000000,-10000000,-10000000,     6,  -278,   -80,    -4,
289   -277,-10000000,    -5,    -8,  -217,  -235,-10000000,  -285,  -285,-10000000,
290    -80,   -33,-10000000,  -225,-10000000,  -218,  -219,-10000000,-10000000,   -80,
291   -278,   -36,   -84,-10000000,    19,    29,    21,-10000000,    26,-10000000,
292 -10000000,-10000000,-10000000,-10000000,-10000000,   -14,   -80,   -84,-10000000,    19,
293     20,-10000000,-10000000,   -33,-10000000,-10000000,  -274,  -221,  -222,   -84,
294 -10000000,    19,-10000000,  -232,   -37,-10000000,   -36,   -36,  -274,-10000000,
295 -10000000,-10000000,    26,-10000000,    24,-10000000,   -14,-10000000,   -84,-10000000,
296     19,-10000000,-10000000,-10000000,  -224,-10000000,-10000000,   -37,    23,-10000000,
297   -228,-10000000 };
298 static YYCONST yytabelem yypgo[]={
299 
300      0,    76,    99,    98,    97,    95,    46,    42,    92,    91,
301     44,    90,    49,    51,    48,    89,    88,    50,    71,    75,
302     87,    84,    81,    74,    85,    80,    54,    52,    55,    77,
303     67,    47 };
304 static YYCONST yytabelem yyr1[]={
305 
306      0,    20,    20,    20,    20,    21,    21,    21,    21,    23,
307     22,    25,     2,    24,     3,     3,     1,     1,     1,     1,
308      4,     9,     8,     8,    18,    18,    18,    19,    19,    28,
309     28,    28,    28,     6,     6,     6,     6,    14,    14,    14,
310     14,    14,    13,    13,    13,    12,     5,     5,    10,    10,
311     10,    11,     7,     7,    15,    15,    15,    15,    16,    16,
312     26,    27,    31,    31,    29,    30,    17 };
313 static YYCONST yytabelem yyr2[]={
314 
315      0,     2,     2,     4,     4,     9,     9,    11,     2,     2,
316      9,     3,     3,     5,     3,     3,     7,     7,     7,     7,
317     15,    17,    11,     9,     7,     7,     1,     7,     7,     0,
318      2,     2,     4,     3,     7,     5,     2,     3,     7,     7,
319      5,     5,     3,     5,     7,     7,     3,     5,     3,     5,
320      7,     3,     7,     3,     3,     3,     3,     3,     3,     3,
321      3,     3,     3,     3,     7,     7,    15 };
322 static YYCONST yytabelem yychk[]={
323 
324 -10000000,   -20,   -21,   -22,    -2,   -24,   260,   259,   276,   277,
325    -21,   -22,    -1,   279,    -1,   -25,    61,    -3,   274,   275,
326     -4,    -9,   280,    61,   -18,   285,   286,   259,   -23,    59,
327    -23,    61,   270,   271,   273,   272,    -8,   -19,   -28,   282,
328    -29,   -30,   283,   284,    61,    61,    59,   281,   278,   -23,
329    -28,   -26,   123,    61,   -30,    61,    61,   257,   259,   -18,
330    -18,   -26,   -13,    59,   -12,    -7,   -15,   -17,   257,   269,
331    259,   259,   257,   257,   257,   -26,   -28,   -14,    59,   -12,
332     -7,   -27,   125,   -31,    44,    59,    44,    47,    46,    -6,
333     59,    -5,    -7,    33,   -26,   -27,   -31,   -31,    44,   -13,
334    -19,   -16,   257,   -17,   257,   -27,   -31,    -7,   -10,    59,
335    -11,    -7,   -14,   -14,    46,    -6,   -27,   -31,   257,   -10,
336     46,   257 };
337 static YYCONST yytabelem yydef[]={
338 
339      0,    -2,     1,     2,     0,     0,     8,     0,    12,     0,
340      3,     4,     0,     0,    26,     0,    11,    13,    14,    15,
341      0,     0,     0,     0,    29,     0,     0,     0,     5,     9,
342      6,     0,    16,    17,    18,    19,     0,    29,     0,     0,
343     30,    31,     0,     0,     0,     0,    10,    26,    26,     7,
344      0,     0,    60,     0,    32,     0,     0,    24,    25,     0,
345     29,     0,     0,    42,     0,     0,    53,    54,    55,    56,
346     57,    27,    28,    64,    65,     0,     0,     0,    37,     0,
347      0,    23,    61,    43,    62,    63,     0,     0,     0,     0,
348     33,    36,    46,     0,     0,    22,    40,    41,    62,    44,
349     45,    52,    58,    59,     0,    20,    35,    47,     0,    48,
350      0,    51,    38,    39,     0,    34,    21,    49,     0,    50,
351      0,    66 };
352 typedef struct
353 #ifdef __cplusplus
354 	yytoktype
355 #endif
356 {
357 #ifdef __cplusplus
358 const
359 #endif
360 char *t_name; int t_val; } yytoktype;
361 #ifndef YYDEBUG
362 #	define YYDEBUG	0	/* don't allow debugging */
363 #endif
364 
365 #if YYDEBUG
366 
367 yytoktype yytoks[] =
368 {
369 	"YY_NUMBER",	257,
370 	"YY_HEX",	258,
371 	"YY_STR",	259,
372 	"YY_COMMENT",	260,
373 	"YY_CMP_EQ",	261,
374 	"YY_CMP_NE",	262,
375 	"YY_CMP_LE",	263,
376 	"YY_CMP_GE",	264,
377 	"YY_CMP_LT",	265,
378 	"YY_CMP_GT",	266,
379 	"YY_RANGE_OUT",	267,
380 	"YY_RANGE_IN",	268,
381 	"YY_IPV6",	269,
382 	"IPT_IPF",	270,
383 	"IPT_NAT",	271,
384 	"IPT_COUNT",	272,
385 	"IPT_AUTH",	273,
386 	"IPT_IN",	274,
387 	"IPT_OUT",	275,
388 	"IPT_TABLE",	276,
389 	"IPT_GROUPMAP",	277,
390 	"IPT_HASH",	278,
391 	"IPT_ROLE",	279,
392 	"IPT_TYPE",	280,
393 	"IPT_TREE",	281,
394 	"IPT_GROUP",	282,
395 	"IPT_SIZE",	283,
396 	"IPT_SEED",	284,
397 	"IPT_NUM",	285,
398 	"IPT_NAME",	286,
399 	"-unknown-",	-1	/* ends search */
400 };
401 
402 #ifdef __cplusplus
403 const
404 #endif
405 char * yyreds[] =
406 {
407 	"-no such reduction-",
408 	"file : line",
409 	"file : assign",
410 	"file : file line",
411 	"file : file assign",
412 	"line : table role ipftree eol",
413 	"line : table role ipfhash eol",
414 	"line : groupmap role number ipfgroup eol",
415 	"line : YY_COMMENT",
416 	"eol : ';'",
417 	"assign : YY_STR assigning YY_STR ';'",
418 	"assigning : '='",
419 	"table : IPT_TABLE",
420 	"groupmap : IPT_GROUPMAP inout",
421 	"inout : IPT_IN",
422 	"inout : IPT_OUT",
423 	"role : IPT_ROLE '=' IPT_IPF",
424 	"role : IPT_ROLE '=' IPT_NAT",
425 	"role : IPT_ROLE '=' IPT_AUTH",
426 	"role : IPT_ROLE '=' IPT_COUNT",
427 	"ipftree : IPT_TYPE '=' IPT_TREE number start addrlist end",
428 	"ipfhash : IPT_TYPE '=' IPT_HASH number hashopts start hashlist end",
429 	"ipfgroup : setgroup hashopts start grouplist end",
430 	"ipfgroup : hashopts start setgrouplist end",
431 	"number : IPT_NUM '=' YY_NUMBER",
432 	"number : IPT_NAME '=' YY_STR",
433 	"number : /* empty */",
434 	"setgroup : IPT_GROUP '=' YY_STR",
435 	"setgroup : IPT_GROUP '=' YY_NUMBER",
436 	"hashopts : /* empty */",
437 	"hashopts : size",
438 	"hashopts : seed",
439 	"hashopts : size seed",
440 	"addrlist : ';'",
441 	"addrlist : range next addrlist",
442 	"addrlist : range next",
443 	"addrlist : range",
444 	"grouplist : ';'",
445 	"grouplist : groupentry next grouplist",
446 	"grouplist : addrmask next grouplist",
447 	"grouplist : groupentry next",
448 	"grouplist : addrmask next",
449 	"setgrouplist : ';'",
450 	"setgrouplist : groupentry next",
451 	"setgrouplist : groupentry next setgrouplist",
452 	"groupentry : addrmask ',' setgroup",
453 	"range : addrmask",
454 	"range : '!' addrmask",
455 	"hashlist : ';'",
456 	"hashlist : hashentry next",
457 	"hashlist : hashentry next hashlist",
458 	"hashentry : addrmask",
459 	"addrmask : ipaddr '/' mask",
460 	"addrmask : ipaddr",
461 	"ipaddr : ipv4",
462 	"ipaddr : YY_NUMBER",
463 	"ipaddr : YY_IPV6",
464 	"ipaddr : YY_STR",
465 	"mask : YY_NUMBER",
466 	"mask : ipv4",
467 	"start : '{'",
468 	"end : '}'",
469 	"next : ','",
470 	"next : ';'",
471 	"size : IPT_SIZE '=' YY_NUMBER",
472 	"seed : IPT_SEED '=' YY_NUMBER",
473 	"ipv4 : YY_NUMBER '.' YY_NUMBER '.' YY_NUMBER '.' YY_NUMBER",
474 };
475 #endif /* YYDEBUG */
476 # line	1 "/usr/share/lib/ccs/yaccpar"
477 /*
478  * CDDL HEADER START
479  *
480  * The contents of this file are subject to the terms of the
481  * Common Development and Distribution License, Version 1.0 only
482  * (the "License").  You may not use this file except in compliance
483  * with the License.
484  *
485  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
486  * or http://www.opensolaris.org/os/licensing.
487  * See the License for the specific language governing permissions
488  * and limitations under the License.
489  *
490  * When distributing Covered Code, include this CDDL HEADER in each
491  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
492  * If applicable, add the following below this CDDL HEADER, with the
493  * fields enclosed by brackets "[]" replaced with your own identifying
494  * information: Portions Copyright [yyyy] [name of copyright owner]
495  *
496  * CDDL HEADER END
497  */
498 /*
499  * Copyright 1993 Sun Microsystems, Inc.  All rights reserved.
500  * Use is subject to license terms.
501  */
502 
503 /* Copyright (c) 1988 AT&T */
504 /* All Rights Reserved */
505 
506 #pragma ident	"%Z%%M%	%I%	%E% SMI"
507 
508 /*
509 ** Skeleton parser driver for yacc output
510 */
511 
512 /*
513 ** yacc user known macros and defines
514 */
515 #define YYERROR		goto yyerrlab
516 #define YYACCEPT	return(0)
517 #define YYABORT		return(1)
518 #define YYBACKUP( newtoken, newvalue )\
519 {\
520 	if ( yychar >= 0 || ( yyr2[ yytmp ] >> 1 ) != 1 )\
521 	{\
522 		yyerror( "syntax error - cannot backup" );\
523 		goto yyerrlab;\
524 	}\
525 	yychar = newtoken;\
526 	yystate = *yyps;\
527 	yylval = newvalue;\
528 	goto yynewstate;\
529 }
530 #define YYRECOVERING()	(!!yyerrflag)
531 #define YYNEW(type)	malloc(sizeof(type) * yynewmax)
532 #define YYCOPY(to, from, type) \
533 	(type *) memcpy(to, (char *) from, yymaxdepth * sizeof (type))
534 #define YYENLARGE( from, type) \
535 	(type *) realloc((char *) from, yynewmax * sizeof(type))
536 #ifndef YYDEBUG
537 #	define YYDEBUG	1	/* make debugging available */
538 #endif
539 
540 /*
541 ** user known globals
542 */
543 int yydebug;			/* set to 1 to get debugging */
544 
545 /*
546 ** driver internal defines
547 */
548 #define YYFLAG		(-10000000)
549 
550 /*
551 ** global variables used by the parser
552 */
553 YYSTYPE *yypv;			/* top of value stack */
554 int *yyps;			/* top of state stack */
555 
556 int yystate;			/* current state */
557 int yytmp;			/* extra var (lasts between blocks) */
558 
559 int yynerrs;			/* number of errors */
560 int yyerrflag;			/* error recovery flag */
561 int yychar;			/* current input token number */
562 
563 
564 
565 #ifdef YYNMBCHARS
566 #define YYLEX()		yycvtok(yylex())
567 /*
568 ** yycvtok - return a token if i is a wchar_t value that exceeds 255.
569 **	If i<255, i itself is the token.  If i>255 but the neither
570 **	of the 30th or 31st bit is on, i is already a token.
571 */
572 #if defined(__STDC__) || defined(__cplusplus)
573 int yycvtok(int i)
574 #else
575 int yycvtok(i) int i;
576 #endif
577 {
578 	int first = 0;
579 	int last = YYNMBCHARS - 1;
580 	int mid;
581 	wchar_t j;
582 
583 	if(i&0x60000000){/*Must convert to a token. */
584 		if( yymbchars[last].character < i ){
585 			return i;/*Giving up*/
586 		}
587 		while ((last>=first)&&(first>=0)) {/*Binary search loop*/
588 			mid = (first+last)/2;
589 			j = yymbchars[mid].character;
590 			if( j==i ){/*Found*/
591 				return yymbchars[mid].tvalue;
592 			}else if( j<i ){
593 				first = mid + 1;
594 			}else{
595 				last = mid -1;
596 			}
597 		}
598 		/*No entry in the table.*/
599 		return i;/* Giving up.*/
600 	}else{/* i is already a token. */
601 		return i;
602 	}
603 }
604 #else/*!YYNMBCHARS*/
605 #define YYLEX()		yylex()
606 #endif/*!YYNMBCHARS*/
607 
608 /*
609 ** yyparse - return 0 if worked, 1 if syntax error not recovered from
610 */
611 #if defined(__STDC__) || defined(__cplusplus)
612 int yyparse(void)
613 #else
614 int yyparse()
615 #endif
616 {
617 	register YYSTYPE *yypvt = 0;	/* top of value stack for $vars */
618 
619 #if defined(__cplusplus) || defined(lint)
620 /*
621 	hacks to please C++ and lint - goto's inside
622 	switch should never be executed
623 */
624 	static int __yaccpar_lint_hack__ = 0;
625 	switch (__yaccpar_lint_hack__)
626 	{
627 		case 1: goto yyerrlab;
628 		case 2: goto yynewstate;
629 	}
630 #endif
631 
632 	/*
633 	** Initialize externals - yyparse may be called more than once
634 	*/
635 	yypv = &yyv[-1];
636 	yyps = &yys[-1];
637 	yystate = 0;
638 	yytmp = 0;
639 	yynerrs = 0;
640 	yyerrflag = 0;
641 	yychar = -1;
642 
643 #if YYMAXDEPTH <= 0
644 	if (yymaxdepth <= 0)
645 	{
646 		if ((yymaxdepth = YYEXPAND(0)) <= 0)
647 		{
648 			yyerror("yacc initialization error");
649 			YYABORT;
650 		}
651 	}
652 #endif
653 
654 	{
655 		register YYSTYPE *yy_pv;	/* top of value stack */
656 		register int *yy_ps;		/* top of state stack */
657 		register int yy_state;		/* current state */
658 		register int  yy_n;		/* internal state number info */
659 	goto yystack;	/* moved from 6 lines above to here to please C++ */
660 
661 		/*
662 		** get globals into registers.
663 		** branch to here only if YYBACKUP was called.
664 		*/
665 	yynewstate:
666 		yy_pv = yypv;
667 		yy_ps = yyps;
668 		yy_state = yystate;
669 		goto yy_newstate;
670 
671 		/*
672 		** get globals into registers.
673 		** either we just started, or we just finished a reduction
674 		*/
675 	yystack:
676 		yy_pv = yypv;
677 		yy_ps = yyps;
678 		yy_state = yystate;
679 
680 		/*
681 		** top of for (;;) loop while no reductions done
682 		*/
683 	yy_stack:
684 		/*
685 		** put a state and value onto the stacks
686 		*/
687 #if YYDEBUG
688 		/*
689 		** if debugging, look up token value in list of value vs.
690 		** name pairs.  0 and negative (-1) are special values.
691 		** Note: linear search is used since time is not a real
692 		** consideration while debugging.
693 		*/
694 		if ( yydebug )
695 		{
696 			register int yy_i;
697 
698 			printf( "State %d, token ", yy_state );
699 			if ( yychar == 0 )
700 				printf( "end-of-file\n" );
701 			else if ( yychar < 0 )
702 				printf( "-none-\n" );
703 			else
704 			{
705 				for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
706 					yy_i++ )
707 				{
708 					if ( yytoks[yy_i].t_val == yychar )
709 						break;
710 				}
711 				printf( "%s\n", yytoks[yy_i].t_name );
712 			}
713 		}
714 #endif /* YYDEBUG */
715 		if ( ++yy_ps >= &yys[ yymaxdepth ] )	/* room on stack? */
716 		{
717 			/*
718 			** reallocate and recover.  Note that pointers
719 			** have to be reset, or bad things will happen
720 			*/
721 			long yyps_index = (yy_ps - yys);
722 			long yypv_index = (yy_pv - yyv);
723 			long yypvt_index = (yypvt - yyv);
724 			int yynewmax;
725 #ifdef YYEXPAND
726 			yynewmax = YYEXPAND(yymaxdepth);
727 #else
728 			yynewmax = 2 * yymaxdepth;	/* double table size */
729 			if (yymaxdepth == YYMAXDEPTH)	/* first time growth */
730 			{
731 				char *newyys = (char *)YYNEW(int);
732 				char *newyyv = (char *)YYNEW(YYSTYPE);
733 				if (newyys != 0 && newyyv != 0)
734 				{
735 					yys = YYCOPY(newyys, yys, int);
736 					yyv = YYCOPY(newyyv, yyv, YYSTYPE);
737 				}
738 				else
739 					yynewmax = 0;	/* failed */
740 			}
741 			else				/* not first time */
742 			{
743 				yys = YYENLARGE(yys, int);
744 				yyv = YYENLARGE(yyv, YYSTYPE);
745 				if (yys == 0 || yyv == 0)
746 					yynewmax = 0;	/* failed */
747 			}
748 #endif
749 			if (yynewmax <= yymaxdepth)	/* tables not expanded */
750 			{
751 				yyerror( "yacc stack overflow" );
752 				YYABORT;
753 			}
754 			yymaxdepth = yynewmax;
755 
756 			yy_ps = yys + yyps_index;
757 			yy_pv = yyv + yypv_index;
758 			yypvt = yyv + yypvt_index;
759 		}
760 		*yy_ps = yy_state;
761 		*++yy_pv = yyval;
762 
763 		/*
764 		** we have a new state - find out what to do
765 		*/
766 	yy_newstate:
767 		if ( ( yy_n = yypact[ yy_state ] ) <= YYFLAG )
768 			goto yydefault;		/* simple state */
769 #if YYDEBUG
770 		/*
771 		** if debugging, need to mark whether new token grabbed
772 		*/
773 		yytmp = yychar < 0;
774 #endif
775 		if ( ( yychar < 0 ) && ( ( yychar = YYLEX() ) < 0 ) )
776 			yychar = 0;		/* reached EOF */
777 #if YYDEBUG
778 		if ( yydebug && yytmp )
779 		{
780 			register int yy_i;
781 
782 			printf( "Received token " );
783 			if ( yychar == 0 )
784 				printf( "end-of-file\n" );
785 			else if ( yychar < 0 )
786 				printf( "-none-\n" );
787 			else
788 			{
789 				for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
790 					yy_i++ )
791 				{
792 					if ( yytoks[yy_i].t_val == yychar )
793 						break;
794 				}
795 				printf( "%s\n", yytoks[yy_i].t_name );
796 			}
797 		}
798 #endif /* YYDEBUG */
799 		if ( ( ( yy_n += yychar ) < 0 ) || ( yy_n >= YYLAST ) )
800 			goto yydefault;
801 		if ( yychk[ yy_n = yyact[ yy_n ] ] == yychar )	/*valid shift*/
802 		{
803 			yychar = -1;
804 			yyval = yylval;
805 			yy_state = yy_n;
806 			if ( yyerrflag > 0 )
807 				yyerrflag--;
808 			goto yy_stack;
809 		}
810 
811 	yydefault:
812 		if ( ( yy_n = yydef[ yy_state ] ) == -2 )
813 		{
814 #if YYDEBUG
815 			yytmp = yychar < 0;
816 #endif
817 			if ( ( yychar < 0 ) && ( ( yychar = YYLEX() ) < 0 ) )
818 				yychar = 0;		/* reached EOF */
819 #if YYDEBUG
820 			if ( yydebug && yytmp )
821 			{
822 				register int yy_i;
823 
824 				printf( "Received token " );
825 				if ( yychar == 0 )
826 					printf( "end-of-file\n" );
827 				else if ( yychar < 0 )
828 					printf( "-none-\n" );
829 				else
830 				{
831 					for ( yy_i = 0;
832 						yytoks[yy_i].t_val >= 0;
833 						yy_i++ )
834 					{
835 						if ( yytoks[yy_i].t_val
836 							== yychar )
837 						{
838 							break;
839 						}
840 					}
841 					printf( "%s\n", yytoks[yy_i].t_name );
842 				}
843 			}
844 #endif /* YYDEBUG */
845 			/*
846 			** look through exception table
847 			*/
848 			{
849 				register YYCONST int *yyxi = yyexca;
850 
851 				while ( ( *yyxi != -1 ) ||
852 					( yyxi[1] != yy_state ) )
853 				{
854 					yyxi += 2;
855 				}
856 				while ( ( *(yyxi += 2) >= 0 ) &&
857 					( *yyxi != yychar ) )
858 					;
859 				if ( ( yy_n = yyxi[1] ) < 0 )
860 					YYACCEPT;
861 			}
862 		}
863 
864 		/*
865 		** check for syntax error
866 		*/
867 		if ( yy_n == 0 )	/* have an error */
868 		{
869 			/* no worry about speed here! */
870 			switch ( yyerrflag )
871 			{
872 			case 0:		/* new error */
873 				yyerror( "syntax error" );
874 				goto skip_init;
875 			yyerrlab:
876 				/*
877 				** get globals into registers.
878 				** we have a user generated syntax type error
879 				*/
880 				yy_pv = yypv;
881 				yy_ps = yyps;
882 				yy_state = yystate;
883 			skip_init:
884 				yynerrs++;
885 				/* FALLTHRU */
886 			case 1:
887 			case 2:		/* incompletely recovered error */
888 					/* try again... */
889 				yyerrflag = 3;
890 				/*
891 				** find state where "error" is a legal
892 				** shift action
893 				*/
894 				while ( yy_ps >= yys )
895 				{
896 					yy_n = yypact[ *yy_ps ] + YYERRCODE;
897 					if ( yy_n >= 0 && yy_n < YYLAST &&
898 						yychk[yyact[yy_n]] == YYERRCODE)					{
899 						/*
900 						** simulate shift of "error"
901 						*/
902 						yy_state = yyact[ yy_n ];
903 						goto yy_stack;
904 					}
905 					/*
906 					** current state has no shift on
907 					** "error", pop stack
908 					*/
909 #if YYDEBUG
910 #	define _POP_ "Error recovery pops state %d, uncovers state %d\n"
911 					if ( yydebug )
912 						printf( _POP_, *yy_ps,
913 							yy_ps[-1] );
914 #	undef _POP_
915 #endif
916 					yy_ps--;
917 					yy_pv--;
918 				}
919 				/*
920 				** there is no state on stack with "error" as
921 				** a valid shift.  give up.
922 				*/
923 				YYABORT;
924 			case 3:		/* no shift yet; eat a token */
925 #if YYDEBUG
926 				/*
927 				** if debugging, look up token in list of
928 				** pairs.  0 and negative shouldn't occur,
929 				** but since timing doesn't matter when
930 				** debugging, it doesn't hurt to leave the
931 				** tests here.
932 				*/
933 				if ( yydebug )
934 				{
935 					register int yy_i;
936 
937 					printf( "Error recovery discards " );
938 					if ( yychar == 0 )
939 						printf( "token end-of-file\n" );
940 					else if ( yychar < 0 )
941 						printf( "token -none-\n" );
942 					else
943 					{
944 						for ( yy_i = 0;
945 							yytoks[yy_i].t_val >= 0;
946 							yy_i++ )
947 						{
948 							if ( yytoks[yy_i].t_val
949 								== yychar )
950 							{
951 								break;
952 							}
953 						}
954 						printf( "token %s\n",
955 							yytoks[yy_i].t_name );
956 					}
957 				}
958 #endif /* YYDEBUG */
959 				if ( yychar == 0 )	/* reached EOF. quit */
960 					YYABORT;
961 				yychar = -1;
962 				goto yy_newstate;
963 			}
964 		}/* end if ( yy_n == 0 ) */
965 		/*
966 		** reduction by production yy_n
967 		** put stack tops, etc. so things right after switch
968 		*/
969 #if YYDEBUG
970 		/*
971 		** if debugging, print the string that is the user's
972 		** specification of the reduction which is just about
973 		** to be done.
974 		*/
975 		if ( yydebug )
976 			printf( "Reduce by (%d) \"%s\"\n",
977 				yy_n, yyreds[ yy_n ] );
978 #endif
979 		yytmp = yy_n;			/* value to switch over */
980 		yypvt = yy_pv;			/* $vars top of value stack */
981 		/*
982 		** Look in goto table for next state
983 		** Sorry about using yy_state here as temporary
984 		** register variable, but why not, if it works...
985 		** If yyr2[ yy_n ] doesn't have the low order bit
986 		** set, then there is no action to be done for
987 		** this reduction.  So, no saving & unsaving of
988 		** registers done.  The only difference between the
989 		** code just after the if and the body of the if is
990 		** the goto yy_stack in the body.  This way the test
991 		** can be made before the choice of what to do is needed.
992 		*/
993 		{
994 			/* length of production doubled with extra bit */
995 			register int yy_len = yyr2[ yy_n ];
996 
997 			if ( !( yy_len & 01 ) )
998 			{
999 				yy_len >>= 1;
1000 				yyval = ( yy_pv -= yy_len )[1];	/* $$ = $1 */
1001 				yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
1002 					*( yy_ps -= yy_len ) + 1;
1003 				if ( yy_state >= YYLAST ||
1004 					yychk[ yy_state =
1005 					yyact[ yy_state ] ] != -yy_n )
1006 				{
1007 					yy_state = yyact[ yypgo[ yy_n ] ];
1008 				}
1009 				goto yy_stack;
1010 			}
1011 			yy_len >>= 1;
1012 			yyval = ( yy_pv -= yy_len )[1];	/* $$ = $1 */
1013 			yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
1014 				*( yy_ps -= yy_len ) + 1;
1015 			if ( yy_state >= YYLAST ||
1016 				yychk[ yy_state = yyact[ yy_state ] ] != -yy_n )
1017 			{
1018 				yy_state = yyact[ yypgo[ yy_n ] ];
1019 			}
1020 		}
1021 					/* save until reenter driver code */
1022 		yystate = yy_state;
1023 		yyps = yy_ps;
1024 		yypv = yy_pv;
1025 	}
1026 	/*
1027 	** code supplied by user is placed in this switch
1028 	*/
1029 	switch( yytmp )
1030 	{
1031 
1032 case 5:
1033 # line 97 "../ippool_y.y"
1034 { iplo.ipo_unit = yypvt[-2].num;
1035 					  iplo.ipo_list = yypvt[-1].ipp;
1036 					  load_pool(&iplo, poolioctl);
1037 					  resetlexer();
1038 					} break;
1039 case 6:
1040 # line 102 "../ippool_y.y"
1041 { ipht.iph_unit = yypvt[-2].num;
1042 					  ipht.iph_type = IPHASH_LOOKUP;
1043 					  load_hash(&ipht, yypvt[-1].ipe, poolioctl);
1044 					  resetlexer();
1045 					} break;
1046 case 7:
1047 # line 108 "../ippool_y.y"
1048 { ipht.iph_unit = yypvt[-3].num;
1049 					  strncpy(ipht.iph_name, yypvt[-2].str,
1050 						  sizeof(ipht.iph_name));
1051 					  ipht.iph_type = IPHASH_GROUPMAP;
1052 					  load_hash(&ipht, yypvt[-1].ipe, poolioctl);
1053 					  resetlexer();
1054 					} break;
1055 case 10:
1056 # line 121 "../ippool_y.y"
1057 { set_variable(yypvt[-3].str, yypvt[-1].str);
1058 					  resetlexer();
1059 					  free(yypvt[-3].str);
1060 					  free(yypvt[-1].str);
1061 					} break;
1062 case 11:
1063 # line 129 "../ippool_y.y"
1064 { yyvarnext = 1; } break;
1065 case 12:
1066 # line 132 "../ippool_y.y"
1067 { bzero((char *)&ipht, sizeof(ipht));
1068 				  bzero((char *)&iphte, sizeof(iphte));
1069 				  bzero((char *)&iplo, sizeof(iplo));
1070 				  *ipht.iph_name = '\0';
1071 				  iplo.ipo_flags = IPHASH_ANON;
1072 				  iplo.ipo_name[0] = '\0';
1073 				} break;
1074 case 13:
1075 # line 142 "../ippool_y.y"
1076 { bzero((char *)&ipht, sizeof(ipht));
1077 				  bzero((char *)&iphte, sizeof(iphte));
1078 				  *ipht.iph_name = '\0';
1079 				  ipht.iph_unit = IPHASH_GROUPMAP;
1080 				  ipht.iph_flags = yypvt[-0].num;
1081 				} break;
1082 case 14:
1083 # line 150 "../ippool_y.y"
1084 { yyval.num = FR_INQUE; } break;
1085 case 15:
1086 # line 151 "../ippool_y.y"
1087 { yyval.num = FR_OUTQUE; } break;
1088 case 16:
1089 # line 154 "../ippool_y.y"
1090 { yyval.num = IPL_LOGIPF; } break;
1091 case 17:
1092 # line 155 "../ippool_y.y"
1093 { yyval.num = IPL_LOGNAT; } break;
1094 case 18:
1095 # line 156 "../ippool_y.y"
1096 { yyval.num = IPL_LOGAUTH; } break;
1097 case 19:
1098 # line 157 "../ippool_y.y"
1099 { yyval.num = IPL_LOGCOUNT; } break;
1100 case 20:
1101 # line 162 "../ippool_y.y"
1102 { strncpy(iplo.ipo_name, yypvt[-3].str,
1103 						  sizeof(iplo.ipo_name));
1104 					  yyval.ipp = yypvt[-1].ipp;
1105 					} break;
1106 case 21:
1107 # line 170 "../ippool_y.y"
1108 { strncpy(ipht.iph_name, yypvt[-4].str,
1109 						  sizeof(ipht.iph_name));
1110 					  yyval.ipe = yypvt[-1].ipe;
1111 					} break;
1112 case 22:
1113 # line 178 "../ippool_y.y"
1114 { iphtent_t *e;
1115 					  for (e = yypvt[-1].ipe; e != NULL;
1116 					       e = e->ipe_next)
1117 						if (e->ipe_group[0] == '\0')
1118 							strncpy(e->ipe_group,
1119 								yypvt[-4].str,
1120 								FR_GROUPLEN);
1121 					  yyval.ipe = yypvt[-1].ipe;
1122 					} break;
1123 case 23:
1124 # line 187 "../ippool_y.y"
1125 { yyval.ipe = yypvt[-1].ipe; } break;
1126 case 24:
1127 # line 190 "../ippool_y.y"
1128 { snprintf(poolname, FR_GROUPLEN, "%u", yypvt[-0].num);
1129 						  yyval.str = poolname;
1130 						} break;
1131 case 25:
1132 # line 193 "../ippool_y.y"
1133 { yyval.str = yypvt[-0].str; } break;
1134 case 26:
1135 # line 194 "../ippool_y.y"
1136 { yyval.str = ""; } break;
1137 case 27:
1138 # line 198 "../ippool_y.y"
1139 { char tmp[FR_GROUPLEN+1];
1140 					  strncpy(tmp, yypvt[-0].str, FR_GROUPLEN);
1141 					  yyval.str = strdup(tmp);
1142 					} break;
1143 case 28:
1144 # line 202 "../ippool_y.y"
1145 { char tmp[FR_GROUPLEN+1];
1146 					  snprintf(tmp, FR_GROUPLEN, "%u", yypvt[-0].num);
1147 					  yyval.str = strdup(tmp);
1148 					} break;
1149 case 33:
1150 # line 215 "../ippool_y.y"
1151 { yyval.ipp = NULL; } break;
1152 case 34:
1153 # line 216 "../ippool_y.y"
1154 { yypvt[-2].ipp->ipn_next = yypvt[-0].ipp; yyval.ipp = yypvt[-2].ipp; } break;
1155 case 35:
1156 # line 217 "../ippool_y.y"
1157 { yyval.ipp = yypvt[-1].ipp; } break;
1158 case 37:
1159 # line 222 "../ippool_y.y"
1160 { yyval.ipe = NULL; } break;
1161 case 38:
1162 # line 223 "../ippool_y.y"
1163 { yyval.ipe = yypvt[-2].ipe; yypvt[-2].ipe->ipe_next = yypvt[-0].ipe; } break;
1164 case 39:
1165 # line 224 "../ippool_y.y"
1166 { yyval.ipe = calloc(1, sizeof(iphtent_t));
1167 					  if (yyval.ipe == NULL)
1168 						yyerror("sorry, out of memory");
1169 					  if  (set_ipv6_addr)
1170 					  	yyval.ipe->ipe_family = AF_INET6;
1171 					  else
1172 						yyval.ipe->ipe_family = AF_INET;
1173 					  bcopy((char *)&(yypvt[-2].adrmsk[0]),
1174 						(char *)&(yyval.ipe->ipe_addr),
1175 						sizeof(yyval.ipe->ipe_addr));
1176 					  bcopy((char *)&(yypvt[-2].adrmsk[1]),
1177 						(char *)&(yyval.ipe->ipe_mask),
1178 						sizeof(yyval.ipe->ipe_mask));
1179 					  set_ipv6_addr = 0;
1180 					  yyval.ipe->ipe_next = yypvt[-0].ipe;
1181 					} break;
1182 case 40:
1183 # line 240 "../ippool_y.y"
1184 { yyval.ipe = yypvt[-1].ipe; } break;
1185 case 41:
1186 # line 241 "../ippool_y.y"
1187 { yyval.ipe = calloc(1, sizeof(iphtent_t));
1188 					  if (yyval.ipe == NULL)
1189 						yyerror("sorry, out of memory");
1190 					  if  (set_ipv6_addr)
1191 					  	yyval.ipe->ipe_family = AF_INET6;
1192 					  else
1193 						yyval.ipe->ipe_family = AF_INET;
1194 					  bcopy((char *)&(yypvt[-1].adrmsk[0]),
1195 						(char *)&(yyval.ipe->ipe_addr),
1196 						sizeof(yyval.ipe->ipe_addr));
1197 					  bcopy((char *)&(yypvt[-1].adrmsk[1]),
1198 						(char *)&(yyval.ipe->ipe_mask),
1199 						sizeof(yyval.ipe->ipe_mask));
1200 					  set_ipv6_addr = 0;
1201 					} break;
1202 case 42:
1203 # line 259 "../ippool_y.y"
1204 { yyval.ipe = NULL; } break;
1205 case 43:
1206 # line 260 "../ippool_y.y"
1207 { yyval.ipe = yypvt[-1].ipe; } break;
1208 case 44:
1209 # line 261 "../ippool_y.y"
1210 { yypvt[-2].ipe->ipe_next = yypvt[-0].ipe; yyval.ipe = yypvt[-2].ipe; } break;
1211 case 45:
1212 # line 265 "../ippool_y.y"
1213 { yyval.ipe = calloc(1, sizeof(iphtent_t));
1214 					  if (yyval.ipe == NULL)
1215 						yyerror("sorry, out of memory");
1216 					  if  (set_ipv6_addr)
1217 					  	yyval.ipe->ipe_family = AF_INET6;
1218 					  else
1219 						yyval.ipe->ipe_family = AF_INET;
1220 					  bcopy((char *)&(yypvt[-2].adrmsk[0]),
1221 						(char *)&(yyval.ipe->ipe_addr),
1222 						sizeof(yyval.ipe->ipe_addr));
1223 					  bcopy((char *)&(yypvt[-2].adrmsk[1]),
1224 						(char *)&(yyval.ipe->ipe_mask),
1225 						sizeof(yyval.ipe->ipe_mask));
1226 					  set_ipv6_addr = 0;
1227 					  strncpy(yyval.ipe->ipe_group, yypvt[-0].str,
1228 						  FR_GROUPLEN);
1229 					  free(yypvt[-0].str);
1230 					} break;
1231 case 46:
1232 # line 285 "../ippool_y.y"
1233 { yyval.ipp = calloc(1, sizeof(*yyval.ipp));
1234 			  if (yyval.ipp == NULL)
1235 				yyerror("sorry, out of memory");
1236 			  yyval.ipp->ipn_info = 0;
1237 			  yyval.ipp->ipn_addr.adf_len = sizeof(yyval.ipp->ipn_addr);
1238 			  yyval.ipp->ipn_mask.adf_len = sizeof(yyval.ipp->ipn_mask);
1239 			  if (set_ipv6_addr) {
1240 				  yyval.ipp->ipn_addr.adf_family = AF_INET6;
1241 				  yyval.ipp->ipn_addr.adf_addr = yypvt[-0].adrmsk[0];
1242 				  yyval.ipp->ipn_mask.adf_addr = yypvt[-0].adrmsk[1];
1243 
1244 			  } else {
1245 				  yyval.ipp->ipn_addr.adf_family = AF_INET;
1246 				  yyval.ipp->ipn_addr.adf_addr.in4.s_addr = yypvt[-0].adrmsk[0].in4.s_addr;
1247 				  yyval.ipp->ipn_mask.adf_addr.in4.s_addr = yypvt[-0].adrmsk[1].in4.s_addr;
1248 			  }
1249 			  set_ipv6_addr = 0;
1250 			} break;
1251 case 47:
1252 # line 303 "../ippool_y.y"
1253 { yyval.ipp = calloc(1, sizeof(*yyval.ipp));
1254 			  if (yyval.ipp == NULL)
1255 				yyerror("sorry, out of memory");
1256 			  yyval.ipp->ipn_info = 1;
1257 			  yyval.ipp->ipn_addr.adf_len = sizeof(yyval.ipp->ipn_addr);
1258 			  yyval.ipp->ipn_mask.adf_len = sizeof(yyval.ipp->ipn_mask);
1259 			  if (set_ipv6_addr) {
1260 				  yyval.ipp->ipn_addr.adf_family = AF_INET6;
1261 				  yyval.ipp->ipn_addr.adf_addr = yypvt[-0].adrmsk[0];
1262 				  yyval.ipp->ipn_mask.adf_addr = yypvt[-0].adrmsk[1];
1263 			  } else {
1264 				  yyval.ipp->ipn_addr.adf_family = AF_INET;
1265 				  yyval.ipp->ipn_addr.adf_addr.in4.s_addr = yypvt[-0].adrmsk[0].in4.s_addr;
1266 				  yyval.ipp->ipn_mask.adf_addr.in4.s_addr = yypvt[-0].adrmsk[1].in4.s_addr;
1267 			  }
1268 			  set_ipv6_addr = 0;
1269 			} break;
1270 case 48:
1271 # line 322 "../ippool_y.y"
1272 { yyval.ipe = NULL; } break;
1273 case 49:
1274 # line 323 "../ippool_y.y"
1275 { yyval.ipe = yypvt[-1].ipe; } break;
1276 case 50:
1277 # line 324 "../ippool_y.y"
1278 { yypvt[-2].ipe->ipe_next = yypvt[-0].ipe; yyval.ipe = yypvt[-2].ipe; } break;
1279 case 51:
1280 # line 328 "../ippool_y.y"
1281 { yyval.ipe = calloc(1, sizeof(iphtent_t));
1282 					  if (yyval.ipe == NULL)
1283 						yyerror("sorry, out of memory");
1284 					  if  (set_ipv6_addr)
1285 					  	yyval.ipe->ipe_family = AF_INET6;
1286 					  else
1287 						yyval.ipe->ipe_family = AF_INET;
1288 					  bcopy((char *)&(yypvt[-0].adrmsk[0]),
1289 						(char *)&(yyval.ipe->ipe_addr),
1290 						sizeof(yyval.ipe->ipe_addr));
1291 					  bcopy((char *)&(yypvt[-0].adrmsk[1]),
1292 						(char *)&(yyval.ipe->ipe_mask),
1293 						sizeof(yyval.ipe->ipe_mask));
1294 					} break;
1295 case 52:
1296 # line 345 "../ippool_y.y"
1297 { yyval.adrmsk[0] = yypvt[-2].ip6; yyval.adrmsk[1] = yypvt[-0].ip6;
1298 				  yyexpectaddr = 0;
1299 				} break;
1300 case 53:
1301 # line 348 "../ippool_y.y"
1302 { yyval.adrmsk[0] = yypvt[-0].ip6;
1303 				  yyexpectaddr = 0;
1304 				  if (set_ipv6_addr)
1305 				  	fill6bits(128, (u_32_t *)yyval.adrmsk[1].in6.s6_addr);
1306 				  else
1307 				  	yyval.adrmsk[1].in4.s_addr = 0xffffffff;
1308 				} break;
1309 case 54:
1310 # line 357 "../ippool_y.y"
1311 { yyval.ip6 = yypvt[-0].ip6; } break;
1312 case 55:
1313 # line 358 "../ippool_y.y"
1314 { yyval.ip6.in4.s_addr = htonl(yypvt[-0].num); } break;
1315 case 56:
1316 # line 359 "../ippool_y.y"
1317 { set_ipv6_addr = 1;
1318 				  bcopy(&yypvt[-0].ip6, &yyval.ip6, sizeof(yyval.ip6));
1319 				  yyexpectaddr = 0; } break;
1320 case 57:
1321 # line 362 "../ippool_y.y"
1322 { if (gethost(yypvt[-0].str, &yyval.ip6, 0) == -1)
1323 					yyerror("Unknown hostname");
1324 				} break;
1325 case 58:
1326 # line 367 "../ippool_y.y"
1327 { if (set_ipv6_addr)
1328 					ntomask(6, yypvt[-0].num, (u_32_t *)yyval.ip6.in6.s6_addr);
1329 				  else
1330 				  	ntomask(4, yypvt[-0].num, (u_32_t *)&yyval.ip6.in4.s_addr); } break;
1331 case 59:
1332 # line 371 "../ippool_y.y"
1333 { yyval.ip6 = yypvt[-0].ip6; } break;
1334 case 60:
1335 # line 374 "../ippool_y.y"
1336 { yyexpectaddr = 1; } break;
1337 case 61:
1338 # line 377 "../ippool_y.y"
1339 { yyexpectaddr = 0; } break;
1340 case 62:
1341 # line 380 "../ippool_y.y"
1342 { yyexpectaddr = 1; } break;
1343 case 63:
1344 # line 381 "../ippool_y.y"
1345 { yyexpectaddr = 1; } break;
1346 case 64:
1347 # line 384 "../ippool_y.y"
1348 { ipht.iph_size = yypvt[-0].num; } break;
1349 case 65:
1350 # line 387 "../ippool_y.y"
1351 { ipht.iph_seed = yypvt[-0].num; } break;
1352 case 66:
1353 # line 391 "../ippool_y.y"
1354 { if (yypvt[-6].num > 255 || yypvt[-4].num > 255 || yypvt[-2].num > 255 || yypvt[-0].num > 255) {
1355 			yyerror("Invalid octet string for IP address");
1356 			return 0;
1357 		  }
1358 		  yyval.ip6.in4.s_addr = (yypvt[-6].num << 24) | (yypvt[-4].num << 16) | (yypvt[-2].num << 8) | yypvt[-0].num;
1359 		  yyval.ip6.in4.s_addr = htonl(yyval.ip6.in4.s_addr);
1360 		} break;
1361 # line	556 "/usr/share/lib/ccs/yaccpar"
1362 	}
1363 	goto yystack;		/* reset registers in driver code */
1364 }
1365 
1366