From 06b42f5e663591f0081455fbb8e05cfca641577a Mon Sep 17 00:00:00 2001 From: jmc Date: Fri, 16 Dec 2005 16:25:07 +0000 Subject: [PATCH] Redo previous rework to generate yacc/lex output again and remove generated copies from the import as they don't compile clean across all archs. --- .../ipsec-tools/src/libipsec/policy_parse.c | 1545 ---------- .../ipsec-tools/src/libipsec/policy_parse.h | 29 - .../ipsec-tools/src/libipsec/policy_token.c | 1888 ------------ crypto/dist/ipsec-tools/src/setkey/parse.c | 2550 ---------------- crypto/dist/ipsec-tools/src/setkey/parse.h | 64 - crypto/dist/ipsec-tools/src/setkey/token.c | 2677 ----------------- lib/libipsec/Makefile | 12 +- sbin/setkey/Makefile | 12 +- 8 files changed, 10 insertions(+), 8767 deletions(-) delete mode 100644 crypto/dist/ipsec-tools/src/libipsec/policy_parse.c delete mode 100644 crypto/dist/ipsec-tools/src/libipsec/policy_parse.h delete mode 100644 crypto/dist/ipsec-tools/src/libipsec/policy_token.c delete mode 100644 crypto/dist/ipsec-tools/src/setkey/parse.c delete mode 100644 crypto/dist/ipsec-tools/src/setkey/parse.h delete mode 100644 crypto/dist/ipsec-tools/src/setkey/token.c diff --git a/crypto/dist/ipsec-tools/src/libipsec/policy_parse.c b/crypto/dist/ipsec-tools/src/libipsec/policy_parse.c deleted file mode 100644 index bd177a84c8da..000000000000 --- a/crypto/dist/ipsec-tools/src/libipsec/policy_parse.c +++ /dev/null @@ -1,1545 +0,0 @@ -/* $NetBSD: policy_parse.c,v 1.2 2005/11/21 14:20:28 manu Exp $ */ - - -/* A Bison parser, made from policy_parse.y - by GNU Bison version 1.28 */ - -#define YYBISON 1 /* Identify Bison output. */ - -#define yyparse __libipsecparse -#define yylex __libipseclex -#define yyerror __libipsecerror -#define yylval __libipseclval -#define yychar __libipsecchar -#define yydebug __libipsecdebug -#define yynerrs __libipsecnerrs -#define DIR 257 -#define PRIORITY 258 -#define PLUS 259 -#define PRIO_BASE 260 -#define PRIO_OFFSET 261 -#define ACTION 262 -#define PROTOCOL 263 -#define MODE 264 -#define LEVEL 265 -#define LEVEL_SPECIFY 266 -#define IPADDRESS 267 -#define PORT 268 -#define ME 269 -#define ANY 270 -#define SLASH 271 -#define HYPHEN 272 - -#line 63 "policy_parse.y" - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include - -#include -#ifdef HAVE_NETINET6_IPSEC -# include -#else -# include -#endif - -#include -#include -#include -#include - -#include - -#include "config.h" - -#include "ipsec_strerror.h" -#include "libpfkey.h" - -#ifndef INT32_MAX -#define INT32_MAX (0xffffffff) -#endif - -#ifndef INT32_MIN -#define INT32_MIN (-INT32_MAX-1) -#endif - -#define ATOX(c) \ - (isdigit(c) ? (c - '0') : (isupper(c) ? (c - 'A' + 10) : (c - 'a' + 10) )) - -static u_int8_t *pbuf = NULL; /* sadb_x_policy buffer */ -static int tlen = 0; /* total length of pbuf */ -static int offset = 0; /* offset of pbuf */ -static int p_dir, p_type, p_protocol, p_mode, p_level, p_reqid; -static u_int32_t p_priority = 0; -static long p_priority_offset = 0; -static struct sockaddr *p_src = NULL; -static struct sockaddr *p_dst = NULL; - -struct _val; -extern void yyerror __P((char *msg)); -static struct sockaddr *parse_sockaddr __P((struct _val *addrbuf, - struct _val *portbuf)); -static int rule_check __P((void)); -static int init_x_policy __P((void)); -static int set_x_request __P((struct sockaddr *, struct sockaddr *)); -static int set_sockaddr __P((struct sockaddr *)); -static void policy_parse_request_init __P((void)); -static void *policy_parse __P((const char *, int)); - -extern void __policy__strbuffer__init__ __P((const char *)); -extern void __policy__strbuffer__free__ __P((void)); -extern int yyparse __P((void)); -extern int yylex __P((void)); - -extern char *__libipsectext; /*XXX*/ - - -#line 131 "policy_parse.y" -typedef union { - u_int num; - u_int32_t num32; - struct _val { - int len; - char *buf; - } val; -} YYSTYPE; -#include - -#ifndef __cplusplus -#ifndef __STDC__ -#define const -#endif -#endif - - - -#define YYFINAL 60 -#define YYFLAG -32768 -#define YYNTBASE 19 - -#define YYTRANSLATE(x) ((unsigned)(x) <= 272 ? yytranslate[x] : 34) - -static const char yytranslate[] = { 0, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 1, 3, 4, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - 17, 18 -}; - -#if YYDEBUG != 0 -static const short yyprhs[] = { 0, - 0, 1, 6, 7, 14, 15, 23, 24, 31, 32, - 41, 42, 51, 53, 54, 57, 65, 72, 78, 83, - 90, 94, 97, 99, 101, 103, 105, 107, 108, 113, - 114, 121, 125 -}; - -static const short yyrhs[] = { -1, - 3, 8, 20, 26, 0, 0, 3, 4, 7, 8, - 21, 26, 0, 0, 3, 4, 18, 7, 8, 22, - 26, 0, 0, 3, 4, 6, 8, 23, 26, 0, - 0, 3, 4, 6, 5, 7, 8, 24, 26, 0, - 0, 3, 4, 6, 18, 7, 8, 25, 26, 0, - 3, 0, 0, 26, 27, 0, 28, 17, 29, 17, - 31, 17, 30, 0, 28, 17, 29, 17, 31, 17, - 0, 28, 17, 29, 17, 31, 0, 28, 17, 29, - 17, 0, 28, 17, 29, 17, 17, 30, 0, 28, - 17, 29, 0, 28, 17, 0, 28, 0, 9, 0, - 10, 0, 11, 0, 12, 0, 0, 13, 32, 18, - 13, 0, 0, 13, 14, 33, 18, 13, 14, 0, - 15, 18, 16, 0, 16, 18, 15, 0 -}; - -#endif - -#if YYDEBUG != 0 -static const short yyrline[] = { 0, - 152, 167, 167, 203, 203, 225, 225, 236, 236, 258, - 258, 280, 280, 293, 294, 306, 307, 308, 309, 310, - 311, 312, 316, 323, 327, 331, 335, 342, 348, 353, - 359, 364, 370 -}; -#endif - - -#if YYDEBUG != 0 || defined (YYERROR_VERBOSE) - -static const char * const yytname[] = { "$","error","$undefined.","DIR","PRIORITY", -"PLUS","PRIO_BASE","PRIO_OFFSET","ACTION","PROTOCOL","MODE","LEVEL","LEVEL_SPECIFY", -"IPADDRESS","PORT","ME","ANY","SLASH","HYPHEN","policy_spec","@1","@2","@3", -"@4","@5","@6","rules","rule","protocol","mode","level","addresses","@7","@8", NULL -}; -#endif - -static const short yyr1[] = { 0, - 20, 19, 21, 19, 22, 19, 23, 19, 24, 19, - 25, 19, 19, 26, 26, 27, 27, 27, 27, 27, - 27, 27, 27, 28, 29, 30, 30, 32, 31, 33, - 31, 31, 31 -}; - -static const short yyr2[] = { 0, - 0, 4, 0, 6, 0, 7, 0, 6, 0, 8, - 0, 8, 1, 0, 2, 7, 6, 5, 4, 6, - 3, 2, 1, 1, 1, 1, 1, 0, 4, 0, - 6, 3, 3 -}; - -static const short yydefact[] = { 0, - 13, 0, 1, 0, 0, 0, 14, 0, 7, 0, - 3, 0, 2, 0, 14, 0, 14, 5, 24, 15, - 23, 9, 8, 11, 4, 14, 22, 14, 14, 6, - 25, 21, 10, 12, 19, 28, 0, 0, 0, 18, - 30, 0, 0, 0, 26, 27, 20, 17, 0, 0, - 32, 33, 16, 0, 29, 0, 31, 0, 0, 0 -}; - -static const short yydefgoto[] = { 58, - 7, 17, 26, 15, 28, 29, 13, 20, 21, 32, - 47, 40, 42, 49 -}; - -static const short yypact[] = { 6, - -3, 1,-32768, -2, -4, 3,-32768, 8,-32768, 10, --32768, 4, 16, 18,-32768, 19,-32768,-32768,-32768,-32768, - 11,-32768, 16,-32768, 16,-32768, 20,-32768,-32768, 16, --32768, 14, 16, 16, 5, 15, 17, 21, 12, 23, --32768, 24, 22, 26,-32768,-32768,-32768, 12, 25, 31, --32768,-32768,-32768, 32,-32768, 33,-32768, 34, 36,-32768 -}; - -static const short yypgoto[] = {-32768, --32768,-32768,-32768,-32768,-32768,-32768, -15,-32768,-32768,-32768, - -16,-32768,-32768,-32768 -}; - - -#define YYLAST 47 - - -static const short yytable[] = { 23, - 2, 25, 8, 11, 3, 9, 4, 5, 1, 12, - 30, 18, 33, 34, 14, 10, 16, 36, 6, 37, - 38, 39, 45, 46, 19, 22, 24, 27, 41, 31, - 35, 53, 0, 59, 43, 60, 0, 51, 44, 48, - 52, 50, 54, 55, 56, 0, 57 -}; - -static const short yycheck[] = { 15, - 4, 17, 5, 8, 8, 8, 6, 7, 3, 7, - 26, 8, 28, 29, 7, 18, 7, 13, 18, 15, - 16, 17, 11, 12, 9, 8, 8, 17, 14, 10, - 17, 48, -1, 0, 18, 0, -1, 16, 18, 17, - 15, 18, 18, 13, 13, -1, 14 -}; -/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ -#line 3 "/usr/lib/bison.simple" -/* This file comes from bison-1.28. */ - -/* Skeleton output parser for bison, - Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* As a special exception, when this file is copied by Bison into a - Bison output file, you may use that output file without restriction. - This special exception was added by the Free Software Foundation - in version 1.24 of Bison. */ - -/* This is the parser code that is written into each bison parser - when the %semantic_parser declaration is not specified in the grammar. - It was written by Richard Stallman by simplifying the hairy parser - used when %semantic_parser is specified. */ - -#ifndef YYSTACK_USE_ALLOCA -#ifdef alloca -#define YYSTACK_USE_ALLOCA -#else /* alloca not defined */ -#ifdef __GNUC__ -#define YYSTACK_USE_ALLOCA -#define alloca __builtin_alloca -#else /* not GNU C. */ -#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386)) -#define YYSTACK_USE_ALLOCA -#include -#else /* not sparc */ -/* We think this test detects Watcom and Microsoft C. */ -/* This used to test MSDOS, but that is a bad idea - since that symbol is in the user namespace. */ -#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) -#if 0 /* No need for malloc.h, which pollutes the namespace; - instead, just don't use alloca. */ -#include -#endif -#else /* not MSDOS, or __TURBOC__ */ -#if defined(_AIX) -/* I don't know what this was needed for, but it pollutes the namespace. - So I turned it off. rms, 2 May 1997. */ -/* #include */ - #pragma alloca -#define YYSTACK_USE_ALLOCA -#else /* not MSDOS, or __TURBOC__, or _AIX */ -#if 0 -#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up, - and on HPUX 10. Eventually we can turn this on. */ -#define YYSTACK_USE_ALLOCA -#define alloca __builtin_alloca -#endif /* __hpux */ -#endif -#endif /* not _AIX */ -#endif /* not MSDOS, or __TURBOC__ */ -#endif /* not sparc */ -#endif /* not GNU C */ -#endif /* alloca not defined */ -#endif /* YYSTACK_USE_ALLOCA not defined */ - -#ifdef YYSTACK_USE_ALLOCA -#define YYSTACK_ALLOC alloca -#else -#define YYSTACK_ALLOC malloc -#endif - -/* Note: there must be only one dollar sign in this file. - It is replaced by the list of actions, each action - as one case of the switch. */ - -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY -2 -#define YYEOF 0 -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrlab1 -/* Like YYERROR except do call yyerror. - This remains here temporarily to ease the - transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. */ -#define YYFAIL goto yyerrlab -#define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(token, value) \ -do \ - if (yychar == YYEMPTY && yylen == 1) \ - { yychar = (token), yylval = (value); \ - yychar1 = YYTRANSLATE (yychar); \ - YYPOPSTACK; \ - goto yybackup; \ - } \ - else \ - { yyerror ("syntax error: cannot back up"); YYERROR; } \ -while (0) - -#define YYTERROR 1 -#define YYERRCODE 256 - -#ifndef YYPURE -#define YYLEX yylex() -#endif - -#ifdef YYPURE -#ifdef YYLSP_NEEDED -#ifdef YYLEX_PARAM -#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) -#else -#define YYLEX yylex(&yylval, &yylloc) -#endif -#else /* not YYLSP_NEEDED */ -#ifdef YYLEX_PARAM -#define YYLEX yylex(&yylval, YYLEX_PARAM) -#else -#define YYLEX yylex(&yylval) -#endif -#endif /* not YYLSP_NEEDED */ -#endif - -/* If nonreentrant, generate the variables here */ - -#ifndef YYPURE - -int yychar; /* the lookahead symbol */ -YYSTYPE yylval; /* the semantic value of the */ - /* lookahead symbol */ - -#ifdef YYLSP_NEEDED -YYLTYPE yylloc; /* location data for the lookahead */ - /* symbol */ -#endif - -int yynerrs; /* number of parse errors so far */ -#endif /* not YYPURE */ - -#if YYDEBUG != 0 -int yydebug; /* nonzero means print parse trace */ -/* Since this is uninitialized, it does not stop multiple parsers - from coexisting. */ -#endif - -/* YYINITDEPTH indicates the initial size of the parser's stacks */ - -#ifndef YYINITDEPTH -#define YYINITDEPTH 200 -#endif - -/* YYMAXDEPTH is the maximum size the stacks can grow to - (effective only if the built-in stack extension method is used). */ - -#if YYMAXDEPTH == 0 -#undef YYMAXDEPTH -#endif - -#ifndef YYMAXDEPTH -#define YYMAXDEPTH 10000 -#endif - -/* Define __yy_memcpy. Note that the size argument - should be passed with type unsigned int, because that is what the non-GCC - definitions require. With GCC, __builtin_memcpy takes an arg - of type size_t, but it can handle unsigned int. */ - -#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ -#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) -#else /* not GNU C or C++ */ -#ifndef __cplusplus - -/* This is the most reliable way to avoid incompatibilities - in available built-in functions on various systems. */ -static void -__yy_memcpy (to, from, count) - char *to; - char *from; - unsigned int count; -{ - register char *f = from; - register char *t = to; - register int i = count; - - while (i-- > 0) - *t++ = *f++; -} - -#else /* __cplusplus */ - -/* This is the most reliable way to avoid incompatibilities - in available built-in functions on various systems. */ -static void -__yy_memcpy (char *to, char *from, unsigned int count) -{ - register char *t = to; - register char *f = from; - register int i = count; - - while (i-- > 0) - *t++ = *f++; -} - -#endif -#endif - -#line 217 "/usr/lib/bison.simple" - -/* The user can define YYPARSE_PARAM as the name of an argument to be passed - into yyparse. The argument should have type void *. - It should actually point to an object. - Grammar actions can access the variable by casting it - to the proper pointer type. */ - -#ifdef YYPARSE_PARAM -#ifdef __cplusplus -#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM -#define YYPARSE_PARAM_DECL -#else /* not __cplusplus */ -#define YYPARSE_PARAM_ARG YYPARSE_PARAM -#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; -#endif /* not __cplusplus */ -#else /* not YYPARSE_PARAM */ -#define YYPARSE_PARAM_ARG -#define YYPARSE_PARAM_DECL -#endif /* not YYPARSE_PARAM */ - -/* Prevent warning if -Wstrict-prototypes. */ -#ifdef __GNUC__ -#ifdef YYPARSE_PARAM -int yyparse (void *); -#else -int yyparse (void); -#endif -#endif - -int -yyparse(YYPARSE_PARAM_ARG) - YYPARSE_PARAM_DECL -{ - register int yystate; - register int yyn; - register short *yyssp; - register YYSTYPE *yyvsp; - int yyerrstatus; /* number of tokens to shift before error messages enabled */ - int yychar1 = 0; /* lookahead token as an internal (translated) token number */ - - short yyssa[YYINITDEPTH]; /* the state stack */ - YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ - - short *yyss = yyssa; /* refer to the stacks thru separate pointers */ - YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ - -#ifdef YYLSP_NEEDED - YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ - YYLTYPE *yyls = yylsa; - YYLTYPE *yylsp; - -#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) -#else -#define YYPOPSTACK (yyvsp--, yyssp--) -#endif - - int yystacksize = YYINITDEPTH; - int yyfree_stacks = 0; - -#ifdef YYPURE - int yychar; - YYSTYPE yylval; - int yynerrs; -#ifdef YYLSP_NEEDED - YYLTYPE yylloc; -#endif -#endif - - YYSTYPE yyval; /* the variable used to return */ - /* semantic values from the action */ - /* routines */ - - int yylen; - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Starting parse\n"); -#endif - - yystate = 0; - yyerrstatus = 0; - yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ - - /* Initialize stack pointers. - Waste one element of value and location stack - so that they stay on the same level as the state stack. - The wasted elements are never initialized. */ - - yyssp = yyss - 1; - yyvsp = yyvs; -#ifdef YYLSP_NEEDED - yylsp = yyls; -#endif - -/* Push a new state, which is found in yystate . */ -/* In all cases, when you get here, the value and location stacks - have just been pushed. so pushing a state here evens the stacks. */ -yynewstate: - - *++yyssp = yystate; - - if (yyssp >= yyss + yystacksize - 1) - { - /* Give user a chance to reallocate the stack */ - /* Use copies of these so that the &'s don't force the real ones into memory. */ - YYSTYPE *yyvs1 = yyvs; - short *yyss1 = yyss; -#ifdef YYLSP_NEEDED - YYLTYPE *yyls1 = yyls; -#endif - - /* Get the current used size of the three stacks, in elements. */ - int size = yyssp - yyss + 1; - -#ifdef yyoverflow - /* Each stack pointer address is followed by the size of - the data in use in that stack, in bytes. */ -#ifdef YYLSP_NEEDED - /* This used to be a conditional around just the two extra args, - but that might be undefined if yyoverflow is a macro. */ - yyoverflow("parser stack overflow", - &yyss1, size * sizeof (*yyssp), - &yyvs1, size * sizeof (*yyvsp), - &yyls1, size * sizeof (*yylsp), - &yystacksize); -#else - yyoverflow("parser stack overflow", - &yyss1, size * sizeof (*yyssp), - &yyvs1, size * sizeof (*yyvsp), - &yystacksize); -#endif - - yyss = yyss1; yyvs = yyvs1; -#ifdef YYLSP_NEEDED - yyls = yyls1; -#endif -#else /* no yyoverflow */ - /* Extend the stack our own way. */ - if (yystacksize >= YYMAXDEPTH) - { - yyerror("parser stack overflow"); - if (yyfree_stacks) - { - free (yyss); - free (yyvs); -#ifdef YYLSP_NEEDED - free (yyls); -#endif - } - return 2; - } - yystacksize *= 2; - if (yystacksize > YYMAXDEPTH) - yystacksize = YYMAXDEPTH; -#ifndef YYSTACK_USE_ALLOCA - yyfree_stacks = 1; -#endif - yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); - __yy_memcpy ((char *)yyss, (char *)yyss1, - size * (unsigned int) sizeof (*yyssp)); - yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); - __yy_memcpy ((char *)yyvs, (char *)yyvs1, - size * (unsigned int) sizeof (*yyvsp)); -#ifdef YYLSP_NEEDED - yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); - __yy_memcpy ((char *)yyls, (char *)yyls1, - size * (unsigned int) sizeof (*yylsp)); -#endif -#endif /* no yyoverflow */ - - yyssp = yyss + size - 1; - yyvsp = yyvs + size - 1; -#ifdef YYLSP_NEEDED - yylsp = yyls + size - 1; -#endif - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Stack size increased to %d\n", yystacksize); -#endif - - if (yyssp >= yyss + yystacksize - 1) - YYABORT; - } - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Entering state %d\n", yystate); -#endif - - goto yybackup; - yybackup: - -/* Do appropriate processing given the current state. */ -/* Read a lookahead token if we need one and don't already have one. */ -/* yyresume: */ - - /* First try to decide what to do without reference to lookahead token. */ - - yyn = yypact[yystate]; - if (yyn == YYFLAG) - goto yydefault; - - /* Not known => get a lookahead token if don't already have one. */ - - /* yychar is either YYEMPTY or YYEOF - or a valid token in external form. */ - - if (yychar == YYEMPTY) - { -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Reading a token: "); -#endif - yychar = YYLEX; - } - - /* Convert token to internal form (in yychar1) for indexing tables with */ - - if (yychar <= 0) /* This means end of input. */ - { - yychar1 = 0; - yychar = YYEOF; /* Don't call YYLEX any more */ - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Now at end of input.\n"); -#endif - } - else - { - yychar1 = YYTRANSLATE(yychar); - -#if YYDEBUG != 0 - if (yydebug) - { - fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); - /* Give the individual parser a way to print the precise meaning - of a token, for further debugging info. */ -#ifdef YYPRINT - YYPRINT (stderr, yychar, yylval); -#endif - fprintf (stderr, ")\n"); - } -#endif - } - - yyn += yychar1; - if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) - goto yydefault; - - yyn = yytable[yyn]; - - /* yyn is what to do for this token type in this state. - Negative => reduce, -yyn is rule number. - Positive => shift, yyn is new state. - New state is final state => don't bother to shift, - just return success. - 0, or most negative number => error. */ - - if (yyn < 0) - { - if (yyn == YYFLAG) - goto yyerrlab; - yyn = -yyn; - goto yyreduce; - } - else if (yyn == 0) - goto yyerrlab; - - if (yyn == YYFINAL) - YYACCEPT; - - /* Shift the lookahead token. */ - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); -#endif - - /* Discard the token being shifted unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; - - *++yyvsp = yylval; -#ifdef YYLSP_NEEDED - *++yylsp = yylloc; -#endif - - /* count tokens shifted since error; after three, turn off error status. */ - if (yyerrstatus) yyerrstatus--; - - yystate = yyn; - goto yynewstate; - -/* Do the default action for the current state. */ -yydefault: - - yyn = yydefact[yystate]; - if (yyn == 0) - goto yyerrlab; - -/* Do a reduction. yyn is the number of a rule to reduce with. */ -yyreduce: - yylen = yyr2[yyn]; - if (yylen > 0) - yyval = yyvsp[1-yylen]; /* implement default value of the action */ - -#if YYDEBUG != 0 - if (yydebug) - { - int i; - - fprintf (stderr, "Reducing via rule %d (line %d), ", - yyn, yyrline[yyn]); - - /* Print the symbols being reduced, and their result. */ - for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) - fprintf (stderr, "%s ", yytname[yyrhs[i]]); - fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); - } -#endif - - - switch (yyn) { - -case 1: -#line 153 "policy_parse.y" -{ - p_dir = yyvsp[-1].num; - p_type = yyvsp[0].num; - -#ifdef HAVE_PFKEY_POLICY_PRIORITY - p_priority = PRIORITY_DEFAULT; -#else - p_priority = 0; -#endif - - if (init_x_policy()) - return -1; - ; - break;} -case 3: -#line 168 "policy_parse.y" -{ - char *offset_buf; - - p_dir = yyvsp[-3].num; - p_type = yyvsp[0].num; - - /* buffer big enough to hold a prepended negative sign */ - offset_buf = malloc(yyvsp[-1].val.len + 2); - if (offset_buf == NULL) - { - __ipsec_errcode = EIPSEC_NO_BUFS; - return -1; - } - - /* positive input value means higher priority, therefore lower - actual value so that is closer to the beginning of the list */ - sprintf (offset_buf, "-%s", yyvsp[-1].val.buf); - - errno = 0; - p_priority_offset = atol(offset_buf); - - free(offset_buf); - - if (errno != 0 || p_priority_offset < INT32_MIN) - { - __ipsec_errcode = EIPSEC_INVAL_PRIORITY_OFFSET; - return -1; - } - - p_priority = PRIORITY_DEFAULT + (u_int32_t) p_priority_offset; - - if (init_x_policy()) - return -1; - ; - break;} -case 5: -#line 204 "policy_parse.y" -{ - p_dir = yyvsp[-4].num; - p_type = yyvsp[0].num; - - errno = 0; - p_priority_offset = atol(yyvsp[-1].val.buf); - - if (errno != 0 || p_priority_offset > INT32_MAX) - { - __ipsec_errcode = EIPSEC_INVAL_PRIORITY_OFFSET; - return -1; - } - - /* negative input value means lower priority, therefore higher - actual value so that is closer to the end of the list */ - p_priority = PRIORITY_DEFAULT + (u_int32_t) p_priority_offset; - - if (init_x_policy()) - return -1; - ; - break;} -case 7: -#line 226 "policy_parse.y" -{ - p_dir = yyvsp[-3].num; - p_type = yyvsp[0].num; - - p_priority = yyvsp[-1].num32; - - if (init_x_policy()) - return -1; - ; - break;} -case 9: -#line 237 "policy_parse.y" -{ - p_dir = yyvsp[-5].num; - p_type = yyvsp[0].num; - - errno = 0; - p_priority_offset = atol(yyvsp[-1].val.buf); - - if (errno != 0 || p_priority_offset > PRIORITY_OFFSET_NEGATIVE_MAX) - { - __ipsec_errcode = EIPSEC_INVAL_PRIORITY_BASE_OFFSET; - return -1; - } - - /* adding value means higher priority, therefore lower - actual value so that is closer to the beginning of the list */ - p_priority = yyvsp[-3].num32 - (u_int32_t) p_priority_offset; - - if (init_x_policy()) - return -1; - ; - break;} -case 11: -#line 259 "policy_parse.y" -{ - p_dir = yyvsp[-5].num; - p_type = yyvsp[0].num; - - errno = 0; - p_priority_offset = atol(yyvsp[-1].val.buf); - - if (errno != 0 || p_priority_offset > PRIORITY_OFFSET_POSITIVE_MAX) - { - __ipsec_errcode = EIPSEC_INVAL_PRIORITY_BASE_OFFSET; - return -1; - } - - /* subtracting value means lower priority, therefore higher - actual value so that is closer to the end of the list */ - p_priority = yyvsp[-3].num32 + (u_int32_t) p_priority_offset; - - if (init_x_policy()) - return -1; - ; - break;} -case 13: -#line 281 "policy_parse.y" -{ - p_dir = yyvsp[0].num; - p_type = 0; /* ignored it by kernel */ - - p_priority = 0; - - if (init_x_policy()) - return -1; - ; - break;} -case 15: -#line 294 "policy_parse.y" -{ - if (rule_check() < 0) - return -1; - - if (set_x_request(p_src, p_dst) < 0) - return -1; - - policy_parse_request_init(); - ; - break;} -case 22: -#line 312 "policy_parse.y" -{ - __ipsec_errcode = EIPSEC_FEW_ARGUMENTS; - return -1; - ; - break;} -case 23: -#line 316 "policy_parse.y" -{ - __ipsec_errcode = EIPSEC_FEW_ARGUMENTS; - return -1; - ; - break;} -case 24: -#line 323 "policy_parse.y" -{ p_protocol = yyvsp[0].num; ; - break;} -case 25: -#line 327 "policy_parse.y" -{ p_mode = yyvsp[0].num; ; - break;} -case 26: -#line 331 "policy_parse.y" -{ - p_level = yyvsp[0].num; - p_reqid = 0; - ; - break;} -case 27: -#line 335 "policy_parse.y" -{ - p_level = IPSEC_LEVEL_UNIQUE; - p_reqid = atol(yyvsp[0].val.buf); /* atol() is good. */ - ; - break;} -case 28: -#line 342 "policy_parse.y" -{ - p_src = parse_sockaddr(&yyvsp[0].val, NULL); - if (p_src == NULL) - return -1; - ; - break;} -case 29: -#line 348 "policy_parse.y" -{ - p_dst = parse_sockaddr(&yyvsp[0].val, NULL); - if (p_dst == NULL) - return -1; - ; - break;} -case 30: -#line 353 "policy_parse.y" -{ - p_src = parse_sockaddr(&yyvsp[-1].val, &yyvsp[0].val); - if (p_src == NULL) - return -1; - ; - break;} -case 31: -#line 359 "policy_parse.y" -{ - p_dst = parse_sockaddr(&yyvsp[-1].val, &yyvsp[0].val); - if (p_dst == NULL) - return -1; - ; - break;} -case 32: -#line 364 "policy_parse.y" -{ - if (p_dir != IPSEC_DIR_OUTBOUND) { - __ipsec_errcode = EIPSEC_INVAL_DIR; - return -1; - } - ; - break;} -case 33: -#line 370 "policy_parse.y" -{ - if (p_dir != IPSEC_DIR_INBOUND) { - __ipsec_errcode = EIPSEC_INVAL_DIR; - return -1; - } - ; - break;} -} - /* the action file gets copied in in place of this dollarsign */ -#line 543 "/usr/lib/bison.simple" - - yyvsp -= yylen; - yyssp -= yylen; -#ifdef YYLSP_NEEDED - yylsp -= yylen; -#endif - -#if YYDEBUG != 0 - if (yydebug) - { - short *ssp1 = yyss - 1; - fprintf (stderr, "state stack now"); - while (ssp1 != yyssp) - fprintf (stderr, " %d", *++ssp1); - fprintf (stderr, "\n"); - } -#endif - - *++yyvsp = yyval; - -#ifdef YYLSP_NEEDED - yylsp++; - if (yylen == 0) - { - yylsp->first_line = yylloc.first_line; - yylsp->first_column = yylloc.first_column; - yylsp->last_line = (yylsp-1)->last_line; - yylsp->last_column = (yylsp-1)->last_column; - yylsp->text = 0; - } - else - { - yylsp->last_line = (yylsp+yylen-1)->last_line; - yylsp->last_column = (yylsp+yylen-1)->last_column; - } -#endif - - /* Now "shift" the result of the reduction. - Determine what state that goes to, - based on the state we popped back to - and the rule number reduced by. */ - - yyn = yyr1[yyn]; - - yystate = yypgoto[yyn - YYNTBASE] + *yyssp; - if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) - yystate = yytable[yystate]; - else - yystate = yydefgoto[yyn - YYNTBASE]; - - goto yynewstate; - -yyerrlab: /* here on detecting error */ - - if (! yyerrstatus) - /* If not already recovering from an error, report this error. */ - { - ++yynerrs; - -#ifdef YYERROR_VERBOSE - yyn = yypact[yystate]; - - if (yyn > YYFLAG && yyn < YYLAST) - { - int size = 0; - char *msg; - int x, count; - - count = 0; - /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ - for (x = (yyn < 0 ? -yyn : 0); - x < (sizeof(yytname) / sizeof(char *)); x++) - if (yycheck[x + yyn] == x) - size += strlen(yytname[x]) + 15, count++; - msg = (char *) malloc(size + 15); - if (msg != 0) - { - strcpy(msg, "parse error"); - - if (count < 5) - { - count = 0; - for (x = (yyn < 0 ? -yyn : 0); - x < (sizeof(yytname) / sizeof(char *)); x++) - if (yycheck[x + yyn] == x) - { - strcat(msg, count == 0 ? ", expecting `" : " or `"); - strcat(msg, yytname[x]); - strcat(msg, "'"); - count++; - } - } - yyerror(msg); - free(msg); - } - else - yyerror ("parse error; also virtual memory exceeded"); - } - else -#endif /* YYERROR_VERBOSE */ - yyerror("parse error"); - } - - goto yyerrlab1; -yyerrlab1: /* here on error raised explicitly by an action */ - - if (yyerrstatus == 3) - { - /* if just tried and failed to reuse lookahead token after an error, discard it. */ - - /* return failure if at end of input */ - if (yychar == YYEOF) - YYABORT; - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); -#endif - - yychar = YYEMPTY; - } - - /* Else will try to reuse lookahead token - after shifting the error token. */ - - yyerrstatus = 3; /* Each real token shifted decrements this */ - - goto yyerrhandle; - -yyerrdefault: /* current state does not do anything special for the error token. */ - -#if 0 - /* This is wrong; only states that explicitly want error tokens - should shift them. */ - yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ - if (yyn) goto yydefault; -#endif - -yyerrpop: /* pop the current state because it cannot handle the error token */ - - if (yyssp == yyss) YYABORT; - yyvsp--; - yystate = *--yyssp; -#ifdef YYLSP_NEEDED - yylsp--; -#endif - -#if YYDEBUG != 0 - if (yydebug) - { - short *ssp1 = yyss - 1; - fprintf (stderr, "Error: state stack now"); - while (ssp1 != yyssp) - fprintf (stderr, " %d", *++ssp1); - fprintf (stderr, "\n"); - } -#endif - -yyerrhandle: - - yyn = yypact[yystate]; - if (yyn == YYFLAG) - goto yyerrdefault; - - yyn += YYTERROR; - if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) - goto yyerrdefault; - - yyn = yytable[yyn]; - if (yyn < 0) - { - if (yyn == YYFLAG) - goto yyerrpop; - yyn = -yyn; - goto yyreduce; - } - else if (yyn == 0) - goto yyerrpop; - - if (yyn == YYFINAL) - YYACCEPT; - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Shifting error token, "); -#endif - - *++yyvsp = yylval; -#ifdef YYLSP_NEEDED - *++yylsp = yylloc; -#endif - - yystate = yyn; - goto yynewstate; - - yyacceptlab: - /* YYACCEPT comes here. */ - if (yyfree_stacks) - { - free (yyss); - free (yyvs); -#ifdef YYLSP_NEEDED - free (yyls); -#endif - } - return 0; - - yyabortlab: - /* YYABORT comes here. */ - if (yyfree_stacks) - { - free (yyss); - free (yyvs); -#ifdef YYLSP_NEEDED - free (yyls); -#endif - } - return 1; -} -#line 381 "policy_parse.y" - - -void -yyerror(msg) - char *msg; -{ - fprintf(stderr, "libipsec: %s while parsing \"%s\"\n", - msg, __libipsectext); - - return; -} - -static struct sockaddr * -parse_sockaddr(addrbuf, portbuf) - struct _val *addrbuf; - struct _val *portbuf; -{ - struct addrinfo hints, *res; - char *addr; - char *serv = NULL; - int error; - struct sockaddr *newaddr = NULL; - - if ((addr = malloc(addrbuf->len + 1)) == NULL) { - yyerror("malloc failed"); - __ipsec_set_strerror(strerror(errno)); - return NULL; - } - - if (portbuf && ((serv = malloc(portbuf->len + 1)) == NULL)) { - free(addr); - yyerror("malloc failed"); - __ipsec_set_strerror(strerror(errno)); - return NULL; - } - - strncpy(addr, addrbuf->buf, addrbuf->len); - addr[addrbuf->len] = '\0'; - - if (portbuf) { - strncpy(serv, portbuf->buf, portbuf->len); - serv[portbuf->len] = '\0'; - } - - memset(&hints, 0, sizeof(hints)); - hints.ai_family = PF_UNSPEC; - hints.ai_flags = AI_NUMERICHOST; - hints.ai_socktype = SOCK_DGRAM; - error = getaddrinfo(addr, serv, &hints, &res); - free(addr); - if (serv != NULL) - free(serv); - if (error != 0) { - yyerror("invalid IP address"); - __ipsec_set_strerror(gai_strerror(error)); - return NULL; - } - - if (res->ai_addr == NULL) { - yyerror("invalid IP address"); - __ipsec_set_strerror(gai_strerror(error)); - return NULL; - } - - newaddr = malloc(res->ai_addrlen); - if (newaddr == NULL) { - __ipsec_errcode = EIPSEC_NO_BUFS; - freeaddrinfo(res); - return NULL; - } - memcpy(newaddr, res->ai_addr, res->ai_addrlen); - - freeaddrinfo(res); - - __ipsec_errcode = EIPSEC_NO_ERROR; - return newaddr; -} - -static int -rule_check() -{ - if (p_type == IPSEC_POLICY_IPSEC) { - if (p_protocol == IPPROTO_IP) { - __ipsec_errcode = EIPSEC_NO_PROTO; - return -1; - } - - if (p_mode != IPSEC_MODE_TRANSPORT - && p_mode != IPSEC_MODE_TUNNEL) { - __ipsec_errcode = EIPSEC_INVAL_MODE; - return -1; - } - - if (p_src == NULL && p_dst == NULL) { - if (p_mode != IPSEC_MODE_TRANSPORT) { - __ipsec_errcode = EIPSEC_INVAL_ADDRESS; - return -1; - } - } - else if (p_src->sa_family != p_dst->sa_family) { - __ipsec_errcode = EIPSEC_FAMILY_MISMATCH; - return -1; - } - } - - __ipsec_errcode = EIPSEC_NO_ERROR; - return 0; -} - -static int -init_x_policy() -{ - struct sadb_x_policy *p; - - if (pbuf) { - free(pbuf); - tlen = 0; - } - pbuf = malloc(sizeof(struct sadb_x_policy)); - if (pbuf == NULL) { - __ipsec_errcode = EIPSEC_NO_BUFS; - return -1; - } - tlen = sizeof(struct sadb_x_policy); - - memset(pbuf, 0, tlen); - p = (struct sadb_x_policy *)pbuf; - p->sadb_x_policy_len = 0; /* must update later */ - p->sadb_x_policy_exttype = SADB_X_EXT_POLICY; - p->sadb_x_policy_type = p_type; - p->sadb_x_policy_dir = p_dir; - p->sadb_x_policy_id = 0; -#ifdef HAVE_PFKEY_POLICY_PRIORITY - p->sadb_x_policy_priority = p_priority; -#else - /* fail if given a priority and libipsec was not compiled with - priority support */ - if (p_priority != 0) - { - __ipsec_errcode = EIPSEC_PRIORITY_NOT_COMPILED; - return -1; - } -#endif - - offset = tlen; - - __ipsec_errcode = EIPSEC_NO_ERROR; - return 0; -} - -static int -set_x_request(src, dst) - struct sockaddr *src, *dst; -{ - struct sadb_x_ipsecrequest *p; - int reqlen; - u_int8_t *n; - - reqlen = sizeof(*p) - + (src ? sysdep_sa_len(src) : 0) - + (dst ? sysdep_sa_len(dst) : 0); - tlen += reqlen; /* increment to total length */ - - n = realloc(pbuf, tlen); - if (n == NULL) { - __ipsec_errcode = EIPSEC_NO_BUFS; - return -1; - } - pbuf = n; - - p = (struct sadb_x_ipsecrequest *)&pbuf[offset]; - p->sadb_x_ipsecrequest_len = reqlen; - p->sadb_x_ipsecrequest_proto = p_protocol; - p->sadb_x_ipsecrequest_mode = p_mode; - p->sadb_x_ipsecrequest_level = p_level; - p->sadb_x_ipsecrequest_reqid = p_reqid; - offset += sizeof(*p); - - if (set_sockaddr(src) || set_sockaddr(dst)) - return -1; - - __ipsec_errcode = EIPSEC_NO_ERROR; - return 0; -} - -static int -set_sockaddr(addr) - struct sockaddr *addr; -{ - if (addr == NULL) { - __ipsec_errcode = EIPSEC_NO_ERROR; - return 0; - } - - /* tlen has already incremented */ - - memcpy(&pbuf[offset], addr, sysdep_sa_len(addr)); - - offset += sysdep_sa_len(addr); - - __ipsec_errcode = EIPSEC_NO_ERROR; - return 0; -} - -static void -policy_parse_request_init() -{ - p_protocol = IPPROTO_IP; - p_mode = IPSEC_MODE_ANY; - p_level = IPSEC_LEVEL_DEFAULT; - p_reqid = 0; - if (p_src != NULL) { - free(p_src); - p_src = NULL; - } - if (p_dst != NULL) { - free(p_dst); - p_dst = NULL; - } - - return; -} - -static void * -policy_parse(msg, msglen) - const char *msg; - int msglen; -{ - int error; - - pbuf = NULL; - tlen = 0; - - /* initialize */ - p_dir = IPSEC_DIR_INVALID; - p_type = IPSEC_POLICY_DISCARD; - policy_parse_request_init(); - __policy__strbuffer__init__(msg); - - error = yyparse(); /* it must be set errcode. */ - __policy__strbuffer__free__(); - - if (error) { - if (pbuf != NULL) - free(pbuf); - return NULL; - } - - /* update total length */ - ((struct sadb_x_policy *)pbuf)->sadb_x_policy_len = PFKEY_UNIT64(tlen); - - __ipsec_errcode = EIPSEC_NO_ERROR; - - return pbuf; -} - -ipsec_policy_t -ipsec_set_policy(msg, msglen) - __ipsec_const char *msg; - int msglen; -{ - caddr_t policy; - - policy = policy_parse(msg, msglen); - if (policy == NULL) { - if (__ipsec_errcode == EIPSEC_NO_ERROR) - __ipsec_errcode = EIPSEC_INVAL_ARGUMENT; - return NULL; - } - - __ipsec_errcode = EIPSEC_NO_ERROR; - return policy; -} diff --git a/crypto/dist/ipsec-tools/src/libipsec/policy_parse.h b/crypto/dist/ipsec-tools/src/libipsec/policy_parse.h deleted file mode 100644 index 683a83e81393..000000000000 --- a/crypto/dist/ipsec-tools/src/libipsec/policy_parse.h +++ /dev/null @@ -1,29 +0,0 @@ -/* $NetBSD: policy_parse.h,v 1.2 2005/11/21 14:20:28 manu Exp $ */ - -typedef union { - u_int num; - u_int32_t num32; - struct _val { - int len; - char *buf; - } val; -} YYSTYPE; -#define DIR 257 -#define PRIORITY 258 -#define PLUS 259 -#define PRIO_BASE 260 -#define PRIO_OFFSET 261 -#define ACTION 262 -#define PROTOCOL 263 -#define MODE 264 -#define LEVEL 265 -#define LEVEL_SPECIFY 266 -#define IPADDRESS 267 -#define PORT 268 -#define ME 269 -#define ANY 270 -#define SLASH 271 -#define HYPHEN 272 - - -extern YYSTYPE __libipseclval; diff --git a/crypto/dist/ipsec-tools/src/libipsec/policy_token.c b/crypto/dist/ipsec-tools/src/libipsec/policy_token.c deleted file mode 100644 index eb933d4b63a2..000000000000 --- a/crypto/dist/ipsec-tools/src/libipsec/policy_token.c +++ /dev/null @@ -1,1888 +0,0 @@ -/* $NetBSD: policy_token.c,v 1.2 2005/11/21 14:20:28 manu Exp $ */ - -#define yy_create_buffer __libipsec_create_buffer -#define yy_delete_buffer __libipsec_delete_buffer -#define yy_scan_buffer __libipsec_scan_buffer -#define yy_scan_string __libipsec_scan_string -#define yy_scan_bytes __libipsec_scan_bytes -#define yy_flex_debug __libipsec_flex_debug -#define yy_init_buffer __libipsec_init_buffer -#define yy_flush_buffer __libipsec_flush_buffer -#define yy_load_buffer_state __libipsec_load_buffer_state -#define yy_switch_to_buffer __libipsec_switch_to_buffer -#define yyin __libipsecin -#define yyleng __libipsecleng -#define yylex __libipseclex -#define yyout __libipsecout -#define yyrestart __libipsecrestart -#define yytext __libipsectext - -#line 19 "policy_token.c" -/* A lexical scanner generated by flex */ - -/* Scanner skeleton version: - * Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp - */ - -#define FLEX_SCANNER -#define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 - -#include - - -/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ -#ifdef c_plusplus -#ifndef __cplusplus -#define __cplusplus -#endif -#endif - - -#ifdef __cplusplus - -#include -#include - -/* Use prototypes in function declarations. */ -#define YY_USE_PROTOS - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -#if __STDC__ - -#define YY_USE_PROTOS -#define YY_USE_CONST - -#endif /* __STDC__ */ -#endif /* ! __cplusplus */ - -#ifdef __TURBOC__ - #pragma warn -rch - #pragma warn -use -#include -#include -#define YY_USE_CONST -#define YY_USE_PROTOS -#endif - -#ifdef YY_USE_CONST -#define yyconst const -#else -#define yyconst -#endif - - -#ifdef YY_USE_PROTOS -#define YY_PROTO(proto) proto -#else -#define YY_PROTO(proto) () -#endif - -/* Returned upon end-of-file. */ -#define YY_NULL 0 - -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. - */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) - -/* Enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN. - */ -#define BEGIN yy_start = 1 + 2 * - -/* Translate the current start state into a value that can be later handed - * to BEGIN to return to the state. The YYSTATE alias is for lex - * compatibility. - */ -#define YY_START ((yy_start - 1) / 2) -#define YYSTATE YY_START - -/* Action number for EOF rule of a given start state. */ -#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - -/* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart( yyin ) - -#define YY_END_OF_BUFFER_CHAR 0 - -/* Size of default input buffer. */ -#define YY_BUF_SIZE 16384 - -typedef struct yy_buffer_state *YY_BUFFER_STATE; - -extern int yyleng; -extern FILE *yyin, *yyout; - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - -/* The funky do-while in the following #define is used to turn the definition - * int a single C statement (which needs a semi-colon terminator). This - * avoids problems with code like: - * - * if ( condition_holds ) - * yyless( 5 ); - * else - * do_something_else(); - * - * Prior to using the do-while the compiler would get upset at the - * "else" because it interpreted the "if" statement as being all - * done when it reached the ';' after the yyless() call. - */ - -/* Return all but the first 'n' matched characters back to the input stream. */ - -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - *yy_cp = yy_hold_char; \ - YY_RESTORE_YY_MORE_OFFSET \ - yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } \ - while ( 0 ) - -#define unput(c) yyunput( c, yytext_ptr ) - -/* The following is because we cannot portably get our hands on size_t - * (without autoconf's help, which isn't available because we want - * flex-generated scanners to compile on their own). - */ -typedef unsigned int yy_size_t; - - -struct yy_buffer_state - { - FILE *yy_input_file; - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - int yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; - - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; - - int yy_buffer_status; -#define YY_BUFFER_NEW 0 -#define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. - */ -#define YY_BUFFER_EOF_PENDING 2 - }; - -static YY_BUFFER_STATE yy_current_buffer = 0; - -/* We provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state". - */ -#define YY_CURRENT_BUFFER yy_current_buffer - - -/* yy_hold_char holds the character lost when yytext is formed. */ -static char yy_hold_char; - -static int yy_n_chars; /* number of characters read into yy_ch_buf */ - - -int yyleng; - -/* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; -static int yy_init = 1; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ - -/* Flag which is used to allow yywrap()'s to do buffer switches - * instead of setting up a fresh yyin. A bit of a hack ... - */ -static int yy_did_buffer_switch_on_eof; - -void yyrestart YY_PROTO(( FILE *input_file )); - -void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); -void yy_load_buffer_state YY_PROTO(( void )); -YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); -void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); -void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); -void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); -#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) - -YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); -YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); -YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); - -static void *yy_flex_alloc YY_PROTO(( yy_size_t )); -static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); -static void yy_flex_free YY_PROTO(( void * )); - -#define yy_new_buffer yy_create_buffer - -#define yy_set_interactive(is_interactive) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_is_interactive = is_interactive; \ - } - -#define yy_set_bol(at_bol) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_at_bol = at_bol; \ - } - -#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) - - -#define yywrap() 1 -#define YY_SKIP_YYWRAP -typedef unsigned char YY_CHAR; -FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; -typedef int yy_state_type; -extern char *yytext; -#define yytext_ptr yytext - -static yy_state_type yy_get_previous_state YY_PROTO(( void )); -static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); -static int yy_get_next_buffer YY_PROTO(( void )); -static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); - -/* Done after the current pattern has been matched and before the - * corresponding action - sets up yytext. - */ -#define YY_DO_BEFORE_ACTION \ - yytext_ptr = yy_bp; \ - yyleng = (int) (yy_cp - yy_bp); \ - yy_hold_char = *yy_cp; \ - *yy_cp = '\0'; \ - yy_c_buf_p = yy_cp; - -#define YY_NUM_RULES 34 -#define YY_END_OF_BUFFER 35 -static yyconst short int yy_accept[121] = - { 0, - 0, 0, 35, 34, 32, 33, 9, 30, 29, 28, - 10, 34, 29, 29, 29, 29, 29, 29, 29, 29, - 29, 29, 29, 29, 29, 29, 29, 32, 0, 29, - 10, 0, 17, 29, 29, 29, 29, 29, 29, 29, - 29, 1, 29, 29, 21, 29, 29, 29, 29, 29, - 29, 29, 29, 29, 31, 22, 29, 7, 29, 29, - 16, 3, 29, 29, 29, 6, 29, 2, 29, 29, - 29, 29, 29, 24, 29, 29, 29, 29, 8, 29, - 29, 12, 5, 29, 29, 29, 29, 29, 29, 29, - 29, 29, 13, 29, 29, 29, 29, 29, 14, 29, - - 29, 29, 18, 29, 29, 29, 20, 27, 23, 11, - 15, 29, 25, 29, 29, 4, 29, 26, 19, 0 - } ; - -static yyconst int yy_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 2, 1, 1, 1, 1, 4, 1, 1, 1, - 1, 1, 5, 1, 6, 7, 8, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 10, 1, 1, - 1, 1, 1, 1, 11, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, - 12, 1, 13, 1, 7, 1, 14, 15, 16, 17, - - 18, 19, 20, 21, 22, 11, 11, 23, 24, 25, - 26, 27, 28, 29, 30, 31, 32, 11, 33, 11, - 34, 11, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1 - } ; - -static yyconst int yy_meta[35] = - { 0, - 1, 1, 1, 2, 1, 1, 2, 1, 3, 2, - 3, 1, 1, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3 - } ; - -static yyconst short int yy_base[123] = - { 0, - 0, 0, 235, 236, 232, 236, 236, 236, 229, 236, - 31, 223, 32, 33, 34, 35, 37, 39, 41, 38, - 40, 43, 42, 44, 45, 46, 47, 229, 0, 226, - 50, 67, 225, 51, 67, 77, 58, 75, 78, 80, - 79, 224, 82, 83, 223, 85, 86, 87, 91, 88, - 89, 96, 97, 0, 236, 222, 99, 107, 104, 100, - 221, 220, 103, 118, 119, 219, 121, 218, 122, 123, - 124, 126, 128, 217, 127, 129, 131, 130, 216, 134, - 136, 215, 137, 132, 138, 142, 139, 143, 146, 149, - 155, 159, 214, 160, 161, 166, 168, 163, 213, 170, - - 171, 172, 212, 173, 176, 179, 211, 185, 206, 204, - 202, 175, 196, 183, 188, 195, 180, 198, 194, 236, - 211, 193 - } ; - -static yyconst short int yy_def[123] = - { 0, - 120, 1, 120, 120, 120, 120, 120, 120, 121, 120, - 121, 120, 121, 121, 121, 121, 121, 121, 121, 121, - 121, 121, 121, 121, 121, 121, 121, 120, 122, 121, - 121, 120, 121, 121, 121, 121, 121, 121, 121, 121, - 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, - 121, 121, 121, 122, 120, 121, 121, 121, 121, 121, - 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, - 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, - 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, - 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, - - 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, - 121, 121, 121, 121, 121, 121, 121, 121, 121, 0, - 120, 120 - } ; - -static yyconst short int yy_nxt[271] = - { 0, - 4, 5, 6, 4, 7, 8, 9, 10, 11, 9, - 9, 12, 4, 13, 14, 9, 15, 16, 17, 9, - 18, 19, 20, 21, 22, 23, 24, 9, 25, 9, - 26, 27, 9, 9, 29, 29, 29, 29, 29, 31, - 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, - 29, 36, 33, 29, 29, 37, 34, 45, 31, 38, - 41, 29, 49, 44, 39, 42, 35, 43, 46, 40, - 29, 52, 48, 47, 50, 32, 53, 51, 29, 55, - 29, 29, 29, 29, 56, 29, 29, 59, 29, 29, - 29, 29, 29, 57, 29, 58, 62, 64, 63, 29, - - 29, 71, 29, 29, 61, 60, 29, 29, 69, 67, - 29, 65, 75, 72, 74, 66, 68, 73, 70, 77, - 76, 29, 29, 79, 29, 29, 29, 29, 78, 29, - 29, 29, 29, 29, 29, 29, 81, 29, 82, 29, - 29, 29, 29, 80, 90, 29, 29, 83, 85, 29, - 86, 93, 29, 95, 84, 87, 88, 92, 29, 97, - 89, 91, 29, 29, 29, 94, 29, 96, 100, 29, - 98, 29, 99, 29, 29, 29, 29, 101, 29, 29, - 108, 104, 29, 29, 102, 103, 29, 110, 29, 105, - 107, 29, 106, 113, 115, 54, 118, 29, 29, 29, - - 109, 29, 111, 112, 114, 29, 118, 29, 116, 29, - 119, 117, 30, 30, 29, 29, 29, 29, 29, 29, - 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, - 28, 32, 29, 28, 120, 3, 120, 120, 120, 120, - 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, - 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, - 120, 120, 120, 120, 120, 120, 120, 120, 120, 120 - } ; - -static yyconst short int yy_chk[271] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 11, 13, 14, 15, 16, 11, - 17, 20, 18, 21, 19, 23, 22, 24, 25, 26, - 27, 15, 13, 31, 34, 15, 13, 21, 31, 16, - 18, 37, 25, 20, 16, 19, 14, 19, 22, 17, - 35, 27, 24, 23, 26, 32, 27, 26, 38, 32, - 36, 39, 41, 40, 34, 43, 44, 37, 46, 47, - 48, 50, 51, 35, 49, 36, 40, 43, 41, 52, - - 53, 50, 57, 60, 39, 38, 63, 59, 48, 46, - 58, 43, 57, 51, 53, 44, 47, 52, 49, 59, - 58, 64, 65, 63, 67, 69, 70, 71, 60, 72, - 75, 73, 76, 78, 77, 84, 65, 80, 67, 81, - 83, 85, 87, 64, 77, 86, 88, 69, 71, 89, - 72, 81, 90, 84, 70, 73, 75, 80, 91, 86, - 76, 78, 92, 94, 95, 83, 98, 85, 89, 96, - 87, 97, 88, 100, 101, 102, 104, 90, 112, 105, - 98, 94, 106, 117, 91, 92, 114, 101, 108, 95, - 97, 115, 96, 105, 108, 122, 115, 119, 116, 113, - - 100, 118, 102, 104, 106, 111, 118, 110, 112, 109, - 117, 114, 121, 121, 107, 103, 99, 93, 82, 79, - 74, 68, 66, 62, 61, 56, 45, 42, 33, 30, - 28, 12, 9, 5, 3, 120, 120, 120, 120, 120, - 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, - 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, - 120, 120, 120, 120, 120, 120, 120, 120, 120, 120 - } ; - -static yy_state_type yy_last_accepting_state; -static char *yy_last_accepting_cpos; - -/* The intent behind this definition is that it'll catch - * any uses of REJECT which flex missed. - */ -#define REJECT reject_used_but_not_detected -#define yymore() yymore_used_but_not_detected -#define YY_MORE_ADJ 0 -#define YY_RESTORE_YY_MORE_OFFSET -char *yytext; -#line 1 "policy_token.l" -#define INITIAL 0 -/* Id: policy_token.l,v 1.10.4.1 2005/05/07 14:30:38 manubsd Exp */ -/* - * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the project nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ -#line 33 "policy_token.l" -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include -#include -#ifdef HAVE_NETINET6_IPSEC -# include -#else -# include -#endif - -#include -#include -#include -#include -#include - -#include "libpfkey.h" - -#if !defined(__NetBSD__) && !defined(__FreeBSD__) && !defined(__linux__) -#include "y.tab.h" -#else -#include "policy_parse.h" -#endif -#define yylval __libipseclval /* XXX */ - -int yylex __P((void)); -#define YY_NO_UNPUT 1 -/* common section */ -#line 544 "policy_token.c" - -/* Macros after this point can all be overridden by user definitions in - * section 1. - */ - -#ifndef YY_SKIP_YYWRAP -#ifdef __cplusplus -extern "C" int yywrap YY_PROTO(( void )); -#else -extern int yywrap YY_PROTO(( void )); -#endif -#endif - -#ifndef YY_NO_UNPUT -static void yyunput YY_PROTO(( int c, char *buf_ptr )); -#endif - -#ifndef yytext_ptr -static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen YY_PROTO(( yyconst char * )); -#endif - -#ifndef YY_NO_INPUT -#ifdef __cplusplus -static int yyinput YY_PROTO(( void )); -#else -static int input YY_PROTO(( void )); -#endif -#endif - -#if YY_STACK_USED -static int yy_start_stack_ptr = 0; -static int yy_start_stack_depth = 0; -static int *yy_start_stack = 0; -#ifndef YY_NO_PUSH_STATE -static void yy_push_state YY_PROTO(( int new_state )); -#endif -#ifndef YY_NO_POP_STATE -static void yy_pop_state YY_PROTO(( void )); -#endif -#ifndef YY_NO_TOP_STATE -static int yy_top_state YY_PROTO(( void )); -#endif - -#else -#define YY_NO_PUSH_STATE 1 -#define YY_NO_POP_STATE 1 -#define YY_NO_TOP_STATE 1 -#endif - -#ifdef YY_MALLOC_DECL -YY_MALLOC_DECL -#else -#if __STDC__ -#ifndef __cplusplus -#include -#endif -#else -/* Just try to get by without declaring the routines. This will fail - * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) - * or sizeof(void*) != sizeof(int). - */ -#endif -#endif - -/* Amount of stuff to slurp up with each read. */ -#ifndef YY_READ_BUF_SIZE -#define YY_READ_BUF_SIZE 8192 -#endif - -/* Copy whatever the last rule matched to the standard output. */ - -#ifndef ECHO -/* This used to be an fputs(), but since the string might contain NUL's, - * we now use fwrite(). - */ -#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) -#endif - -/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, - * is returned in "result". - */ -#ifndef YY_INPUT -#define YY_INPUT(buf,result,max_size) \ - if ( yy_current_buffer->yy_is_interactive ) \ - { \ - int c = '*', n; \ - for ( n = 0; n < max_size && \ - (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ) \ - buf[n++] = (char) c; \ - if ( c == EOF && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - result = n; \ - } \ - else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ - && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); -#endif - -/* No semi-colon after return; correct usage is to write "yyterminate();" - - * we don't want an extra ';' after the "return" because that will cause - * some compilers to complain about unreachable statements. - */ -#ifndef yyterminate -#define yyterminate() return YY_NULL -#endif - -/* Number of entries by which start-condition stack grows. */ -#ifndef YY_START_STACK_INCR -#define YY_START_STACK_INCR 25 -#endif - -/* Report a fatal error. */ -#ifndef YY_FATAL_ERROR -#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) -#endif - -/* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ -#ifndef YY_DECL -#define YY_DECL int yylex YY_PROTO(( void )) -#endif - -/* Code executed at the beginning of each rule, after yytext and yyleng - * have been set up. - */ -#ifndef YY_USER_ACTION -#define YY_USER_ACTION -#endif - -/* Code executed at the end of each rule. */ -#ifndef YY_BREAK -#define YY_BREAK break; -#endif - -#define YY_RULE_SETUP \ - YY_USER_ACTION - -YY_DECL - { - register yy_state_type yy_current_state; - register char *yy_cp = NULL, *yy_bp = NULL; - register int yy_act; - -#line 98 "policy_token.l" - - -#line 698 "policy_token.c" - - if ( yy_init ) - { - yy_init = 0; - -#ifdef YY_USER_INIT - YY_USER_INIT; -#endif - - if ( ! yy_start ) - yy_start = 1; /* first start state */ - - if ( ! yyin ) - yyin = stdin; - - if ( ! yyout ) - yyout = stdout; - - if ( ! yy_current_buffer ) - yy_current_buffer = - yy_create_buffer( yyin, YY_BUF_SIZE ); - - yy_load_buffer_state(); - } - - while ( 1 ) /* loops until end-of-file is reached */ - { - yy_cp = yy_c_buf_p; - - /* Support of yytext. */ - *yy_cp = yy_hold_char; - - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; - - yy_current_state = yy_start; -yy_match: - do - { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 121 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 236 ); - -yy_find_action: - yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; - yy_act = yy_accept[yy_current_state]; - } - - YY_DO_BEFORE_ACTION; - - -do_action: /* This label is used only to access EOF actions. */ - - - switch ( yy_act ) - { /* beginning of action switch */ - case 0: /* must back up */ - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = yy_hold_char; - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; - goto yy_find_action; - -case 1: -YY_RULE_SETUP -#line 100 "policy_token.l" -{ yylval.num = IPSEC_DIR_INBOUND; return(DIR); } - YY_BREAK -case 2: -YY_RULE_SETUP -#line 101 "policy_token.l" -{ yylval.num = IPSEC_DIR_OUTBOUND; return(DIR); } - YY_BREAK -case 3: -YY_RULE_SETUP -#line 102 "policy_token.l" -{ -#ifdef HAVE_POLICY_FWD - yylval.num = IPSEC_DIR_FWD; return(DIR); -#else - yylval.num = IPSEC_DIR_INBOUND; return(DIR); -#endif - } - YY_BREAK -case 4: -YY_RULE_SETUP -#line 110 "policy_token.l" -{ return(PRIORITY); } - YY_BREAK -case 5: -YY_RULE_SETUP -#line 111 "policy_token.l" -{ return(PRIORITY); } - YY_BREAK -case 6: -YY_RULE_SETUP -#line 112 "policy_token.l" -{ yylval.num32 = PRIORITY_LOW; return(PRIO_BASE); } - YY_BREAK -case 7: -YY_RULE_SETUP -#line 113 "policy_token.l" -{ yylval.num32 = PRIORITY_DEFAULT; return(PRIO_BASE); } - YY_BREAK -case 8: -YY_RULE_SETUP -#line 114 "policy_token.l" -{ yylval.num32 = PRIORITY_HIGH; return(PRIO_BASE); } - YY_BREAK -case 9: -YY_RULE_SETUP -#line 115 "policy_token.l" -{ return(PLUS); } - YY_BREAK -case 10: -YY_RULE_SETUP -#line 116 "policy_token.l" -{ - yylval.val.len = strlen(yytext); - yylval.val.buf = yytext; - return(PRIO_OFFSET); -} - YY_BREAK -case 11: -YY_RULE_SETUP -#line 122 "policy_token.l" -{ yylval.num = IPSEC_POLICY_DISCARD; return(ACTION); } - YY_BREAK -case 12: -YY_RULE_SETUP -#line 123 "policy_token.l" -{ yylval.num = IPSEC_POLICY_NONE; return(ACTION); } - YY_BREAK -case 13: -YY_RULE_SETUP -#line 124 "policy_token.l" -{ yylval.num = IPSEC_POLICY_IPSEC; return(ACTION); } - YY_BREAK -case 14: -YY_RULE_SETUP -#line 125 "policy_token.l" -{ yylval.num = IPSEC_POLICY_BYPASS; return(ACTION); } - YY_BREAK -case 15: -YY_RULE_SETUP -#line 126 "policy_token.l" -{ yylval.num = IPSEC_POLICY_ENTRUST; return(ACTION); } - YY_BREAK -case 16: -YY_RULE_SETUP -#line 128 "policy_token.l" -{ yylval.num = IPPROTO_ESP; return(PROTOCOL); } - YY_BREAK -case 17: -YY_RULE_SETUP -#line 129 "policy_token.l" -{ yylval.num = IPPROTO_AH; return(PROTOCOL); } - YY_BREAK -case 18: -YY_RULE_SETUP -#line 130 "policy_token.l" -{ yylval.num = IPPROTO_IPCOMP; return(PROTOCOL); } - YY_BREAK -case 19: -YY_RULE_SETUP -#line 132 "policy_token.l" -{ yylval.num = IPSEC_MODE_TRANSPORT; return(MODE); } - YY_BREAK -case 20: -YY_RULE_SETUP -#line 133 "policy_token.l" -{ yylval.num = IPSEC_MODE_TUNNEL; return(MODE); } - YY_BREAK -case 21: -YY_RULE_SETUP -#line 135 "policy_token.l" -{ return(ME); } - YY_BREAK -case 22: -YY_RULE_SETUP -#line 136 "policy_token.l" -{ return(ANY); } - YY_BREAK -case 23: -YY_RULE_SETUP -#line 138 "policy_token.l" -{ yylval.num = IPSEC_LEVEL_DEFAULT; return(LEVEL); } - YY_BREAK -case 24: -YY_RULE_SETUP -#line 139 "policy_token.l" -{ yylval.num = IPSEC_LEVEL_USE; return(LEVEL); } - YY_BREAK -case 25: -YY_RULE_SETUP -#line 140 "policy_token.l" -{ yylval.num = IPSEC_LEVEL_REQUIRE; return(LEVEL); } - YY_BREAK -case 26: -YY_RULE_SETUP -#line 141 "policy_token.l" -{ - yylval.val.len = strlen(yytext + 7); - yylval.val.buf = yytext + 7; - return(LEVEL_SPECIFY); - } - YY_BREAK -case 27: -YY_RULE_SETUP -#line 146 "policy_token.l" -{ yylval.num = IPSEC_LEVEL_UNIQUE; return(LEVEL); } - YY_BREAK -case 28: -YY_RULE_SETUP -#line 147 "policy_token.l" -{ return(SLASH); } - YY_BREAK -case 29: -YY_RULE_SETUP -#line 149 "policy_token.l" -{ - yylval.val.len = strlen(yytext); - yylval.val.buf = yytext; - return(IPADDRESS); - } - YY_BREAK -case 30: -YY_RULE_SETUP -#line 155 "policy_token.l" -{ return(HYPHEN); } - YY_BREAK -case 31: -YY_RULE_SETUP -#line 157 "policy_token.l" -{ - /* Remove leading '[' and trailing ']' */ - yylval.val.buf = yytext + 1; - yylval.val.len = strlen(yytext) - 2; - - return(PORT); - } - YY_BREAK -case 32: -YY_RULE_SETUP -#line 165 "policy_token.l" -{ ; } - YY_BREAK -case 33: -YY_RULE_SETUP -#line 166 "policy_token.l" -{ ; } - YY_BREAK -case 34: -YY_RULE_SETUP -#line 168 "policy_token.l" -ECHO; - YY_BREAK -#line 975 "policy_token.c" -case YY_STATE_EOF(INITIAL): - yyterminate(); - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = yy_hold_char; - YY_RESTORE_YY_MORE_OFFSET - - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure - * consistency between yy_current_buffer and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - yy_n_chars = yy_current_buffer->yy_n_chars; - yy_current_buffer->yy_input_file = yyin; - yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state(); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - yy_next_state = yy_try_NUL_trans( yy_current_state ); - - yy_bp = yytext_ptr + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++yy_c_buf_p; - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { - yy_cp = yy_c_buf_p; - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer() ) - { - case EOB_ACT_END_OF_FILE: - { - yy_did_buffer_switch_on_eof = 0; - - if ( yywrap() ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * yytext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = - yytext_ptr + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state(); - - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - yy_c_buf_p = - &yy_current_buffer->yy_ch_buf[yy_n_chars]; - - yy_current_state = yy_get_previous_state(); - - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ - } /* end of yylex */ - - -/* yy_get_next_buffer - try to read in a new buffer - * - * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file - */ - -static int yy_get_next_buffer() - { - register char *dest = yy_current_buffer->yy_ch_buf; - register char *source = yytext_ptr; - register int number_to_move, i; - int ret_val; - - if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( yy_current_buffer->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) - { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - yy_current_buffer->yy_n_chars = yy_n_chars = 0; - - else - { - int num_to_read = - yy_current_buffer->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ -#ifdef YY_USES_REJECT - YY_FATAL_ERROR( -"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); -#else - - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = yy_current_buffer; - - int yy_c_buf_p_offset = - (int) (yy_c_buf_p - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) - { - int new_size = b->yy_buf_size * 2; - - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; - - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - yy_flex_realloc( (void *) b->yy_ch_buf, - b->yy_buf_size + 2 ); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; - - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); - - yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; - - num_to_read = yy_current_buffer->yy_buf_size - - number_to_move - 1; -#endif - } - - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), - yy_n_chars, num_to_read ); - - yy_current_buffer->yy_n_chars = yy_n_chars; - } - - if ( yy_n_chars == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - yyrestart( yyin ); - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - yy_current_buffer->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - yy_n_chars += number_to_move; - yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; - yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; - - yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; - - return ret_val; - } - - -/* yy_get_previous_state - get the state just before the EOB char was reached */ - -static yy_state_type yy_get_previous_state() - { - register yy_state_type yy_current_state; - register char *yy_cp; - - yy_current_state = yy_start; - - for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) - { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 121 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - } - - return yy_current_state; - } - - -/* yy_try_NUL_trans - try to make a transition on the NUL character - * - * synopsis - * next_state = yy_try_NUL_trans( current_state ); - */ - -#ifdef YY_USE_PROTOS -static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) -#else -static yy_state_type yy_try_NUL_trans( yy_current_state ) -yy_state_type yy_current_state; -#endif - { - register int yy_is_jam; - register char *yy_cp = yy_c_buf_p; - - register YY_CHAR yy_c = 1; - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 121 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 120); - - return yy_is_jam ? 0 : yy_current_state; - } - - -#ifndef YY_NO_UNPUT -#ifdef YY_USE_PROTOS -static void yyunput( int c, register char *yy_bp ) -#else -static void yyunput( c, yy_bp ) -int c; -register char *yy_bp; -#endif - { - register char *yy_cp = yy_c_buf_p; - - /* undo effects of setting up yytext */ - *yy_cp = yy_hold_char; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register int number_to_move = yy_n_chars + 2; - register char *dest = &yy_current_buffer->yy_ch_buf[ - yy_current_buffer->yy_buf_size + 2]; - register char *source = - &yy_current_buffer->yy_ch_buf[number_to_move]; - - while ( source > yy_current_buffer->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - yy_current_buffer->yy_n_chars = - yy_n_chars = yy_current_buffer->yy_buf_size; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - - - yytext_ptr = yy_bp; - yy_hold_char = *yy_cp; - yy_c_buf_p = yy_cp; - } -#endif /* ifndef YY_NO_UNPUT */ - - -#ifdef __cplusplus -static int yyinput() -#else -static int input() -#endif - { - int c; - - *yy_c_buf_p = yy_hold_char; - - if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - /* This was really a NUL. */ - *yy_c_buf_p = '\0'; - - else - { /* need more input */ - int offset = yy_c_buf_p - yytext_ptr; - ++yy_c_buf_p; - - switch ( yy_get_next_buffer() ) - { - case EOB_ACT_LAST_MATCH: - /* This happens because yy_g_n_b() - * sees that we've accumulated a - * token and flags that we need to - * try matching the token before - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ - - /* Reset buffer status. */ - yyrestart( yyin ); - - /* fall through */ - - case EOB_ACT_END_OF_FILE: - { - if ( yywrap() ) - return EOF; - - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; -#ifdef __cplusplus - return yyinput(); -#else - return input(); -#endif - } - - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = yytext_ptr + offset; - break; - } - } - } - - c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ - *yy_c_buf_p = '\0'; /* preserve yytext */ - yy_hold_char = *++yy_c_buf_p; - - - return c; - } - - -#ifdef YY_USE_PROTOS -void yyrestart( FILE *input_file ) -#else -void yyrestart( input_file ) -FILE *input_file; -#endif - { - if ( ! yy_current_buffer ) - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); - - yy_init_buffer( yy_current_buffer, input_file ); - yy_load_buffer_state(); - } - - -#ifdef YY_USE_PROTOS -void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) -#else -void yy_switch_to_buffer( new_buffer ) -YY_BUFFER_STATE new_buffer; -#endif - { - if ( yy_current_buffer == new_buffer ) - return; - - if ( yy_current_buffer ) - { - /* Flush out information for old buffer. */ - *yy_c_buf_p = yy_hold_char; - yy_current_buffer->yy_buf_pos = yy_c_buf_p; - yy_current_buffer->yy_n_chars = yy_n_chars; - } - - yy_current_buffer = new_buffer; - yy_load_buffer_state(); - - /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe - * to go ahead and always set it. - */ - yy_did_buffer_switch_on_eof = 1; - } - - -#ifdef YY_USE_PROTOS -void yy_load_buffer_state( void ) -#else -void yy_load_buffer_state() -#endif - { - yy_n_chars = yy_current_buffer->yy_n_chars; - yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; - yyin = yy_current_buffer->yy_input_file; - yy_hold_char = *yy_c_buf_p; - } - - -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) -#else -YY_BUFFER_STATE yy_create_buffer( file, size ) -FILE *file; -int size; -#endif - { - YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_buf_size = size; - - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_is_our_buffer = 1; - - yy_init_buffer( b, file ); - - return b; - } - - -#ifdef YY_USE_PROTOS -void yy_delete_buffer( YY_BUFFER_STATE b ) -#else -void yy_delete_buffer( b ) -YY_BUFFER_STATE b; -#endif - { - if ( ! b ) - return; - - if ( b == yy_current_buffer ) - yy_current_buffer = (YY_BUFFER_STATE) 0; - - if ( b->yy_is_our_buffer ) - yy_flex_free( (void *) b->yy_ch_buf ); - - yy_flex_free( (void *) b ); - } - - -#ifndef YY_ALWAYS_INTERACTIVE -#ifndef YY_NEVER_INTERACTIVE -extern int isatty YY_PROTO(( int )); -#endif -#endif - -#ifdef YY_USE_PROTOS -void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) -#else -void yy_init_buffer( b, file ) -YY_BUFFER_STATE b; -FILE *file; -#endif - - - { - yy_flush_buffer( b ); - - b->yy_input_file = file; - b->yy_fill_buffer = 1; - -#if YY_ALWAYS_INTERACTIVE - b->yy_is_interactive = 1; -#else -#if YY_NEVER_INTERACTIVE - b->yy_is_interactive = 0; -#else - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; -#endif -#endif - } - - -#ifdef YY_USE_PROTOS -void yy_flush_buffer( YY_BUFFER_STATE b ) -#else -void yy_flush_buffer( b ) -YY_BUFFER_STATE b; -#endif - - { - if ( ! b ) - return; - - b->yy_n_chars = 0; - - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - - b->yy_buf_pos = &b->yy_ch_buf[0]; - - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; - - if ( b == yy_current_buffer ) - yy_load_buffer_state(); - } - - -#ifndef YY_NO_SCAN_BUFFER -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) -#else -YY_BUFFER_STATE yy_scan_buffer( base, size ) -char *base; -yy_size_t size; -#endif - { - YY_BUFFER_STATE b; - - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return 0; - - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = 0; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; - - yy_switch_to_buffer( b ); - - return b; - } -#endif - - -#ifndef YY_NO_SCAN_STRING -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) -#else -YY_BUFFER_STATE yy_scan_string( yy_str ) -yyconst char *yy_str; -#endif - { - int len; - for ( len = 0; yy_str[len]; ++len ) - ; - - return yy_scan_bytes( yy_str, len ); - } -#endif - - -#ifndef YY_NO_SCAN_BYTES -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) -#else -YY_BUFFER_STATE yy_scan_bytes( bytes, len ) -yyconst char *bytes; -int len; -#endif - { - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - int i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = len + 2; - buf = (char *) yy_flex_alloc( n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); - - for ( i = 0; i < len; ++i ) - buf[i] = bytes[i]; - - buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; - - b = yy_scan_buffer( buf, n ); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); - - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; - - return b; - } -#endif - - -#ifndef YY_NO_PUSH_STATE -#ifdef YY_USE_PROTOS -static void yy_push_state( int new_state ) -#else -static void yy_push_state( new_state ) -int new_state; -#endif - { - if ( yy_start_stack_ptr >= yy_start_stack_depth ) - { - yy_size_t new_size; - - yy_start_stack_depth += YY_START_STACK_INCR; - new_size = yy_start_stack_depth * sizeof( int ); - - if ( ! yy_start_stack ) - yy_start_stack = (int *) yy_flex_alloc( new_size ); - - else - yy_start_stack = (int *) yy_flex_realloc( - (void *) yy_start_stack, new_size ); - - if ( ! yy_start_stack ) - YY_FATAL_ERROR( - "out of memory expanding start-condition stack" ); - } - - yy_start_stack[yy_start_stack_ptr++] = YY_START; - - BEGIN(new_state); - } -#endif - - -#ifndef YY_NO_POP_STATE -static void yy_pop_state() - { - if ( --yy_start_stack_ptr < 0 ) - YY_FATAL_ERROR( "start-condition stack underflow" ); - - BEGIN(yy_start_stack[yy_start_stack_ptr]); - } -#endif - - -#ifndef YY_NO_TOP_STATE -static int yy_top_state() - { - return yy_start_stack[yy_start_stack_ptr - 1]; - } -#endif - -#ifndef YY_EXIT_FAILURE -#define YY_EXIT_FAILURE 2 -#endif - -#ifdef YY_USE_PROTOS -static void yy_fatal_error( yyconst char msg[] ) -#else -static void yy_fatal_error( msg ) -char msg[]; -#endif - { - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); - } - - - -/* Redefine yyless() so it works in section 3 code. */ - -#undef yyless -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - yytext[yyleng] = yy_hold_char; \ - yy_c_buf_p = yytext + n; \ - yy_hold_char = *yy_c_buf_p; \ - *yy_c_buf_p = '\0'; \ - yyleng = n; \ - } \ - while ( 0 ) - - -/* Internal utility routines. */ - -#ifndef yytext_ptr -#ifdef YY_USE_PROTOS -static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) -#else -static void yy_flex_strncpy( s1, s2, n ) -char *s1; -yyconst char *s2; -int n; -#endif - { - register int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; - } -#endif - -#ifdef YY_NEED_STRLEN -#ifdef YY_USE_PROTOS -static int yy_flex_strlen( yyconst char *s ) -#else -static int yy_flex_strlen( s ) -yyconst char *s; -#endif - { - register int n; - for ( n = 0; s[n]; ++n ) - ; - - return n; - } -#endif - - -#ifdef YY_USE_PROTOS -static void *yy_flex_alloc( yy_size_t size ) -#else -static void *yy_flex_alloc( size ) -yy_size_t size; -#endif - { - return (void *) malloc( size ); - } - -#ifdef YY_USE_PROTOS -static void *yy_flex_realloc( void *ptr, yy_size_t size ) -#else -static void *yy_flex_realloc( ptr, size ) -void *ptr; -yy_size_t size; -#endif - { - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return (void *) realloc( (char *) ptr, size ); - } - -#ifdef YY_USE_PROTOS -static void yy_flex_free( void *ptr ) -#else -static void yy_flex_free( ptr ) -void *ptr; -#endif - { - free( ptr ); - } - -#if YY_MAIN -int main() - { - yylex(); - return 0; - } -#endif -#line 168 "policy_token.l" - - -void __policy__strbuffer__init__ __P((char *)); -void __policy__strbuffer__free__ __P((void)); - -static YY_BUFFER_STATE strbuffer; - -void -__policy__strbuffer__init__(msg) - char *msg; -{ - if (YY_CURRENT_BUFFER) - yy_delete_buffer(YY_CURRENT_BUFFER); - strbuffer = (YY_BUFFER_STATE)yy_scan_string(msg); - yy_switch_to_buffer(strbuffer); - - return; -} - -void -__policy__strbuffer__free__() -{ - yy_delete_buffer(strbuffer); - - return; -} diff --git a/crypto/dist/ipsec-tools/src/setkey/parse.c b/crypto/dist/ipsec-tools/src/setkey/parse.c deleted file mode 100644 index e5f13b39d6bc..000000000000 --- a/crypto/dist/ipsec-tools/src/setkey/parse.c +++ /dev/null @@ -1,2550 +0,0 @@ -/* $NetBSD: parse.c,v 1.2 2005/11/21 14:20:36 manu Exp $ */ - - -/* A Bison parser, made from parse.y - by GNU Bison version 1.28 */ - -#define YYBISON 1 /* Identify Bison output. */ - -#define EOT 257 -#define SLASH 258 -#define BLCL 259 -#define ELCL 260 -#define ADD 261 -#define GET 262 -#define DELETE 263 -#define DELETEALL 264 -#define FLUSH 265 -#define DUMP 266 -#define EXIT 267 -#define PR_ESP 268 -#define PR_AH 269 -#define PR_IPCOMP 270 -#define PR_ESPUDP 271 -#define PR_TCP 272 -#define F_PROTOCOL 273 -#define F_AUTH 274 -#define F_ENC 275 -#define F_REPLAY 276 -#define F_COMP 277 -#define F_RAWCPI 278 -#define F_MODE 279 -#define MODE 280 -#define F_REQID 281 -#define F_EXT 282 -#define EXTENSION 283 -#define NOCYCLICSEQ 284 -#define ALG_AUTH 285 -#define ALG_AUTH_NOKEY 286 -#define ALG_ENC 287 -#define ALG_ENC_NOKEY 288 -#define ALG_ENC_DESDERIV 289 -#define ALG_ENC_DES32IV 290 -#define ALG_ENC_OLD 291 -#define ALG_COMP 292 -#define F_LIFETIME_HARD 293 -#define F_LIFETIME_SOFT 294 -#define F_LIFEBYTE_HARD 295 -#define F_LIFEBYTE_SOFT 296 -#define DECSTRING 297 -#define QUOTEDSTRING 298 -#define HEXSTRING 299 -#define STRING 300 -#define ANY 301 -#define SPDADD 302 -#define SPDDELETE 303 -#define SPDDUMP 304 -#define SPDFLUSH 305 -#define F_POLICY 306 -#define PL_REQUESTS 307 -#define F_AIFLAGS 308 -#define TAGGED 309 - -#line 32 "parse.y" - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include - -#include -#include -#ifdef HAVE_NETINET6_IPSEC -# include -#else -# include -#endif -#include - -#include -#include -#include -#include -#include -#include -#include - -#include "libpfkey.h" -#include "vchar.h" -#include "extern.h" - -#define DEFAULT_NATT_PORT 4500 - -#ifndef UDP_ENCAP_ESPINUDP -#define UDP_ENCAP_ESPINUDP 2 -#endif - -#define ATOX(c) \ - (isdigit((int)c) ? (c - '0') : \ - (isupper((int)c) ? (c - 'A' + 10) : (c - 'a' + 10))) - -u_int32_t p_spi; -u_int p_ext, p_alg_enc, p_alg_auth, p_replay, p_mode; -u_int32_t p_reqid; -u_int p_key_enc_len, p_key_auth_len; -const char *p_key_enc; -const char *p_key_auth; -time_t p_lt_hard, p_lt_soft; -size_t p_lb_hard, p_lb_soft; - -static u_int p_natt_type; -static struct addrinfo * p_natt_oa = NULL; - -static int p_aiflags = 0, p_aifamily = PF_UNSPEC; - -static struct addrinfo *parse_addr __P((char *, char *)); -static int fix_portstr __P((vchar_t *, vchar_t *, vchar_t *)); -static int setvarbuf __P((char *, int *, struct sadb_ext *, int, - const void *, int)); -void parse_init __P((void)); -void free_buffer __P((void)); - -int setkeymsg0 __P((struct sadb_msg *, unsigned int, unsigned int, size_t)); -static int setkeymsg_spdaddr __P((unsigned int, unsigned int, vchar_t *, - struct addrinfo *, int, struct addrinfo *, int)); -static int setkeymsg_spdaddr_tag __P((unsigned int, char *, vchar_t *)); -static int setkeymsg_addr __P((unsigned int, unsigned int, - struct addrinfo *, struct addrinfo *, int)); -static int setkeymsg_add __P((unsigned int, unsigned int, - struct addrinfo *, struct addrinfo *)); - -#line 103 "parse.y" -typedef union { - int num; - unsigned long ulnum; - vchar_t val; - struct addrinfo *res; -} YYSTYPE; -#include - -#ifndef __cplusplus -#ifndef __STDC__ -#define const -#endif -#endif - - - -#define YYFINAL 160 -#define YYFLAG -32768 -#define YYNTBASE 56 - -#define YYTRANSLATE(x) ((unsigned)(x) <= 309 ? yytranslate[x] : 90) - -static const char yytranslate[] = { 0, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 1, 3, 4, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, - 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 50, 51, 52, 53, 54, 55 -}; - -#if YYDEBUG != 0 -static const short yyprhs[] = { 0, - 0, 1, 4, 6, 8, 10, 12, 14, 16, 18, - 20, 22, 24, 26, 36, 45, 52, 61, 65, 69, - 70, 72, 74, 76, 78, 81, 83, 85, 87, 89, - 91, 93, 98, 101, 104, 107, 111, 113, 116, 118, - 121, 124, 127, 129, 131, 133, 134, 137, 140, 143, - 146, 149, 152, 155, 158, 161, 164, 167, 180, 186, - 199, 202, 205, 206, 209, 211, 213, 215, 218, 219, - 222, 223, 227, 231, 235, 237, 239, 241, 243, 244, - 246, 249, 251 -}; - -static const short yyrhs[] = { -1, - 56, 57, 0, 58, 0, 61, 0, 59, 0, 60, - 0, 62, 0, 63, 0, 89, 0, 75, 0, 76, - 0, 77, 0, 78, 0, 7, 79, 82, 82, 64, - 65, 73, 66, 3, 0, 9, 79, 81, 81, 64, - 65, 73, 3, 0, 10, 79, 81, 81, 64, 3, - 0, 8, 79, 81, 81, 64, 65, 73, 3, 0, - 11, 64, 3, 0, 12, 64, 3, 0, 0, 14, - 0, 15, 0, 16, 0, 17, 0, 17, 81, 0, - 18, 0, 43, 0, 45, 0, 67, 0, 68, 0, - 69, 0, 21, 70, 20, 71, 0, 21, 70, 0, - 20, 71, 0, 23, 38, 0, 23, 38, 24, 0, - 34, 0, 33, 72, 0, 37, 0, 35, 72, 0, - 36, 72, 0, 31, 72, 0, 32, 0, 44, 0, - 45, 0, 0, 73, 74, 0, 28, 29, 0, 28, - 30, 0, 25, 26, 0, 25, 47, 0, 27, 43, - 0, 22, 43, 0, 39, 43, 0, 40, 43, 0, - 41, 43, 0, 42, 43, 0, 48, 79, 46, 83, - 84, 46, 83, 84, 85, 86, 87, 3, 0, 48, - 55, 44, 87, 3, 0, 49, 79, 46, 83, 84, - 46, 83, 84, 85, 86, 87, 3, 0, 50, 3, - 0, 51, 3, 0, 0, 79, 80, 0, 54, 0, - 46, 0, 46, 0, 46, 84, 0, 0, 4, 43, - 0, 0, 5, 47, 6, 0, 5, 43, 6, 0, - 5, 46, 6, 0, 43, 0, 47, 0, 18, 0, - 46, 0, 0, 46, 0, 52, 88, 0, 53, 0, - 13, 3, 0 -}; - -#endif - -#if YYDEBUG != 0 -static const short yyrline[] = { 0, - 144, 145, 153, 154, 155, 156, 157, 158, 159, 160, - 161, 162, 163, 169, 181, 200, 212, 227, 237, 246, - 250, 258, 266, 270, 277, 284, 293, 294, 315, 316, - 317, 321, 322, 326, 330, 338, 350, 365, 380, 396, - 417, 441, 466, 479, 483, 513, 514, 518, 519, 520, - 521, 522, 523, 532, 533, 534, 535, 541, 580, 592, - 629, 640, 651, 652, 656, 681, 692, 700, 712, 713, - 717, 726, 735, 746, 753, 754, 755, 758, 780, 785, - 797, 821, 826 -}; -#endif - - -#if YYDEBUG != 0 || defined (YYERROR_VERBOSE) - -static const char * const yytname[] = { "$","error","$undefined.","EOT","SLASH", -"BLCL","ELCL","ADD","GET","DELETE","DELETEALL","FLUSH","DUMP","EXIT","PR_ESP", -"PR_AH","PR_IPCOMP","PR_ESPUDP","PR_TCP","F_PROTOCOL","F_AUTH","F_ENC","F_REPLAY", -"F_COMP","F_RAWCPI","F_MODE","MODE","F_REQID","F_EXT","EXTENSION","NOCYCLICSEQ", -"ALG_AUTH","ALG_AUTH_NOKEY","ALG_ENC","ALG_ENC_NOKEY","ALG_ENC_DESDERIV","ALG_ENC_DES32IV", -"ALG_ENC_OLD","ALG_COMP","F_LIFETIME_HARD","F_LIFETIME_SOFT","F_LIFEBYTE_HARD", -"F_LIFEBYTE_SOFT","DECSTRING","QUOTEDSTRING","HEXSTRING","STRING","ANY","SPDADD", -"SPDDELETE","SPDDUMP","SPDFLUSH","F_POLICY","PL_REQUESTS","F_AIFLAGS","TAGGED", -"commands","command","add_command","delete_command","deleteall_command","get_command", -"flush_command","dump_command","protocol_spec","spi","algorithm_spec","esp_spec", -"ah_spec","ipcomp_spec","enc_alg","auth_alg","key_string","extension_spec","extension", -"spdadd_command","spddelete_command","spddump_command","spdflush_command","ipaddropts", -"ipaddropt","ipaddr","ipandport","prefix","portstr","upper_spec","upper_misc_spec", -"policy_spec","policy_requests","exit_command", NULL -}; -#endif - -static const short yyr1[] = { 0, - 56, 56, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 58, 59, 60, 61, 62, 63, 64, - 64, 64, 64, 64, 64, 64, 65, 65, 66, 66, - 66, 67, 67, 68, 69, 69, 70, 70, 70, 70, - 70, 71, 71, 72, 72, 73, 73, 74, 74, 74, - 74, 74, 74, 74, 74, 74, 74, 75, 75, 76, - 77, 78, 79, 79, 80, 81, 82, 82, 83, 83, - 84, 84, 84, 84, 85, 85, 85, 85, 86, 86, - 87, 88, 89 -}; - -static const short yyr2[] = { 0, - 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 9, 8, 6, 8, 3, 3, 0, - 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, - 1, 4, 2, 2, 2, 3, 1, 2, 1, 2, - 2, 2, 1, 1, 1, 0, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 12, 5, 12, - 2, 2, 0, 2, 1, 1, 1, 2, 0, 2, - 0, 3, 3, 3, 1, 1, 1, 1, 0, 1, - 2, 1, 2 -}; - -static const short yydefact[] = { 1, - 0, 63, 63, 63, 63, 20, 20, 0, 63, 63, - 0, 0, 2, 3, 5, 6, 4, 7, 8, 10, - 11, 12, 13, 9, 0, 0, 0, 0, 21, 22, - 23, 24, 26, 0, 0, 83, 0, 0, 0, 61, - 62, 67, 65, 64, 0, 66, 0, 0, 0, 25, - 18, 19, 0, 69, 69, 0, 68, 20, 20, 20, - 20, 0, 0, 0, 71, 71, 0, 0, 0, 0, - 0, 0, 0, 82, 81, 59, 70, 0, 0, 73, - 74, 72, 27, 28, 46, 46, 46, 16, 69, 69, - 0, 0, 0, 71, 71, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 29, 30, 31, - 47, 17, 15, 0, 0, 0, 43, 34, 0, 37, - 0, 0, 39, 33, 53, 35, 50, 51, 52, 48, - 49, 54, 55, 56, 57, 14, 77, 75, 78, 76, - 79, 79, 44, 45, 42, 38, 40, 41, 0, 36, - 80, 0, 0, 32, 0, 0, 58, 60, 0, 0 -}; - -static const short yydefgoto[] = { 1, - 13, 14, 15, 16, 17, 18, 19, 34, 85, 107, - 108, 109, 110, 124, 118, 145, 91, 111, 20, 21, - 22, 23, 25, 44, 47, 45, 65, 57, 141, 152, - 63, 75, 24 -}; - -static const short yypact[] = {-32768, - 7,-32768,-32768,-32768,-32768, 32, 32, 67, -45,-32768, - 86, 88,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, --32768,-32768,-32768,-32768, -41, 14, 14, 14,-32768,-32768, --32768, 15,-32768, 111, 112,-32768, 74, 33, 34,-32768, --32768, 114,-32768,-32768, 70,-32768, 15, 15, 15,-32768, --32768,-32768, -15, 113, 113, 58,-32768, 32, 32, 32, - 32, 68, 117, 79, 114, 114, 118, 119, 120, 47, - 47, 47, 124,-32768,-32768,-32768,-32768, 77, 82,-32768, --32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 113, 113, - 44, -1, 3, 114, 114, -9, 63, 87, 91, -18, - 89, 73, 90, 92, 93, 94, 128,-32768,-32768,-32768, --32768,-32768,-32768, 16, 16, 62,-32768,-32768, 62,-32768, - 62, 62,-32768, 121,-32768, 110,-32768,-32768,-32768,-32768, --32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - 96, 96,-32768,-32768,-32768,-32768,-32768,-32768, -9,-32768, --32768, -15, -15,-32768, 135, 136,-32768,-32768, 140,-32768 -}; - -static const short yypgoto[] = {-32768, --32768,-32768,-32768,-32768,-32768,-32768,-32768, -7, 37,-32768, --32768,-32768,-32768,-32768, -6, -110, 24,-32768,-32768,-32768, --32768,-32768, 72,-32768, 46, 99, -54, -62, 30, 4, - -40,-32768,-32768 -}; - - -#define YYLAST 146 - - -static const short yytable[] = { 35, - 66, 112, 78, 79, 42, 113, 159, 127, 146, 37, - 147, 148, 43, 2, 3, 4, 5, 6, 7, 8, - 98, 116, 117, 100, 98, 101, 102, 100, 128, 101, - 102, 114, 115, 137, 94, 95, 62, 103, 104, 105, - 106, 103, 104, 105, 106, 29, 30, 31, 32, 33, - 70, 71, 72, 73, 9, 10, 11, 12, 138, 46, - 46, 139, 140, 96, 97, 98, 99, 43, 100, 36, - 101, 102, 48, 49, 26, 27, 28, 50, 54, 55, - 38, 39, 103, 104, 105, 106, 43, 43, 40, 83, - 41, 84, 59, 60, 61, 119, 120, 121, 122, 123, - 67, 130, 131, 68, 69, 143, 144, 86, 87, 92, - 93, 155, 156, 51, 52, 42, 64, 53, 56, 76, - 74, 77, 89, 80, 81, 82, 88, 90, 126, 125, - 136, 129, 132, 150, 133, 134, 135, 157, 158, 160, - 149, 151, 154, 58, 142, 153 -}; - -static const short yycheck[] = { 7, - 55, 3, 65, 66, 46, 3, 0, 26, 119, 55, - 121, 122, 54, 7, 8, 9, 10, 11, 12, 13, - 22, 31, 32, 25, 22, 27, 28, 25, 47, 27, - 28, 94, 95, 18, 89, 90, 52, 39, 40, 41, - 42, 39, 40, 41, 42, 14, 15, 16, 17, 18, - 58, 59, 60, 61, 48, 49, 50, 51, 43, 46, - 46, 46, 47, 20, 21, 22, 23, 54, 25, 3, - 27, 28, 27, 28, 3, 4, 5, 32, 46, 46, - 9, 10, 39, 40, 41, 42, 54, 54, 3, 43, - 3, 45, 47, 48, 49, 33, 34, 35, 36, 37, - 43, 29, 30, 46, 47, 44, 45, 71, 72, 86, - 87, 152, 153, 3, 3, 46, 4, 44, 5, 3, - 53, 43, 46, 6, 6, 6, 3, 46, 38, 43, - 3, 43, 43, 24, 43, 43, 43, 3, 3, 0, - 20, 46, 149, 45, 115, 142 -}; -/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ -#line 3 "/usr/lib/bison.simple" -/* This file comes from bison-1.28. */ - -/* Skeleton output parser for bison, - Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* As a special exception, when this file is copied by Bison into a - Bison output file, you may use that output file without restriction. - This special exception was added by the Free Software Foundation - in version 1.24 of Bison. */ - -/* This is the parser code that is written into each bison parser - when the %semantic_parser declaration is not specified in the grammar. - It was written by Richard Stallman by simplifying the hairy parser - used when %semantic_parser is specified. */ - -#ifndef YYSTACK_USE_ALLOCA -#ifdef alloca -#define YYSTACK_USE_ALLOCA -#else /* alloca not defined */ -#ifdef __GNUC__ -#define YYSTACK_USE_ALLOCA -#define alloca __builtin_alloca -#else /* not GNU C. */ -#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386)) -#define YYSTACK_USE_ALLOCA -#include -#else /* not sparc */ -/* We think this test detects Watcom and Microsoft C. */ -/* This used to test MSDOS, but that is a bad idea - since that symbol is in the user namespace. */ -#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) -#if 0 /* No need for malloc.h, which pollutes the namespace; - instead, just don't use alloca. */ -#include -#endif -#else /* not MSDOS, or __TURBOC__ */ -#if defined(_AIX) -/* I don't know what this was needed for, but it pollutes the namespace. - So I turned it off. rms, 2 May 1997. */ -/* #include */ - #pragma alloca -#define YYSTACK_USE_ALLOCA -#else /* not MSDOS, or __TURBOC__, or _AIX */ -#if 0 -#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up, - and on HPUX 10. Eventually we can turn this on. */ -#define YYSTACK_USE_ALLOCA -#define alloca __builtin_alloca -#endif /* __hpux */ -#endif -#endif /* not _AIX */ -#endif /* not MSDOS, or __TURBOC__ */ -#endif /* not sparc */ -#endif /* not GNU C */ -#endif /* alloca not defined */ -#endif /* YYSTACK_USE_ALLOCA not defined */ - -#ifdef YYSTACK_USE_ALLOCA -#define YYSTACK_ALLOC alloca -#else -#define YYSTACK_ALLOC malloc -#endif - -/* Note: there must be only one dollar sign in this file. - It is replaced by the list of actions, each action - as one case of the switch. */ - -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY -2 -#define YYEOF 0 -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrlab1 -/* Like YYERROR except do call yyerror. - This remains here temporarily to ease the - transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. */ -#define YYFAIL goto yyerrlab -#define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(token, value) \ -do \ - if (yychar == YYEMPTY && yylen == 1) \ - { yychar = (token), yylval = (value); \ - yychar1 = YYTRANSLATE (yychar); \ - YYPOPSTACK; \ - goto yybackup; \ - } \ - else \ - { yyerror ("syntax error: cannot back up"); YYERROR; } \ -while (0) - -#define YYTERROR 1 -#define YYERRCODE 256 - -#ifndef YYPURE -#define YYLEX yylex() -#endif - -#ifdef YYPURE -#ifdef YYLSP_NEEDED -#ifdef YYLEX_PARAM -#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) -#else -#define YYLEX yylex(&yylval, &yylloc) -#endif -#else /* not YYLSP_NEEDED */ -#ifdef YYLEX_PARAM -#define YYLEX yylex(&yylval, YYLEX_PARAM) -#else -#define YYLEX yylex(&yylval) -#endif -#endif /* not YYLSP_NEEDED */ -#endif - -/* If nonreentrant, generate the variables here */ - -#ifndef YYPURE - -int yychar; /* the lookahead symbol */ -YYSTYPE yylval; /* the semantic value of the */ - /* lookahead symbol */ - -#ifdef YYLSP_NEEDED -YYLTYPE yylloc; /* location data for the lookahead */ - /* symbol */ -#endif - -int yynerrs; /* number of parse errors so far */ -#endif /* not YYPURE */ - -#if YYDEBUG != 0 -int yydebug; /* nonzero means print parse trace */ -/* Since this is uninitialized, it does not stop multiple parsers - from coexisting. */ -#endif - -/* YYINITDEPTH indicates the initial size of the parser's stacks */ - -#ifndef YYINITDEPTH -#define YYINITDEPTH 200 -#endif - -/* YYMAXDEPTH is the maximum size the stacks can grow to - (effective only if the built-in stack extension method is used). */ - -#if YYMAXDEPTH == 0 -#undef YYMAXDEPTH -#endif - -#ifndef YYMAXDEPTH -#define YYMAXDEPTH 10000 -#endif - -/* Define __yy_memcpy. Note that the size argument - should be passed with type unsigned int, because that is what the non-GCC - definitions require. With GCC, __builtin_memcpy takes an arg - of type size_t, but it can handle unsigned int. */ - -#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ -#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) -#else /* not GNU C or C++ */ -#ifndef __cplusplus - -/* This is the most reliable way to avoid incompatibilities - in available built-in functions on various systems. */ -static void -__yy_memcpy (to, from, count) - char *to; - char *from; - unsigned int count; -{ - register char *f = from; - register char *t = to; - register int i = count; - - while (i-- > 0) - *t++ = *f++; -} - -#else /* __cplusplus */ - -/* This is the most reliable way to avoid incompatibilities - in available built-in functions on various systems. */ -static void -__yy_memcpy (char *to, char *from, unsigned int count) -{ - register char *t = to; - register char *f = from; - register int i = count; - - while (i-- > 0) - *t++ = *f++; -} - -#endif -#endif - -#line 217 "/usr/lib/bison.simple" - -/* The user can define YYPARSE_PARAM as the name of an argument to be passed - into yyparse. The argument should have type void *. - It should actually point to an object. - Grammar actions can access the variable by casting it - to the proper pointer type. */ - -#ifdef YYPARSE_PARAM -#ifdef __cplusplus -#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM -#define YYPARSE_PARAM_DECL -#else /* not __cplusplus */ -#define YYPARSE_PARAM_ARG YYPARSE_PARAM -#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; -#endif /* not __cplusplus */ -#else /* not YYPARSE_PARAM */ -#define YYPARSE_PARAM_ARG -#define YYPARSE_PARAM_DECL -#endif /* not YYPARSE_PARAM */ - -/* Prevent warning if -Wstrict-prototypes. */ -#ifdef __GNUC__ -#ifdef YYPARSE_PARAM -int yyparse (void *); -#else -int yyparse (void); -#endif -#endif - -int -yyparse(YYPARSE_PARAM_ARG) - YYPARSE_PARAM_DECL -{ - register int yystate; - register int yyn; - register short *yyssp; - register YYSTYPE *yyvsp; - int yyerrstatus; /* number of tokens to shift before error messages enabled */ - int yychar1 = 0; /* lookahead token as an internal (translated) token number */ - - short yyssa[YYINITDEPTH]; /* the state stack */ - YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ - - short *yyss = yyssa; /* refer to the stacks thru separate pointers */ - YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ - -#ifdef YYLSP_NEEDED - YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ - YYLTYPE *yyls = yylsa; - YYLTYPE *yylsp; - -#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) -#else -#define YYPOPSTACK (yyvsp--, yyssp--) -#endif - - int yystacksize = YYINITDEPTH; - int yyfree_stacks = 0; - -#ifdef YYPURE - int yychar; - YYSTYPE yylval; - int yynerrs; -#ifdef YYLSP_NEEDED - YYLTYPE yylloc; -#endif -#endif - - YYSTYPE yyval; /* the variable used to return */ - /* semantic values from the action */ - /* routines */ - - int yylen; - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Starting parse\n"); -#endif - - yystate = 0; - yyerrstatus = 0; - yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ - - /* Initialize stack pointers. - Waste one element of value and location stack - so that they stay on the same level as the state stack. - The wasted elements are never initialized. */ - - yyssp = yyss - 1; - yyvsp = yyvs; -#ifdef YYLSP_NEEDED - yylsp = yyls; -#endif - -/* Push a new state, which is found in yystate . */ -/* In all cases, when you get here, the value and location stacks - have just been pushed. so pushing a state here evens the stacks. */ -yynewstate: - - *++yyssp = yystate; - - if (yyssp >= yyss + yystacksize - 1) - { - /* Give user a chance to reallocate the stack */ - /* Use copies of these so that the &'s don't force the real ones into memory. */ - YYSTYPE *yyvs1 = yyvs; - short *yyss1 = yyss; -#ifdef YYLSP_NEEDED - YYLTYPE *yyls1 = yyls; -#endif - - /* Get the current used size of the three stacks, in elements. */ - int size = yyssp - yyss + 1; - -#ifdef yyoverflow - /* Each stack pointer address is followed by the size of - the data in use in that stack, in bytes. */ -#ifdef YYLSP_NEEDED - /* This used to be a conditional around just the two extra args, - but that might be undefined if yyoverflow is a macro. */ - yyoverflow("parser stack overflow", - &yyss1, size * sizeof (*yyssp), - &yyvs1, size * sizeof (*yyvsp), - &yyls1, size * sizeof (*yylsp), - &yystacksize); -#else - yyoverflow("parser stack overflow", - &yyss1, size * sizeof (*yyssp), - &yyvs1, size * sizeof (*yyvsp), - &yystacksize); -#endif - - yyss = yyss1; yyvs = yyvs1; -#ifdef YYLSP_NEEDED - yyls = yyls1; -#endif -#else /* no yyoverflow */ - /* Extend the stack our own way. */ - if (yystacksize >= YYMAXDEPTH) - { - yyerror("parser stack overflow"); - if (yyfree_stacks) - { - free (yyss); - free (yyvs); -#ifdef YYLSP_NEEDED - free (yyls); -#endif - } - return 2; - } - yystacksize *= 2; - if (yystacksize > YYMAXDEPTH) - yystacksize = YYMAXDEPTH; -#ifndef YYSTACK_USE_ALLOCA - yyfree_stacks = 1; -#endif - yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); - __yy_memcpy ((char *)yyss, (char *)yyss1, - size * (unsigned int) sizeof (*yyssp)); - yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); - __yy_memcpy ((char *)yyvs, (char *)yyvs1, - size * (unsigned int) sizeof (*yyvsp)); -#ifdef YYLSP_NEEDED - yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); - __yy_memcpy ((char *)yyls, (char *)yyls1, - size * (unsigned int) sizeof (*yylsp)); -#endif -#endif /* no yyoverflow */ - - yyssp = yyss + size - 1; - yyvsp = yyvs + size - 1; -#ifdef YYLSP_NEEDED - yylsp = yyls + size - 1; -#endif - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Stack size increased to %d\n", yystacksize); -#endif - - if (yyssp >= yyss + yystacksize - 1) - YYABORT; - } - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Entering state %d\n", yystate); -#endif - - goto yybackup; - yybackup: - -/* Do appropriate processing given the current state. */ -/* Read a lookahead token if we need one and don't already have one. */ -/* yyresume: */ - - /* First try to decide what to do without reference to lookahead token. */ - - yyn = yypact[yystate]; - if (yyn == YYFLAG) - goto yydefault; - - /* Not known => get a lookahead token if don't already have one. */ - - /* yychar is either YYEMPTY or YYEOF - or a valid token in external form. */ - - if (yychar == YYEMPTY) - { -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Reading a token: "); -#endif - yychar = YYLEX; - } - - /* Convert token to internal form (in yychar1) for indexing tables with */ - - if (yychar <= 0) /* This means end of input. */ - { - yychar1 = 0; - yychar = YYEOF; /* Don't call YYLEX any more */ - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Now at end of input.\n"); -#endif - } - else - { - yychar1 = YYTRANSLATE(yychar); - -#if YYDEBUG != 0 - if (yydebug) - { - fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); - /* Give the individual parser a way to print the precise meaning - of a token, for further debugging info. */ -#ifdef YYPRINT - YYPRINT (stderr, yychar, yylval); -#endif - fprintf (stderr, ")\n"); - } -#endif - } - - yyn += yychar1; - if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) - goto yydefault; - - yyn = yytable[yyn]; - - /* yyn is what to do for this token type in this state. - Negative => reduce, -yyn is rule number. - Positive => shift, yyn is new state. - New state is final state => don't bother to shift, - just return success. - 0, or most negative number => error. */ - - if (yyn < 0) - { - if (yyn == YYFLAG) - goto yyerrlab; - yyn = -yyn; - goto yyreduce; - } - else if (yyn == 0) - goto yyerrlab; - - if (yyn == YYFINAL) - YYACCEPT; - - /* Shift the lookahead token. */ - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); -#endif - - /* Discard the token being shifted unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; - - *++yyvsp = yylval; -#ifdef YYLSP_NEEDED - *++yylsp = yylloc; -#endif - - /* count tokens shifted since error; after three, turn off error status. */ - if (yyerrstatus) yyerrstatus--; - - yystate = yyn; - goto yynewstate; - -/* Do the default action for the current state. */ -yydefault: - - yyn = yydefact[yystate]; - if (yyn == 0) - goto yyerrlab; - -/* Do a reduction. yyn is the number of a rule to reduce with. */ -yyreduce: - yylen = yyr2[yyn]; - if (yylen > 0) - yyval = yyvsp[1-yylen]; /* implement default value of the action */ - -#if YYDEBUG != 0 - if (yydebug) - { - int i; - - fprintf (stderr, "Reducing via rule %d (line %d), ", - yyn, yyrline[yyn]); - - /* Print the symbols being reduced, and their result. */ - for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) - fprintf (stderr, "%s ", yytname[yyrhs[i]]); - fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); - } -#endif - - - switch (yyn) { - -case 2: -#line 146 "parse.y" -{ - free_buffer(); - parse_init(); - ; - break;} -case 14: -#line 170 "parse.y" -{ - int status; - - status = setkeymsg_add(SADB_ADD, yyvsp[-4].num, yyvsp[-6].res, yyvsp[-5].res); - if (status < 0) - return -1; - ; - break;} -case 15: -#line 182 "parse.y" -{ - int status; - - if (yyvsp[-5].res->ai_next || yyvsp[-4].res->ai_next) { - yyerror("multiple address specified"); - return -1; - } - if (p_mode != IPSEC_MODE_ANY) - yyerror("WARNING: mode is obsolete"); - - status = setkeymsg_addr(SADB_DELETE, yyvsp[-3].num, yyvsp[-5].res, yyvsp[-4].res, 0); - if (status < 0) - return -1; - ; - break;} -case 16: -#line 201 "parse.y" -{ - int status; - - status = setkeymsg_addr(SADB_DELETE, yyvsp[-1].num, yyvsp[-3].res, yyvsp[-2].res, 1); - if (status < 0) - return -1; - ; - break;} -case 17: -#line 213 "parse.y" -{ - int status; - - if (p_mode != IPSEC_MODE_ANY) - yyerror("WARNING: mode is obsolete"); - - status = setkeymsg_addr(SADB_GET, yyvsp[-3].num, yyvsp[-5].res, yyvsp[-4].res, 0); - if (status < 0) - return -1; - ; - break;} -case 18: -#line 228 "parse.y" -{ - struct sadb_msg msg; - setkeymsg0(&msg, SADB_FLUSH, yyvsp[-1].num, sizeof(msg)); - sendkeymsg((char *)&msg, sizeof(msg)); - ; - break;} -case 19: -#line 238 "parse.y" -{ - struct sadb_msg msg; - setkeymsg0(&msg, SADB_DUMP, yyvsp[-1].num, sizeof(msg)); - sendkeymsg((char *)&msg, sizeof(msg)); - ; - break;} -case 20: -#line 247 "parse.y" -{ - yyval.num = SADB_SATYPE_UNSPEC; - ; - break;} -case 21: -#line 251 "parse.y" -{ - yyval.num = SADB_SATYPE_ESP; - if (yyvsp[0].num == 1) - p_ext |= SADB_X_EXT_OLD; - else - p_ext &= ~SADB_X_EXT_OLD; - ; - break;} -case 22: -#line 259 "parse.y" -{ - yyval.num = SADB_SATYPE_AH; - if (yyvsp[0].num == 1) - p_ext |= SADB_X_EXT_OLD; - else - p_ext &= ~SADB_X_EXT_OLD; - ; - break;} -case 23: -#line 267 "parse.y" -{ - yyval.num = SADB_X_SATYPE_IPCOMP; - ; - break;} -case 24: -#line 271 "parse.y" -{ - yyval.num = SADB_SATYPE_ESP; - p_ext &= ~SADB_X_EXT_OLD; - p_natt_oa = 0; - p_natt_type = UDP_ENCAP_ESPINUDP; - ; - break;} -case 25: -#line 278 "parse.y" -{ - yyval.num = SADB_SATYPE_ESP; - p_ext &= ~SADB_X_EXT_OLD; - p_natt_oa = yyvsp[0].res; - p_natt_type = UDP_ENCAP_ESPINUDP; - ; - break;} -case 26: -#line 285 "parse.y" -{ -#ifdef SADB_X_SATYPE_TCPSIGNATURE - yyval.num = SADB_X_SATYPE_TCPSIGNATURE; -#endif - ; - break;} -case 27: -#line 293 "parse.y" -{ p_spi = yyvsp[0].ulnum; ; - break;} -case 28: -#line 295 "parse.y" -{ - char *ep; - unsigned long v; - - ep = NULL; - v = strtoul(yyvsp[0].val.buf, &ep, 16); - if (!ep || *ep) { - yyerror("invalid SPI"); - return -1; - } - if (v & ~0xffffffff) { - yyerror("SPI too big."); - return -1; - } - - p_spi = v; - ; - break;} -case 35: -#line 331 "parse.y" -{ - if (yyvsp[0].num < 0) { - yyerror("unsupported algorithm"); - return -1; - } - p_alg_enc = yyvsp[0].num; - ; - break;} -case 36: -#line 339 "parse.y" -{ - if (yyvsp[-1].num < 0) { - yyerror("unsupported algorithm"); - return -1; - } - p_alg_enc = yyvsp[-1].num; - p_ext |= SADB_X_EXT_RAWCPI; - ; - break;} -case 37: -#line 350 "parse.y" -{ - if (yyvsp[0].num < 0) { - yyerror("unsupported algorithm"); - return -1; - } - p_alg_enc = yyvsp[0].num; - - p_key_enc_len = 0; - p_key_enc = ""; - if (ipsec_check_keylen(SADB_EXT_SUPPORTED_ENCRYPT, - p_alg_enc, PFKEY_UNUNIT64(p_key_enc_len)) < 0) { - yyerror(ipsec_strerror()); - return -1; - } - ; - break;} -case 38: -#line 365 "parse.y" -{ - if (yyvsp[-1].num < 0) { - yyerror("unsupported algorithm"); - return -1; - } - p_alg_enc = yyvsp[-1].num; - - p_key_enc_len = yyvsp[0].val.len; - p_key_enc = yyvsp[0].val.buf; - if (ipsec_check_keylen(SADB_EXT_SUPPORTED_ENCRYPT, - p_alg_enc, PFKEY_UNUNIT64(p_key_enc_len)) < 0) { - yyerror(ipsec_strerror()); - return -1; - } - ; - break;} -case 39: -#line 380 "parse.y" -{ - if (yyvsp[0].num < 0) { - yyerror("unsupported algorithm"); - return -1; - } - yyerror("WARNING: obsolete algorithm"); - p_alg_enc = yyvsp[0].num; - - p_key_enc_len = 0; - p_key_enc = ""; - if (ipsec_check_keylen(SADB_EXT_SUPPORTED_ENCRYPT, - p_alg_enc, PFKEY_UNUNIT64(p_key_enc_len)) < 0) { - yyerror(ipsec_strerror()); - return -1; - } - ; - break;} -case 40: -#line 397 "parse.y" -{ - if (yyvsp[-1].num < 0) { - yyerror("unsupported algorithm"); - return -1; - } - p_alg_enc = yyvsp[-1].num; - if (p_ext & SADB_X_EXT_OLD) { - yyerror("algorithm mismatched"); - return -1; - } - p_ext |= SADB_X_EXT_DERIV; - - p_key_enc_len = yyvsp[0].val.len; - p_key_enc = yyvsp[0].val.buf; - if (ipsec_check_keylen(SADB_EXT_SUPPORTED_ENCRYPT, - p_alg_enc, PFKEY_UNUNIT64(p_key_enc_len)) < 0) { - yyerror(ipsec_strerror()); - return -1; - } - ; - break;} -case 41: -#line 418 "parse.y" -{ - if (yyvsp[-1].num < 0) { - yyerror("unsupported algorithm"); - return -1; - } - p_alg_enc = yyvsp[-1].num; - if (!(p_ext & SADB_X_EXT_OLD)) { - yyerror("algorithm mismatched"); - return -1; - } - p_ext |= SADB_X_EXT_IV4B; - - p_key_enc_len = yyvsp[0].val.len; - p_key_enc = yyvsp[0].val.buf; - if (ipsec_check_keylen(SADB_EXT_SUPPORTED_ENCRYPT, - p_alg_enc, PFKEY_UNUNIT64(p_key_enc_len)) < 0) { - yyerror(ipsec_strerror()); - return -1; - } - ; - break;} -case 42: -#line 441 "parse.y" -{ - if (yyvsp[-1].num < 0) { - yyerror("unsupported algorithm"); - return -1; - } - p_alg_auth = yyvsp[-1].num; - - p_key_auth_len = yyvsp[0].val.len; - p_key_auth = yyvsp[0].val.buf; -#ifdef SADB_X_AALG_TCP_MD5 - if (p_alg_auth == SADB_X_AALG_TCP_MD5) { - if ((p_key_auth_len < 1) || - (p_key_auth_len > 80)) - return -1; - } else -#endif - { - if (ipsec_check_keylen(SADB_EXT_SUPPORTED_AUTH, - p_alg_auth, - PFKEY_UNUNIT64(p_key_auth_len)) < 0) { - yyerror(ipsec_strerror()); - return -1; - } - } - ; - break;} -case 43: -#line 466 "parse.y" -{ - if (yyvsp[0].num < 0) { - yyerror("unsupported algorithm"); - return -1; - } - p_alg_auth = yyvsp[0].num; - - p_key_auth_len = 0; - p_key_auth = NULL; - ; - break;} -case 44: -#line 480 "parse.y" -{ - yyval.val = yyvsp[0].val; - ; - break;} -case 45: -#line 484 "parse.y" -{ - caddr_t pp_key; - caddr_t bp; - caddr_t yp = yyvsp[0].val.buf; - int l; - - l = strlen(yp) % 2 + strlen(yp) / 2; - if ((pp_key = malloc(l)) == 0) { - yyerror("not enough core"); - return -1; - } - memset(pp_key, 0, l); - - bp = pp_key; - if (strlen(yp) % 2) { - *bp = ATOX(yp[0]); - yp++, bp++; - } - while (*yp) { - *bp = (ATOX(yp[0]) << 4) | ATOX(yp[1]); - yp += 2, bp++; - } - - yyval.val.len = l; - yyval.val.buf = pp_key; - ; - break;} -case 48: -#line 518 "parse.y" -{ p_ext |= yyvsp[0].num; ; - break;} -case 49: -#line 519 "parse.y" -{ p_ext &= ~SADB_X_EXT_CYCSEQ; ; - break;} -case 50: -#line 520 "parse.y" -{ p_mode = yyvsp[0].num; ; - break;} -case 51: -#line 521 "parse.y" -{ p_mode = IPSEC_MODE_ANY; ; - break;} -case 52: -#line 522 "parse.y" -{ p_reqid = yyvsp[0].ulnum; ; - break;} -case 53: -#line 524 "parse.y" -{ - if ((p_ext & SADB_X_EXT_OLD) != 0) { - yyerror("replay prevention cannot be used with " - "ah/esp-old"); - return -1; - } - p_replay = yyvsp[0].ulnum; - ; - break;} -case 54: -#line 532 "parse.y" -{ p_lt_hard = yyvsp[0].ulnum; ; - break;} -case 55: -#line 533 "parse.y" -{ p_lt_soft = yyvsp[0].ulnum; ; - break;} -case 56: -#line 534 "parse.y" -{ p_lb_hard = yyvsp[0].ulnum; ; - break;} -case 57: -#line 535 "parse.y" -{ p_lb_soft = yyvsp[0].ulnum; ; - break;} -case 58: -#line 542 "parse.y" -{ - int status; - struct addrinfo *src, *dst; - -#ifdef HAVE_PFKEY_POLICY_PRIORITY - last_msg_type = SADB_X_SPDADD; -#endif - - /* fixed port fields if ulp is icmpv6 */ - if (yyvsp[-2].val.buf != NULL) { - if (yyvsp[-3].num != IPPROTO_ICMPV6) - return -1; - free(yyvsp[-7].val.buf); - free(yyvsp[-4].val.buf); - if (fix_portstr(&yyvsp[-2].val, &yyvsp[-7].val, &yyvsp[-4].val)) - return -1; - } - - src = parse_addr(yyvsp[-9].val.buf, yyvsp[-7].val.buf); - dst = parse_addr(yyvsp[-6].val.buf, yyvsp[-4].val.buf); - if (!src || !dst) { - /* yyerror is already called */ - return -1; - } - if (src->ai_next || dst->ai_next) { - yyerror("multiple address specified"); - freeaddrinfo(src); - freeaddrinfo(dst); - return -1; - } - - status = setkeymsg_spdaddr(SADB_X_SPDADD, yyvsp[-3].num, &yyvsp[-1].val, - src, yyvsp[-8].num, dst, yyvsp[-5].num); - freeaddrinfo(src); - freeaddrinfo(dst); - if (status < 0) - return -1; - ; - break;} -case 59: -#line 581 "parse.y" -{ - int status; - - status = setkeymsg_spdaddr_tag(SADB_X_SPDADD, - yyvsp[-2].val.buf, &yyvsp[-1].val); - if (status < 0) - return -1; - ; - break;} -case 60: -#line 593 "parse.y" -{ - int status; - struct addrinfo *src, *dst; - - /* fixed port fields if ulp is icmpv6 */ - if (yyvsp[-2].val.buf != NULL) { - if (yyvsp[-3].num != IPPROTO_ICMPV6) - return -1; - free(yyvsp[-7].val.buf); - free(yyvsp[-4].val.buf); - if (fix_portstr(&yyvsp[-2].val, &yyvsp[-7].val, &yyvsp[-4].val)) - return -1; - } - - src = parse_addr(yyvsp[-9].val.buf, yyvsp[-7].val.buf); - dst = parse_addr(yyvsp[-6].val.buf, yyvsp[-4].val.buf); - if (!src || !dst) { - /* yyerror is already called */ - return -1; - } - if (src->ai_next || dst->ai_next) { - yyerror("multiple address specified"); - freeaddrinfo(src); - freeaddrinfo(dst); - return -1; - } - - status = setkeymsg_spdaddr(SADB_X_SPDDELETE, yyvsp[-3].num, &yyvsp[-1].val, - src, yyvsp[-8].num, dst, yyvsp[-5].num); - freeaddrinfo(src); - freeaddrinfo(dst); - if (status < 0) - return -1; - ; - break;} -case 61: -#line 631 "parse.y" -{ - struct sadb_msg msg; - setkeymsg0(&msg, SADB_X_SPDDUMP, SADB_SATYPE_UNSPEC, - sizeof(msg)); - sendkeymsg((char *)&msg, sizeof(msg)); - ; - break;} -case 62: -#line 642 "parse.y" -{ - struct sadb_msg msg; - setkeymsg0(&msg, SADB_X_SPDFLUSH, SADB_SATYPE_UNSPEC, - sizeof(msg)); - sendkeymsg((char *)&msg, sizeof(msg)); - ; - break;} -case 65: -#line 657 "parse.y" -{ - char *p; - - for (p = yyvsp[0].val.buf + 1; *p; p++) - switch (*p) { - case '4': - p_aifamily = AF_INET; - break; -#ifdef INET6 - case '6': - p_aifamily = AF_INET6; - break; -#endif - case 'n': - p_aiflags = AI_NUMERICHOST; - break; - default: - yyerror("invalid flag"); - return -1; - } - ; - break;} -case 66: -#line 682 "parse.y" -{ - yyval.res = parse_addr(yyvsp[0].val.buf, NULL); - if (yyval.res == NULL) { - /* yyerror already called by parse_addr */ - return -1; - } - ; - break;} -case 67: -#line 693 "parse.y" -{ - yyval.res = parse_addr(yyvsp[0].val.buf, NULL); - if (yyval.res == NULL) { - /* yyerror already called by parse_addr */ - return -1; - } - ; - break;} -case 68: -#line 701 "parse.y" -{ - yyval.res = parse_addr(yyvsp[-1].val.buf, yyvsp[0].val.buf); - if (yyval.res == NULL) { - /* yyerror already called by parse_addr */ - return -1; - } - ; - break;} -case 69: -#line 712 "parse.y" -{ yyval.num = -1; ; - break;} -case 70: -#line 713 "parse.y" -{ yyval.num = yyvsp[0].ulnum; ; - break;} -case 71: -#line 718 "parse.y" -{ - yyval.val.buf = strdup("0"); - if (!yyval.val.buf) { - yyerror("insufficient memory"); - return -1; - } - yyval.val.len = strlen(yyval.val.buf); - ; - break;} -case 72: -#line 727 "parse.y" -{ - yyval.val.buf = strdup("0"); - if (!yyval.val.buf) { - yyerror("insufficient memory"); - return -1; - } - yyval.val.len = strlen(yyval.val.buf); - ; - break;} -case 73: -#line 736 "parse.y" -{ - char buf[20]; - snprintf(buf, sizeof(buf), "%lu", yyvsp[-1].ulnum); - yyval.val.buf = strdup(buf); - if (!yyval.val.buf) { - yyerror("insufficient memory"); - return -1; - } - yyval.val.len = strlen(yyval.val.buf); - ; - break;} -case 74: -#line 747 "parse.y" -{ - yyval.val = yyvsp[-1].val; - ; - break;} -case 75: -#line 753 "parse.y" -{ yyval.num = yyvsp[0].ulnum; ; - break;} -case 76: -#line 754 "parse.y" -{ yyval.num = IPSEC_ULPROTO_ANY; ; - break;} -case 77: -#line 755 "parse.y" -{ - yyval.num = IPPROTO_TCP; - ; - break;} -case 78: -#line 759 "parse.y" -{ - struct protoent *ent; - - ent = getprotobyname(yyvsp[0].val.buf); - if (ent) - yyval.num = ent->p_proto; - else { - if (strcmp("icmp6", yyvsp[0].val.buf) == 0) { - yyval.num = IPPROTO_ICMPV6; - } else if(strcmp("ip4", yyvsp[0].val.buf) == 0) { - yyval.num = IPPROTO_IPV4; - } else { - yyerror("invalid upper layer protocol"); - return -1; - } - } - endprotoent(); - ; - break;} -case 79: -#line 781 "parse.y" -{ - yyval.val.buf = NULL; - yyval.val.len = 0; - ; - break;} -case 80: -#line 786 "parse.y" -{ - yyval.val.buf = strdup(yyvsp[0].val.buf); - if (!yyval.val.buf) { - yyerror("insufficient memory"); - return -1; - } - yyval.val.len = strlen(yyval.val.buf); - ; - break;} -case 81: -#line 798 "parse.y" -{ - char *policy; -#ifdef HAVE_PFKEY_POLICY_PRIORITY - struct sadb_x_policy *xpl; -#endif - - policy = ipsec_set_policy(yyvsp[0].val.buf, yyvsp[0].val.len); - if (policy == NULL) { - yyerror(ipsec_strerror()); - return -1; - } - - yyval.val.buf = policy; - yyval.val.len = ipsec_get_policylen(policy); - -#ifdef HAVE_PFKEY_POLICY_PRIORITY - xpl = (struct sadb_x_policy *) yyval.val.buf; - last_priority = xpl->sadb_x_policy_priority; -#endif - ; - break;} -case 82: -#line 821 "parse.y" -{ yyval.val = yyvsp[0].val; ; - break;} -case 83: -#line 827 "parse.y" -{ - exit_now = 1; - YYACCEPT; - ; - break;} -} - /* the action file gets copied in in place of this dollarsign */ -#line 543 "/usr/lib/bison.simple" - - yyvsp -= yylen; - yyssp -= yylen; -#ifdef YYLSP_NEEDED - yylsp -= yylen; -#endif - -#if YYDEBUG != 0 - if (yydebug) - { - short *ssp1 = yyss - 1; - fprintf (stderr, "state stack now"); - while (ssp1 != yyssp) - fprintf (stderr, " %d", *++ssp1); - fprintf (stderr, "\n"); - } -#endif - - *++yyvsp = yyval; - -#ifdef YYLSP_NEEDED - yylsp++; - if (yylen == 0) - { - yylsp->first_line = yylloc.first_line; - yylsp->first_column = yylloc.first_column; - yylsp->last_line = (yylsp-1)->last_line; - yylsp->last_column = (yylsp-1)->last_column; - yylsp->text = 0; - } - else - { - yylsp->last_line = (yylsp+yylen-1)->last_line; - yylsp->last_column = (yylsp+yylen-1)->last_column; - } -#endif - - /* Now "shift" the result of the reduction. - Determine what state that goes to, - based on the state we popped back to - and the rule number reduced by. */ - - yyn = yyr1[yyn]; - - yystate = yypgoto[yyn - YYNTBASE] + *yyssp; - if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) - yystate = yytable[yystate]; - else - yystate = yydefgoto[yyn - YYNTBASE]; - - goto yynewstate; - -yyerrlab: /* here on detecting error */ - - if (! yyerrstatus) - /* If not already recovering from an error, report this error. */ - { - ++yynerrs; - -#ifdef YYERROR_VERBOSE - yyn = yypact[yystate]; - - if (yyn > YYFLAG && yyn < YYLAST) - { - int size = 0; - char *msg; - int x, count; - - count = 0; - /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ - for (x = (yyn < 0 ? -yyn : 0); - x < (sizeof(yytname) / sizeof(char *)); x++) - if (yycheck[x + yyn] == x) - size += strlen(yytname[x]) + 15, count++; - msg = (char *) malloc(size + 15); - if (msg != 0) - { - strcpy(msg, "parse error"); - - if (count < 5) - { - count = 0; - for (x = (yyn < 0 ? -yyn : 0); - x < (sizeof(yytname) / sizeof(char *)); x++) - if (yycheck[x + yyn] == x) - { - strcat(msg, count == 0 ? ", expecting `" : " or `"); - strcat(msg, yytname[x]); - strcat(msg, "'"); - count++; - } - } - yyerror(msg); - free(msg); - } - else - yyerror ("parse error; also virtual memory exceeded"); - } - else -#endif /* YYERROR_VERBOSE */ - yyerror("parse error"); - } - - goto yyerrlab1; -yyerrlab1: /* here on error raised explicitly by an action */ - - if (yyerrstatus == 3) - { - /* if just tried and failed to reuse lookahead token after an error, discard it. */ - - /* return failure if at end of input */ - if (yychar == YYEOF) - YYABORT; - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); -#endif - - yychar = YYEMPTY; - } - - /* Else will try to reuse lookahead token - after shifting the error token. */ - - yyerrstatus = 3; /* Each real token shifted decrements this */ - - goto yyerrhandle; - -yyerrdefault: /* current state does not do anything special for the error token. */ - -#if 0 - /* This is wrong; only states that explicitly want error tokens - should shift them. */ - yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ - if (yyn) goto yydefault; -#endif - -yyerrpop: /* pop the current state because it cannot handle the error token */ - - if (yyssp == yyss) YYABORT; - yyvsp--; - yystate = *--yyssp; -#ifdef YYLSP_NEEDED - yylsp--; -#endif - -#if YYDEBUG != 0 - if (yydebug) - { - short *ssp1 = yyss - 1; - fprintf (stderr, "Error: state stack now"); - while (ssp1 != yyssp) - fprintf (stderr, " %d", *++ssp1); - fprintf (stderr, "\n"); - } -#endif - -yyerrhandle: - - yyn = yypact[yystate]; - if (yyn == YYFLAG) - goto yyerrdefault; - - yyn += YYTERROR; - if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) - goto yyerrdefault; - - yyn = yytable[yyn]; - if (yyn < 0) - { - if (yyn == YYFLAG) - goto yyerrpop; - yyn = -yyn; - goto yyreduce; - } - else if (yyn == 0) - goto yyerrpop; - - if (yyn == YYFINAL) - YYACCEPT; - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Shifting error token, "); -#endif - - *++yyvsp = yylval; -#ifdef YYLSP_NEEDED - *++yylsp = yylloc; -#endif - - yystate = yyn; - goto yynewstate; - - yyacceptlab: - /* YYACCEPT comes here. */ - if (yyfree_stacks) - { - free (yyss); - free (yyvs); -#ifdef YYLSP_NEEDED - free (yyls); -#endif - } - return 0; - - yyabortlab: - /* YYABORT comes here. */ - if (yyfree_stacks) - { - free (yyss); - free (yyvs); -#ifdef YYLSP_NEEDED - free (yyls); -#endif - } - return 1; -} -#line 832 "parse.y" - - -int -setkeymsg0(msg, type, satype, l) - struct sadb_msg *msg; - unsigned int type; - unsigned int satype; - size_t l; -{ - - msg->sadb_msg_version = PF_KEY_V2; - msg->sadb_msg_type = type; - msg->sadb_msg_errno = 0; - msg->sadb_msg_satype = satype; - msg->sadb_msg_reserved = 0; - msg->sadb_msg_seq = 0; - msg->sadb_msg_pid = getpid(); - msg->sadb_msg_len = PFKEY_UNIT64(l); - return 0; -} - -/* XXX NO BUFFER OVERRUN CHECK! BAD BAD! */ -static int -setkeymsg_spdaddr(type, upper, policy, srcs, splen, dsts, dplen) - unsigned int type; - unsigned int upper; - vchar_t *policy; - struct addrinfo *srcs; - int splen; - struct addrinfo *dsts; - int dplen; -{ - struct sadb_msg *msg; - char buf[BUFSIZ]; - int l, l0; - struct sadb_address m_addr; - struct addrinfo *s, *d; - int n; - int plen; - struct sockaddr *sa; - int salen; - struct sadb_x_policy *sp; -#ifdef HAVE_POLICY_FWD - struct sadb_x_ipsecrequest *ps = NULL; - int saved_level, saved_id = 0; -#endif - - msg = (struct sadb_msg *)buf; - - if (!srcs || !dsts) - return -1; - - /* fix up length afterwards */ - setkeymsg0(msg, type, SADB_SATYPE_UNSPEC, 0); - l = sizeof(struct sadb_msg); - - sp = (struct sadb_x_policy*) (buf + l); - memcpy(buf + l, policy->buf, policy->len); - l += policy->len; - - l0 = l; - n = 0; - - /* do it for all src/dst pairs */ - for (s = srcs; s; s = s->ai_next) { - for (d = dsts; d; d = d->ai_next) { - /* rewind pointer */ - l = l0; - - if (s->ai_addr->sa_family != d->ai_addr->sa_family) - continue; - switch (s->ai_addr->sa_family) { - case AF_INET: - plen = sizeof(struct in_addr) << 3; - break; -#ifdef INET6 - case AF_INET6: - plen = sizeof(struct in6_addr) << 3; - break; -#endif - default: - continue; - } - - /* set src */ - sa = s->ai_addr; - salen = sysdep_sa_len(s->ai_addr); - m_addr.sadb_address_len = PFKEY_UNIT64(sizeof(m_addr) + - PFKEY_ALIGN8(salen)); - m_addr.sadb_address_exttype = SADB_EXT_ADDRESS_SRC; - m_addr.sadb_address_proto = upper; - m_addr.sadb_address_prefixlen = - (splen >= 0 ? splen : plen); - m_addr.sadb_address_reserved = 0; - - setvarbuf(buf, &l, (struct sadb_ext *)&m_addr, - sizeof(m_addr), (caddr_t)sa, salen); - - /* set dst */ - sa = d->ai_addr; - salen = sysdep_sa_len(d->ai_addr); - m_addr.sadb_address_len = PFKEY_UNIT64(sizeof(m_addr) + - PFKEY_ALIGN8(salen)); - m_addr.sadb_address_exttype = SADB_EXT_ADDRESS_DST; - m_addr.sadb_address_proto = upper; - m_addr.sadb_address_prefixlen = - (dplen >= 0 ? dplen : plen); - m_addr.sadb_address_reserved = 0; - - setvarbuf(buf, &l, (struct sadb_ext *)&m_addr, - sizeof(m_addr), sa, salen); - - msg->sadb_msg_len = PFKEY_UNIT64(l); - - sendkeymsg(buf, l); - -#ifdef HAVE_POLICY_FWD - /* create extra call for FWD policy */ - if (f_rfcmode && sp->sadb_x_policy_dir == IPSEC_DIR_INBOUND) { - sp->sadb_x_policy_dir = IPSEC_DIR_FWD; - ps = (struct sadb_x_ipsecrequest*) (sp+1); - - /* if request level is unique, change it to - * require for fwd policy */ - /* XXX: currently, only first policy is updated - * only. Update following too... */ - saved_level = ps->sadb_x_ipsecrequest_level; - if (saved_level == IPSEC_LEVEL_UNIQUE) { - saved_id = ps->sadb_x_ipsecrequest_reqid; - ps->sadb_x_ipsecrequest_reqid=0; - ps->sadb_x_ipsecrequest_level=IPSEC_LEVEL_REQUIRE; - } - - sendkeymsg(buf, l); - /* restoring for next message */ - sp->sadb_x_policy_dir = IPSEC_DIR_INBOUND; - if (saved_level == IPSEC_LEVEL_UNIQUE) { - ps->sadb_x_ipsecrequest_reqid = saved_id; - ps->sadb_x_ipsecrequest_level = saved_level; - } - } -#endif - - n++; - } - } - - if (n == 0) - return -1; - else - return 0; -} - -static int -setkeymsg_spdaddr_tag(type, tag, policy) - unsigned int type; - char *tag; - vchar_t *policy; -{ - struct sadb_msg *msg; - char buf[BUFSIZ]; - int l, l0; -#ifdef SADB_X_EXT_TAG - struct sadb_x_tag m_tag; -#endif - int n; - - msg = (struct sadb_msg *)buf; - - /* fix up length afterwards */ - setkeymsg0(msg, type, SADB_SATYPE_UNSPEC, 0); - l = sizeof(struct sadb_msg); - - memcpy(buf + l, policy->buf, policy->len); - l += policy->len; - - l0 = l; - n = 0; - -#ifdef SADB_X_EXT_TAG - memset(&m_tag, 0, sizeof(m_tag)); - m_tag.sadb_x_tag_len = PFKEY_UNIT64(sizeof(m_tag)); - m_tag.sadb_x_tag_exttype = SADB_X_EXT_TAG; - if (strlcpy(m_tag.sadb_x_tag_name, tag, - sizeof(m_tag.sadb_x_tag_name)) >= sizeof(m_tag.sadb_x_tag_name)) - return -1; - memcpy(buf + l, &m_tag, sizeof(m_tag)); - l += sizeof(m_tag); -#endif - - msg->sadb_msg_len = PFKEY_UNIT64(l); - - sendkeymsg(buf, l); - - return 0; -} - -/* XXX NO BUFFER OVERRUN CHECK! BAD BAD! */ -static int -setkeymsg_addr(type, satype, srcs, dsts, no_spi) - unsigned int type; - unsigned int satype; - struct addrinfo *srcs; - struct addrinfo *dsts; - int no_spi; -{ - struct sadb_msg *msg; - char buf[BUFSIZ]; - int l, l0, len; - struct sadb_sa m_sa; - struct sadb_x_sa2 m_sa2; - struct sadb_address m_addr; - struct addrinfo *s, *d; - int n; - int plen; - struct sockaddr *sa; - int salen; - - msg = (struct sadb_msg *)buf; - - if (!srcs || !dsts) - return -1; - - /* fix up length afterwards */ - setkeymsg0(msg, type, satype, 0); - l = sizeof(struct sadb_msg); - - if (!no_spi) { - len = sizeof(struct sadb_sa); - m_sa.sadb_sa_len = PFKEY_UNIT64(len); - m_sa.sadb_sa_exttype = SADB_EXT_SA; - m_sa.sadb_sa_spi = htonl(p_spi); - m_sa.sadb_sa_replay = p_replay; - m_sa.sadb_sa_state = 0; - m_sa.sadb_sa_auth = p_alg_auth; - m_sa.sadb_sa_encrypt = p_alg_enc; - m_sa.sadb_sa_flags = p_ext; - - memcpy(buf + l, &m_sa, len); - l += len; - - len = sizeof(struct sadb_x_sa2); - m_sa2.sadb_x_sa2_len = PFKEY_UNIT64(len); - m_sa2.sadb_x_sa2_exttype = SADB_X_EXT_SA2; - m_sa2.sadb_x_sa2_mode = p_mode; - m_sa2.sadb_x_sa2_reqid = p_reqid; - - memcpy(buf + l, &m_sa2, len); - l += len; - } - - l0 = l; - n = 0; - - /* do it for all src/dst pairs */ - for (s = srcs; s; s = s->ai_next) { - for (d = dsts; d; d = d->ai_next) { - /* rewind pointer */ - l = l0; - - if (s->ai_addr->sa_family != d->ai_addr->sa_family) - continue; - switch (s->ai_addr->sa_family) { - case AF_INET: - plen = sizeof(struct in_addr) << 3; - break; -#ifdef INET6 - case AF_INET6: - plen = sizeof(struct in6_addr) << 3; - break; -#endif - default: - continue; - } - - /* set src */ - sa = s->ai_addr; - salen = sysdep_sa_len(s->ai_addr); - m_addr.sadb_address_len = PFKEY_UNIT64(sizeof(m_addr) + - PFKEY_ALIGN8(salen)); - m_addr.sadb_address_exttype = SADB_EXT_ADDRESS_SRC; - m_addr.sadb_address_proto = IPSEC_ULPROTO_ANY; - m_addr.sadb_address_prefixlen = plen; - m_addr.sadb_address_reserved = 0; - - setvarbuf(buf, &l, (struct sadb_ext *)&m_addr, - sizeof(m_addr), sa, salen); - - /* set dst */ - sa = d->ai_addr; - salen = sysdep_sa_len(d->ai_addr); - m_addr.sadb_address_len = PFKEY_UNIT64(sizeof(m_addr) + - PFKEY_ALIGN8(salen)); - m_addr.sadb_address_exttype = SADB_EXT_ADDRESS_DST; - m_addr.sadb_address_proto = IPSEC_ULPROTO_ANY; - m_addr.sadb_address_prefixlen = plen; - m_addr.sadb_address_reserved = 0; - - setvarbuf(buf, &l, (struct sadb_ext *)&m_addr, - sizeof(m_addr), sa, salen); - - msg->sadb_msg_len = PFKEY_UNIT64(l); - - sendkeymsg(buf, l); - - n++; - } - } - - if (n == 0) - return -1; - else - return 0; -} - -#ifdef SADB_X_EXT_NAT_T_TYPE -static u_int16_t get_port (struct addrinfo *addr) -{ - struct sockaddr *s = addr->ai_addr; - u_int16_t port = 0; - - switch (s->sa_family) { - case AF_INET: - { - struct sockaddr_in *sin4 = (struct sockaddr_in *)s; - port = ntohs(sin4->sin_port); - break; - } - case AF_INET6: - { - struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)s; - port = ntohs(sin6->sin6_port); - break; - } - } - - if (port == 0) - port = DEFAULT_NATT_PORT; - - return port; -} -#endif - -/* XXX NO BUFFER OVERRUN CHECK! BAD BAD! */ -static int -setkeymsg_add(type, satype, srcs, dsts) - unsigned int type; - unsigned int satype; - struct addrinfo *srcs; - struct addrinfo *dsts; -{ - struct sadb_msg *msg; - char buf[BUFSIZ]; - int l, l0, len; - struct sadb_sa m_sa; - struct sadb_x_sa2 m_sa2; - struct sadb_address m_addr; - struct addrinfo *s, *d; - int n; - int plen; - struct sockaddr *sa; - int salen; - - msg = (struct sadb_msg *)buf; - - if (!srcs || !dsts) - return -1; - - /* fix up length afterwards */ - setkeymsg0(msg, type, satype, 0); - l = sizeof(struct sadb_msg); - - /* set encryption algorithm, if present. */ - if (satype != SADB_X_SATYPE_IPCOMP && p_key_enc) { - union { - struct sadb_key key; - struct sadb_ext ext; - } m; - - m.key.sadb_key_len = - PFKEY_UNIT64(sizeof(m.key) - + PFKEY_ALIGN8(p_key_enc_len)); - m.key.sadb_key_exttype = SADB_EXT_KEY_ENCRYPT; - m.key.sadb_key_bits = p_key_enc_len * 8; - m.key.sadb_key_reserved = 0; - - setvarbuf(buf, &l, &m.ext, sizeof(m.key), - p_key_enc, p_key_enc_len); - } - - /* set authentication algorithm, if present. */ - if (p_key_auth) { - union { - struct sadb_key key; - struct sadb_ext ext; - } m; - - m.key.sadb_key_len = - PFKEY_UNIT64(sizeof(m.key) - + PFKEY_ALIGN8(p_key_auth_len)); - m.key.sadb_key_exttype = SADB_EXT_KEY_AUTH; - m.key.sadb_key_bits = p_key_auth_len * 8; - m.key.sadb_key_reserved = 0; - - setvarbuf(buf, &l, &m.ext, sizeof(m.key), - p_key_auth, p_key_auth_len); - } - - /* set lifetime for HARD */ - if (p_lt_hard != 0 || p_lb_hard != 0) { - struct sadb_lifetime m_lt; - u_int slen = sizeof(struct sadb_lifetime); - - m_lt.sadb_lifetime_len = PFKEY_UNIT64(slen); - m_lt.sadb_lifetime_exttype = SADB_EXT_LIFETIME_HARD; - m_lt.sadb_lifetime_allocations = 0; - m_lt.sadb_lifetime_bytes = p_lb_hard; - m_lt.sadb_lifetime_addtime = p_lt_hard; - m_lt.sadb_lifetime_usetime = 0; - - memcpy(buf + l, &m_lt, slen); - l += slen; - } - - /* set lifetime for SOFT */ - if (p_lt_soft != 0 || p_lb_soft != 0) { - struct sadb_lifetime m_lt; - u_int slen = sizeof(struct sadb_lifetime); - - m_lt.sadb_lifetime_len = PFKEY_UNIT64(slen); - m_lt.sadb_lifetime_exttype = SADB_EXT_LIFETIME_SOFT; - m_lt.sadb_lifetime_allocations = 0; - m_lt.sadb_lifetime_bytes = p_lb_soft; - m_lt.sadb_lifetime_addtime = p_lt_soft; - m_lt.sadb_lifetime_usetime = 0; - - memcpy(buf + l, &m_lt, slen); - l += slen; - } - - len = sizeof(struct sadb_sa); - m_sa.sadb_sa_len = PFKEY_UNIT64(len); - m_sa.sadb_sa_exttype = SADB_EXT_SA; - m_sa.sadb_sa_spi = htonl(p_spi); - m_sa.sadb_sa_replay = p_replay; - m_sa.sadb_sa_state = 0; - m_sa.sadb_sa_auth = p_alg_auth; - m_sa.sadb_sa_encrypt = p_alg_enc; - m_sa.sadb_sa_flags = p_ext; - - memcpy(buf + l, &m_sa, len); - l += len; - - len = sizeof(struct sadb_x_sa2); - m_sa2.sadb_x_sa2_len = PFKEY_UNIT64(len); - m_sa2.sadb_x_sa2_exttype = SADB_X_EXT_SA2; - m_sa2.sadb_x_sa2_mode = p_mode; - m_sa2.sadb_x_sa2_reqid = p_reqid; - - memcpy(buf + l, &m_sa2, len); - l += len; - -#ifdef SADB_X_EXT_NAT_T_TYPE - if (p_natt_type) { - struct sadb_x_nat_t_type natt_type; - - len = sizeof(struct sadb_x_nat_t_type); - memset(&natt_type, 0, len); - natt_type.sadb_x_nat_t_type_len = PFKEY_UNIT64(len); - natt_type.sadb_x_nat_t_type_exttype = SADB_X_EXT_NAT_T_TYPE; - natt_type.sadb_x_nat_t_type_type = p_natt_type; - - memcpy(buf + l, &natt_type, len); - l += len; - - if (p_natt_oa) { - sa = p_natt_oa->ai_addr; - switch (sa->sa_family) { - case AF_INET: - plen = sizeof(struct in_addr) << 3; - break; -#ifdef INET6 - case AF_INET6: - plen = sizeof(struct in6_addr) << 3; - break; -#endif - default: - return -1; - } - salen = sysdep_sa_len(sa); - m_addr.sadb_address_len = PFKEY_UNIT64(sizeof(m_addr) + - PFKEY_ALIGN8(salen)); - m_addr.sadb_address_exttype = SADB_X_EXT_NAT_T_OA; - m_addr.sadb_address_proto = IPSEC_ULPROTO_ANY; - m_addr.sadb_address_prefixlen = plen; - m_addr.sadb_address_reserved = 0; - - setvarbuf(buf, &l, (struct sadb_ext *)&m_addr, - sizeof(m_addr), sa, salen); - } - } -#endif - - l0 = l; - n = 0; - - /* do it for all src/dst pairs */ - for (s = srcs; s; s = s->ai_next) { - for (d = dsts; d; d = d->ai_next) { - /* rewind pointer */ - l = l0; - - if (s->ai_addr->sa_family != d->ai_addr->sa_family) - continue; - switch (s->ai_addr->sa_family) { - case AF_INET: - plen = sizeof(struct in_addr) << 3; - break; -#ifdef INET6 - case AF_INET6: - plen = sizeof(struct in6_addr) << 3; - break; -#endif - default: - continue; - } - - /* set src */ - sa = s->ai_addr; - salen = sysdep_sa_len(s->ai_addr); - m_addr.sadb_address_len = PFKEY_UNIT64(sizeof(m_addr) + - PFKEY_ALIGN8(salen)); - m_addr.sadb_address_exttype = SADB_EXT_ADDRESS_SRC; - m_addr.sadb_address_proto = IPSEC_ULPROTO_ANY; - m_addr.sadb_address_prefixlen = plen; - m_addr.sadb_address_reserved = 0; - - setvarbuf(buf, &l, (struct sadb_ext *)&m_addr, - sizeof(m_addr), sa, salen); - - /* set dst */ - sa = d->ai_addr; - salen = sysdep_sa_len(d->ai_addr); - m_addr.sadb_address_len = PFKEY_UNIT64(sizeof(m_addr) + - PFKEY_ALIGN8(salen)); - m_addr.sadb_address_exttype = SADB_EXT_ADDRESS_DST; - m_addr.sadb_address_proto = IPSEC_ULPROTO_ANY; - m_addr.sadb_address_prefixlen = plen; - m_addr.sadb_address_reserved = 0; - - setvarbuf(buf, &l, (struct sadb_ext *)&m_addr, - sizeof(m_addr), sa, salen); - -#ifdef SADB_X_EXT_NAT_T_TYPE - if (p_natt_type) { - struct sadb_x_nat_t_port natt_port; - - /* NATT_SPORT */ - len = sizeof(struct sadb_x_nat_t_port); - memset(&natt_port, 0, len); - natt_port.sadb_x_nat_t_port_len = PFKEY_UNIT64(len); - natt_port.sadb_x_nat_t_port_exttype = - SADB_X_EXT_NAT_T_SPORT; - natt_port.sadb_x_nat_t_port_port = htons(get_port(s)); - - memcpy(buf + l, &natt_port, len); - l += len; - - /* NATT_DPORT */ - natt_port.sadb_x_nat_t_port_exttype = - SADB_X_EXT_NAT_T_DPORT; - natt_port.sadb_x_nat_t_port_port = htons(get_port(d)); - - memcpy(buf + l, &natt_port, len); - l += len; - } -#endif - msg->sadb_msg_len = PFKEY_UNIT64(l); - - sendkeymsg(buf, l); - - n++; - } - } - - if (n == 0) - return -1; - else - return 0; -} - -static struct addrinfo * -parse_addr(host, port) - char *host; - char *port; -{ - struct addrinfo hints, *res = NULL; - int error; - - memset(&hints, 0, sizeof(hints)); - hints.ai_family = p_aifamily; - hints.ai_socktype = SOCK_DGRAM; /*dummy*/ - hints.ai_protocol = IPPROTO_UDP; /*dummy*/ - hints.ai_flags = p_aiflags; - error = getaddrinfo(host, port, &hints, &res); - if (error != 0) { - yyerror(gai_strerror(error)); - return NULL; - } - return res; -} - -static int -fix_portstr(spec, sport, dport) - vchar_t *spec, *sport, *dport; -{ - const char *p, *p2 = "0"; - char *q; - u_int l; - - l = 0; - for (q = spec->buf; *q != ',' && *q != '\0' && l < spec->len; q++, l++) - ; - if (*q != '\0') { - if (*q == ',') { - *q = '\0'; - p2 = ++q; - } - for (p = p2; *p != '\0' && l < spec->len; p++, l++) - ; - if (*p != '\0' || *p2 == '\0') { - yyerror("invalid an upper layer protocol spec"); - return -1; - } - } - - sport->buf = strdup(spec->buf); - if (!sport->buf) { - yyerror("insufficient memory"); - return -1; - } - sport->len = strlen(sport->buf); - dport->buf = strdup(p2); - if (!dport->buf) { - yyerror("insufficient memory"); - return -1; - } - dport->len = strlen(dport->buf); - - return 0; -} - -static int -setvarbuf(buf, off, ebuf, elen, vbuf, vlen) - char *buf; - int *off; - struct sadb_ext *ebuf; - int elen; - const void *vbuf; - int vlen; -{ - memset(buf + *off, 0, PFKEY_UNUNIT64(ebuf->sadb_ext_len)); - memcpy(buf + *off, (caddr_t)ebuf, elen); - memcpy(buf + *off + elen, vbuf, vlen); - (*off) += PFKEY_ALIGN8(elen + vlen); - - return 0; -} - -void -parse_init() -{ - p_spi = 0; - - p_ext = SADB_X_EXT_CYCSEQ; - p_alg_enc = SADB_EALG_NONE; - p_alg_auth = SADB_AALG_NONE; - p_mode = IPSEC_MODE_ANY; - p_reqid = 0; - p_replay = 0; - p_key_enc_len = p_key_auth_len = 0; - p_key_enc = p_key_auth = 0; - p_lt_hard = p_lt_soft = 0; - p_lb_hard = p_lb_soft = 0; - - p_aiflags = 0; - p_aifamily = PF_UNSPEC; - - /* Clear out any natt OA information */ - if (p_natt_oa) - freeaddrinfo (p_natt_oa); - p_natt_oa = NULL; - p_natt_type = 0; - - return; -} - -void -free_buffer() -{ - /* we got tons of memory leaks in the parser anyways, leave them */ - - return; -} diff --git a/crypto/dist/ipsec-tools/src/setkey/parse.h b/crypto/dist/ipsec-tools/src/setkey/parse.h deleted file mode 100644 index 1eb289a98e22..000000000000 --- a/crypto/dist/ipsec-tools/src/setkey/parse.h +++ /dev/null @@ -1,64 +0,0 @@ -/* $NetBSD: parse.h,v 1.2 2005/11/21 14:20:36 manu Exp $ */ - -typedef union { - int num; - unsigned long ulnum; - vchar_t val; - struct addrinfo *res; -} YYSTYPE; -#define EOT 257 -#define SLASH 258 -#define BLCL 259 -#define ELCL 260 -#define ADD 261 -#define GET 262 -#define DELETE 263 -#define DELETEALL 264 -#define FLUSH 265 -#define DUMP 266 -#define EXIT 267 -#define PR_ESP 268 -#define PR_AH 269 -#define PR_IPCOMP 270 -#define PR_ESPUDP 271 -#define PR_TCP 272 -#define F_PROTOCOL 273 -#define F_AUTH 274 -#define F_ENC 275 -#define F_REPLAY 276 -#define F_COMP 277 -#define F_RAWCPI 278 -#define F_MODE 279 -#define MODE 280 -#define F_REQID 281 -#define F_EXT 282 -#define EXTENSION 283 -#define NOCYCLICSEQ 284 -#define ALG_AUTH 285 -#define ALG_AUTH_NOKEY 286 -#define ALG_ENC 287 -#define ALG_ENC_NOKEY 288 -#define ALG_ENC_DESDERIV 289 -#define ALG_ENC_DES32IV 290 -#define ALG_ENC_OLD 291 -#define ALG_COMP 292 -#define F_LIFETIME_HARD 293 -#define F_LIFETIME_SOFT 294 -#define F_LIFEBYTE_HARD 295 -#define F_LIFEBYTE_SOFT 296 -#define DECSTRING 297 -#define QUOTEDSTRING 298 -#define HEXSTRING 299 -#define STRING 300 -#define ANY 301 -#define SPDADD 302 -#define SPDDELETE 303 -#define SPDDUMP 304 -#define SPDFLUSH 305 -#define F_POLICY 306 -#define PL_REQUESTS 307 -#define F_AIFLAGS 308 -#define TAGGED 309 - - -extern YYSTYPE yylval; diff --git a/crypto/dist/ipsec-tools/src/setkey/token.c b/crypto/dist/ipsec-tools/src/setkey/token.c deleted file mode 100644 index d739e06de9f1..000000000000 --- a/crypto/dist/ipsec-tools/src/setkey/token.c +++ /dev/null @@ -1,2677 +0,0 @@ -/* $NetBSD: token.c,v 1.2 2005/11/21 14:20:36 manu Exp $ */ - -/* A lexical scanner generated by flex */ - -/* Scanner skeleton version: - * Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp - */ - -#define FLEX_SCANNER -#define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 - -#include - - -/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ -#ifdef c_plusplus -#ifndef __cplusplus -#define __cplusplus -#endif -#endif - - -#ifdef __cplusplus - -#include -#include - -/* Use prototypes in function declarations. */ -#define YY_USE_PROTOS - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -#if __STDC__ - -#define YY_USE_PROTOS -#define YY_USE_CONST - -#endif /* __STDC__ */ -#endif /* ! __cplusplus */ - -#ifdef __TURBOC__ - #pragma warn -rch - #pragma warn -use -#include -#include -#define YY_USE_CONST -#define YY_USE_PROTOS -#endif - -#ifdef YY_USE_CONST -#define yyconst const -#else -#define yyconst -#endif - - -#ifdef YY_USE_PROTOS -#define YY_PROTO(proto) proto -#else -#define YY_PROTO(proto) () -#endif - -/* Returned upon end-of-file. */ -#define YY_NULL 0 - -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. - */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) - -/* Enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN. - */ -#define BEGIN yy_start = 1 + 2 * - -/* Translate the current start state into a value that can be later handed - * to BEGIN to return to the state. The YYSTATE alias is for lex - * compatibility. - */ -#define YY_START ((yy_start - 1) / 2) -#define YYSTATE YY_START - -/* Action number for EOF rule of a given start state. */ -#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - -/* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart( yyin ) - -#define YY_END_OF_BUFFER_CHAR 0 - -/* Size of default input buffer. */ -#define YY_BUF_SIZE 16384 - -typedef struct yy_buffer_state *YY_BUFFER_STATE; - -extern int yyleng; -extern FILE *yyin, *yyout; - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - -/* The funky do-while in the following #define is used to turn the definition - * int a single C statement (which needs a semi-colon terminator). This - * avoids problems with code like: - * - * if ( condition_holds ) - * yyless( 5 ); - * else - * do_something_else(); - * - * Prior to using the do-while the compiler would get upset at the - * "else" because it interpreted the "if" statement as being all - * done when it reached the ';' after the yyless() call. - */ - -/* Return all but the first 'n' matched characters back to the input stream. */ - -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - *yy_cp = yy_hold_char; \ - YY_RESTORE_YY_MORE_OFFSET \ - yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } \ - while ( 0 ) - -#define unput(c) yyunput( c, yytext_ptr ) - -/* The following is because we cannot portably get our hands on size_t - * (without autoconf's help, which isn't available because we want - * flex-generated scanners to compile on their own). - */ -typedef unsigned int yy_size_t; - - -struct yy_buffer_state - { - FILE *yy_input_file; - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - int yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; - - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; - - int yy_buffer_status; -#define YY_BUFFER_NEW 0 -#define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. - */ -#define YY_BUFFER_EOF_PENDING 2 - }; - -static YY_BUFFER_STATE yy_current_buffer = 0; - -/* We provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state". - */ -#define YY_CURRENT_BUFFER yy_current_buffer - - -/* yy_hold_char holds the character lost when yytext is formed. */ -static char yy_hold_char; - -static int yy_n_chars; /* number of characters read into yy_ch_buf */ - - -int yyleng; - -/* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; -static int yy_init = 1; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ - -/* Flag which is used to allow yywrap()'s to do buffer switches - * instead of setting up a fresh yyin. A bit of a hack ... - */ -static int yy_did_buffer_switch_on_eof; - -void yyrestart YY_PROTO(( FILE *input_file )); - -void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); -void yy_load_buffer_state YY_PROTO(( void )); -YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); -void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); -void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); -void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); -#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) - -YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); -YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); -YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); - -static void *yy_flex_alloc YY_PROTO(( yy_size_t )); -static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); -static void yy_flex_free YY_PROTO(( void * )); - -#define yy_new_buffer yy_create_buffer - -#define yy_set_interactive(is_interactive) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_is_interactive = is_interactive; \ - } - -#define yy_set_bol(at_bol) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_at_bol = at_bol; \ - } - -#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) - -typedef unsigned char YY_CHAR; -FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; -typedef int yy_state_type; -extern char *yytext; -#define yytext_ptr yytext - -static yy_state_type yy_get_previous_state YY_PROTO(( void )); -static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); -static int yy_get_next_buffer YY_PROTO(( void )); -static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); - -/* Done after the current pattern has been matched and before the - * corresponding action - sets up yytext. - */ -#define YY_DO_BEFORE_ACTION \ - yytext_ptr = yy_bp; \ - yytext_ptr -= yy_more_len; \ - yyleng = (int) (yy_cp - yytext_ptr); \ - yy_hold_char = *yy_cp; \ - *yy_cp = '\0'; \ - yy_c_buf_p = yy_cp; - -#define YY_NUM_RULES 87 -#define YY_END_OF_BUFFER 88 -static yyconst short int yy_accept[536] = - { 0, - 0, 0, 0, 0, 0, 0, 0, 0, 88, 86, - 74, 75, 86, 76, 85, 86, 78, 81, 81, 84, - 77, 79, 80, 84, 84, 84, 84, 84, 84, 84, - 84, 84, 84, 84, 84, 84, 84, 84, 16, 16, - 16, 16, 16, 16, 16, 16, 17, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 84, 84, 84, 84, 84, 81, 84, 84, - 84, 84, 84, 84, 84, 84, 74, 0, 83, 76, - 85, 18, 26, 54, 41, 15, 58, 0, 63, 0, - 59, 68, 62, 84, 81, 84, 84, 19, 84, 84, - - 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, - 84, 84, 84, 84, 84, 84, 84, 84, 84, 16, - 16, 16, 16, 16, 16, 15, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 84, - 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, - 84, 84, 84, 18, 71, 72, 69, 70, 82, 1, - 84, 73, 9, 84, 84, 84, 20, 84, 84, 4, - 84, 57, 84, 55, 84, 84, 84, 84, 84, 25, - - 84, 84, 84, 16, 16, 16, 16, 16, 16, 1, - 16, 16, 9, 16, 16, 16, 16, 16, 16, 4, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 84, 84, 84, 84, 25, 84, 84, - 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, - 6, 84, 7, 84, 84, 84, 8, 84, 84, 84, - 84, 84, 84, 84, 84, 84, 16, 16, 16, 6, - 16, 7, 16, 16, 16, 8, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 84, 84, 84, 40, 84, - 84, 84, 84, 84, 84, 44, 84, 84, 84, 84, - - 84, 84, 84, 84, 5, 84, 84, 84, 84, 84, - 84, 84, 84, 84, 84, 84, 84, 16, 16, 16, - 16, 16, 5, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 84, 84, 84, 84, 84, - 84, 84, 84, 84, 84, 84, 84, 84, 84, 21, - 84, 2, 84, 84, 24, 84, 84, 84, 10, 84, - 84, 84, 14, 84, 61, 84, 16, 16, 2, 16, - 16, 16, 16, 16, 16, 10, 16, 16, 16, 14, - 16, 16, 16, 84, 84, 84, 84, 84, 84, 84, - 84, 84, 84, 84, 84, 84, 84, 84, 45, 84, - - 56, 84, 22, 23, 84, 84, 65, 84, 12, 84, - 84, 84, 16, 16, 16, 16, 16, 16, 16, 16, - 12, 16, 16, 16, 84, 84, 84, 84, 84, 84, - 39, 84, 51, 53, 84, 84, 84, 42, 84, 84, - 84, 84, 84, 84, 84, 13, 84, 66, 16, 16, - 16, 16, 13, 16, 16, 84, 27, 84, 84, 84, - 84, 43, 84, 84, 49, 84, 84, 84, 3, 84, - 84, 11, 60, 3, 16, 16, 11, 16, 84, 84, - 28, 84, 84, 84, 29, 84, 84, 84, 48, 84, - 84, 84, 64, 16, 16, 84, 84, 84, 84, 84, - - 84, 30, 84, 84, 84, 84, 84, 16, 84, 84, - 84, 84, 84, 32, 34, 36, 84, 47, 84, 50, - 67, 16, 38, 84, 84, 84, 84, 46, 52, 84, - 31, 33, 35, 37, 0 - } ; - -static yyconst int yy_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 2, 1, 4, 5, 1, 6, 1, 1, 1, - 1, 1, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 19, 21, 22, 1, - 1, 1, 1, 1, 23, 24, 25, 24, 26, 24, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 27, - 21, 28, 21, 21, 21, 21, 21, 29, 21, 21, - 30, 1, 31, 1, 32, 1, 33, 34, 35, 36, - - 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - 57, 58, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1 - } ; - -static yyconst int yy_meta[59] = - { 0, - 1, 2, 3, 1, 1, 4, 2, 5, 4, 4, - 2, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 4, 1, 4, 4, 4, 4, 4, 4, 4, 2, - 2, 2, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4 - } ; - -static yyconst short int yy_base[542] = - { 0, - 0, 0, 58, 0, 84, 85, 123, 161, 1492, 1493, - 1489, 1493, 1486, 0, 0, 198, 1493, 244, 293, 1481, - 1493, 1493, 1493, 114, 111, 112, 115, 118, 124, 131, - 125, 133, 132, 134, 113, 140, 156, 126, 1486, 0, - 298, 0, 0, 350, 405, 197, 1493, 436, 146, 194, - 199, 107, 229, 231, 232, 234, 246, 249, 251, 282, - 338, 301, 309, 127, 144, 137, 342, 1451, 364, 332, - 185, 346, 241, 352, 421, 395, 1484, 1481, 1493, 0, - 0, 313, 1493, 1493, 1493, 1493, 1493, 104, 1493, 127, - 1493, 1493, 1493, 1476, 0, 475, 162, 193, 246, 209, - - 388, 275, 245, 386, 378, 382, 202, 225, 379, 401, - 432, 288, 290, 397, 296, 403, 438, 407, 348, 1481, - 0, 438, 0, 0, 0, 0, 0, 401, 0, 409, - 0, 0, 0, 419, 0, 506, 434, 518, 439, 509, - 521, 526, 533, 534, 542, 547, 550, 558, 565, 566, - 574, 577, 582, 589, 594, 596, 605, 603, 610, 453, - 469, 449, 473, 455, 470, 497, 489, 525, 619, 507, - 508, 539, 530, 573, 1493, 1493, 1493, 1493, 0, 1474, - 545, 1473, 1472, 608, 526, 520, 211, 595, 613, 1471, - 618, 1470, 478, 1469, 616, 640, 645, 647, 650, 1468, - - 629, 651, 653, 653, 0, 0, 0, 0, 0, 626, - 641, 638, 646, 658, 669, 655, 681, 672, 674, 683, - 686, 694, 695, 702, 703, 710, 727, 724, 729, 736, - 738, 741, 743, 736, 745, 659, 703, 750, 665, 777, - 699, 685, 783, 753, 705, 758, 763, 780, 785, 786, - 1467, 787, 1466, 788, 552, 790, 1465, 792, 794, 791, - 795, 797, 796, 799, 800, 801, 775, 780, 807, 809, - 816, 818, 821, 830, 837, 838, 845, 850, 853, 864, - 867, 869, 872, 884, 886, 804, 814, 843, 1464, 823, - 821, 809, 827, 389, 919, 1463, 880, 838, 894, 889, - - 828, 906, 920, 911, 1462, 921, 923, 925, 928, 929, - 930, 931, 932, 936, 933, 934, 938, 912, 937, 913, - 944, 920, 951, 956, 959, 970, 978, 973, 981, 986, - 993, 994, 1001, 1008, 1015, 963, 1015, 954, 943, 985, - 960, 967, 319, 993, 207, 1020, 949, 1027, 992, 1461, - 1030, 1037, 1042, 1028, 1460, 1034, 1050, 1045, 1459, 1048, - 1054, 1060, 1458, 1061, 1457, 1063, 1037, 1051, 1046, 1044, - 1053, 1058, 1069, 1086, 1067, 1078, 1083, 1085, 1094, 1101, - 1102, 1110, 1118, 1066, 1108, 1098, 1119, 1120, 1135, 1127, - 1128, 1145, 1104, 1149, 1152, 1154, 1158, 1159, 1456, 1160, - - 1455, 1162, 1454, 1453, 1164, 1165, 1452, 1166, 1451, 1167, - 1169, 1168, 1142, 1165, 1144, 1145, 1180, 1181, 1188, 1195, - 1196, 1197, 1204, 1209, 1175, 1186, 1190, 1179, 1178, 1217, - 1450, 1231, 1449, 1448, 1222, 1214, 1194, 1447, 1238, 1243, - 1244, 1248, 1250, 1252, 1253, 1440, 1255, 1428, 1228, 1258, - 1237, 1259, 1229, 1257, 1240, 1273, 1418, 1263, 1298, 1293, - 1281, 1417, 1308, 1283, 1416, 1270, 1311, 1294, 1413, 1276, - 1300, 1408, 1401, 1285, 1286, 1294, 1299, 1302, 1315, 1320, - 1280, 1335, 1333, 1184, 1171, 1338, 1339, 1325, 1109, 1341, - 1346, 1342, 1064, 1321, 1326, 1348, 1347, 1356, 1360, 1361, - - 1374, 937, 1355, 1367, 1376, 1377, 1378, 1351, 1382, 1385, - 1384, 1386, 1391, 886, 879, 863, 1387, 806, 1388, 720, - 671, 1367, 600, 1397, 1400, 1403, 1406, 529, 456, 544, - 307, 230, 214, 121, 1493, 1427, 1433, 1435, 1438, 1443, - 1448 - } ; - -static yyconst short int yy_def[542] = - { 0, - 535, 1, 535, 3, 1, 1, 1, 1, 535, 535, - 535, 535, 536, 537, 538, 535, 535, 539, 539, 539, - 535, 535, 535, 539, 539, 539, 539, 539, 539, 539, - 539, 539, 539, 539, 539, 539, 539, 539, 540, 540, - 540, 540, 540, 541, 541, 541, 535, 541, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 539, 539, 539, 539, 539, 19, 539, 539, - 539, 539, 539, 539, 539, 539, 535, 536, 535, 537, - 538, 535, 535, 535, 535, 535, 535, 535, 535, 535, - 535, 535, 535, 539, 19, 19, 539, 539, 539, 539, - - 539, 539, 539, 539, 539, 539, 539, 539, 539, 539, - 539, 539, 539, 539, 539, 539, 539, 539, 539, 540, - 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, - 540, 540, 540, 48, 45, 45, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 539, - 539, 539, 539, 539, 539, 539, 539, 539, 539, 539, - 539, 539, 539, 535, 535, 535, 535, 535, 96, 539, - 539, 539, 539, 539, 539, 539, 539, 539, 539, 539, - 539, 539, 539, 539, 539, 539, 539, 539, 539, 539, - - 539, 539, 539, 540, 540, 540, 540, 540, 136, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 539, 539, 539, 539, 539, 539, 539, - 539, 539, 539, 539, 539, 539, 539, 539, 539, 539, - 539, 539, 539, 539, 539, 539, 539, 539, 539, 539, - 539, 539, 539, 539, 539, 539, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 539, 539, 539, 539, 539, - 539, 539, 539, 539, 539, 539, 539, 539, 539, 539, - - 539, 539, 539, 539, 539, 539, 539, 539, 539, 539, - 539, 539, 539, 539, 539, 539, 539, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 539, 539, 539, 539, 539, - 539, 539, 539, 539, 539, 539, 539, 539, 539, 539, - 539, 539, 539, 539, 539, 539, 539, 539, 539, 539, - 539, 539, 539, 539, 539, 539, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 539, 539, 539, 539, 539, 539, 539, - 539, 539, 539, 539, 539, 539, 539, 539, 539, 539, - - 539, 539, 539, 539, 539, 539, 539, 539, 539, 539, - 539, 539, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 539, 539, 539, 539, 539, 539, - 539, 539, 539, 539, 539, 539, 539, 539, 539, 539, - 539, 539, 539, 539, 539, 539, 539, 539, 48, 48, - 48, 48, 48, 48, 48, 539, 539, 539, 539, 539, - 539, 539, 539, 539, 539, 539, 539, 539, 539, 539, - 539, 539, 539, 48, 48, 48, 48, 48, 539, 539, - 539, 539, 539, 539, 539, 539, 539, 539, 539, 539, - 539, 539, 539, 48, 48, 539, 539, 539, 539, 539, - - 539, 539, 539, 539, 539, 539, 539, 48, 539, 539, - 539, 539, 539, 539, 539, 539, 539, 539, 539, 539, - 539, 48, 539, 539, 539, 539, 539, 539, 539, 539, - 539, 539, 539, 539, 0, 535, 535, 535, 535, 535, - 535 - } ; - -static yyconst short int yy_nxt[1552] = - { 0, - 10, 11, 12, 13, 14, 10, 10, 15, 16, 10, - 17, 18, 19, 19, 19, 19, 19, 19, 19, 19, - 20, 21, 20, 20, 20, 20, 20, 20, 20, 22, - 23, 10, 24, 25, 20, 26, 27, 28, 29, 20, - 30, 20, 20, 31, 20, 32, 33, 20, 34, 35, - 36, 37, 20, 20, 20, 20, 20, 38, 10, 39, - 40, 13, 14, 10, 10, 15, 41, 42, 43, 44, - 45, 45, 45, 45, 45, 45, 45, 45, 46, 47, - 46, 46, 46, 46, 46, 46, 46, 22, 23, 42, - 48, 49, 46, 50, 51, 52, 53, 46, 54, 46, - - 46, 55, 46, 56, 57, 46, 58, 59, 60, 61, - 46, 46, 46, 46, 46, 62, 63, 63, 535, 535, - 535, 535, 535, 64, 64, 535, 65, 65, 535, 66, - 66, 535, 535, 535, 535, 67, 67, 68, 535, 535, - 535, 535, 134, 175, 535, 112, 134, 535, 101, 97, - 145, 535, 134, 98, 176, 69, 70, 71, 72, 99, - 106, 105, 119, 535, 102, 103, 177, 100, 73, 535, - 104, 161, 74, 75, 76, 68, 113, 178, 107, 109, - 162, 134, 108, 109, 110, 134, 111, 114, 115, 163, - 116, 134, 535, 69, 70, 71, 72, 180, 121, 121, - - 535, 181, 140, 121, 535, 117, 73, 121, 118, 535, - 74, 75, 76, 82, 535, 82, 535, 168, 535, 252, - 83, 535, 84, 85, 86, 87, 121, 121, 121, 134, - 141, 88, 535, 134, 134, 89, 191, 535, 134, 134, - 396, 90, 91, 82, 134, 183, 142, 92, 535, 143, - 93, 81, 535, 535, 144, 95, 95, 95, 95, 95, - 95, 95, 95, 95, 134, 146, 134, 134, 134, 134, - 134, 134, 96, 134, 134, 192, 134, 134, 147, 134, - 149, 134, 535, 152, 134, 134, 134, 109, 134, 148, - 134, 134, 187, 170, 134, 535, 134, 535, 150, 96, - - 81, 151, 182, 535, 95, 95, 95, 95, 95, 95, - 95, 95, 95, 122, 535, 122, 535, 134, 153, 186, - 123, 134, 124, 125, 126, 127, 535, 134, 174, 154, - 174, 128, 394, 196, 199, 129, 134, 159, 197, 535, - 134, 130, 131, 122, 97, 160, 134, 132, 98, 535, - 133, 121, 121, 535, 99, 535, 121, 81, 174, 535, - 121, 135, 135, 135, 135, 135, 135, 135, 135, 135, - 155, 535, 156, 134, 115, 167, 164, 134, 136, 121, - 121, 121, 169, 134, 112, 535, 535, 157, 100, 535, - 158, 117, 171, 535, 118, 535, 535, 203, 102, 97, - - 166, 343, 535, 98, 535, 136, 121, 121, 535, 99, - 535, 121, 81, 193, 535, 121, 135, 135, 135, 135, - 135, 135, 135, 135, 135, 184, 188, 115, 535, 116, - 189, 185, 198, 190, 121, 121, 121, 121, 121, 535, - 205, 194, 121, 535, 117, 535, 121, 118, 207, 173, - 200, 206, 202, 204, 134, 204, 535, 113, 134, 208, - 535, 172, 535, 535, 134, 121, 121, 121, 114, 210, - 201, 137, 195, 134, 134, 138, 535, 535, 134, 134, - 535, 139, 535, 204, 134, 535, 179, 179, 179, 179, - 179, 179, 179, 179, 179, 212, 535, 179, 179, 179, - - 179, 235, 238, 234, 535, 236, 239, 179, 179, 179, - 179, 179, 179, 535, 535, 535, 237, 209, 209, 209, - 209, 209, 209, 209, 209, 209, 211, 535, 209, 209, - 209, 209, 535, 535, 256, 241, 535, 535, 209, 209, - 209, 209, 209, 209, 134, 213, 535, 240, 134, 245, - 244, 535, 535, 134, 134, 534, 134, 134, 214, 535, - 134, 134, 250, 134, 215, 134, 134, 251, 134, 134, - 216, 134, 134, 134, 218, 242, 247, 134, 134, 134, - 217, 134, 134, 246, 221, 134, 134, 134, 174, 134, - 174, 248, 134, 134, 219, 134, 306, 134, 220, 223, - - 134, 134, 535, 134, 134, 134, 224, 535, 222, 134, - 134, 134, 134, 134, 225, 535, 134, 134, 174, 134, - 535, 134, 226, 535, 228, 535, 535, 134, 134, 134, - 227, 134, 229, 134, 134, 134, 535, 231, 134, 134, - 134, 134, 134, 230, 134, 134, 253, 535, 232, 134, - 134, 249, 535, 259, 535, 134, 184, 535, 535, 233, - 535, 134, 185, 254, 255, 134, 535, 257, 204, 243, - 204, 134, 535, 134, 264, 258, 134, 134, 535, 260, - 134, 134, 261, 134, 262, 134, 134, 267, 263, 271, - 134, 134, 535, 134, 134, 288, 265, 134, 204, 266, - - 134, 268, 270, 134, 134, 269, 535, 134, 134, 134, - 535, 134, 535, 134, 134, 291, 134, 134, 134, 134, - 134, 134, 134, 272, 273, 134, 134, 535, 134, 134, - 134, 134, 274, 134, 134, 278, 294, 134, 134, 134, - 134, 134, 134, 535, 286, 277, 289, 134, 134, 134, - 297, 275, 535, 293, 276, 134, 279, 535, 290, 280, - 535, 281, 134, 134, 134, 535, 134, 282, 134, 134, - 535, 134, 134, 134, 134, 134, 134, 134, 134, 287, - 134, 134, 134, 283, 535, 292, 284, 535, 134, 285, - 535, 295, 535, 535, 535, 535, 296, 535, 535, 535, - - 299, 535, 535, 535, 535, 298, 535, 535, 535, 317, - 134, 535, 319, 535, 134, 134, 535, 301, 318, 134, - 134, 535, 337, 300, 307, 134, 310, 305, 535, 340, - 535, 311, 314, 303, 535, 535, 316, 302, 308, 304, - 313, 309, 134, 341, 134, 535, 134, 312, 134, 315, - 535, 134, 134, 134, 134, 134, 134, 134, 320, 336, - 323, 134, 321, 134, 342, 134, 134, 339, 322, 134, - 535, 325, 134, 134, 324, 134, 134, 134, 338, 351, - 134, 348, 134, 134, 134, 134, 535, 535, 328, 134, - 134, 326, 134, 535, 335, 134, 535, 327, 134, 134, - - 329, 535, 134, 134, 134, 332, 134, 134, 134, 134, - 331, 134, 134, 535, 134, 347, 330, 134, 535, 134, - 334, 134, 333, 134, 350, 134, 535, 535, 535, 134, - 535, 134, 535, 344, 349, 535, 535, 535, 535, 535, - 535, 535, 352, 535, 535, 535, 354, 367, 134, 369, - 535, 134, 134, 345, 346, 371, 535, 134, 134, 134, - 358, 535, 388, 353, 359, 134, 356, 535, 355, 357, - 535, 363, 134, 360, 535, 361, 134, 365, 389, 134, - 364, 398, 134, 134, 362, 366, 134, 370, 368, 134, - 134, 134, 535, 391, 134, 134, 134, 384, 134, 535, - - 535, 134, 373, 372, 134, 134, 395, 393, 376, 134, - 375, 392, 134, 134, 374, 134, 134, 134, 134, 390, - 134, 134, 535, 134, 377, 134, 134, 535, 134, 380, - 378, 134, 134, 134, 535, 535, 134, 535, 134, 134, - 134, 535, 400, 134, 535, 379, 134, 134, 381, 535, - 134, 382, 535, 134, 134, 535, 397, 535, 406, 385, - 134, 535, 383, 399, 386, 387, 401, 535, 535, 402, - 535, 535, 134, 535, 405, 404, 134, 403, 414, 415, - 407, 134, 134, 134, 408, 134, 134, 413, 134, 134, - 134, 134, 134, 134, 418, 412, 134, 134, 134, 425, - - 416, 409, 419, 134, 134, 535, 134, 411, 134, 417, - 410, 535, 134, 134, 134, 535, 535, 134, 134, 420, - 134, 134, 134, 134, 134, 134, 535, 535, 134, 134, - 134, 134, 421, 134, 535, 535, 134, 134, 427, 134, - 134, 134, 535, 426, 422, 134, 134, 134, 423, 134, - 424, 431, 535, 134, 435, 134, 535, 134, 428, 535, - 432, 535, 433, 134, 429, 535, 535, 535, 436, 535, - 430, 535, 535, 535, 535, 535, 535, 134, 535, 134, - 134, 134, 535, 134, 134, 535, 535, 134, 438, 134, - 134, 535, 437, 535, 434, 440, 501, 535, 443, 441, - - 134, 535, 457, 448, 134, 442, 446, 439, 449, 456, - 134, 459, 444, 460, 450, 134, 134, 445, 447, 134, - 134, 535, 464, 134, 535, 134, 134, 134, 451, 535, - 134, 134, 134, 134, 134, 134, 453, 458, 535, 134, - 134, 134, 134, 134, 455, 535, 452, 465, 134, 134, - 535, 535, 468, 454, 134, 535, 461, 535, 470, 535, - 535, 463, 535, 134, 134, 462, 475, 134, 134, 476, - 535, 474, 134, 134, 134, 134, 134, 535, 466, 134, - 535, 479, 134, 535, 471, 134, 467, 535, 535, 472, - 535, 469, 134, 134, 134, 477, 134, 134, 134, 480, - - 535, 535, 134, 134, 134, 535, 473, 535, 478, 485, - 481, 482, 483, 486, 484, 535, 487, 488, 535, 490, - 134, 134, 535, 489, 134, 134, 492, 535, 491, 495, - 134, 134, 535, 134, 134, 493, 494, 134, 134, 134, - 535, 134, 535, 498, 134, 535, 535, 134, 535, 535, - 502, 499, 500, 535, 535, 535, 134, 508, 504, 496, - 134, 134, 535, 535, 497, 134, 134, 535, 535, 511, - 512, 134, 513, 503, 535, 505, 515, 514, 507, 506, - 509, 535, 510, 535, 535, 535, 134, 516, 517, 535, - 134, 535, 535, 535, 535, 535, 134, 524, 535, 522, - - 525, 518, 134, 527, 535, 526, 134, 535, 535, 519, - 535, 520, 134, 535, 530, 535, 523, 531, 532, 533, - 535, 528, 529, 535, 535, 535, 521, 78, 78, 78, - 78, 78, 78, 80, 80, 535, 80, 80, 80, 81, - 81, 94, 94, 94, 121, 121, 121, 535, 121, 134, - 134, 134, 134, 134, 535, 535, 535, 535, 535, 535, - 535, 535, 535, 535, 535, 535, 535, 535, 535, 535, - 535, 535, 535, 535, 535, 535, 535, 535, 535, 535, - 535, 535, 120, 535, 79, 77, 165, 120, 535, 79, - 77, 535, 9, 535, 535, 535, 535, 535, 535, 535, - - 535, 535, 535, 535, 535, 535, 535, 535, 535, 535, - 535, 535, 535, 535, 535, 535, 535, 535, 535, 535, - 535, 535, 535, 535, 535, 535, 535, 535, 535, 535, - 535, 535, 535, 535, 535, 535, 535, 535, 535, 535, - 535, 535, 535, 535, 535, 535, 535, 535, 535, 535, - 535 - } ; - -static yyconst short int yy_chk[1552] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 5, 6, 25, 26, - 35, 24, 27, 5, 6, 28, 5, 6, 534, 5, - 6, 29, 31, 38, 64, 5, 6, 7, 30, 33, - 32, 34, 52, 88, 66, 35, 52, 36, 26, 24, - 52, 65, 52, 24, 88, 7, 7, 7, 7, 24, - 29, 28, 38, 37, 26, 27, 90, 25, 7, 97, - 27, 64, 7, 7, 7, 8, 36, 90, 30, 32, - 65, 49, 31, 66, 33, 49, 34, 36, 37, 66, - 37, 49, 71, 8, 8, 8, 8, 97, 46, 46, - - 98, 98, 49, 46, 46, 37, 8, 46, 37, 107, - 8, 8, 8, 16, 345, 16, 100, 71, 187, 187, - 16, 533, 16, 16, 16, 16, 46, 46, 46, 50, - 50, 16, 108, 50, 51, 16, 107, 532, 51, 50, - 345, 16, 16, 16, 51, 100, 50, 16, 73, 51, - 16, 18, 103, 99, 51, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 53, 53, 54, 55, 53, 56, - 54, 55, 18, 56, 53, 108, 54, 55, 54, 56, - 56, 57, 102, 59, 58, 57, 59, 73, 58, 55, - 59, 57, 103, 73, 58, 112, 59, 113, 57, 18, - - 19, 58, 99, 115, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 41, 531, 41, 63, 60, 60, 102, - 41, 60, 41, 41, 41, 41, 343, 60, 82, 60, - 82, 41, 343, 112, 115, 41, 62, 62, 113, 70, - 62, 41, 41, 41, 63, 63, 62, 41, 63, 67, - 41, 44, 44, 72, 63, 119, 44, 44, 82, 74, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 61, 69, 61, 61, 67, 70, 67, 61, 44, 44, - 44, 44, 72, 61, 74, 105, 109, 61, 70, 106, - 61, 67, 74, 104, 67, 101, 294, 119, 72, 69, - - 69, 294, 76, 69, 114, 44, 45, 45, 110, 69, - 116, 45, 45, 109, 118, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 101, 104, 76, 75, 76, - 105, 101, 114, 106, 45, 45, 45, 48, 48, 111, - 128, 110, 48, 48, 76, 117, 48, 76, 130, 76, - 116, 128, 118, 122, 134, 122, 162, 75, 134, 130, - 160, 75, 164, 529, 134, 48, 48, 48, 75, 137, - 117, 48, 111, 137, 139, 48, 161, 165, 139, 137, - 163, 48, 96, 122, 139, 193, 96, 96, 96, 96, - 96, 96, 96, 96, 96, 139, 167, 96, 96, 96, - - 96, 161, 164, 160, 166, 162, 165, 96, 96, 96, - 96, 96, 96, 136, 170, 171, 163, 136, 136, 136, - 136, 136, 136, 136, 136, 136, 138, 186, 136, 136, - 136, 136, 168, 185, 193, 167, 528, 173, 136, 136, - 136, 136, 136, 136, 140, 140, 172, 166, 140, 171, - 170, 530, 181, 138, 140, 530, 141, 138, 141, 255, - 141, 142, 185, 138, 141, 142, 141, 186, 143, 144, - 142, 142, 143, 144, 144, 168, 173, 145, 143, 144, - 143, 145, 146, 172, 147, 147, 146, 145, 174, 147, - 174, 181, 146, 148, 145, 147, 255, 148, 146, 149, - - 149, 150, 188, 148, 149, 150, 150, 523, 148, 151, - 149, 150, 152, 151, 151, 184, 152, 153, 174, 151, - 189, 153, 152, 195, 154, 191, 169, 153, 154, 155, - 153, 156, 155, 155, 154, 156, 201, 157, 158, 155, - 157, 156, 158, 156, 157, 159, 188, 196, 158, 159, - 157, 184, 197, 197, 198, 159, 169, 199, 202, 159, - 203, 210, 169, 189, 191, 210, 236, 195, 204, 169, - 204, 210, 239, 212, 201, 196, 211, 212, 521, 198, - 211, 213, 198, 212, 198, 213, 211, 211, 199, 217, - 216, 213, 242, 214, 216, 236, 202, 214, 204, 203, - - 216, 214, 216, 214, 215, 215, 241, 218, 215, 219, - 237, 218, 245, 219, 215, 239, 217, 218, 220, 219, - 217, 221, 220, 218, 219, 221, 217, 520, 220, 222, - 223, 221, 221, 222, 223, 227, 242, 224, 225, 222, - 223, 224, 225, 234, 234, 226, 237, 224, 225, 226, - 245, 223, 235, 241, 225, 226, 228, 238, 238, 228, - 244, 228, 227, 228, 229, 246, 227, 229, 229, 228, - 247, 230, 227, 231, 229, 230, 232, 231, 233, 235, - 232, 230, 233, 231, 240, 240, 232, 248, 233, 233, - 243, 243, 249, 250, 252, 254, 244, 256, 260, 258, - - 247, 259, 261, 263, 262, 246, 264, 265, 266, 266, - 267, 286, 268, 518, 267, 268, 292, 249, 267, 268, - 267, 287, 287, 248, 256, 268, 260, 254, 291, 291, - 290, 261, 263, 252, 293, 301, 265, 250, 258, 252, - 262, 259, 269, 292, 270, 298, 269, 261, 270, 264, - 288, 271, 269, 272, 270, 271, 273, 272, 269, 286, - 273, 271, 271, 272, 293, 274, 273, 290, 271, 274, - 516, 275, 275, 276, 274, 274, 275, 276, 288, 301, - 277, 298, 275, 276, 277, 278, 515, 297, 279, 278, - 277, 277, 279, 514, 285, 278, 300, 278, 279, 280, - - 280, 299, 281, 280, 282, 282, 281, 283, 282, 280, - 281, 283, 281, 302, 282, 297, 280, 283, 304, 284, - 284, 285, 283, 284, 300, 285, 295, 303, 306, 284, - 307, 285, 308, 295, 299, 309, 310, 311, 312, 313, - 315, 316, 302, 314, 502, 317, 304, 318, 320, 320, - 339, 318, 320, 295, 295, 322, 347, 318, 320, 322, - 309, 338, 338, 303, 310, 322, 307, 341, 306, 308, - 336, 314, 319, 311, 342, 312, 319, 316, 339, 321, - 315, 347, 319, 321, 313, 317, 323, 321, 319, 321, - 323, 324, 340, 341, 325, 324, 323, 336, 325, 349, - - 344, 324, 325, 324, 325, 326, 344, 342, 328, 326, - 327, 341, 328, 327, 326, 326, 329, 327, 328, 340, - 329, 330, 337, 327, 329, 330, 329, 346, 331, 332, - 330, 330, 331, 332, 348, 354, 333, 351, 331, 332, - 333, 356, 349, 334, 352, 331, 333, 334, 333, 353, - 335, 334, 358, 334, 335, 360, 346, 357, 357, 337, - 335, 361, 335, 348, 337, 337, 351, 362, 364, 352, - 366, 493, 367, 384, 356, 354, 367, 353, 369, 370, - 358, 369, 367, 370, 360, 369, 368, 368, 371, 370, - 368, 369, 371, 372, 374, 366, 368, 372, 371, 384, - - 371, 361, 375, 372, 373, 386, 375, 364, 373, 373, - 362, 393, 375, 376, 373, 385, 489, 376, 377, 377, - 378, 374, 377, 376, 378, 374, 387, 388, 377, 379, - 378, 374, 378, 379, 390, 391, 380, 381, 386, 379, - 380, 381, 389, 385, 379, 382, 380, 381, 381, 382, - 383, 389, 392, 383, 393, 382, 394, 383, 387, 395, - 390, 396, 391, 383, 388, 397, 398, 400, 394, 402, - 388, 405, 406, 408, 410, 412, 411, 413, 485, 415, - 416, 413, 425, 415, 416, 429, 428, 413, 396, 415, - 416, 484, 395, 426, 392, 398, 484, 427, 405, 400, - - 414, 437, 426, 412, 414, 402, 410, 397, 414, 425, - 414, 428, 406, 429, 417, 417, 418, 408, 411, 417, - 418, 436, 436, 419, 430, 417, 418, 419, 418, 435, - 420, 421, 422, 419, 420, 421, 422, 427, 432, 423, - 420, 421, 422, 423, 424, 439, 420, 437, 424, 423, - 440, 441, 441, 423, 424, 442, 430, 443, 443, 444, - 445, 435, 447, 449, 453, 432, 450, 449, 453, 451, - 458, 449, 451, 449, 453, 455, 451, 466, 439, 455, - 456, 456, 451, 470, 444, 455, 440, 481, 461, 445, - 464, 442, 454, 450, 452, 452, 454, 450, 452, 458, - - 460, 468, 454, 450, 452, 459, 447, 471, 454, 460, - 459, 459, 459, 461, 459, 463, 463, 464, 467, 467, - 474, 475, 479, 466, 474, 475, 470, 480, 468, 476, - 474, 475, 488, 476, 477, 471, 475, 478, 477, 476, - 483, 478, 482, 482, 477, 486, 487, 478, 490, 492, - 486, 482, 483, 491, 497, 496, 494, 494, 488, 479, - 494, 495, 503, 498, 480, 495, 494, 499, 500, 498, - 498, 495, 498, 487, 504, 490, 500, 499, 492, 491, - 496, 501, 497, 505, 506, 507, 508, 501, 503, 509, - 508, 511, 510, 512, 517, 519, 508, 510, 513, 508, - - 511, 504, 522, 513, 524, 512, 522, 525, 473, 505, - 526, 506, 522, 527, 524, 472, 509, 525, 526, 527, - 469, 517, 519, 465, 462, 457, 507, 536, 536, 536, - 536, 536, 536, 537, 537, 448, 537, 537, 537, 538, - 538, 539, 539, 539, 540, 540, 540, 446, 540, 541, - 541, 541, 541, 541, 438, 434, 433, 431, 409, 407, - 404, 403, 401, 399, 365, 363, 359, 355, 350, 305, - 296, 289, 257, 253, 251, 200, 194, 192, 190, 183, - 182, 180, 120, 94, 78, 77, 68, 39, 20, 13, - 11, 9, 535, 535, 535, 535, 535, 535, 535, 535, - - 535, 535, 535, 535, 535, 535, 535, 535, 535, 535, - 535, 535, 535, 535, 535, 535, 535, 535, 535, 535, - 535, 535, 535, 535, 535, 535, 535, 535, 535, 535, - 535, 535, 535, 535, 535, 535, 535, 535, 535, 535, - 535, 535, 535, 535, 535, 535, 535, 535, 535, 535, - 535 - } ; - -static yy_state_type yy_last_accepting_state; -static char *yy_last_accepting_cpos; - -/* The intent behind this definition is that it'll catch - * any uses of REJECT which flex missed. - */ -#define REJECT reject_used_but_not_detected -static int yy_more_flag = 0; -static int yy_more_len = 0; -#define yymore() (yy_more_flag = 1) -#define YY_MORE_ADJ yy_more_len -#define YY_RESTORE_YY_MORE_OFFSET -char *yytext; -#line 1 "token.l" -#define INITIAL 0 -/* $KAME: token.l,v 1.44 2003/10/21 07:20:58 itojun Exp $ */ -/* - * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the project nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ -#line 33 "token.l" - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include -#include -#ifdef HAVE_NETINET6_IPSEC -# include -#else -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "vchar.h" -#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__linux__) -#include "parse.h" -#else -#include "y.tab.h" -#endif - -#include "extern.h" - -/* make the code compile on *BSD-current */ -#ifndef SADB_X_AALG_SHA2_256 -#define SADB_X_AALG_SHA2_256 (-1) -#endif -#ifndef SADB_X_AALG_SHA2_384 -#define SADB_X_AALG_SHA2_384 (-1) -#endif -#ifndef SADB_X_AALG_SHA2_512 -#define SADB_X_AALG_SHA2_512 (-1) -#endif -#ifndef SADB_X_AALG_RIPEMD160HMAC -#define SADB_X_AALG_RIPEMD160HMAC (-1) -#endif -#ifndef SADB_X_AALG_AES_XCBC_MAC -#define SADB_X_AALG_AES_XCBC_MAC (-1) -#endif -#ifndef SADB_X_EALG_TWOFISHCBC -#define SADB_X_EALG_TWOFISHCBC (-1) -#endif -#ifndef SADB_X_EALG_AESCTR -#define SADB_X_EALG_AESCTR (-1) -#endif -/* common section */ -#define S_PL 1 -#define S_AUTHALG 2 -#define S_ENCALG 3 - -#line 976 "token.c" - -/* Macros after this point can all be overridden by user definitions in - * section 1. - */ - -#ifndef YY_SKIP_YYWRAP -#ifdef __cplusplus -extern "C" int yywrap YY_PROTO(( void )); -#else -extern int yywrap YY_PROTO(( void )); -#endif -#endif - -#ifndef YY_NO_UNPUT -static void yyunput YY_PROTO(( int c, char *buf_ptr )); -#endif - -#ifndef yytext_ptr -static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen YY_PROTO(( yyconst char * )); -#endif - -#ifndef YY_NO_INPUT -#ifdef __cplusplus -static int yyinput YY_PROTO(( void )); -#else -static int input YY_PROTO(( void )); -#endif -#endif - -#if YY_STACK_USED -static int yy_start_stack_ptr = 0; -static int yy_start_stack_depth = 0; -static int *yy_start_stack = 0; -#ifndef YY_NO_PUSH_STATE -static void yy_push_state YY_PROTO(( int new_state )); -#endif -#ifndef YY_NO_POP_STATE -static void yy_pop_state YY_PROTO(( void )); -#endif -#ifndef YY_NO_TOP_STATE -static int yy_top_state YY_PROTO(( void )); -#endif - -#else -#define YY_NO_PUSH_STATE 1 -#define YY_NO_POP_STATE 1 -#define YY_NO_TOP_STATE 1 -#endif - -#ifdef YY_MALLOC_DECL -YY_MALLOC_DECL -#else -#if __STDC__ -#ifndef __cplusplus -#include -#endif -#else -/* Just try to get by without declaring the routines. This will fail - * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) - * or sizeof(void*) != sizeof(int). - */ -#endif -#endif - -/* Amount of stuff to slurp up with each read. */ -#ifndef YY_READ_BUF_SIZE -#define YY_READ_BUF_SIZE 8192 -#endif - -/* Copy whatever the last rule matched to the standard output. */ - -#ifndef ECHO -/* This used to be an fputs(), but since the string might contain NUL's, - * we now use fwrite(). - */ -#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) -#endif - -/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, - * is returned in "result". - */ -#ifndef YY_INPUT -#define YY_INPUT(buf,result,max_size) \ - if ( yy_current_buffer->yy_is_interactive ) \ - { \ - int c = '*', n; \ - for ( n = 0; n < max_size && \ - (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ) \ - buf[n++] = (char) c; \ - if ( c == EOF && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - result = n; \ - } \ - else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ - && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); -#endif - -/* No semi-colon after return; correct usage is to write "yyterminate();" - - * we don't want an extra ';' after the "return" because that will cause - * some compilers to complain about unreachable statements. - */ -#ifndef yyterminate -#define yyterminate() return YY_NULL -#endif - -/* Number of entries by which start-condition stack grows. */ -#ifndef YY_START_STACK_INCR -#define YY_START_STACK_INCR 25 -#endif - -/* Report a fatal error. */ -#ifndef YY_FATAL_ERROR -#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) -#endif - -/* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ -#ifndef YY_DECL -#define YY_DECL int yylex YY_PROTO(( void )) -#endif - -/* Code executed at the beginning of each rule, after yytext and yyleng - * have been set up. - */ -#ifndef YY_USER_ACTION -#define YY_USER_ACTION -#endif - -/* Code executed at the end of each rule. */ -#ifndef YY_BREAK -#define YY_BREAK break; -#endif - -#define YY_RULE_SETUP \ - YY_USER_ACTION - -YY_DECL - { - register yy_state_type yy_current_state; - register char *yy_cp = NULL, *yy_bp = NULL; - register int yy_act; - -#line 112 "token.l" - - -#line 1130 "token.c" - - if ( yy_init ) - { - yy_init = 0; - -#ifdef YY_USER_INIT - YY_USER_INIT; -#endif - - if ( ! yy_start ) - yy_start = 1; /* first start state */ - - if ( ! yyin ) - yyin = stdin; - - if ( ! yyout ) - yyout = stdout; - - if ( ! yy_current_buffer ) - yy_current_buffer = - yy_create_buffer( yyin, YY_BUF_SIZE ); - - yy_load_buffer_state(); - } - - while ( 1 ) /* loops until end-of-file is reached */ - { - yy_more_len = 0; - if ( yy_more_flag ) - { - yy_more_len = yy_c_buf_p - yytext_ptr; - yy_more_flag = 0; - } - yy_cp = yy_c_buf_p; - - /* Support of yytext. */ - *yy_cp = yy_hold_char; - - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; - - yy_current_state = yy_start; -yy_match: - do - { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 536 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 1493 ); - -yy_find_action: - yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; - yy_act = yy_accept[yy_current_state]; - } - - YY_DO_BEFORE_ACTION; - - -do_action: /* This label is used only to access EOF actions. */ - - - switch ( yy_act ) - { /* beginning of action switch */ - case 0: /* must back up */ - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = yy_hold_char; - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; - goto yy_find_action; - -case 1: -YY_RULE_SETUP -#line 114 "token.l" -{ return(ADD); } - YY_BREAK -case 2: -YY_RULE_SETUP -#line 115 "token.l" -{ return(DELETE); } - YY_BREAK -case 3: -YY_RULE_SETUP -#line 116 "token.l" -{ return(DELETEALL); } - YY_BREAK -case 4: -YY_RULE_SETUP -#line 117 "token.l" -{ return(GET); } - YY_BREAK -case 5: -YY_RULE_SETUP -#line 118 "token.l" -{ return(FLUSH); } - YY_BREAK -case 6: -YY_RULE_SETUP -#line 119 "token.l" -{ return(DUMP); } - YY_BREAK -case 7: -YY_RULE_SETUP -#line 120 "token.l" -{ return(EXIT); } - YY_BREAK -case 8: -YY_RULE_SETUP -#line 121 "token.l" -{ return(EXIT); } - YY_BREAK -case 9: -YY_RULE_SETUP -#line 122 "token.l" -{ return(EXIT); } - YY_BREAK -/* for management SPD */ -case 10: -YY_RULE_SETUP -#line 125 "token.l" -{ return(SPDADD); } - YY_BREAK -case 11: -YY_RULE_SETUP -#line 126 "token.l" -{ return(SPDDELETE); } - YY_BREAK -case 12: -YY_RULE_SETUP -#line 127 "token.l" -{ return(SPDDUMP); } - YY_BREAK -case 13: -YY_RULE_SETUP -#line 128 "token.l" -{ return(SPDFLUSH); } - YY_BREAK -case 14: -YY_RULE_SETUP -#line 129 "token.l" -{ return(TAGGED); } - YY_BREAK -case 15: -YY_RULE_SETUP -#line 130 "token.l" -{ BEGIN S_PL; return(F_POLICY); } - YY_BREAK -case 16: -YY_RULE_SETUP -#line 131 "token.l" -{ - yymore(); - - /* count up for nl */ - { - char *p; - for (p = yytext; *p != '\0'; p++) - if (*p == '\n') - lineno++; - } - - yylval.val.len = strlen(yytext); - yylval.val.buf = strdup(yytext); - if (!yylval.val.buf) - yyfatal("insufficient memory"); - - return(PL_REQUESTS); - } - YY_BREAK -case 17: -YY_RULE_SETUP -#line 149 "token.l" -{ BEGIN INITIAL; return(EOT); } - YY_BREAK -/* address resolution flags */ -case 18: -YY_RULE_SETUP -#line 152 "token.l" -{ - yylval.val.len = strlen(yytext); - yylval.val.buf = strdup(yytext); - if (!yylval.val.buf) - yyfatal("insufficient memory"); - return(F_AIFLAGS); - } - YY_BREAK -/* security protocols */ -case 19: -YY_RULE_SETUP -#line 161 "token.l" -{ yylval.num = 0; return(PR_AH); } - YY_BREAK -case 20: -YY_RULE_SETUP -#line 162 "token.l" -{ yylval.num = 0; return(PR_ESP); } - YY_BREAK -case 21: -YY_RULE_SETUP -#line 163 "token.l" -{ yylval.num = 1; return(PR_AH); } - YY_BREAK -case 22: -YY_RULE_SETUP -#line 164 "token.l" -{ yylval.num = 1; return(PR_ESP); } - YY_BREAK -case 23: -YY_RULE_SETUP -#line 165 "token.l" -{ yylval.num = 0; return(PR_ESPUDP); } - YY_BREAK -case 24: -YY_RULE_SETUP -#line 166 "token.l" -{ yylval.num = 0; return(PR_IPCOMP); } - YY_BREAK -case 25: -YY_RULE_SETUP -#line 167 "token.l" -{ - yylval.num = 0; return(PR_TCP); - } - YY_BREAK -/* authentication alogorithm */ -case 26: -YY_RULE_SETUP -#line 172 "token.l" -{ BEGIN S_AUTHALG; return(F_AUTH); } - YY_BREAK -case 27: -YY_RULE_SETUP -#line 173 "token.l" -{ yylval.num = SADB_AALG_MD5HMAC; BEGIN INITIAL; return(ALG_AUTH); } - YY_BREAK -case 28: -YY_RULE_SETUP -#line 174 "token.l" -{ yylval.num = SADB_AALG_SHA1HMAC; BEGIN INITIAL; return(ALG_AUTH); } - YY_BREAK -case 29: -YY_RULE_SETUP -#line 175 "token.l" -{ yylval.num = SADB_X_AALG_MD5; BEGIN INITIAL; return(ALG_AUTH); } - YY_BREAK -case 30: -YY_RULE_SETUP -#line 176 "token.l" -{ yylval.num = SADB_X_AALG_SHA; BEGIN INITIAL; return(ALG_AUTH); } - YY_BREAK -case 31: -YY_RULE_SETUP -#line 177 "token.l" -{ yylval.num = SADB_X_AALG_SHA2_256; BEGIN INITIAL; return(ALG_AUTH); } - YY_BREAK -case 32: -YY_RULE_SETUP -#line 178 "token.l" -{ yylval.num = SADB_X_AALG_SHA2_256; BEGIN INITIAL; return(ALG_AUTH); } - YY_BREAK -case 33: -YY_RULE_SETUP -#line 179 "token.l" -{ yylval.num = SADB_X_AALG_SHA2_384; BEGIN INITIAL; return(ALG_AUTH); } - YY_BREAK -case 34: -YY_RULE_SETUP -#line 180 "token.l" -{ yylval.num = SADB_X_AALG_SHA2_384; BEGIN INITIAL; return(ALG_AUTH); } - YY_BREAK -case 35: -YY_RULE_SETUP -#line 181 "token.l" -{ yylval.num = SADB_X_AALG_SHA2_512; BEGIN INITIAL; return(ALG_AUTH); } - YY_BREAK -case 36: -YY_RULE_SETUP -#line 182 "token.l" -{ yylval.num = SADB_X_AALG_SHA2_512; BEGIN INITIAL; return(ALG_AUTH); } - YY_BREAK -case 37: -YY_RULE_SETUP -#line 183 "token.l" -{ yylval.num = SADB_X_AALG_RIPEMD160HMAC; BEGIN INITIAL; return(ALG_AUTH); } - YY_BREAK -case 38: -YY_RULE_SETUP -#line 184 "token.l" -{ yylval.num = SADB_X_AALG_AES_XCBC_MAC; BEGIN INITIAL; return(ALG_AUTH); } - YY_BREAK -case 39: -YY_RULE_SETUP -#line 185 "token.l" -{ -#ifdef SADB_X_AALG_TCP_MD5 - yylval.num = SADB_X_AALG_TCP_MD5; - BEGIN INITIAL; - return(ALG_AUTH); -#endif - } - YY_BREAK -case 40: -YY_RULE_SETUP -#line 192 "token.l" -{ yylval.num = SADB_X_AALG_NULL; BEGIN INITIAL; return(ALG_AUTH_NOKEY); } - YY_BREAK -/* encryption alogorithm */ -case 41: -YY_RULE_SETUP -#line 195 "token.l" -{ BEGIN S_ENCALG; return(F_ENC); } - YY_BREAK -case 42: -YY_RULE_SETUP -#line 196 "token.l" -{ yylval.num = SADB_EALG_DESCBC; BEGIN INITIAL; return(ALG_ENC); } - YY_BREAK -case 43: -YY_RULE_SETUP -#line 197 "token.l" -{ yylval.num = SADB_EALG_3DESCBC; BEGIN INITIAL; return(ALG_ENC); } - YY_BREAK -case 44: -YY_RULE_SETUP -#line 198 "token.l" -{ yylval.num = SADB_EALG_NULL; BEGIN INITIAL; return(ALG_ENC_NOKEY); } - YY_BREAK -case 45: -YY_RULE_SETUP -#line 199 "token.l" -{ yylval.num = SADB_EALG_NULL; BEGIN INITIAL; return(ALG_ENC_OLD); } - YY_BREAK -case 46: -YY_RULE_SETUP -#line 200 "token.l" -{ yylval.num = SADB_X_EALG_BLOWFISHCBC; BEGIN INITIAL; return(ALG_ENC); } - YY_BREAK -case 47: -YY_RULE_SETUP -#line 201 "token.l" -{ yylval.num = SADB_X_EALG_CAST128CBC; BEGIN INITIAL; return(ALG_ENC); } - YY_BREAK -case 48: -YY_RULE_SETUP -#line 202 "token.l" -{ yylval.num = SADB_EALG_DESCBC; BEGIN INITIAL; return(ALG_ENC_DESDERIV); } - YY_BREAK -case 49: -YY_RULE_SETUP -#line 203 "token.l" -{ yylval.num = SADB_EALG_DESCBC; BEGIN INITIAL; return(ALG_ENC_DES32IV); } - YY_BREAK -case 50: -YY_RULE_SETUP -#line 204 "token.l" -{ yylval.num = SADB_X_EALG_TWOFISHCBC; BEGIN INITIAL; return(ALG_ENC); } - YY_BREAK -case 51: -YY_RULE_SETUP -#line 205 "token.l" -{ -#ifdef SADB_X_EALG_AESCBC - yylval.num = SADB_X_EALG_AESCBC; BEGIN INITIAL; return(ALG_ENC); -#endif -} - YY_BREAK -case 52: -YY_RULE_SETUP -#line 210 "token.l" -{ -#ifdef SADB_X_EALG_AESCBC - yylval.num = SADB_X_EALG_AESCBC; BEGIN INITIAL; return(ALG_ENC); -#endif -} - YY_BREAK -case 53: -YY_RULE_SETUP -#line 215 "token.l" -{ yylval.num = SADB_X_EALG_AESCTR; BEGIN INITIAL; return(ALG_ENC); } - YY_BREAK -/* compression algorithms */ -case 54: -YY_RULE_SETUP -#line 218 "token.l" -{ return(F_COMP); } - YY_BREAK -case 55: -YY_RULE_SETUP -#line 219 "token.l" -{ yylval.num = SADB_X_CALG_OUI; return(ALG_COMP); } - YY_BREAK -case 56: -YY_RULE_SETUP -#line 220 "token.l" -{ yylval.num = SADB_X_CALG_DEFLATE; return(ALG_COMP); } - YY_BREAK -case 57: -YY_RULE_SETUP -#line 221 "token.l" -{ yylval.num = SADB_X_CALG_LZS; return(ALG_COMP); } - YY_BREAK -case 58: -YY_RULE_SETUP -#line 222 "token.l" -{ return(F_RAWCPI); } - YY_BREAK -/* extension */ -case 59: -YY_RULE_SETUP -#line 225 "token.l" -{ return(F_MODE); } - YY_BREAK -case 60: -YY_RULE_SETUP -#line 226 "token.l" -{ yylval.num = IPSEC_MODE_TRANSPORT; return(MODE); } - YY_BREAK -case 61: -YY_RULE_SETUP -#line 227 "token.l" -{ yylval.num = IPSEC_MODE_TUNNEL; return(MODE); } - YY_BREAK -case 62: -YY_RULE_SETUP -#line 228 "token.l" -{ return(F_REQID); } - YY_BREAK -case 63: -YY_RULE_SETUP -#line 229 "token.l" -{ return(F_EXT); } - YY_BREAK -case 64: -YY_RULE_SETUP -#line 230 "token.l" -{ yylval.num = SADB_X_EXT_PRAND; return(EXTENSION); } - YY_BREAK -case 65: -YY_RULE_SETUP -#line 231 "token.l" -{ yylval.num = SADB_X_EXT_PSEQ; return(EXTENSION); } - YY_BREAK -case 66: -YY_RULE_SETUP -#line 232 "token.l" -{ yylval.num = SADB_X_EXT_PZERO; return(EXTENSION); } - YY_BREAK -case 67: -YY_RULE_SETUP -#line 233 "token.l" -{ return(NOCYCLICSEQ); } - YY_BREAK -case 68: -YY_RULE_SETUP -#line 234 "token.l" -{ return(F_REPLAY); } - YY_BREAK -case 69: -YY_RULE_SETUP -#line 235 "token.l" -{ return(F_LIFETIME_HARD); } - YY_BREAK -case 70: -YY_RULE_SETUP -#line 236 "token.l" -{ return(F_LIFETIME_SOFT); } - YY_BREAK -case 71: -YY_RULE_SETUP -#line 237 "token.l" -{ return(F_LIFEBYTE_HARD); } - YY_BREAK -case 72: -YY_RULE_SETUP -#line 238 "token.l" -{ return(F_LIFEBYTE_SOFT); } - YY_BREAK -/* ... */ -case 73: -YY_RULE_SETUP -#line 241 "token.l" -{ return(ANY); } - YY_BREAK -case 74: -YY_RULE_SETUP -#line 242 "token.l" -{ } - YY_BREAK -case 75: -YY_RULE_SETUP -#line 243 "token.l" -{ lineno++; } - YY_BREAK -case 76: -YY_RULE_SETUP -#line 244 "token.l" - - YY_BREAK -case 77: -YY_RULE_SETUP -#line 245 "token.l" -{ return(EOT); } - YY_BREAK -/* for address parameters: /prefix, [port] */ -case 78: -YY_RULE_SETUP -#line 248 "token.l" -{ return SLASH; } - YY_BREAK -case 79: -YY_RULE_SETUP -#line 249 "token.l" -{ return BLCL; } - YY_BREAK -case 80: -YY_RULE_SETUP -#line 250 "token.l" -{ return ELCL; } - YY_BREAK -/* parameter */ -case 81: -YY_RULE_SETUP -#line 253 "token.l" -{ - char *bp; - - yylval.ulnum = strtoul(yytext, &bp, 10); - return(DECSTRING); - } - YY_BREAK -case 82: -YY_RULE_SETUP -#line 260 "token.l" -{ - yylval.val.buf = strdup(yytext + 2); - if (!yylval.val.buf) - yyfatal("insufficient memory"); - yylval.val.len = strlen(yylval.val.buf); - - return(HEXSTRING); - } - YY_BREAK -case 83: -YY_RULE_SETUP -#line 269 "token.l" -{ - char *p = yytext; - while (*++p != '"') ; - *p = '\0'; - yytext++; - yylval.val.len = yyleng - 2; - yylval.val.buf = strdup(yytext); - if (!yylval.val.buf) - yyfatal("insufficient memory"); - - return(QUOTEDSTRING); - } - YY_BREAK -case 84: -YY_RULE_SETUP -#line 282 "token.l" -{ - yylval.val.len = yyleng; - yylval.val.buf = strdup(yytext); - if (!yylval.val.buf) - yyfatal("insufficient memory"); - return(STRING); - } - YY_BREAK -case 85: -YY_RULE_SETUP -#line 290 "token.l" -{ - yylval.val.len = yyleng; - yylval.val.buf = strdup(yytext); - if (!yylval.val.buf) - yyfatal("insufficient memory"); - return(STRING); - } - YY_BREAK -case 86: -YY_RULE_SETUP -#line 298 "token.l" -{ - yyfatal("Syntax error"); - /*NOTREACHED*/ - } - YY_BREAK -case 87: -YY_RULE_SETUP -#line 303 "token.l" -ECHO; - YY_BREAK -#line 1741 "token.c" -case YY_STATE_EOF(INITIAL): -case YY_STATE_EOF(S_PL): -case YY_STATE_EOF(S_AUTHALG): -case YY_STATE_EOF(S_ENCALG): - yyterminate(); - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = yy_hold_char; - YY_RESTORE_YY_MORE_OFFSET - - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure - * consistency between yy_current_buffer and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - yy_n_chars = yy_current_buffer->yy_n_chars; - yy_current_buffer->yy_input_file = yyin; - yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state(); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - yy_next_state = yy_try_NUL_trans( yy_current_state ); - - yy_bp = yytext_ptr + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++yy_c_buf_p; - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { - yy_cp = yy_c_buf_p; - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer() ) - { - case EOB_ACT_END_OF_FILE: - { - yy_did_buffer_switch_on_eof = 0; - - if ( yywrap() ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * yytext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = - yytext_ptr + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state(); - - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - yy_c_buf_p = - &yy_current_buffer->yy_ch_buf[yy_n_chars]; - - yy_current_state = yy_get_previous_state(); - - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ - } /* end of yylex */ - - -/* yy_get_next_buffer - try to read in a new buffer - * - * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file - */ - -static int yy_get_next_buffer() - { - register char *dest = yy_current_buffer->yy_ch_buf; - register char *source = yytext_ptr; - register int number_to_move, i; - int ret_val; - - if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( yy_current_buffer->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) - { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - yy_current_buffer->yy_n_chars = yy_n_chars = 0; - - else - { - int num_to_read = - yy_current_buffer->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ -#ifdef YY_USES_REJECT - YY_FATAL_ERROR( -"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); -#else - - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = yy_current_buffer; - - int yy_c_buf_p_offset = - (int) (yy_c_buf_p - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) - { - int new_size = b->yy_buf_size * 2; - - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; - - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - yy_flex_realloc( (void *) b->yy_ch_buf, - b->yy_buf_size + 2 ); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; - - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); - - yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; - - num_to_read = yy_current_buffer->yy_buf_size - - number_to_move - 1; -#endif - } - - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), - yy_n_chars, num_to_read ); - - yy_current_buffer->yy_n_chars = yy_n_chars; - } - - if ( yy_n_chars == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - yyrestart( yyin ); - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - yy_current_buffer->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - yy_n_chars += number_to_move; - yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; - yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; - - yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; - - return ret_val; - } - - -/* yy_get_previous_state - get the state just before the EOB char was reached */ - -static yy_state_type yy_get_previous_state() - { - register yy_state_type yy_current_state; - register char *yy_cp; - - yy_current_state = yy_start; - - for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) - { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 536 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - } - - return yy_current_state; - } - - -/* yy_try_NUL_trans - try to make a transition on the NUL character - * - * synopsis - * next_state = yy_try_NUL_trans( current_state ); - */ - -#ifdef YY_USE_PROTOS -static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) -#else -static yy_state_type yy_try_NUL_trans( yy_current_state ) -yy_state_type yy_current_state; -#endif - { - register int yy_is_jam; - register char *yy_cp = yy_c_buf_p; - - register YY_CHAR yy_c = 1; - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 536 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 535); - - return yy_is_jam ? 0 : yy_current_state; - } - - -#ifndef YY_NO_UNPUT -#ifdef YY_USE_PROTOS -static void yyunput( int c, register char *yy_bp ) -#else -static void yyunput( c, yy_bp ) -int c; -register char *yy_bp; -#endif - { - register char *yy_cp = yy_c_buf_p; - - /* undo effects of setting up yytext */ - *yy_cp = yy_hold_char; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register int number_to_move = yy_n_chars + 2; - register char *dest = &yy_current_buffer->yy_ch_buf[ - yy_current_buffer->yy_buf_size + 2]; - register char *source = - &yy_current_buffer->yy_ch_buf[number_to_move]; - - while ( source > yy_current_buffer->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - yy_current_buffer->yy_n_chars = - yy_n_chars = yy_current_buffer->yy_buf_size; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - - - yytext_ptr = yy_bp; - yy_hold_char = *yy_cp; - yy_c_buf_p = yy_cp; - } -#endif /* ifndef YY_NO_UNPUT */ - - -#ifdef __cplusplus -static int yyinput() -#else -static int input() -#endif - { - int c; - - *yy_c_buf_p = yy_hold_char; - - if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - /* This was really a NUL. */ - *yy_c_buf_p = '\0'; - - else - { /* need more input */ - int offset = yy_c_buf_p - yytext_ptr; - ++yy_c_buf_p; - - switch ( yy_get_next_buffer() ) - { - case EOB_ACT_LAST_MATCH: - /* This happens because yy_g_n_b() - * sees that we've accumulated a - * token and flags that we need to - * try matching the token before - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ - - /* Reset buffer status. */ - yyrestart( yyin ); - - /* fall through */ - - case EOB_ACT_END_OF_FILE: - { - if ( yywrap() ) - return EOF; - - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; -#ifdef __cplusplus - return yyinput(); -#else - return input(); -#endif - } - - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = yytext_ptr + offset; - break; - } - } - } - - c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ - *yy_c_buf_p = '\0'; /* preserve yytext */ - yy_hold_char = *++yy_c_buf_p; - - - return c; - } - - -#ifdef YY_USE_PROTOS -void yyrestart( FILE *input_file ) -#else -void yyrestart( input_file ) -FILE *input_file; -#endif - { - if ( ! yy_current_buffer ) - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); - - yy_init_buffer( yy_current_buffer, input_file ); - yy_load_buffer_state(); - } - - -#ifdef YY_USE_PROTOS -void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) -#else -void yy_switch_to_buffer( new_buffer ) -YY_BUFFER_STATE new_buffer; -#endif - { - if ( yy_current_buffer == new_buffer ) - return; - - if ( yy_current_buffer ) - { - /* Flush out information for old buffer. */ - *yy_c_buf_p = yy_hold_char; - yy_current_buffer->yy_buf_pos = yy_c_buf_p; - yy_current_buffer->yy_n_chars = yy_n_chars; - } - - yy_current_buffer = new_buffer; - yy_load_buffer_state(); - - /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe - * to go ahead and always set it. - */ - yy_did_buffer_switch_on_eof = 1; - } - - -#ifdef YY_USE_PROTOS -void yy_load_buffer_state( void ) -#else -void yy_load_buffer_state() -#endif - { - yy_n_chars = yy_current_buffer->yy_n_chars; - yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; - yyin = yy_current_buffer->yy_input_file; - yy_hold_char = *yy_c_buf_p; - } - - -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) -#else -YY_BUFFER_STATE yy_create_buffer( file, size ) -FILE *file; -int size; -#endif - { - YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_buf_size = size; - - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_is_our_buffer = 1; - - yy_init_buffer( b, file ); - - return b; - } - - -#ifdef YY_USE_PROTOS -void yy_delete_buffer( YY_BUFFER_STATE b ) -#else -void yy_delete_buffer( b ) -YY_BUFFER_STATE b; -#endif - { - if ( ! b ) - return; - - if ( b == yy_current_buffer ) - yy_current_buffer = (YY_BUFFER_STATE) 0; - - if ( b->yy_is_our_buffer ) - yy_flex_free( (void *) b->yy_ch_buf ); - - yy_flex_free( (void *) b ); - } - - -#ifndef YY_ALWAYS_INTERACTIVE -#ifndef YY_NEVER_INTERACTIVE -extern int isatty YY_PROTO(( int )); -#endif -#endif - -#ifdef YY_USE_PROTOS -void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) -#else -void yy_init_buffer( b, file ) -YY_BUFFER_STATE b; -FILE *file; -#endif - - - { - yy_flush_buffer( b ); - - b->yy_input_file = file; - b->yy_fill_buffer = 1; - -#if YY_ALWAYS_INTERACTIVE - b->yy_is_interactive = 1; -#else -#if YY_NEVER_INTERACTIVE - b->yy_is_interactive = 0; -#else - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; -#endif -#endif - } - - -#ifdef YY_USE_PROTOS -void yy_flush_buffer( YY_BUFFER_STATE b ) -#else -void yy_flush_buffer( b ) -YY_BUFFER_STATE b; -#endif - - { - if ( ! b ) - return; - - b->yy_n_chars = 0; - - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - - b->yy_buf_pos = &b->yy_ch_buf[0]; - - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; - - if ( b == yy_current_buffer ) - yy_load_buffer_state(); - } - - -#ifndef YY_NO_SCAN_BUFFER -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) -#else -YY_BUFFER_STATE yy_scan_buffer( base, size ) -char *base; -yy_size_t size; -#endif - { - YY_BUFFER_STATE b; - - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return 0; - - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = 0; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; - - yy_switch_to_buffer( b ); - - return b; - } -#endif - - -#ifndef YY_NO_SCAN_STRING -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) -#else -YY_BUFFER_STATE yy_scan_string( yy_str ) -yyconst char *yy_str; -#endif - { - int len; - for ( len = 0; yy_str[len]; ++len ) - ; - - return yy_scan_bytes( yy_str, len ); - } -#endif - - -#ifndef YY_NO_SCAN_BYTES -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) -#else -YY_BUFFER_STATE yy_scan_bytes( bytes, len ) -yyconst char *bytes; -int len; -#endif - { - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - int i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = len + 2; - buf = (char *) yy_flex_alloc( n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); - - for ( i = 0; i < len; ++i ) - buf[i] = bytes[i]; - - buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; - - b = yy_scan_buffer( buf, n ); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); - - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; - - return b; - } -#endif - - -#ifndef YY_NO_PUSH_STATE -#ifdef YY_USE_PROTOS -static void yy_push_state( int new_state ) -#else -static void yy_push_state( new_state ) -int new_state; -#endif - { - if ( yy_start_stack_ptr >= yy_start_stack_depth ) - { - yy_size_t new_size; - - yy_start_stack_depth += YY_START_STACK_INCR; - new_size = yy_start_stack_depth * sizeof( int ); - - if ( ! yy_start_stack ) - yy_start_stack = (int *) yy_flex_alloc( new_size ); - - else - yy_start_stack = (int *) yy_flex_realloc( - (void *) yy_start_stack, new_size ); - - if ( ! yy_start_stack ) - YY_FATAL_ERROR( - "out of memory expanding start-condition stack" ); - } - - yy_start_stack[yy_start_stack_ptr++] = YY_START; - - BEGIN(new_state); - } -#endif - - -#ifndef YY_NO_POP_STATE -static void yy_pop_state() - { - if ( --yy_start_stack_ptr < 0 ) - YY_FATAL_ERROR( "start-condition stack underflow" ); - - BEGIN(yy_start_stack[yy_start_stack_ptr]); - } -#endif - - -#ifndef YY_NO_TOP_STATE -static int yy_top_state() - { - return yy_start_stack[yy_start_stack_ptr - 1]; - } -#endif - -#ifndef YY_EXIT_FAILURE -#define YY_EXIT_FAILURE 2 -#endif - -#ifdef YY_USE_PROTOS -static void yy_fatal_error( yyconst char msg[] ) -#else -static void yy_fatal_error( msg ) -char msg[]; -#endif - { - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); - } - - - -/* Redefine yyless() so it works in section 3 code. */ - -#undef yyless -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - yytext[yyleng] = yy_hold_char; \ - yy_c_buf_p = yytext + n; \ - yy_hold_char = *yy_c_buf_p; \ - *yy_c_buf_p = '\0'; \ - yyleng = n; \ - } \ - while ( 0 ) - - -/* Internal utility routines. */ - -#ifndef yytext_ptr -#ifdef YY_USE_PROTOS -static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) -#else -static void yy_flex_strncpy( s1, s2, n ) -char *s1; -yyconst char *s2; -int n; -#endif - { - register int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; - } -#endif - -#ifdef YY_NEED_STRLEN -#ifdef YY_USE_PROTOS -static int yy_flex_strlen( yyconst char *s ) -#else -static int yy_flex_strlen( s ) -yyconst char *s; -#endif - { - register int n; - for ( n = 0; s[n]; ++n ) - ; - - return n; - } -#endif - - -#ifdef YY_USE_PROTOS -static void *yy_flex_alloc( yy_size_t size ) -#else -static void *yy_flex_alloc( size ) -yy_size_t size; -#endif - { - return (void *) malloc( size ); - } - -#ifdef YY_USE_PROTOS -static void *yy_flex_realloc( void *ptr, yy_size_t size ) -#else -static void *yy_flex_realloc( ptr, size ) -void *ptr; -yy_size_t size; -#endif - { - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return (void *) realloc( (char *) ptr, size ); - } - -#ifdef YY_USE_PROTOS -static void yy_flex_free( void *ptr ) -#else -static void yy_flex_free( ptr ) -void *ptr; -#endif - { - free( ptr ); - } - -#if YY_MAIN -int main() - { - yylex(); - return 0; - } -#endif -#line 303 "token.l" - - -void -yyfatal(s) - const char *s; -{ - yyerror(s); - exit(1); -} - -void -yyerror(s) - const char *s; -{ - printf("line %d: %s at [%s]\n", lineno, s, yytext); -} - -int -parse(fp) - FILE **fp; -{ - yyin = *fp; - - lineno = 1; - parse_init(); - - if (yyparse()) { - printf("parse failed, line %d.\n", lineno); - return(-1); - } - - return(0); -} - -int -parse_string (char *src) -{ - int result; - YY_BUFFER_STATE buf_state; - - buf_state = yy_scan_string(src); - result = yyparse(); - yy_delete_buffer(buf_state); - return result; -} - diff --git a/lib/libipsec/Makefile b/lib/libipsec/Makefile index b2055994f43a..5216fde43ef5 100644 --- a/lib/libipsec/Makefile +++ b/lib/libipsec/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.15 2005/12/15 04:27:32 jmc Exp $ +# $NetBSD: Makefile,v 1.16 2005/12/16 16:25:07 jmc Exp $ USE_SHLIBDIR= yes WARNS= 0 # Will be fixed later @@ -20,14 +20,14 @@ CPPFLAGS+=-DINET6 .PATH: ${DIST}/src/libipsec SRCS= ipsec_dump_policy.c ipsec_get_policylen.c ipsec_strerror.c \ - pfkey.c pfkey_dump.c policy_parse.c policy_token.c key_debug.c + pfkey.c pfkey_dump.c policy_parse.y policy_token.l key_debug.c + +LPREFIX+=__libipsec +YPREFIX+=__libipsec +YHEADER=policy_parse.h MAN= ipsec_set_policy.3 ipsec_strerror.3 MLINKS+=ipsec_set_policy.3 ipsec_get_policylen.3 \ ipsec_set_policy.3 ipsec_dump_policy.3 .include - -# Don't auto-frob .y or .l files. -.l.c .y.c .y.h: - @true diff --git a/sbin/setkey/Makefile b/sbin/setkey/Makefile index ee5d9584816d..fba1354b10a4 100644 --- a/sbin/setkey/Makefile +++ b/sbin/setkey/Makefile @@ -1,13 +1,13 @@ -# $NetBSD: Makefile,v 1.8 2005/12/15 14:27:21 jmc Exp $ - -WARNS= 0 # Will be fixed later +# $NetBSD: Makefile,v 1.9 2005/12/16 16:25:07 jmc Exp $ .include PROG= setkey -SRCS= setkey.c parse.c token.c +SRCS= setkey.c parse.y token.l MAN= setkey.8 +YHEADER=parse.h + DIST= ${NETBSDSRCDIR}/crypto/dist/ipsec-tools CPPFLAGS+= -I${DIST}/src/setkey -I${DIST}/src/libipsec @@ -25,7 +25,3 @@ CPPFLAGS+=-DINET6 .PATH: ${DIST}/src/setkey .include - -# Don't auto-frob .y or .l files. -.l.c .y.c .y.h: - @true