diff options
Diffstat (limited to 'ipsec-tools/src/setkey/parse.c')
-rw-r--r-- | ipsec-tools/src/setkey/parse.c | 4227 |
1 files changed, 1495 insertions, 2732 deletions
diff --git a/ipsec-tools/src/setkey/parse.c b/ipsec-tools/src/setkey/parse.c index 2a9f8796..415acf6c 100644 --- a/ipsec-tools/src/setkey/parse.c +++ b/ipsec-tools/src/setkey/parse.c @@ -1,70 +1,103 @@ -/* A Bison parser, made by GNU Bison 2.6.2. */ - -/* Bison implementation for Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2012 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - -/* C LALR(1) parser skeleton written by Richard Stallman, by - simplifying the original so-called "semantic" parser. */ - -/* All symbols defined below should begin with yy or YY, to avoid - infringing on user name space. This should be done even for local - variables, as they might otherwise be expanded by user macros. - There are some unavoidable exceptions within include files to - define necessary library symbols; they are noted "INFRINGES ON - USER NAME SPACE" below. */ - -/* Identify Bison output. */ -#define YYBISON 1 - -/* Bison version. */ -#define YYBISON_VERSION "2.6.2" - -/* Skeleton name. */ -#define YYSKELETON_NAME "yacc.c" - -/* Pure parsers. */ -#define YYPURE 0 - -/* Push parsers. */ -#define YYPUSH 0 - -/* Pull parsers. */ -#define YYPULL 1 - - - +/* original parser id follows */ +/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ + +#define YYBYACC 1 +#define YYMAJOR 1 +#define YYMINOR 9 +#define YYPATCH 20170201 + +#define YYEMPTY (-1) +#define yyclearin (yychar = YYEMPTY) +#define yyerrok (yyerrflag = 0) +#define YYRECOVERING() (yyerrflag != 0) +#define YYENOMEM (-2) +#define YYEOF 0 + +#ifndef yyparse +#define yyparse setkeyyyparse +#endif /* yyparse */ + +#ifndef yylex +#define yylex setkeyyylex +#endif /* yylex */ + +#ifndef yyerror +#define yyerror setkeyyyerror +#endif /* yyerror */ + +#ifndef yychar +#define yychar setkeyyychar +#endif /* yychar */ + +#ifndef yyval +#define yyval setkeyyyval +#endif /* yyval */ + +#ifndef yylval +#define yylval setkeyyylval +#endif /* yylval */ + +#ifndef yydebug +#define yydebug setkeyyydebug +#endif /* yydebug */ + +#ifndef yynerrs +#define yynerrs setkeyyynerrs +#endif /* yynerrs */ + +#ifndef yyerrflag +#define yyerrflag setkeyyyerrflag +#endif /* yyerrflag */ + +#ifndef yylhs +#define yylhs setkeyyylhs +#endif /* yylhs */ + +#ifndef yylen +#define yylen setkeyyylen +#endif /* yylen */ + +#ifndef yydefred +#define yydefred setkeyyydefred +#endif /* yydefred */ + +#ifndef yydgoto +#define yydgoto setkeyyydgoto +#endif /* yydgoto */ + +#ifndef yysindex +#define yysindex setkeyyysindex +#endif /* yysindex */ + +#ifndef yyrindex +#define yyrindex setkeyyyrindex +#endif /* yyrindex */ + +#ifndef yygindex +#define yygindex setkeyyygindex +#endif /* yygindex */ + +#ifndef yytable +#define yytable setkeyyytable +#endif /* yytable */ + +#ifndef yycheck +#define yycheck setkeyyycheck +#endif /* yycheck */ + +#ifndef yyname +#define yyname setkeyyyname +#endif /* yyname */ + +#ifndef yyrule +#define yyrule setkeyyyrule +#endif /* yyrule */ +#define YYPREFIX "setkeyyy" -/* Copy the first part of user declarations. */ -/* Line 336 of yacc.c */ -#line 34 "parse.y" +#define YYPURE 0 +#line 35 "../../ipsec-tools/src/setkey/parse.y" #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -100,6 +133,7 @@ (isdigit((int)c) ? (c - '0') : \ (isupper((int)c) ? (c - 'A' + 10) : (c - 'a' + 10))) +#ifndef __rtems__ u_int32_t p_spi; u_int p_ext, p_alg_enc, p_alg_auth, p_replay, p_mode; u_int32_t p_reqid; @@ -108,6 +142,16 @@ 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; +#else /* __rtems__ */ +static u_int32_t p_spi; +static u_int p_ext, p_alg_enc, p_alg_auth, p_replay, p_mode; +static u_int32_t p_reqid; +static u_int p_key_enc_len, p_key_auth_len; +static const char *p_key_enc; +static const char *p_key_auth; +static time_t p_lt_hard, p_lt_soft; +static size_t p_lb_hard, p_lb_soft; +#endif /* __rtems__ */ struct security_ctx { u_int8_t doi; @@ -116,7 +160,7 @@ struct security_ctx { char *buf; }; -struct security_ctx sec_ctx; +static struct security_ctx sec_ctx; static u_int p_natt_type; static struct addrinfo * p_natt_oa = NULL; @@ -138,2713 +182,410 @@ 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 336 of yacc.c */ -#line 144 "parse.c" - -# ifndef YY_NULL -# if defined __cplusplus && 201103L <= __cplusplus -# define YY_NULL nullptr -# else -# define YY_NULL 0 -# endif -# endif - -/* Enabling verbose error messages. */ -#ifdef YYERROR_VERBOSE -# undef YYERROR_VERBOSE -# define YYERROR_VERBOSE 1 -#else -# define YYERROR_VERBOSE 0 -#endif - -/* In a future release of Bison, this section will be replaced - by #include "y.tab.h". */ -#ifndef YY_Y_TAB_H -# define YY_Y_TAB_H -/* Enabling traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif -#if YYDEBUG -extern int yydebug; +#ifdef YYSTYPE +#undef YYSTYPE_IS_DECLARED +#define YYSTYPE_IS_DECLARED 1 #endif - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - EOT = 258, - SLASH = 259, - BLCL = 260, - ELCL = 261, - ADD = 262, - GET = 263, - DELETE = 264, - DELETEALL = 265, - FLUSH = 266, - DUMP = 267, - EXIT = 268, - PR_ESP = 269, - PR_AH = 270, - PR_IPCOMP = 271, - PR_ESPUDP = 272, - PR_TCP = 273, - F_PROTOCOL = 274, - F_AUTH = 275, - F_ENC = 276, - F_REPLAY = 277, - F_COMP = 278, - F_RAWCPI = 279, - F_MODE = 280, - MODE = 281, - F_REQID = 282, - F_EXT = 283, - EXTENSION = 284, - NOCYCLICSEQ = 285, - ALG_AUTH = 286, - ALG_AUTH_NOKEY = 287, - ALG_ENC = 288, - ALG_ENC_NOKEY = 289, - ALG_ENC_DESDERIV = 290, - ALG_ENC_DES32IV = 291, - ALG_ENC_OLD = 292, - ALG_COMP = 293, - F_LIFETIME_HARD = 294, - F_LIFETIME_SOFT = 295, - F_LIFEBYTE_HARD = 296, - F_LIFEBYTE_SOFT = 297, - DECSTRING = 298, - QUOTEDSTRING = 299, - HEXSTRING = 300, - STRING = 301, - ANY = 302, - SPDADD = 303, - SPDUPDATE = 304, - SPDDELETE = 305, - SPDDUMP = 306, - SPDFLUSH = 307, - F_POLICY = 308, - PL_REQUESTS = 309, - F_AIFLAGS = 310, - TAGGED = 311, - SECURITY_CTX = 312 - }; -#endif -/* Tokens. */ -#define EOT 258 -#define SLASH 259 -#define BLCL 260 -#define ELCL 261 -#define ADD 262 -#define GET 263 -#define DELETE 264 -#define DELETEALL 265 -#define FLUSH 266 -#define DUMP 267 -#define EXIT 268 -#define PR_ESP 269 -#define PR_AH 270 -#define PR_IPCOMP 271 -#define PR_ESPUDP 272 -#define PR_TCP 273 -#define F_PROTOCOL 274 -#define F_AUTH 275 -#define F_ENC 276 -#define F_REPLAY 277 -#define F_COMP 278 -#define F_RAWCPI 279 -#define F_MODE 280 -#define MODE 281 -#define F_REQID 282 -#define F_EXT 283 -#define EXTENSION 284 -#define NOCYCLICSEQ 285 -#define ALG_AUTH 286 -#define ALG_AUTH_NOKEY 287 -#define ALG_ENC 288 -#define ALG_ENC_NOKEY 289 -#define ALG_ENC_DESDERIV 290 -#define ALG_ENC_DES32IV 291 -#define ALG_ENC_OLD 292 -#define ALG_COMP 293 -#define F_LIFETIME_HARD 294 -#define F_LIFETIME_SOFT 295 -#define F_LIFEBYTE_HARD 296 -#define F_LIFEBYTE_SOFT 297 -#define DECSTRING 298 -#define QUOTEDSTRING 299 -#define HEXSTRING 300 -#define STRING 301 -#define ANY 302 -#define SPDADD 303 -#define SPDUPDATE 304 -#define SPDDELETE 305 -#define SPDDUMP 306 -#define SPDFLUSH 307 -#define F_POLICY 308 -#define PL_REQUESTS 309 -#define F_AIFLAGS 310 -#define TAGGED 311 -#define SECURITY_CTX 312 - - - -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE -{ -/* Line 350 of yacc.c */ -#line 110 "parse.y" - +#ifndef YYSTYPE_IS_DECLARED +#define YYSTYPE_IS_DECLARED 1 +#line 121 "../../ipsec-tools/src/setkey/parse.y" +typedef union { int num; unsigned long ulnum; vchar_t val; struct addrinfo *res; - - -/* Line 350 of yacc.c */ -#line 309 "parse.c" } YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 -#endif - -extern YYSTYPE yylval; +#endif /* !YYSTYPE_IS_DECLARED */ +#line 200 "setkeyyy.tab.c" +/* compatibility with bison */ #ifdef YYPARSE_PARAM -#if defined __STDC__ || defined __cplusplus -int yyparse (void *YYPARSE_PARAM); -#else -int yyparse (); -#endif -#else /* ! YYPARSE_PARAM */ -#if defined __STDC__ || defined __cplusplus -int yyparse (void); -#else -int yyparse (); -#endif -#endif /* ! YYPARSE_PARAM */ - -#endif /* !YY_Y_TAB_H */ - -/* Copy the second part of user declarations. */ - -/* Line 353 of yacc.c */ -#line 337 "parse.c" - -#ifdef short -# undef short -#endif - -#ifdef YYTYPE_UINT8 -typedef YYTYPE_UINT8 yytype_uint8; -#else -typedef unsigned char yytype_uint8; -#endif - -#ifdef YYTYPE_INT8 -typedef YYTYPE_INT8 yytype_int8; -#elif (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -typedef signed char yytype_int8; -#else -typedef short int yytype_int8; -#endif - -#ifdef YYTYPE_UINT16 -typedef YYTYPE_UINT16 yytype_uint16; -#else -typedef unsigned short int yytype_uint16; -#endif - -#ifdef YYTYPE_INT16 -typedef YYTYPE_INT16 yytype_int16; -#else -typedef short int yytype_int16; -#endif - -#ifndef YYSIZE_T -# ifdef __SIZE_TYPE__ -# define YYSIZE_T __SIZE_TYPE__ -# elif defined size_t -# define YYSIZE_T size_t -# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t +/* compatibility with FreeBSD */ +# ifdef YYPARSE_PARAM_TYPE +# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM) # else -# define YYSIZE_T unsigned int +# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM) # endif -#endif - -#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) - -#ifndef YY_ -# if defined YYENABLE_NLS && YYENABLE_NLS -# if ENABLE_NLS -# include <libintl.h> /* INFRINGES ON USER NAME SPACE */ -# define YY_(msgid) dgettext ("bison-runtime", msgid) -# endif -# endif -# ifndef YY_ -# define YY_(msgid) msgid -# endif -#endif - -/* Suppress unused-variable warnings by "using" E. */ -#if ! defined lint || defined __GNUC__ -# define YYUSE(e) ((void) (e)) #else -# define YYUSE(e) /* empty */ +# define YYPARSE_DECL() yyparse(void) #endif -/* Identity function, used to suppress warnings about constant conditions. */ -#ifndef lint -# define YYID(n) (n) -#else -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static int -YYID (int yyi) +/* Parameters sent to lex. */ +#ifdef YYLEX_PARAM +# define YYLEX_DECL() yylex(void *YYLEX_PARAM) +# define YYLEX yylex(YYLEX_PARAM) #else -static int -YYID (yyi) - int yyi; +# define YYLEX_DECL() yylex(void) +# define YYLEX yylex() #endif -{ - return yyi; -} -#endif - -#if ! defined yyoverflow || YYERROR_VERBOSE - -/* The parser invokes alloca or malloc; define the necessary symbols. */ - -# ifdef YYSTACK_USE_ALLOCA -# if YYSTACK_USE_ALLOCA -# ifdef __GNUC__ -# define YYSTACK_ALLOC __builtin_alloca -# elif defined __BUILTIN_VA_ARG_INCR -# include <alloca.h> /* INFRINGES ON USER NAME SPACE */ -# elif defined _AIX -# define YYSTACK_ALLOC __alloca -# elif defined _MSC_VER -# include <malloc.h> /* INFRINGES ON USER NAME SPACE */ -# define alloca _alloca -# else -# define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ - /* Use EXIT_SUCCESS as a witness for stdlib.h. */ -# ifndef EXIT_SUCCESS -# define EXIT_SUCCESS 0 -# endif -# endif -# endif -# endif -# endif - -# ifdef YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) -# ifndef YYSTACK_ALLOC_MAXIMUM - /* The OS might guarantee only one guard page at the bottom of the stack, - and a page size can be as small as 4096 bytes. So we cannot safely - invoke alloca (N) if N exceeds 4096. Use a slightly smaller number - to allow for a few compiler-allocated temporary stack slots. */ -# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ -# endif -# else -# define YYSTACK_ALLOC YYMALLOC -# define YYSTACK_FREE YYFREE -# ifndef YYSTACK_ALLOC_MAXIMUM -# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM -# endif -# if (defined __cplusplus && ! defined EXIT_SUCCESS \ - && ! ((defined YYMALLOC || defined malloc) \ - && (defined YYFREE || defined free))) -# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ -# ifndef EXIT_SUCCESS -# define EXIT_SUCCESS 0 -# endif -# endif -# ifndef YYMALLOC -# define YYMALLOC malloc -# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# ifndef YYFREE -# define YYFREE free -# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -void free (void *); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# endif -#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ - - -#if (! defined yyoverflow \ - && (! defined __cplusplus \ - || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) - -/* A type that is properly aligned for any stack member. */ -union yyalloc -{ - yytype_int16 yyss_alloc; - YYSTYPE yyvs_alloc; -}; - -/* The size of the maximum gap between one aligned stack and the next. */ -# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) - -/* The size of an array large to enough to hold all stacks, each with - N elements. */ -# define YYSTACK_BYTES(N) \ - ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ - + YYSTACK_GAP_MAXIMUM) - -# define YYCOPY_NEEDED 1 - -/* Relocate STACK from its old location to the new one. The - local variables YYSIZE and YYSTACKSIZE give the old and new number of - elements in the stack, and YYPTR gives the new location of the - stack. Advance YYPTR to a properly aligned location for the next - stack. */ -# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ - Stack = &yyptr->Stack_alloc; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ - } \ - while (YYID (0)) +/* Parameters sent to yyerror. */ +#ifndef YYERROR_DECL +#define YYERROR_DECL() yyerror(const char *s) #endif - -#if defined YYCOPY_NEEDED && YYCOPY_NEEDED -/* Copy COUNT objects from SRC to DST. The source and destination do - not overlap. */ -# ifndef YYCOPY -# if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(Dst, Src, Count) \ - __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) -# else -# define YYCOPY(Dst, Src, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (Dst)[yyi] = (Src)[yyi]; \ - } \ - while (YYID (0)) -# endif -# endif -#endif /* !YYCOPY_NEEDED */ - -/* YYFINAL -- State number of the termination state. */ -#define YYFINAL 2 -/* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 174 - -/* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 58 -/* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 37 -/* YYNRULES -- Number of rules. */ -#define YYNRULES 90 -/* YYNRULES -- Number of states. */ -#define YYNSTATES 188 - -/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ -#define YYUNDEFTOK 2 -#define YYMAXUTOK 312 - -#define YYTRANSLATE(YYX) \ - ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) - -/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ -static const yytype_uint8 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, 2, 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, 56, 57 -}; - -#if YYDEBUG -/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in - YYRHS. */ -static const yytype_uint16 yyprhs[] = -{ - 0, 0, 3, 4, 7, 9, 11, 13, 15, 17, - 19, 21, 23, 25, 27, 29, 31, 41, 50, 57, - 66, 70, 74, 75, 77, 79, 81, 83, 86, 88, - 90, 92, 94, 96, 98, 103, 106, 109, 112, 116, - 118, 121, 123, 126, 129, 132, 134, 136, 138, 139, - 142, 145, 148, 151, 154, 157, 160, 163, 166, 169, - 172, 177, 191, 197, 211, 217, 231, 234, 237, 238, - 241, 243, 245, 247, 250, 251, 254, 255, 259, 263, - 267, 269, 271, 273, 275, 276, 278, 279, 284, 287, - 289 -}; - -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const yytype_int8 yyrhs[] = -{ - 59, 0, -1, -1, 59, 60, -1, 61, -1, 64, - -1, 62, -1, 63, -1, 65, -1, 66, -1, 94, - -1, 78, -1, 79, -1, 80, -1, 81, -1, 82, - -1, 7, 83, 86, 86, 67, 68, 76, 69, 3, - -1, 9, 83, 86, 86, 67, 68, 76, 3, -1, - 10, 83, 85, 85, 67, 3, -1, 8, 83, 86, - 86, 67, 68, 76, 3, -1, 11, 67, 3, -1, - 12, 67, 3, -1, -1, 14, -1, 15, -1, 16, - -1, 17, -1, 17, 85, -1, 18, -1, 43, -1, - 45, -1, 70, -1, 71, -1, 72, -1, 21, 73, - 20, 74, -1, 21, 73, -1, 20, 74, -1, 23, - 38, -1, 23, 38, 24, -1, 34, -1, 33, 75, - -1, 37, -1, 35, 75, -1, 36, 75, -1, 31, - 75, -1, 32, -1, 44, -1, 45, -1, -1, 76, - 77, -1, 28, 29, -1, 28, 30, -1, 25, 26, - -1, 25, 47, -1, 27, 43, -1, 22, 43, -1, - 39, 43, -1, 40, 43, -1, 41, 43, -1, 42, - 43, -1, 57, 43, 43, 44, -1, 48, 83, 46, - 87, 88, 46, 87, 88, 89, 90, 91, 92, 3, - -1, 48, 56, 44, 92, 3, -1, 49, 83, 46, - 87, 88, 46, 87, 88, 89, 90, 91, 92, 3, - -1, 49, 56, 44, 92, 3, -1, 50, 83, 46, - 87, 88, 46, 87, 88, 89, 90, 91, 92, 3, - -1, 51, 3, -1, 52, 3, -1, -1, 83, 84, - -1, 55, -1, 46, -1, 46, -1, 46, 88, -1, - -1, 4, 43, -1, -1, 5, 47, 6, -1, 5, - 43, 6, -1, 5, 46, 6, -1, 43, -1, 47, - -1, 18, -1, 46, -1, -1, 46, -1, -1, 57, - 43, 43, 44, -1, 53, 93, -1, 54, -1, 13, - 3, -1 -}; - -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ -static const yytype_uint16 yyrline[] = -{ - 0, 151, 151, 153, 161, 162, 163, 164, 165, 166, - 167, 168, 169, 170, 171, 172, 178, 190, 209, 237, - 252, 262, 272, 275, 283, 291, 295, 302, 309, 318, - 319, 340, 341, 342, 346, 347, 351, 355, 363, 375, - 390, 405, 421, 442, 466, 491, 504, 508, 537, 539, - 543, 544, 545, 546, 547, 548, 557, 558, 559, 560, - 561, 573, 606, 619, 652, 664, 696, 707, 716, 718, - 722, 747, 758, 766, 777, 778, 783, 791, 800, 811, - 818, 819, 820, 823, 846, 850, 861, 863, 872, 896, - 901 -}; +#ifndef YYERROR_CALL +#define YYERROR_CALL(msg) yyerror(msg) #endif -#if YYDEBUG || YYERROR_VERBOSE || 0 -/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - First, the terminals, then, starting at YYNTOKENS, nonterminals. */ -static const char *const yytname[] = -{ - "$end", "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", "SPDUPDATE", "SPDDELETE", "SPDDUMP", "SPDFLUSH", - "F_POLICY", "PL_REQUESTS", "F_AIFLAGS", "TAGGED", "SECURITY_CTX", - "$accept", "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", "spdupdate_command", "spddelete_command", - "spddump_command", "spdflush_command", "ipaddropts", "ipaddropt", - "ipaddr", "ipandport", "prefix", "portstr", "upper_spec", - "upper_misc_spec", "context_spec", "policy_spec", "policy_requests", - "exit_command", YY_NULL +extern int YYPARSE_DECL(); + +#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 SPDUPDATE 303 +#define SPDDELETE 304 +#define SPDDUMP 305 +#define SPDFLUSH 306 +#define F_POLICY 307 +#define PL_REQUESTS 308 +#define F_AIFLAGS 309 +#define TAGGED 310 +#define SECURITY_CTX 311 +#define YYERRCODE 256 +typedef int YYINT; +static const YYINT setkeyyylhs[] = { -1, + 0, 0, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 12, 14, 15, 13, 16, 17, + 2, 2, 2, 2, 2, 2, 2, 25, 25, 27, + 27, 27, 28, 28, 29, 30, 30, 31, 31, 31, + 31, 31, 32, 32, 5, 5, 26, 26, 33, 33, + 33, 33, 33, 33, 33, 33, 33, 33, 33, 19, + 19, 20, 20, 21, 22, 23, 24, 24, 35, 9, + 10, 10, 1, 1, 4, 4, 4, 4, 3, 3, + 3, 3, 7, 7, 34, 34, 8, 6, 18, }; -#endif - -# ifdef YYPRINT -/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to - token YYLEX-NUM. */ -static const yytype_uint16 yytoknum[] = -{ - 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, - 305, 306, 307, 308, 309, 310, 311, 312 +static const YYINT setkeyyylen[] = { 2, + 0, 2, 1, 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, 4, 13, + 5, 13, 5, 13, 2, 2, 0, 2, 1, 1, + 1, 2, 0, 2, 0, 3, 3, 3, 1, 1, + 1, 1, 0, 1, 0, 4, 2, 1, 2, }; -# endif - -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = -{ - 0, 58, 59, 59, 60, 60, 60, 60, 60, 60, - 60, 60, 60, 60, 60, 60, 61, 62, 63, 64, - 65, 66, 67, 67, 67, 67, 67, 67, 67, 68, - 68, 69, 69, 69, 70, 70, 71, 72, 72, 73, - 73, 73, 73, 73, 74, 74, 75, 75, 76, 76, - 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, - 77, 78, 78, 79, 79, 80, 81, 82, 83, 83, - 84, 85, 86, 86, 87, 87, 88, 88, 88, 88, - 89, 89, 89, 89, 90, 90, 91, 91, 92, 93, - 94 +static const YYINT setkeyyydefred[] = { 1, + 0, 67, 67, 67, 67, 0, 0, 0, 0, 0, + 67, 0, 0, 2, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 0, 0, 0, 0, + 22, 23, 24, 0, 27, 0, 0, 89, 0, 0, + 0, 0, 0, 65, 66, 0, 69, 0, 68, 0, + 0, 70, 0, 26, 19, 20, 0, 0, 0, 0, + 0, 0, 72, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 88, 87, 61, 74, 0, 63, 0, 0, 77, + 78, 76, 28, 29, 47, 47, 47, 17, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 30, 31, 32, 48, 18, 16, 0, 0, 0, 0, + 44, 35, 0, 38, 0, 0, 40, 0, 54, 0, + 51, 52, 53, 49, 50, 55, 56, 57, 58, 0, + 15, 81, 79, 82, 80, 0, 0, 0, 45, 46, + 43, 39, 41, 42, 0, 37, 0, 84, 0, 0, + 0, 33, 59, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 60, 62, 64, 86, }; - -/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = -{ - 0, 2, 0, 2, 1, 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, - 4, 13, 5, 13, 5, 13, 2, 2, 0, 2, - 1, 1, 1, 2, 0, 2, 0, 3, 3, 3, - 1, 1, 1, 1, 0, 1, 0, 4, 2, 1, - 2 +static const YYINT setkeyyydgoto[] = { 1, + 71, 36, 156, 63, 161, 83, 169, 69, 53, 48, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 95, 102, 120, 121, 122, 123, + 138, 132, 124, 175, 49, }; - -/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. - Performed when YYTABLE doesn't specify something else to do. Zero - means the default is an error. */ -static const yytype_uint8 yydefact[] = -{ - 2, 0, 1, 68, 68, 68, 68, 22, 22, 0, - 68, 68, 68, 0, 0, 3, 4, 6, 7, 5, - 8, 9, 11, 12, 13, 14, 15, 10, 0, 0, - 0, 0, 23, 24, 25, 26, 28, 0, 0, 90, - 0, 0, 0, 0, 0, 66, 67, 72, 70, 69, - 0, 0, 0, 71, 0, 27, 20, 21, 0, 74, - 0, 74, 74, 0, 73, 22, 22, 22, 22, 0, - 0, 0, 76, 0, 76, 76, 0, 0, 0, 0, - 0, 0, 0, 89, 88, 62, 75, 0, 64, 0, - 0, 78, 79, 77, 29, 30, 48, 48, 48, 18, - 74, 74, 74, 0, 0, 0, 76, 76, 76, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 31, 32, 33, 49, 19, 17, 0, 0, - 0, 0, 45, 36, 0, 39, 0, 0, 41, 35, - 55, 37, 52, 53, 54, 50, 51, 56, 57, 58, - 59, 0, 16, 82, 80, 83, 81, 84, 84, 84, - 46, 47, 44, 40, 42, 43, 0, 38, 0, 85, - 86, 86, 86, 34, 60, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 61, 63, 65, 87 +static const YYINT setkeyyysindex[] = { 0, + -251, 0, 0, 0, 0, -128, -128, -250, -267, -253, + 0, -227, -169, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, -292, -292, -292, -277, + 0, 0, 0, -187, 0, -129, -122, 0, -233, -214, + -133, -185, -180, 0, 0, -103, 0, -134, 0, -134, + -134, 0, -187, 0, 0, 0, -140, -90, -140, -90, + -90, -147, 0, -128, -128, -128, -128, -139, -87, -126, + -103, -85, -103, -103, -86, -84, -83, -210, -210, -210, + -82, 0, 0, 0, 0, -127, 0, -121, -120, 0, + 0, 0, 0, 0, 0, 0, 0, 0, -90, -90, + -90, -197, -255, -248, -103, -103, -103, -280, -142, -119, + -111, -276, -115, -264, -114, -113, -112, -110, -109, -71, + 0, 0, 0, 0, 0, 0, -191, -191, -191, -249, + 0, 0, -249, 0, -249, -249, 0, -81, 0, -89, + 0, 0, 0, 0, 0, 0, 0, 0, 0, -107, + 0, 0, 0, 0, 0, -108, -108, -108, 0, 0, + 0, 0, 0, 0, -280, 0, -104, 0, -116, -116, + -116, 0, 0, -106, -140, -140, -140, -101, -60, -58, + -57, -100, 0, 0, 0, 0, }; - -/* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_int16 yydefgoto[] = -{ - -1, 1, 15, 16, 17, 18, 19, 20, 21, 37, - 96, 121, 122, 123, 124, 139, 133, 162, 103, 125, - 22, 23, 24, 25, 26, 28, 49, 54, 50, 72, - 64, 157, 170, 176, 70, 84, 27 +static const YYINT setkeyyyrindex[] = { 0, + 0, 0, 0, 0, 0, -55, -55, 0, -173, -173, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, -235, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, -178, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, -256, 0, -256, + -256, 0, 0, -192, -192, -192, -55, 0, 0, 0, + -99, 0, -99, -99, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, -230, -230, + -230, 0, 0, 0, -189, -189, -189, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, -54, 0, -53, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, -177, -177, -177, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, -102, -102, + -102, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, }; - -/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ -#define YYPACT_NINF -61 -static const yytype_int16 yypact[] = -{ - -61, 3, -61, -61, -61, -61, -61, 96, 96, 17, - -12, 1, -61, 78, 106, -61, -61, -61, -61, -61, - -61, -61, -61, -61, -61, -61, -61, -61, -38, -38, - -38, 29, -61, -61, -61, 69, -61, 122, 130, -61, - 92, 31, 93, 39, 49, -61, -61, 133, -61, -61, - 94, 94, 94, -61, 69, -61, -61, -61, 88, 135, - 88, 135, 135, -24, -61, 96, 96, 96, 96, 89, - 139, 101, 133, 142, 133, 133, 140, 141, 143, 81, - 81, 81, 145, -61, -61, -61, -61, 104, -61, 105, - 107, -61, -61, -61, -61, -61, -61, -61, -61, -61, - 135, 135, 135, 51, -1, 6, 133, 133, 133, -26, - 86, 109, 116, -22, 112, 13, 113, 114, 115, 117, - 118, 156, -61, -61, -61, -61, -61, -61, -11, -11, - -11, 5, -61, -61, 5, -61, 5, 5, -61, 144, - -61, 138, -61, -61, -61, -61, -61, -61, -61, -61, - -61, 120, -61, -61, -61, -61, -61, 119, 119, 119, - -61, -61, -61, -61, -61, -61, -26, -61, 123, -61, - 111, 111, 111, -61, -61, 126, 88, 88, 88, 127, - 163, 168, 169, 129, -61, -61, -61, -61 +static const YYINT setkeyyygindex[] = { 0, + -25, -6, -56, -5, 22, 0, 2, -59, -16, 75, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 128, 72, 65, 0, 0, 0, 0, + 0, 41, 0, -7, 0, }; - -/* YYPGOTO[NTERM-NUM]. */ -static const yytype_int8 yypgoto[] = -{ - -61, -61, -61, -61, -61, -61, -61, -61, -61, -7, - 22, -61, -61, -61, -61, -61, 8, -54, 30, -61, - -61, -61, -61, -61, -61, 95, -61, -17, 37, -32, - -10, 0, -27, -37, -60, -61, -61 +#define YYTABLESIZE 206 +static const YYINT setkeyyytable[] = { 72, + 37, 125, 73, 141, 130, 131, 38, 46, 126, 2, + 3, 4, 5, 6, 7, 8, 47, 54, 144, 145, + 110, 25, 52, 112, 142, 113, 114, 110, 73, 44, + 112, 47, 113, 114, 73, 74, 67, 115, 116, 117, + 118, 73, 39, 73, 115, 116, 117, 118, 159, 160, + 9, 10, 11, 12, 13, 119, 41, 78, 79, 80, + 81, 25, 119, 25, 57, 86, 73, 88, 89, 73, + 73, 157, 158, 105, 106, 107, 108, 109, 110, 111, + 152, 112, 75, 113, 114, 58, 93, 45, 94, 71, + 71, 71, 71, 71, 47, 115, 116, 117, 118, 127, + 128, 129, 50, 51, 21, 153, 21, 75, 154, 155, + 75, 75, 52, 119, 60, 179, 180, 181, 71, 61, + 71, 71, 64, 47, 65, 66, 67, 55, 47, 83, + 28, 29, 30, 83, 56, 67, 40, 42, 43, 31, + 32, 33, 34, 35, 133, 134, 135, 136, 137, 75, + 96, 97, 76, 77, 162, 62, 163, 164, 170, 171, + 103, 104, 176, 177, 59, 46, 68, 70, 82, 84, + 85, 87, 99, 90, 98, 91, 92, 139, 100, 101, + 140, 143, 146, 147, 148, 151, 149, 150, 166, 167, + 178, 168, 165, 173, 174, 182, 183, 186, 184, 185, + 75, 21, 34, 36, 85, 172, }; - -/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule which - number is the opposite. If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -1 -static const yytype_uint8 yytable[] = -{ - 73, 38, 126, 2, 142, 131, 132, 153, 47, 127, - 3, 4, 5, 6, 7, 8, 9, 48, 55, 76, - 39, 111, 77, 78, 113, 143, 114, 115, 111, 74, - 75, 113, 154, 114, 115, 155, 156, 68, 116, 117, - 118, 119, 145, 146, 40, 116, 117, 118, 119, 160, - 161, 10, 11, 12, 13, 14, 120, 42, 79, 80, - 81, 82, 87, 120, 89, 90, 51, 52, 106, 107, - 108, 109, 110, 111, 112, 53, 113, 59, 114, 115, - 163, 45, 164, 165, 48, 61, 48, 65, 66, 67, - 116, 117, 118, 119, 48, 62, 128, 129, 130, 29, - 30, 31, 97, 98, 48, 41, 43, 44, 120, 46, - 32, 33, 34, 35, 36, 53, 180, 181, 182, 134, - 135, 136, 137, 138, 94, 56, 95, 104, 105, 158, - 159, 171, 172, 57, 177, 178, 58, 60, 63, 71, - 47, 69, 85, 83, 86, 88, 91, 92, 99, 93, - 100, 101, 140, 102, 141, 144, 147, 148, 149, 152, - 150, 151, 167, 168, 166, 169, 184, 174, 175, 179, - 183, 185, 186, 187, 173 +static const YYINT setkeyyycheck[] = { 59, + 7, 257, 259, 280, 285, 286, 257, 300, 257, 261, + 262, 263, 264, 265, 266, 267, 309, 34, 283, 284, + 276, 257, 300, 279, 301, 281, 282, 276, 259, 257, + 279, 309, 281, 282, 60, 61, 53, 293, 294, 295, + 296, 272, 310, 300, 293, 294, 295, 296, 298, 299, + 302, 303, 304, 305, 306, 311, 310, 64, 65, 66, + 67, 297, 311, 299, 298, 71, 297, 73, 74, 300, + 301, 128, 129, 99, 100, 101, 274, 275, 276, 277, + 272, 279, 272, 281, 282, 300, 297, 257, 299, 268, + 269, 270, 271, 272, 309, 293, 294, 295, 296, 105, + 106, 107, 28, 29, 297, 297, 299, 297, 300, 301, + 300, 301, 300, 311, 300, 175, 176, 177, 297, 300, + 299, 300, 48, 309, 50, 51, 300, 257, 309, 307, + 3, 4, 5, 311, 257, 309, 9, 10, 11, 268, + 269, 270, 271, 272, 287, 288, 289, 290, 291, 297, + 79, 80, 300, 301, 133, 259, 135, 136, 157, 158, + 96, 97, 170, 171, 298, 300, 307, 258, 308, 257, + 297, 257, 300, 260, 257, 260, 260, 297, 300, 300, + 292, 297, 297, 297, 297, 257, 297, 297, 278, 297, + 297, 300, 274, 298, 311, 297, 257, 298, 257, 257, + 300, 257, 257, 257, 307, 165, }; - -#define yypact_value_is_default(yystate) \ - ((yystate) == (-61)) - -#define yytable_value_is_error(yytable_value) \ - YYID (0) - -static const yytype_uint8 yycheck[] = -{ - 60, 8, 3, 0, 26, 31, 32, 18, 46, 3, - 7, 8, 9, 10, 11, 12, 13, 55, 35, 43, - 3, 22, 46, 47, 25, 47, 27, 28, 22, 61, - 62, 25, 43, 27, 28, 46, 47, 54, 39, 40, - 41, 42, 29, 30, 56, 39, 40, 41, 42, 44, - 45, 48, 49, 50, 51, 52, 57, 56, 65, 66, - 67, 68, 72, 57, 74, 75, 29, 30, 100, 101, - 102, 20, 21, 22, 23, 46, 25, 46, 27, 28, - 134, 3, 136, 137, 55, 46, 55, 50, 51, 52, - 39, 40, 41, 42, 55, 46, 106, 107, 108, 4, - 5, 6, 80, 81, 55, 10, 11, 12, 57, 3, - 14, 15, 16, 17, 18, 46, 176, 177, 178, 33, - 34, 35, 36, 37, 43, 3, 45, 97, 98, 129, - 130, 158, 159, 3, 171, 172, 44, 44, 5, 4, - 46, 53, 3, 54, 43, 3, 6, 6, 3, 6, - 46, 46, 43, 46, 38, 43, 43, 43, 43, 3, - 43, 43, 24, 43, 20, 46, 3, 44, 57, 43, - 43, 3, 3, 44, 166 -}; - -/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ -static const yytype_uint8 yystos[] = -{ - 0, 59, 0, 7, 8, 9, 10, 11, 12, 13, - 48, 49, 50, 51, 52, 60, 61, 62, 63, 64, - 65, 66, 78, 79, 80, 81, 82, 94, 83, 83, - 83, 83, 14, 15, 16, 17, 18, 67, 67, 3, - 56, 83, 56, 83, 83, 3, 3, 46, 55, 84, - 86, 86, 86, 46, 85, 85, 3, 3, 44, 46, - 44, 46, 46, 5, 88, 86, 86, 86, 85, 53, - 92, 4, 87, 92, 87, 87, 43, 46, 47, 67, - 67, 67, 67, 54, 93, 3, 43, 88, 3, 88, - 88, 6, 6, 6, 43, 45, 68, 68, 68, 3, - 46, 46, 46, 76, 76, 76, 87, 87, 87, 20, - 21, 22, 23, 25, 27, 28, 39, 40, 41, 42, - 57, 69, 70, 71, 72, 77, 3, 3, 88, 88, - 88, 31, 32, 74, 33, 34, 35, 36, 37, 73, - 43, 38, 26, 47, 43, 29, 30, 43, 43, 43, - 43, 43, 3, 18, 43, 46, 47, 89, 89, 89, - 44, 45, 75, 75, 75, 75, 20, 24, 43, 46, - 90, 90, 90, 74, 44, 57, 91, 91, 91, 43, - 92, 92, 92, 43, 3, 3, 3, 44 -}; - -#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 yyerrorlab - - -/* 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. However, - YYFAIL appears to be in use. Nevertheless, it is formally deprecated - in Bison 2.4.2's NEWS entry, where a plan to phase it out is - discussed. */ - -#define YYFAIL goto yyerrlab -#if defined YYFAIL - /* This is here to suppress warnings from the GCC cpp's - -Wunused-macros. Normally we don't worry about that warning, but - some users do, and we want to make it easy for users to remove - YYFAIL uses, which will produce warnings from Bison 2.5. */ -#endif - -#define YYRECOVERING() (!!yyerrstatus) - -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - YYPOPSTACK (yylen); \ - yystate = *yyssp; \ - goto yybackup; \ - } \ - else \ - { \ - yyerror (YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ -while (YYID (0)) - - -#define YYTERROR 1 -#define YYERRCODE 256 - -/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. - If N is 0, then set CURRENT to the empty location which ends - the previous symbol: RHS[0] (always defined). */ - -#ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - do \ - if (YYID (N)) \ - { \ - (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ - (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ - (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ - (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ - } \ - else \ - { \ - (Current).first_line = (Current).last_line = \ - YYRHSLOC (Rhs, 0).last_line; \ - (Current).first_column = (Current).last_column = \ - YYRHSLOC (Rhs, 0).last_column; \ - } \ - while (YYID (0)) -#endif - -#define YYRHSLOC(Rhs, K) ((Rhs)[K]) - - - -/* This macro is provided for backward compatibility. */ - -#ifndef YY_LOCATION_PRINT -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -#endif - - -/* YYLEX -- calling `yylex' with the right arguments. */ - -#ifdef YYLEX_PARAM -# define YYLEX yylex (YYLEX_PARAM) -#else -# define YYLEX yylex () +#define YYFINAL 1 +#ifndef YYDEBUG +#define YYDEBUG 0 #endif - -/* Enable debugging if requested. */ +#define YYMAXTOKEN 311 +#define YYUNDFTOKEN 349 +#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a)) #if YYDEBUG +static const char *const setkeyyyname[] = { + +"end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"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","SPDUPDATE","SPDDELETE","SPDDUMP","SPDFLUSH","F_POLICY", +"PL_REQUESTS","F_AIFLAGS","TAGGED","SECURITY_CTX",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"illegal-symbol", +}; +static const char *const setkeyyyrule[] = { +"$accept : commands", +"commands :", +"commands : commands command", +"command : add_command", +"command : get_command", +"command : delete_command", +"command : deleteall_command", +"command : flush_command", +"command : dump_command", +"command : exit_command", +"command : spdadd_command", +"command : spdupdate_command", +"command : spddelete_command", +"command : spddump_command", +"command : spdflush_command", +"add_command : ADD ipaddropts ipandport ipandport protocol_spec spi extension_spec algorithm_spec EOT", +"delete_command : DELETE ipaddropts ipandport ipandport protocol_spec spi extension_spec EOT", +"deleteall_command : DELETEALL ipaddropts ipaddr ipaddr protocol_spec EOT", +"get_command : GET ipaddropts ipandport ipandport protocol_spec spi extension_spec EOT", +"flush_command : FLUSH protocol_spec EOT", +"dump_command : DUMP protocol_spec EOT", +"protocol_spec :", +"protocol_spec : PR_ESP", +"protocol_spec : PR_AH", +"protocol_spec : PR_IPCOMP", +"protocol_spec : PR_ESPUDP", +"protocol_spec : PR_ESPUDP ipaddr", +"protocol_spec : PR_TCP", +"spi : DECSTRING", +"spi : HEXSTRING", +"algorithm_spec : esp_spec", +"algorithm_spec : ah_spec", +"algorithm_spec : ipcomp_spec", +"esp_spec : F_ENC enc_alg F_AUTH auth_alg", +"esp_spec : F_ENC enc_alg", +"ah_spec : F_AUTH auth_alg", +"ipcomp_spec : F_COMP ALG_COMP", +"ipcomp_spec : F_COMP ALG_COMP F_RAWCPI", +"enc_alg : ALG_ENC_NOKEY", +"enc_alg : ALG_ENC key_string", +"enc_alg : ALG_ENC_OLD", +"enc_alg : ALG_ENC_DESDERIV key_string", +"enc_alg : ALG_ENC_DES32IV key_string", +"auth_alg : ALG_AUTH key_string", +"auth_alg : ALG_AUTH_NOKEY", +"key_string : QUOTEDSTRING", +"key_string : HEXSTRING", +"extension_spec :", +"extension_spec : extension_spec extension", +"extension : F_EXT EXTENSION", +"extension : F_EXT NOCYCLICSEQ", +"extension : F_MODE MODE", +"extension : F_MODE ANY", +"extension : F_REQID DECSTRING", +"extension : F_REPLAY DECSTRING", +"extension : F_LIFETIME_HARD DECSTRING", +"extension : F_LIFETIME_SOFT DECSTRING", +"extension : F_LIFEBYTE_HARD DECSTRING", +"extension : F_LIFEBYTE_SOFT DECSTRING", +"extension : SECURITY_CTX DECSTRING DECSTRING QUOTEDSTRING", +"spdadd_command : SPDADD ipaddropts STRING prefix portstr STRING prefix portstr upper_spec upper_misc_spec context_spec policy_spec EOT", +"spdadd_command : SPDADD TAGGED QUOTEDSTRING policy_spec EOT", +"spdupdate_command : SPDUPDATE ipaddropts STRING prefix portstr STRING prefix portstr upper_spec upper_misc_spec context_spec policy_spec EOT", +"spdupdate_command : SPDUPDATE TAGGED QUOTEDSTRING policy_spec EOT", +"spddelete_command : SPDDELETE ipaddropts STRING prefix portstr STRING prefix portstr upper_spec upper_misc_spec context_spec policy_spec EOT", +"spddump_command : SPDDUMP EOT", +"spdflush_command : SPDFLUSH EOT", +"ipaddropts :", +"ipaddropts : ipaddropts ipaddropt", +"ipaddropt : F_AIFLAGS", +"ipaddr : STRING", +"ipandport : STRING", +"ipandport : STRING portstr", +"prefix :", +"prefix : SLASH DECSTRING", +"portstr :", +"portstr : BLCL ANY ELCL", +"portstr : BLCL DECSTRING ELCL", +"portstr : BLCL STRING ELCL", +"upper_spec : DECSTRING", +"upper_spec : ANY", +"upper_spec : PR_TCP", +"upper_spec : STRING", +"upper_misc_spec :", +"upper_misc_spec : STRING", +"context_spec :", +"context_spec : SECURITY_CTX DECSTRING DECSTRING QUOTEDSTRING", +"policy_spec : F_POLICY policy_requests", +"policy_requests : PL_REQUESTS", +"exit_command : EXIT EOT", -# ifndef YYFPRINTF -# include <stdio.h> /* INFRINGES ON USER NAME SPACE */ -# define YYFPRINTF fprintf -# endif - -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ -} while (YYID (0)) - -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yy_symbol_print (stderr, \ - Type, Value); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (YYID (0)) - - -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -#else -static void -yy_symbol_value_print (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; -#endif -{ - FILE *yyo = yyoutput; - YYUSE (yyo); - if (!yyvaluep) - return; -# ifdef YYPRINT - if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# else - YYUSE (yyoutput); -# endif - switch (yytype) - { - default: - break; - } -} - - -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -#else -static void -yy_symbol_print (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; -#endif -{ - if (yytype < YYNTOKENS) - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); - else - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); - - yy_symbol_value_print (yyoutput, yytype, yyvaluep); - YYFPRINTF (yyoutput, ")"); -} - -/*------------------------------------------------------------------. -| yy_stack_print -- Print the state stack from its BOTTOM up to its | -| TOP (included). | -`------------------------------------------------------------------*/ - -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) -#else -static void -yy_stack_print (yybottom, yytop) - yytype_int16 *yybottom; - yytype_int16 *yytop; -#endif -{ - YYFPRINTF (stderr, "Stack now"); - for (; yybottom <= yytop; yybottom++) - { - int yybot = *yybottom; - YYFPRINTF (stderr, " %d", yybot); - } - YYFPRINTF (stderr, "\n"); -} - -# define YY_STACK_PRINT(Bottom, Top) \ -do { \ - if (yydebug) \ - yy_stack_print ((Bottom), (Top)); \ -} while (YYID (0)) - - -/*------------------------------------------------. -| Report that the YYRULE is going to be reduced. | -`------------------------------------------------*/ - -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_reduce_print (YYSTYPE *yyvsp, int yyrule) -#else -static void -yy_reduce_print (yyvsp, yyrule) - YYSTYPE *yyvsp; - int yyrule; -#endif -{ - int yynrhs = yyr2[yyrule]; - int yyi; - unsigned long int yylno = yyrline[yyrule]; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", - yyrule - 1, yylno); - /* The symbols being reduced. */ - for (yyi = 0; yyi < yynrhs; yyi++) - { - YYFPRINTF (stderr, " $%d = ", yyi + 1); - yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], - &(yyvsp[(yyi + 1) - (yynrhs)]) - ); - YYFPRINTF (stderr, "\n"); - } -} - -# define YY_REDUCE_PRINT(Rule) \ -do { \ - if (yydebug) \ - yy_reduce_print (yyvsp, Rule); \ -} while (YYID (0)) - -/* Nonzero means print parse trace. It is left uninitialized so that - multiple parsers can coexist. */ -int yydebug; -#else /* !YYDEBUG */ -# define YYDPRINTF(Args) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) -# define YY_STACK_PRINT(Bottom, Top) -# define YY_REDUCE_PRINT(Rule) -#endif /* !YYDEBUG */ - - -/* YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef YYINITDEPTH -# define YYINITDEPTH 200 -#endif - -/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only - if the built-in stack extension method is used). - - Do not make this value too large; the results are undefined if - YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) - evaluated with infinite-precision integer arithmetic. */ - -#ifndef YYMAXDEPTH -# define YYMAXDEPTH 10000 +}; #endif +int yydebug; +int yynerrs; -#if YYERROR_VERBOSE +int yyerrflag; +int yychar; +YYSTYPE yyval; +YYSTYPE yylval; -# ifndef yystrlen -# if defined __GLIBC__ && defined _STRING_H -# define yystrlen strlen -# else -/* Return the length of YYSTR. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static YYSIZE_T -yystrlen (const char *yystr) +/* define the initial stack-sizes */ +#ifdef YYSTACKSIZE +#undef YYMAXDEPTH +#define YYMAXDEPTH YYSTACKSIZE #else -static YYSIZE_T -yystrlen (yystr) - const char *yystr; -#endif -{ - YYSIZE_T yylen; - for (yylen = 0; yystr[yylen]; yylen++) - continue; - return yylen; -} -# endif -# endif - -# ifndef yystpcpy -# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE -# define yystpcpy stpcpy -# else -/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in - YYDEST. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static char * -yystpcpy (char *yydest, const char *yysrc) +#ifdef YYMAXDEPTH +#define YYSTACKSIZE YYMAXDEPTH #else -static char * -yystpcpy (yydest, yysrc) - char *yydest; - const char *yysrc; +#define YYSTACKSIZE 10000 +#define YYMAXDEPTH 10000 #endif -{ - char *yyd = yydest; - const char *yys = yysrc; - - while ((*yyd++ = *yys++) != '\0') - continue; - - return yyd - 1; -} -# endif -# endif - -# ifndef yytnamerr -/* Copy to YYRES the contents of YYSTR after stripping away unnecessary - quotes and backslashes, so that it's suitable for yyerror. The - heuristic is that double-quoting is unnecessary unless the string - contains an apostrophe, a comma, or backslash (other than - backslash-backslash). YYSTR is taken from yytname. If YYRES is - null, do not copy; instead, return the length of what the result - would have been. */ -static YYSIZE_T -yytnamerr (char *yyres, const char *yystr) -{ - if (*yystr == '"') - { - YYSIZE_T yyn = 0; - char const *yyp = yystr; - - for (;;) - switch (*++yyp) - { - case '\'': - case ',': - goto do_not_strip_quotes; - - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - /* Fall through. */ - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; - - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } - do_not_strip_quotes: ; - } - - if (! yyres) - return yystrlen (yystr); - - return yystpcpy (yyres, yystr) - yyres; -} -# endif - -/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message - about the unexpected token YYTOKEN for the state stack whose top is - YYSSP. - - Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is - not large enough to hold the message. In that case, also set - *YYMSG_ALLOC to the required number of bytes. Return 2 if the - required number of bytes is too large to store. */ -static int -yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, - yytype_int16 *yyssp, int yytoken) -{ - YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]); - YYSIZE_T yysize = yysize0; - YYSIZE_T yysize1; - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - /* Internationalized format string. */ - const char *yyformat = YY_NULL; - /* Arguments of yyformat. */ - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - /* Number of reported tokens (one for the "unexpected", one per - "expected"). */ - int yycount = 0; - - /* There are many possibilities here to consider: - - Assume YYFAIL is not used. It's too flawed to consider. See - <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html> - for details. YYERROR is fine as it does not invoke this - function. - - If this state is a consistent state with a default action, then - the only way this function was invoked is if the default action - is an error action. In that case, don't check for expected - tokens because there are none. - - The only way there can be no lookahead present (in yychar) is if - this state is a consistent state with a default action. Thus, - detecting the absence of a lookahead is sufficient to determine - that there is no unexpected or expected token to report. In that - case, just report a simple "syntax error". - - Don't assume there isn't a lookahead just because this state is a - consistent state with a default action. There might have been a - previous inconsistent state, consistent state with a non-default - action, or user semantic action that manipulated yychar. - - Of course, the expected token list depends on states to have - correct lookahead information, and it depends on the parser not - to perform extra reductions after fetching a lookahead from the - scanner and before detecting a syntax error. Thus, state merging - (from LALR or IELR) and default reductions corrupt the expected - token list. However, the list is correct for canonical LR with - one exception: it will still contain any token that will not be - accepted due to an error action in a later state. - */ - if (yytoken != YYEMPTY) - { - int yyn = yypact[*yyssp]; - yyarg[yycount++] = yytname[yytoken]; - if (!yypact_value_is_default (yyn)) - { - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. In other words, skip the first -YYN actions for - this state because they are default actions. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yyx; - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR - && !yytable_value_is_error (yytable[yyx + yyn])) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - break; - } - yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]); - if (! (yysize <= yysize1 - && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; - } - } - } - - switch (yycount) - { -# define YYCASE_(N, S) \ - case N: \ - yyformat = S; \ - break - YYCASE_(0, YY_("syntax error")); - YYCASE_(1, YY_("syntax error, unexpected %s")); - YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); - YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); - YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); - YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); -# undef YYCASE_ - } - - yysize1 = yysize + yystrlen (yyformat); - if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; - - if (*yymsg_alloc < yysize) - { - *yymsg_alloc = 2 * yysize; - if (! (yysize <= *yymsg_alloc - && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) - *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; - return 1; - } - - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - { - char *yyp = *yymsg; - int yyi = 0; - while ((*yyp = *yyformat) != '\0') - if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyformat += 2; - } - else - { - yyp++; - yyformat++; - } - } - return 0; -} -#endif /* YYERROR_VERBOSE */ - -/*-----------------------------------------------. -| Release the memory associated to this symbol. | -`-----------------------------------------------*/ - -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) -#else -static void -yydestruct (yymsg, yytype, yyvaluep) - const char *yymsg; - int yytype; - YYSTYPE *yyvaluep; #endif -{ - YYUSE (yyvaluep); - - if (!yymsg) - yymsg = "Deleting"; - YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); - - switch (yytype) - { - - default: - break; - } -} +#define YYINITSTACKSIZE 200 - - -/* The lookahead symbol. */ -int yychar; - -/* The semantic value of the lookahead symbol. */ -YYSTYPE yylval; - -/* Number of syntax errors so far. */ -int yynerrs; - - -/*----------. -| yyparse. | -`----------*/ - -#ifdef YYPARSE_PARAM -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -int -yyparse (void *YYPARSE_PARAM) -#else -int -yyparse (YYPARSE_PARAM) - void *YYPARSE_PARAM; -#endif -#else /* ! YYPARSE_PARAM */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -int -yyparse (void) -#else -int -yyparse () - -#endif -#endif -{ - int yystate; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - - /* The stacks and their tools: - `yyss': related to states. - `yyvs': related to semantic values. - - Refer to the stacks through separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss; - yytype_int16 *yyssp; - - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs; - YYSTYPE *yyvsp; - - YYSIZE_T yystacksize; - - int yyn; - int yyresult; - /* Lookahead token as an internal (translated) token number. */ - int yytoken; - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; - -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif - -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) - - /* The number of symbols on the RHS of the reduced rule. - Keep to zero when no symbol should be popped. */ - int yylen = 0; - - yytoken = 0; - yyss = yyssa; - yyvs = yyvsa; - yystacksize = YYINITDEPTH; - - YYDPRINTF ((stderr, "Starting parse\n")); - - 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; - yyvsp = yyvs; - goto yysetstate; - -/*------------------------------------------------------------. -| yynewstate -- Push a new state, which is found in yystate. | -`------------------------------------------------------------*/ - yynewstate: - /* In all cases, when you get here, the value and location stacks - have just been pushed. So pushing a state here evens the stacks. */ - yyssp++; - - yysetstate: - *yyssp = yystate; - - if (yyss + yystacksize - 1 <= yyssp) - { - /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = yyssp - yyss + 1; - -#ifdef yyoverflow - { - /* 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; - yytype_int16 *yyss1 = yyss; - - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. This used to be a - conditional around just the two extra args, but that might - be undefined if yyoverflow is a macro. */ - yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), - &yystacksize); - - yyss = yyss1; - yyvs = yyvs1; - } -#else /* no yyoverflow */ -# ifndef YYSTACK_RELOCATE - goto yyexhaustedlab; -# else - /* Extend the stack our own way. */ - if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; - yystacksize *= 2; - if (YYMAXDEPTH < yystacksize) - yystacksize = YYMAXDEPTH; - - { - yytype_int16 *yyss1 = yyss; - union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); - if (! yyptr) - goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss_alloc, yyss); - YYSTACK_RELOCATE (yyvs_alloc, yyvs); -# undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE (yyss1); - } -# endif -#endif /* no yyoverflow */ - - yyssp = yyss + yysize - 1; - yyvsp = yyvs + yysize - 1; - - YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); - - if (yyss + yystacksize - 1 <= yyssp) - YYABORT; - } - - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); - - if (yystate == YYFINAL) - YYACCEPT; - - goto yybackup; - -/*-----------. -| yybackup. | -`-----------*/ -yybackup: - - /* Do appropriate processing given the current state. Read a - lookahead token if we need one and don't already have one. */ - - /* First try to decide what to do without reference to lookahead token. */ - yyn = yypact[yystate]; - if (yypact_value_is_default (yyn)) - goto yydefault; - - /* Not known => get a lookahead token if don't already have one. */ - - /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ - if (yychar == YYEMPTY) - { - YYDPRINTF ((stderr, "Reading a token: ")); - yychar = YYLEX; - } - - if (yychar <= YYEOF) - { - yychar = yytoken = YYEOF; - YYDPRINTF ((stderr, "Now at end of input.\n")); - } - else - { - yytoken = YYTRANSLATE (yychar); - YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); - } - - /* If the proper action on seeing token YYTOKEN is to reduce or to - detect an error, take that action. */ - yyn += yytoken; - if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) - goto yydefault; - yyn = yytable[yyn]; - if (yyn <= 0) - { - if (yytable_value_is_error (yyn)) - goto yyerrlab; - yyn = -yyn; - goto yyreduce; - } - - /* Count tokens shifted since error; after three, turn off error - status. */ - if (yyerrstatus) - yyerrstatus--; - - /* Shift the lookahead token. */ - YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - - /* Discard the shifted token. */ - yychar = YYEMPTY; - - yystate = yyn; - *++yyvsp = yylval; - - goto yynewstate; - - -/*-----------------------------------------------------------. -| yydefault -- do the default action for the current state. | -`-----------------------------------------------------------*/ -yydefault: - yyn = yydefact[yystate]; - if (yyn == 0) - goto yyerrlab; - goto yyreduce; - - -/*-----------------------------. -| yyreduce -- Do a reduction. | -`-----------------------------*/ -yyreduce: - /* yyn is the number of a rule to reduce with. */ - yylen = yyr2[yyn]; - - /* If YYLEN is nonzero, implement the default value of the action: - `$$ = $1'. - - Otherwise, the following line sets YYVAL to garbage. - This behavior is undocumented and Bison - users should not rely upon it. Assigning to YYVAL - unconditionally makes the parser a bit smaller, and it avoids a - GCC warning that YYVAL may be used uninitialized. */ - yyval = yyvsp[1-yylen]; - - - YY_REDUCE_PRINT (yyn); - switch (yyn) - { - case 3: -/* Line 1787 of yacc.c */ -#line 154 "parse.y" - { - free_buffer(); - parse_init(); - } - break; - - case 16: -/* Line 1787 of yacc.c */ -#line 179 "parse.y" - { - int status; - - status = setkeymsg_add(SADB_ADD, (yyvsp[(5) - (9)].num), (yyvsp[(3) - (9)].res), (yyvsp[(4) - (9)].res)); - if (status < 0) - return -1; - } - break; - - case 17: -/* Line 1787 of yacc.c */ -#line 191 "parse.y" - { - int status; - - if ((yyvsp[(3) - (8)].res)->ai_next || (yyvsp[(4) - (8)].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[(5) - (8)].num), (yyvsp[(3) - (8)].res), (yyvsp[(4) - (8)].res), 0); - if (status < 0) - return -1; - } - break; - - case 18: -/* Line 1787 of yacc.c */ -#line 210 "parse.y" - { -#ifndef __linux__ - if (setkeymsg_addr(SADB_DELETE, (yyvsp[(5) - (6)].num), (yyvsp[(3) - (6)].res), (yyvsp[(4) - (6)].res), 1) < 0) - return -1; -#else /* __linux__ */ - /* linux strictly adheres to RFC2367, and returns - * an error if we send an SADB_DELETE request without - * an SPI. Therefore, we must first retrieve a list - * of SPIs for all matching SADB entries, and then - * delete each one separately. */ - u_int32_t *spi; - int i, n; - - spi = sendkeymsg_spigrep((yyvsp[(5) - (6)].num), (yyvsp[(3) - (6)].res), (yyvsp[(4) - (6)].res), &n); - for (i = 0; i < n; i++) { - p_spi = spi[i]; - if (setkeymsg_addr(SADB_DELETE, - (yyvsp[(5) - (6)].num), (yyvsp[(3) - (6)].res), (yyvsp[(4) - (6)].res), 0) < 0) - return -1; - } - free(spi); -#endif /* __linux__ */ - } - break; - - case 19: -/* Line 1787 of yacc.c */ -#line 238 "parse.y" - { - int status; - - if (p_mode != IPSEC_MODE_ANY) - yyerror("WARNING: mode is obsolete"); - - status = setkeymsg_addr(SADB_GET, (yyvsp[(5) - (8)].num), (yyvsp[(3) - (8)].res), (yyvsp[(4) - (8)].res), 0); - if (status < 0) - return -1; - } - break; - - case 20: -/* Line 1787 of yacc.c */ -#line 253 "parse.y" - { - struct sadb_msg msg; - setkeymsg0(&msg, SADB_FLUSH, (yyvsp[(2) - (3)].num), sizeof(msg)); - sendkeymsg((char *)&msg, sizeof(msg)); - } - break; - - case 21: -/* Line 1787 of yacc.c */ -#line 263 "parse.y" - { - struct sadb_msg msg; - setkeymsg0(&msg, SADB_DUMP, (yyvsp[(2) - (3)].num), sizeof(msg)); - sendkeymsg((char *)&msg, sizeof(msg)); - } - break; - - case 22: -/* Line 1787 of yacc.c */ -#line 272 "parse.y" - { - (yyval.num) = SADB_SATYPE_UNSPEC; - } - break; - - case 23: -/* Line 1787 of yacc.c */ -#line 276 "parse.y" - { - (yyval.num) = SADB_SATYPE_ESP; - if ((yyvsp[(1) - (1)].num) == 1) - p_ext |= SADB_X_EXT_OLD; - else - p_ext &= ~SADB_X_EXT_OLD; - } - break; - - case 24: -/* Line 1787 of yacc.c */ -#line 284 "parse.y" - { - (yyval.num) = SADB_SATYPE_AH; - if ((yyvsp[(1) - (1)].num) == 1) - p_ext |= SADB_X_EXT_OLD; - else - p_ext &= ~SADB_X_EXT_OLD; - } - break; - - case 25: -/* Line 1787 of yacc.c */ -#line 292 "parse.y" - { - (yyval.num) = SADB_X_SATYPE_IPCOMP; - } - break; - - case 26: -/* Line 1787 of yacc.c */ -#line 296 "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 27: -/* Line 1787 of yacc.c */ -#line 303 "parse.y" - { - (yyval.num) = SADB_SATYPE_ESP; - p_ext &= ~SADB_X_EXT_OLD; - p_natt_oa = (yyvsp[(2) - (2)].res); - p_natt_type = UDP_ENCAP_ESPINUDP; - } - break; - - case 28: -/* Line 1787 of yacc.c */ -#line 310 "parse.y" - { -#ifdef SADB_X_SATYPE_TCPSIGNATURE - (yyval.num) = SADB_X_SATYPE_TCPSIGNATURE; -#endif - } - break; - - case 29: -/* Line 1787 of yacc.c */ -#line 318 "parse.y" - { p_spi = (yyvsp[(1) - (1)].ulnum); } - break; - - case 30: -/* Line 1787 of yacc.c */ -#line 320 "parse.y" - { - char *ep; - unsigned long v; - - ep = NULL; - v = strtoul((yyvsp[(1) - (1)].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 37: -/* Line 1787 of yacc.c */ -#line 356 "parse.y" - { - if ((yyvsp[(2) - (2)].num) < 0) { - yyerror("unsupported algorithm"); - return -1; - } - p_alg_enc = (yyvsp[(2) - (2)].num); - } - break; - - case 38: -/* Line 1787 of yacc.c */ -#line 364 "parse.y" - { - if ((yyvsp[(2) - (3)].num) < 0) { - yyerror("unsupported algorithm"); - return -1; - } - p_alg_enc = (yyvsp[(2) - (3)].num); - p_ext |= SADB_X_EXT_RAWCPI; - } - break; - - case 39: -/* Line 1787 of yacc.c */ -#line 375 "parse.y" - { - if ((yyvsp[(1) - (1)].num) < 0) { - yyerror("unsupported algorithm"); - return -1; - } - p_alg_enc = (yyvsp[(1) - (1)].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 1787 of yacc.c */ -#line 390 "parse.y" - { - if ((yyvsp[(1) - (2)].num) < 0) { - yyerror("unsupported algorithm"); - return -1; - } - p_alg_enc = (yyvsp[(1) - (2)].num); - - p_key_enc_len = (yyvsp[(2) - (2)].val).len; - p_key_enc = (yyvsp[(2) - (2)].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 1787 of yacc.c */ -#line 405 "parse.y" - { - if ((yyvsp[(1) - (1)].num) < 0) { - yyerror("unsupported algorithm"); - return -1; - } - yyerror("WARNING: obsolete algorithm"); - p_alg_enc = (yyvsp[(1) - (1)].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 42: -/* Line 1787 of yacc.c */ -#line 422 "parse.y" - { - if ((yyvsp[(1) - (2)].num) < 0) { - yyerror("unsupported algorithm"); - return -1; - } - p_alg_enc = (yyvsp[(1) - (2)].num); - if (p_ext & SADB_X_EXT_OLD) { - yyerror("algorithm mismatched"); - return -1; - } - p_ext |= SADB_X_EXT_DERIV; - - p_key_enc_len = (yyvsp[(2) - (2)].val).len; - p_key_enc = (yyvsp[(2) - (2)].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 43: -/* Line 1787 of yacc.c */ -#line 443 "parse.y" - { - if ((yyvsp[(1) - (2)].num) < 0) { - yyerror("unsupported algorithm"); - return -1; - } - p_alg_enc = (yyvsp[(1) - (2)].num); - if (!(p_ext & SADB_X_EXT_OLD)) { - yyerror("algorithm mismatched"); - return -1; - } - p_ext |= SADB_X_EXT_IV4B; - - p_key_enc_len = (yyvsp[(2) - (2)].val).len; - p_key_enc = (yyvsp[(2) - (2)].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 44: -/* Line 1787 of yacc.c */ -#line 466 "parse.y" - { - if ((yyvsp[(1) - (2)].num) < 0) { - yyerror("unsupported algorithm"); - return -1; - } - p_alg_auth = (yyvsp[(1) - (2)].num); - - p_key_auth_len = (yyvsp[(2) - (2)].val).len; - p_key_auth = (yyvsp[(2) - (2)].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 45: -/* Line 1787 of yacc.c */ -#line 491 "parse.y" - { - if ((yyvsp[(1) - (1)].num) < 0) { - yyerror("unsupported algorithm"); - return -1; - } - p_alg_auth = (yyvsp[(1) - (1)].num); - - p_key_auth_len = 0; - p_key_auth = NULL; - } - break; - - case 46: -/* Line 1787 of yacc.c */ -#line 505 "parse.y" - { - (yyval.val) = (yyvsp[(1) - (1)].val); - } - break; - - case 47: -/* Line 1787 of yacc.c */ -#line 509 "parse.y" - { - caddr_t pp_key; - caddr_t bp; - caddr_t yp = (yyvsp[(1) - (1)].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 50: -/* Line 1787 of yacc.c */ -#line 543 "parse.y" - { p_ext |= (yyvsp[(2) - (2)].num); } - break; - - case 51: -/* Line 1787 of yacc.c */ -#line 544 "parse.y" - { p_ext &= ~SADB_X_EXT_CYCSEQ; } - break; - - case 52: -/* Line 1787 of yacc.c */ -#line 545 "parse.y" - { p_mode = (yyvsp[(2) - (2)].num); } - break; - - case 53: -/* Line 1787 of yacc.c */ -#line 546 "parse.y" - { p_mode = IPSEC_MODE_ANY; } - break; - - case 54: -/* Line 1787 of yacc.c */ -#line 547 "parse.y" - { p_reqid = (yyvsp[(2) - (2)].ulnum); } - break; - - case 55: -/* Line 1787 of yacc.c */ -#line 549 "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[(2) - (2)].ulnum); - } - break; - - case 56: -/* Line 1787 of yacc.c */ -#line 557 "parse.y" - { p_lt_hard = (yyvsp[(2) - (2)].ulnum); } - break; - - case 57: -/* Line 1787 of yacc.c */ -#line 558 "parse.y" - { p_lt_soft = (yyvsp[(2) - (2)].ulnum); } - break; - - case 58: -/* Line 1787 of yacc.c */ -#line 559 "parse.y" - { p_lb_hard = (yyvsp[(2) - (2)].ulnum); } - break; - - case 59: -/* Line 1787 of yacc.c */ -#line 560 "parse.y" - { p_lb_soft = (yyvsp[(2) - (2)].ulnum); } - break; - - case 60: -/* Line 1787 of yacc.c */ -#line 561 "parse.y" - { - sec_ctx.doi = (yyvsp[(2) - (4)].ulnum); - sec_ctx.alg = (yyvsp[(3) - (4)].ulnum); - sec_ctx.len = (yyvsp[(4) - (4)].val).len+1; - sec_ctx.buf = (yyvsp[(4) - (4)].val).buf; - } - break; - - case 61: -/* Line 1787 of yacc.c */ -#line 574 "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 icmp */ - if (fix_portstr((yyvsp[(9) - (13)].num), &(yyvsp[(10) - (13)].val), &(yyvsp[(5) - (13)].val), &(yyvsp[(8) - (13)].val))) - return -1; - - src = parse_addr((yyvsp[(3) - (13)].val).buf, (yyvsp[(5) - (13)].val).buf); - dst = parse_addr((yyvsp[(6) - (13)].val).buf, (yyvsp[(8) - (13)].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[(9) - (13)].num), &(yyvsp[(12) - (13)].val), - src, (yyvsp[(4) - (13)].num), dst, (yyvsp[(7) - (13)].num)); - freeaddrinfo(src); - freeaddrinfo(dst); - if (status < 0) - return -1; - } - break; - - case 62: -/* Line 1787 of yacc.c */ -#line 607 "parse.y" - { - int status; - - status = setkeymsg_spdaddr_tag(SADB_X_SPDADD, - (yyvsp[(3) - (5)].val).buf, &(yyvsp[(4) - (5)].val)); - if (status < 0) - return -1; - } - break; - - case 63: -/* Line 1787 of yacc.c */ -#line 620 "parse.y" - { - int status; - struct addrinfo *src, *dst; - -#ifdef HAVE_PFKEY_POLICY_PRIORITY - last_msg_type = SADB_X_SPDUPDATE; -#endif - - /* fixed port fields if ulp is icmp */ - if (fix_portstr((yyvsp[(9) - (13)].num), &(yyvsp[(10) - (13)].val), &(yyvsp[(5) - (13)].val), &(yyvsp[(8) - (13)].val))) - return -1; - - src = parse_addr((yyvsp[(3) - (13)].val).buf, (yyvsp[(5) - (13)].val).buf); - dst = parse_addr((yyvsp[(6) - (13)].val).buf, (yyvsp[(8) - (13)].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_SPDUPDATE, (yyvsp[(9) - (13)].num), &(yyvsp[(12) - (13)].val), - src, (yyvsp[(4) - (13)].num), dst, (yyvsp[(7) - (13)].num)); - freeaddrinfo(src); - freeaddrinfo(dst); - if (status < 0) - return -1; - } - break; - - case 64: -/* Line 1787 of yacc.c */ -#line 653 "parse.y" - { - int status; - - status = setkeymsg_spdaddr_tag(SADB_X_SPDUPDATE, - (yyvsp[(3) - (5)].val).buf, &(yyvsp[(4) - (5)].val)); - if (status < 0) - return -1; - } - break; - - case 65: -/* Line 1787 of yacc.c */ -#line 665 "parse.y" - { - int status; - struct addrinfo *src, *dst; - - /* fixed port fields if ulp is icmp */ - if (fix_portstr((yyvsp[(9) - (13)].num), &(yyvsp[(10) - (13)].val), &(yyvsp[(5) - (13)].val), &(yyvsp[(8) - (13)].val))) - return -1; - - src = parse_addr((yyvsp[(3) - (13)].val).buf, (yyvsp[(5) - (13)].val).buf); - dst = parse_addr((yyvsp[(6) - (13)].val).buf, (yyvsp[(8) - (13)].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[(9) - (13)].num), &(yyvsp[(12) - (13)].val), - src, (yyvsp[(4) - (13)].num), dst, (yyvsp[(7) - (13)].num)); - freeaddrinfo(src); - freeaddrinfo(dst); - if (status < 0) - return -1; - } - break; - - case 66: -/* Line 1787 of yacc.c */ -#line 697 "parse.y" - { - struct sadb_msg msg; - setkeymsg0(&msg, SADB_X_SPDDUMP, SADB_SATYPE_UNSPEC, - sizeof(msg)); - sendkeymsg((char *)&msg, sizeof(msg)); - } - break; - - case 67: -/* Line 1787 of yacc.c */ -#line 708 "parse.y" - { - struct sadb_msg msg; - setkeymsg0(&msg, SADB_X_SPDFLUSH, SADB_SATYPE_UNSPEC, - sizeof(msg)); - sendkeymsg((char *)&msg, sizeof(msg)); - } - break; - - case 70: -/* Line 1787 of yacc.c */ -#line 723 "parse.y" - { - char *p; - - for (p = (yyvsp[(1) - (1)].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 71: -/* Line 1787 of yacc.c */ -#line 748 "parse.y" - { - (yyval.res) = parse_addr((yyvsp[(1) - (1)].val).buf, NULL); - if ((yyval.res) == NULL) { - /* yyerror already called by parse_addr */ - return -1; - } - } - break; - - case 72: -/* Line 1787 of yacc.c */ -#line 759 "parse.y" - { - (yyval.res) = parse_addr((yyvsp[(1) - (1)].val).buf, NULL); - if ((yyval.res) == NULL) { - /* yyerror already called by parse_addr */ - return -1; - } - } - break; - - case 73: -/* Line 1787 of yacc.c */ -#line 767 "parse.y" - { - (yyval.res) = parse_addr((yyvsp[(1) - (2)].val).buf, (yyvsp[(2) - (2)].val).buf); - if ((yyval.res) == NULL) { - /* yyerror already called by parse_addr */ - return -1; - } - } - break; - - case 74: -/* Line 1787 of yacc.c */ -#line 777 "parse.y" - { (yyval.num) = -1; } - break; - - case 75: -/* Line 1787 of yacc.c */ -#line 778 "parse.y" - { (yyval.num) = (yyvsp[(2) - (2)].ulnum); } - break; - - case 76: -/* Line 1787 of yacc.c */ -#line 783 "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 77: -/* Line 1787 of yacc.c */ -#line 792 "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 78: -/* Line 1787 of yacc.c */ -#line 801 "parse.y" - { - char buf[20]; - snprintf(buf, sizeof(buf), "%lu", (yyvsp[(2) - (3)].ulnum)); - (yyval.val).buf = strdup(buf); - if (!(yyval.val).buf) { - yyerror("insufficient memory"); - return -1; - } - (yyval.val).len = strlen((yyval.val).buf); - } - break; - - case 79: -/* Line 1787 of yacc.c */ -#line 812 "parse.y" - { - (yyval.val) = (yyvsp[(2) - (3)].val); - } - break; - - case 80: -/* Line 1787 of yacc.c */ -#line 818 "parse.y" - { (yyval.num) = (yyvsp[(1) - (1)].ulnum); } - break; - - case 81: -/* Line 1787 of yacc.c */ -#line 819 "parse.y" - { (yyval.num) = IPSEC_ULPROTO_ANY; } - break; - - case 82: -/* Line 1787 of yacc.c */ -#line 820 "parse.y" - { - (yyval.num) = IPPROTO_TCP; - } - break; - - case 83: -/* Line 1787 of yacc.c */ -#line 824 "parse.y" - { - struct protoent *ent; - - ent = getprotobyname((yyvsp[(1) - (1)].val).buf); - if (ent) - (yyval.num) = ent->p_proto; - else { - if (strcmp("icmp6", (yyvsp[(1) - (1)].val).buf) == 0) { - (yyval.num) = IPPROTO_ICMPV6; - } else if(strcmp("ip4", (yyvsp[(1) - (1)].val).buf) == 0) { - (yyval.num) = IPPROTO_IPV4; - } else { - yyerror("invalid upper layer protocol"); - return -1; - } - } - endprotoent(); - } - break; - - case 84: -/* Line 1787 of yacc.c */ -#line 846 "parse.y" - { - (yyval.val).buf = NULL; - (yyval.val).len = 0; - } - break; - - case 85: -/* Line 1787 of yacc.c */ -#line 851 "parse.y" - { - (yyval.val).buf = strdup((yyvsp[(1) - (1)].val).buf); - if (!(yyval.val).buf) { - yyerror("insufficient memory"); - return -1; - } - (yyval.val).len = strlen((yyval.val).buf); - } - break; - - case 87: -/* Line 1787 of yacc.c */ -#line 863 "parse.y" - { - sec_ctx.doi = (yyvsp[(2) - (4)].ulnum); - sec_ctx.alg = (yyvsp[(3) - (4)].ulnum); - sec_ctx.len = (yyvsp[(4) - (4)].val).len+1; - sec_ctx.buf = (yyvsp[(4) - (4)].val).buf; - } - break; - - case 88: -/* Line 1787 of yacc.c */ -#line 873 "parse.y" - { - char *policy; -#ifdef HAVE_PFKEY_POLICY_PRIORITY - struct sadb_x_policy *xpl; -#endif - - policy = ipsec_set_policy((yyvsp[(2) - (2)].val).buf, (yyvsp[(2) - (2)].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 89: -/* Line 1787 of yacc.c */ -#line 896 "parse.y" - { (yyval.val) = (yyvsp[(1) - (1)].val); } - break; - - case 90: -/* Line 1787 of yacc.c */ -#line 902 "parse.y" - { - exit_now = 1; - YYACCEPT; - } - break; - - -/* Line 1787 of yacc.c */ -#line 2617 "parse.c" - default: break; - } - /* User semantic actions sometimes alter yychar, and that requires - that yytoken be updated with the new translation. We take the - approach of translating immediately before every use of yytoken. - One alternative is translating here after every semantic action, - but that translation would be missed if the semantic action invokes - YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or - if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an - incorrect destructor might then be invoked immediately. In the - case of YYERROR or YYBACKUP, subsequent parser actions might lead - to an incorrect destructor call or verbose syntax error message - before the lookahead is translated. */ - YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); - - YYPOPSTACK (yylen); - yylen = 0; - YY_STACK_PRINT (yyss, yyssp); - - *++yyvsp = yyval; - - /* 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 - YYNTOKENS] + *yyssp; - if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) - yystate = yytable[yystate]; - else - yystate = yydefgoto[yyn - YYNTOKENS]; - - goto yynewstate; - - -/*------------------------------------. -| yyerrlab -- here on detecting error | -`------------------------------------*/ -yyerrlab: - /* Make sure we have latest lookahead translation. See comments at - user semantic actions for why this is necessary. */ - yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); - - /* If not already recovering from an error, report this error. */ - if (!yyerrstatus) - { - ++yynerrs; -#if ! YYERROR_VERBOSE - yyerror (YY_("syntax error")); -#else -# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ - yyssp, yytoken) - { - char const *yymsgp = YY_("syntax error"); - int yysyntax_error_status; - yysyntax_error_status = YYSYNTAX_ERROR; - if (yysyntax_error_status == 0) - yymsgp = yymsg; - else if (yysyntax_error_status == 1) - { - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); - if (!yymsg) - { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - yysyntax_error_status = 2; - } - else - { - yysyntax_error_status = YYSYNTAX_ERROR; - yymsgp = yymsg; - } - } - yyerror (yymsgp); - if (yysyntax_error_status == 2) - goto yyexhaustedlab; - } -# undef YYSYNTAX_ERROR -#endif - } - - - - if (yyerrstatus == 3) - { - /* If just tried and failed to reuse lookahead token after an - error, discard it. */ - - if (yychar <= YYEOF) - { - /* Return failure if at end of input. */ - if (yychar == YYEOF) - YYABORT; - } - else - { - yydestruct ("Error: discarding", - yytoken, &yylval); - yychar = YYEMPTY; - } - } - - /* Else will try to reuse lookahead token after shifting the error - token. */ - goto yyerrlab1; - - -/*---------------------------------------------------. -| yyerrorlab -- error raised explicitly by YYERROR. | -`---------------------------------------------------*/ -yyerrorlab: - - /* Pacify compilers like GCC when the user code never invokes - YYERROR and the label yyerrorlab therefore never appears in user - code. */ - if (/*CONSTCOND*/ 0) - goto yyerrorlab; - - /* Do not reclaim the symbols of the rule which action triggered - this YYERROR. */ - YYPOPSTACK (yylen); - yylen = 0; - YY_STACK_PRINT (yyss, yyssp); - yystate = *yyssp; - goto yyerrlab1; - - -/*-------------------------------------------------------------. -| yyerrlab1 -- common code for both syntax error and YYERROR. | -`-------------------------------------------------------------*/ -yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ - - for (;;) - { - yyn = yypact[yystate]; - if (!yypact_value_is_default (yyn)) - { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) - { - yyn = yytable[yyn]; - if (0 < yyn) - break; - } - } - - /* Pop the current state because it cannot handle the error token. */ - if (yyssp == yyss) - YYABORT; - - - yydestruct ("Error: popping", - yystos[yystate], yyvsp); - YYPOPSTACK (1); - yystate = *yyssp; - YY_STACK_PRINT (yyss, yyssp); - } - - *++yyvsp = yylval; - - - /* Shift the error token. */ - YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); - - yystate = yyn; - goto yynewstate; - - -/*-------------------------------------. -| yyacceptlab -- YYACCEPT comes here. | -`-------------------------------------*/ -yyacceptlab: - yyresult = 0; - goto yyreturn; - -/*-----------------------------------. -| yyabortlab -- YYABORT comes here. | -`-----------------------------------*/ -yyabortlab: - yyresult = 1; - goto yyreturn; - -#if !defined yyoverflow || YYERROR_VERBOSE -/*-------------------------------------------------. -| yyexhaustedlab -- memory exhaustion comes here. | -`-------------------------------------------------*/ -yyexhaustedlab: - yyerror (YY_("memory exhausted")); - yyresult = 2; - /* Fall through. */ -#endif - -yyreturn: - if (yychar != YYEMPTY) - { - /* Make sure we have latest lookahead translation. See comments at - user semantic actions for why this is necessary. */ - yytoken = YYTRANSLATE (yychar); - yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval); - } - /* Do not reclaim the symbols of the rule which action triggered - this YYABORT or YYACCEPT. */ - YYPOPSTACK (yylen); - YY_STACK_PRINT (yyss, yyssp); - while (yyssp != yyss) - { - yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp); - YYPOPSTACK (1); - } -#ifndef yyoverflow - if (yyss != yyssa) - YYSTACK_FREE (yyss); -#endif -#if YYERROR_VERBOSE - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); -#endif - /* Make sure YYID is used. */ - return YYID (yyresult); -} - - -/* Line 2048 of yacc.c */ -#line 907 "parse.y" - +typedef struct { + unsigned stacksize; + YYINT *s_base; + YYINT *s_mark; + YYINT *s_last; + YYSTYPE *l_base; + YYSTYPE *l_mark; +} YYSTACKDATA; +/* variables for the parser stack */ +static YYSTACKDATA yystack; +#line 919 "../../ipsec-tools/src/setkey/parse.y" int setkeymsg0(msg, type, satype, l) @@ -3608,3 +1349,1025 @@ free_buffer() return; } +#line 1353 "setkeyyy.tab.c" + +#if YYDEBUG +#include <stdio.h> /* needed for printf */ +#endif + +#include <stdlib.h> /* needed for malloc, etc */ +#include <string.h> /* needed for memset */ + +/* allocate initial stack or double stack size, up to YYMAXDEPTH */ +static int yygrowstack(YYSTACKDATA *data) +{ + int i; + unsigned newsize; + YYINT *newss; + YYSTYPE *newvs; + + if ((newsize = data->stacksize) == 0) + newsize = YYINITSTACKSIZE; + else if (newsize >= YYMAXDEPTH) + return YYENOMEM; + else if ((newsize *= 2) > YYMAXDEPTH) + newsize = YYMAXDEPTH; + + i = (int) (data->s_mark - data->s_base); + newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss)); + if (newss == 0) + return YYENOMEM; + + data->s_base = newss; + data->s_mark = newss + i; + + newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs)); + if (newvs == 0) + return YYENOMEM; + + data->l_base = newvs; + data->l_mark = newvs + i; + + data->stacksize = newsize; + data->s_last = data->s_base + newsize - 1; + return 0; +} + +#if YYPURE || defined(YY_NO_LEAKS) +static void yyfreestack(YYSTACKDATA *data) +{ + free(data->s_base); + free(data->l_base); + memset(data, 0, sizeof(*data)); +} +#else +#define yyfreestack(data) /* nothing */ +#endif + +#define YYABORT goto yyabort +#define YYREJECT goto yyabort +#define YYACCEPT goto yyaccept +#define YYERROR goto yyerrlab + +int +YYPARSE_DECL() +{ + int yym, yyn, yystate; +#if YYDEBUG + const char *yys; + + if ((yys = getenv("YYDEBUG")) != 0) + { + yyn = *yys; + if (yyn >= '0' && yyn <= '9') + yydebug = yyn - '0'; + } +#endif + + yym = 0; + yyn = 0; + yynerrs = 0; + yyerrflag = 0; + yychar = YYEMPTY; + yystate = 0; + +#if YYPURE + memset(&yystack, 0, sizeof(yystack)); +#endif + + if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; + yystack.s_mark = yystack.s_base; + yystack.l_mark = yystack.l_base; + yystate = 0; + *yystack.s_mark = 0; + +yyloop: + if ((yyn = yydefred[yystate]) != 0) goto yyreduce; + if (yychar < 0) + { + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; +#if YYDEBUG + if (yydebug) + { + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; + printf("%sdebug: state %d, reading %d (%s)\n", + YYPREFIX, yystate, yychar, yys); + } +#endif + } + if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) + { +#if YYDEBUG + if (yydebug) + printf("%sdebug: state %d, shifting to state %d\n", + YYPREFIX, yystate, yytable[yyn]); +#endif + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; + yystate = yytable[yyn]; + *++yystack.s_mark = yytable[yyn]; + *++yystack.l_mark = yylval; + yychar = YYEMPTY; + if (yyerrflag > 0) --yyerrflag; + goto yyloop; + } + if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) + { + yyn = yytable[yyn]; + goto yyreduce; + } + if (yyerrflag != 0) goto yyinrecovery; + + YYERROR_CALL("syntax error"); + + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ +yyerrlab: + ++yynerrs; + +yyinrecovery: + if (yyerrflag < 3) + { + yyerrflag = 3; + for (;;) + { + if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE) + { +#if YYDEBUG + if (yydebug) + printf("%sdebug: state %d, error recovery shifting\ + to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]); +#endif + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; + yystate = yytable[yyn]; + *++yystack.s_mark = yytable[yyn]; + *++yystack.l_mark = yylval; + goto yyloop; + } + else + { +#if YYDEBUG + if (yydebug) + printf("%sdebug: error recovery discarding state %d\n", + YYPREFIX, *yystack.s_mark); +#endif + if (yystack.s_mark <= yystack.s_base) goto yyabort; + --yystack.s_mark; + --yystack.l_mark; + } + } + } + else + { + if (yychar == YYEOF) goto yyabort; +#if YYDEBUG + if (yydebug) + { + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; + printf("%sdebug: state %d, error recovery discards token %d (%s)\n", + YYPREFIX, yystate, yychar, yys); + } +#endif + yychar = YYEMPTY; + goto yyloop; + } + +yyreduce: +#if YYDEBUG + if (yydebug) + printf("%sdebug: state %d, reducing by rule %d (%s)\n", + YYPREFIX, yystate, yyn, yyrule[yyn]); +#endif + yym = yylen[yyn]; + if (yym > 0) + yyval = yystack.l_mark[1-yym]; + else + memset(&yyval, 0, sizeof yyval); + + switch (yyn) + { +case 2: +#line 165 "../../ipsec-tools/src/setkey/parse.y" + { + free_buffer(); + parse_init(); + } +break; +case 15: +#line 190 "../../ipsec-tools/src/setkey/parse.y" + { + int status; + + status = setkeymsg_add(SADB_ADD, yystack.l_mark[-4].num, yystack.l_mark[-6].res, yystack.l_mark[-5].res); + if (status < 0) + return -1; + } +break; +case 16: +#line 202 "../../ipsec-tools/src/setkey/parse.y" + { + int status; + + if (yystack.l_mark[-5].res->ai_next || yystack.l_mark[-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, yystack.l_mark[-3].num, yystack.l_mark[-5].res, yystack.l_mark[-4].res, 0); + if (status < 0) + return -1; + } +break; +case 17: +#line 221 "../../ipsec-tools/src/setkey/parse.y" + { +#ifndef __linux__ + if (setkeymsg_addr(SADB_DELETE, yystack.l_mark[-1].num, yystack.l_mark[-3].res, yystack.l_mark[-2].res, 1) < 0) + return -1; +#else /* __linux__ */ + /* linux strictly adheres to RFC2367, and returns + * an error if we send an SADB_DELETE request without + * an SPI. Therefore, we must first retrieve a list + * of SPIs for all matching SADB entries, and then + * delete each one separately. */ + u_int32_t *spi; + int i, n; + + spi = sendkeymsg_spigrep(yystack.l_mark[-1].num, yystack.l_mark[-3].res, yystack.l_mark[-2].res, &n); + for (i = 0; i < n; i++) { + p_spi = spi[i]; + if (setkeymsg_addr(SADB_DELETE, + yystack.l_mark[-1].num, yystack.l_mark[-3].res, yystack.l_mark[-2].res, 0) < 0) + return -1; + } + free(spi); +#endif /* __linux__ */ + } +break; +case 18: +#line 249 "../../ipsec-tools/src/setkey/parse.y" + { + int status; + + if (p_mode != IPSEC_MODE_ANY) + yyerror("WARNING: mode is obsolete"); + + status = setkeymsg_addr(SADB_GET, yystack.l_mark[-3].num, yystack.l_mark[-5].res, yystack.l_mark[-4].res, 0); + if (status < 0) + return -1; + } +break; +case 19: +#line 264 "../../ipsec-tools/src/setkey/parse.y" + { + struct sadb_msg msg; + setkeymsg0(&msg, SADB_FLUSH, yystack.l_mark[-1].num, sizeof(msg)); + sendkeymsg((char *)&msg, sizeof(msg)); + } +break; +case 20: +#line 274 "../../ipsec-tools/src/setkey/parse.y" + { + struct sadb_msg msg; + setkeymsg0(&msg, SADB_DUMP, yystack.l_mark[-1].num, sizeof(msg)); + sendkeymsg((char *)&msg, sizeof(msg)); + } +break; +case 21: +#line 283 "../../ipsec-tools/src/setkey/parse.y" + { + yyval.num = SADB_SATYPE_UNSPEC; + } +break; +case 22: +#line 287 "../../ipsec-tools/src/setkey/parse.y" + { + yyval.num = SADB_SATYPE_ESP; + if (yystack.l_mark[0].num == 1) + p_ext |= SADB_X_EXT_OLD; + else + p_ext &= ~SADB_X_EXT_OLD; + } +break; +case 23: +#line 295 "../../ipsec-tools/src/setkey/parse.y" + { + yyval.num = SADB_SATYPE_AH; + if (yystack.l_mark[0].num == 1) + p_ext |= SADB_X_EXT_OLD; + else + p_ext &= ~SADB_X_EXT_OLD; + } +break; +case 24: +#line 303 "../../ipsec-tools/src/setkey/parse.y" + { + yyval.num = SADB_X_SATYPE_IPCOMP; + } +break; +case 25: +#line 307 "../../ipsec-tools/src/setkey/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 26: +#line 314 "../../ipsec-tools/src/setkey/parse.y" + { + yyval.num = SADB_SATYPE_ESP; + p_ext &= ~SADB_X_EXT_OLD; + p_natt_oa = yystack.l_mark[0].res; + p_natt_type = UDP_ENCAP_ESPINUDP; + } +break; +case 27: +#line 321 "../../ipsec-tools/src/setkey/parse.y" + { +#ifdef SADB_X_SATYPE_TCPSIGNATURE + yyval.num = SADB_X_SATYPE_TCPSIGNATURE; +#endif + } +break; +case 28: +#line 329 "../../ipsec-tools/src/setkey/parse.y" + { p_spi = yystack.l_mark[0].ulnum; } +break; +case 29: +#line 331 "../../ipsec-tools/src/setkey/parse.y" + { + char *ep; + unsigned long v; + + ep = NULL; + v = strtoul(yystack.l_mark[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 36: +#line 367 "../../ipsec-tools/src/setkey/parse.y" + { + if (yystack.l_mark[0].num < 0) { + yyerror("unsupported algorithm"); + return -1; + } + p_alg_enc = yystack.l_mark[0].num; + } +break; +case 37: +#line 375 "../../ipsec-tools/src/setkey/parse.y" + { + if (yystack.l_mark[-1].num < 0) { + yyerror("unsupported algorithm"); + return -1; + } + p_alg_enc = yystack.l_mark[-1].num; + p_ext |= SADB_X_EXT_RAWCPI; + } +break; +case 38: +#line 386 "../../ipsec-tools/src/setkey/parse.y" + { + if (yystack.l_mark[0].num < 0) { + yyerror("unsupported algorithm"); + return -1; + } + p_alg_enc = yystack.l_mark[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 39: +#line 401 "../../ipsec-tools/src/setkey/parse.y" + { + if (yystack.l_mark[-1].num < 0) { + yyerror("unsupported algorithm"); + return -1; + } + p_alg_enc = yystack.l_mark[-1].num; + + p_key_enc_len = yystack.l_mark[0].val.len; + p_key_enc = yystack.l_mark[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 40: +#line 416 "../../ipsec-tools/src/setkey/parse.y" + { + if (yystack.l_mark[0].num < 0) { + yyerror("unsupported algorithm"); + return -1; + } + yyerror("WARNING: obsolete algorithm"); + p_alg_enc = yystack.l_mark[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 41: +#line 433 "../../ipsec-tools/src/setkey/parse.y" + { + if (yystack.l_mark[-1].num < 0) { + yyerror("unsupported algorithm"); + return -1; + } + p_alg_enc = yystack.l_mark[-1].num; + if (p_ext & SADB_X_EXT_OLD) { + yyerror("algorithm mismatched"); + return -1; + } + p_ext |= SADB_X_EXT_DERIV; + + p_key_enc_len = yystack.l_mark[0].val.len; + p_key_enc = yystack.l_mark[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 454 "../../ipsec-tools/src/setkey/parse.y" + { + if (yystack.l_mark[-1].num < 0) { + yyerror("unsupported algorithm"); + return -1; + } + p_alg_enc = yystack.l_mark[-1].num; + if (!(p_ext & SADB_X_EXT_OLD)) { + yyerror("algorithm mismatched"); + return -1; + } + p_ext |= SADB_X_EXT_IV4B; + + p_key_enc_len = yystack.l_mark[0].val.len; + p_key_enc = yystack.l_mark[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 43: +#line 477 "../../ipsec-tools/src/setkey/parse.y" + { + if (yystack.l_mark[-1].num < 0) { + yyerror("unsupported algorithm"); + return -1; + } + p_alg_auth = yystack.l_mark[-1].num; + + p_key_auth_len = yystack.l_mark[0].val.len; + p_key_auth = yystack.l_mark[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 44: +#line 502 "../../ipsec-tools/src/setkey/parse.y" + { + if (yystack.l_mark[0].num < 0) { + yyerror("unsupported algorithm"); + return -1; + } + p_alg_auth = yystack.l_mark[0].num; + + p_key_auth_len = 0; + p_key_auth = NULL; + } +break; +case 45: +#line 516 "../../ipsec-tools/src/setkey/parse.y" + { + yyval.val = yystack.l_mark[0].val; + } +break; +case 46: +#line 520 "../../ipsec-tools/src/setkey/parse.y" + { + caddr_t pp_key; + caddr_t bp; + caddr_t yp = yystack.l_mark[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 49: +#line 554 "../../ipsec-tools/src/setkey/parse.y" + { p_ext |= yystack.l_mark[0].num; } +break; +case 50: +#line 555 "../../ipsec-tools/src/setkey/parse.y" + { p_ext &= ~SADB_X_EXT_CYCSEQ; } +break; +case 51: +#line 556 "../../ipsec-tools/src/setkey/parse.y" + { p_mode = yystack.l_mark[0].num; } +break; +case 52: +#line 557 "../../ipsec-tools/src/setkey/parse.y" + { p_mode = IPSEC_MODE_ANY; } +break; +case 53: +#line 558 "../../ipsec-tools/src/setkey/parse.y" + { p_reqid = yystack.l_mark[0].ulnum; } +break; +case 54: +#line 560 "../../ipsec-tools/src/setkey/parse.y" + { + if ((p_ext & SADB_X_EXT_OLD) != 0) { + yyerror("replay prevention cannot be used with " + "ah/esp-old"); + return -1; + } + p_replay = yystack.l_mark[0].ulnum; + } +break; +case 55: +#line 568 "../../ipsec-tools/src/setkey/parse.y" + { p_lt_hard = yystack.l_mark[0].ulnum; } +break; +case 56: +#line 569 "../../ipsec-tools/src/setkey/parse.y" + { p_lt_soft = yystack.l_mark[0].ulnum; } +break; +case 57: +#line 570 "../../ipsec-tools/src/setkey/parse.y" + { p_lb_hard = yystack.l_mark[0].ulnum; } +break; +case 58: +#line 571 "../../ipsec-tools/src/setkey/parse.y" + { p_lb_soft = yystack.l_mark[0].ulnum; } +break; +case 59: +#line 572 "../../ipsec-tools/src/setkey/parse.y" + { + sec_ctx.doi = yystack.l_mark[-2].ulnum; + sec_ctx.alg = yystack.l_mark[-1].ulnum; + sec_ctx.len = yystack.l_mark[0].val.len+1; + sec_ctx.buf = yystack.l_mark[0].val.buf; + } +break; +case 60: +#line 585 "../../ipsec-tools/src/setkey/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 icmp */ + if (fix_portstr(yystack.l_mark[-4].num, &yystack.l_mark[-3].val, &yystack.l_mark[-8].val, &yystack.l_mark[-5].val)) + return -1; + + src = parse_addr(yystack.l_mark[-10].val.buf, yystack.l_mark[-8].val.buf); + dst = parse_addr(yystack.l_mark[-7].val.buf, yystack.l_mark[-5].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, yystack.l_mark[-4].num, &yystack.l_mark[-1].val, + src, yystack.l_mark[-9].num, dst, yystack.l_mark[-6].num); + freeaddrinfo(src); + freeaddrinfo(dst); + if (status < 0) + return -1; + } +break; +case 61: +#line 618 "../../ipsec-tools/src/setkey/parse.y" + { + int status; + + status = setkeymsg_spdaddr_tag(SADB_X_SPDADD, + yystack.l_mark[-2].val.buf, &yystack.l_mark[-1].val); + if (status < 0) + return -1; + } +break; +case 62: +#line 631 "../../ipsec-tools/src/setkey/parse.y" + { + int status; + struct addrinfo *src, *dst; + +#ifdef HAVE_PFKEY_POLICY_PRIORITY + last_msg_type = SADB_X_SPDUPDATE; +#endif + + /* fixed port fields if ulp is icmp */ + if (fix_portstr(yystack.l_mark[-4].num, &yystack.l_mark[-3].val, &yystack.l_mark[-8].val, &yystack.l_mark[-5].val)) + return -1; + + src = parse_addr(yystack.l_mark[-10].val.buf, yystack.l_mark[-8].val.buf); + dst = parse_addr(yystack.l_mark[-7].val.buf, yystack.l_mark[-5].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_SPDUPDATE, yystack.l_mark[-4].num, &yystack.l_mark[-1].val, + src, yystack.l_mark[-9].num, dst, yystack.l_mark[-6].num); + freeaddrinfo(src); + freeaddrinfo(dst); + if (status < 0) + return -1; + } +break; +case 63: +#line 664 "../../ipsec-tools/src/setkey/parse.y" + { + int status; + + status = setkeymsg_spdaddr_tag(SADB_X_SPDUPDATE, + yystack.l_mark[-2].val.buf, &yystack.l_mark[-1].val); + if (status < 0) + return -1; + } +break; +case 64: +#line 676 "../../ipsec-tools/src/setkey/parse.y" + { + int status; + struct addrinfo *src, *dst; + + /* fixed port fields if ulp is icmp */ + if (fix_portstr(yystack.l_mark[-4].num, &yystack.l_mark[-3].val, &yystack.l_mark[-8].val, &yystack.l_mark[-5].val)) + return -1; + + src = parse_addr(yystack.l_mark[-10].val.buf, yystack.l_mark[-8].val.buf); + dst = parse_addr(yystack.l_mark[-7].val.buf, yystack.l_mark[-5].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, yystack.l_mark[-4].num, &yystack.l_mark[-1].val, + src, yystack.l_mark[-9].num, dst, yystack.l_mark[-6].num); + freeaddrinfo(src); + freeaddrinfo(dst); + if (status < 0) + return -1; + } +break; +case 65: +#line 708 "../../ipsec-tools/src/setkey/parse.y" + { + struct sadb_msg msg; + setkeymsg0(&msg, SADB_X_SPDDUMP, SADB_SATYPE_UNSPEC, + sizeof(msg)); + sendkeymsg((char *)&msg, sizeof(msg)); + } +break; +case 66: +#line 719 "../../ipsec-tools/src/setkey/parse.y" + { + struct sadb_msg msg; + setkeymsg0(&msg, SADB_X_SPDFLUSH, SADB_SATYPE_UNSPEC, + sizeof(msg)); + sendkeymsg((char *)&msg, sizeof(msg)); + } +break; +case 69: +#line 734 "../../ipsec-tools/src/setkey/parse.y" + { + char *p; + + for (p = yystack.l_mark[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 70: +#line 759 "../../ipsec-tools/src/setkey/parse.y" + { + yyval.res = parse_addr(yystack.l_mark[0].val.buf, NULL); + if (yyval.res == NULL) { + /* yyerror already called by parse_addr */ + return -1; + } + } +break; +case 71: +#line 770 "../../ipsec-tools/src/setkey/parse.y" + { + yyval.res = parse_addr(yystack.l_mark[0].val.buf, NULL); + if (yyval.res == NULL) { + /* yyerror already called by parse_addr */ + return -1; + } + } +break; +case 72: +#line 778 "../../ipsec-tools/src/setkey/parse.y" + { + yyval.res = parse_addr(yystack.l_mark[-1].val.buf, yystack.l_mark[0].val.buf); + if (yyval.res == NULL) { + /* yyerror already called by parse_addr */ + return -1; + } + } +break; +case 73: +#line 788 "../../ipsec-tools/src/setkey/parse.y" + { yyval.num = -1; } +break; +case 74: +#line 789 "../../ipsec-tools/src/setkey/parse.y" + { yyval.num = yystack.l_mark[0].ulnum; } +break; +case 75: +#line 794 "../../ipsec-tools/src/setkey/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 76: +#line 803 "../../ipsec-tools/src/setkey/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 77: +#line 812 "../../ipsec-tools/src/setkey/parse.y" + { + char buf[20]; + snprintf(buf, sizeof(buf), "%lu", yystack.l_mark[-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 78: +#line 823 "../../ipsec-tools/src/setkey/parse.y" + { + yyval.val = yystack.l_mark[-1].val; + } +break; +case 79: +#line 829 "../../ipsec-tools/src/setkey/parse.y" + { yyval.num = yystack.l_mark[0].ulnum; } +break; +case 80: +#line 830 "../../ipsec-tools/src/setkey/parse.y" + { yyval.num = IPSEC_ULPROTO_ANY; } +break; +case 81: +#line 831 "../../ipsec-tools/src/setkey/parse.y" + { + yyval.num = IPPROTO_TCP; + } +break; +case 82: +#line 835 "../../ipsec-tools/src/setkey/parse.y" + { + struct protoent *ent; + + ent = getprotobyname(yystack.l_mark[0].val.buf); + if (ent) + yyval.num = ent->p_proto; + else { + if (strcmp("icmp6", yystack.l_mark[0].val.buf) == 0) { + yyval.num = IPPROTO_ICMPV6; + } else if(strcmp("ip4", yystack.l_mark[0].val.buf) == 0) { + yyval.num = IPPROTO_IPV4; + } else { + yyerror("invalid upper layer protocol"); + return -1; + } + } + endprotoent(); + } +break; +case 83: +#line 857 "../../ipsec-tools/src/setkey/parse.y" + { + yyval.val.buf = NULL; + yyval.val.len = 0; + } +break; +case 84: +#line 862 "../../ipsec-tools/src/setkey/parse.y" + { + yyval.val.buf = strdup(yystack.l_mark[0].val.buf); + if (!yyval.val.buf) { + yyerror("insufficient memory"); + return -1; + } + yyval.val.len = strlen(yyval.val.buf); + } +break; +case 86: +#line 874 "../../ipsec-tools/src/setkey/parse.y" + { + sec_ctx.doi = yystack.l_mark[-2].ulnum; + sec_ctx.alg = yystack.l_mark[-1].ulnum; + sec_ctx.len = yystack.l_mark[0].val.len+1; + sec_ctx.buf = yystack.l_mark[0].val.buf; + } +break; +case 87: +#line 884 "../../ipsec-tools/src/setkey/parse.y" + { + char *policy; +#ifdef HAVE_PFKEY_POLICY_PRIORITY + struct sadb_x_policy *xpl; +#endif + + policy = ipsec_set_policy(yystack.l_mark[0].val.buf, yystack.l_mark[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 88: +#line 907 "../../ipsec-tools/src/setkey/parse.y" + { yyval.val = yystack.l_mark[0].val; } +break; +case 89: +#line 913 "../../ipsec-tools/src/setkey/parse.y" + { + exit_now = 1; + YYACCEPT; + } +break; +#line 2317 "setkeyyy.tab.c" + } + yystack.s_mark -= yym; + yystate = *yystack.s_mark; + yystack.l_mark -= yym; + yym = yylhs[yyn]; + if (yystate == 0 && yym == 0) + { +#if YYDEBUG + if (yydebug) + printf("%sdebug: after reduction, shifting from state 0 to\ + state %d\n", YYPREFIX, YYFINAL); +#endif + yystate = YYFINAL; + *++yystack.s_mark = YYFINAL; + *++yystack.l_mark = yyval; + if (yychar < 0) + { + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; +#if YYDEBUG + if (yydebug) + { + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; + printf("%sdebug: state %d, reading %d (%s)\n", + YYPREFIX, YYFINAL, yychar, yys); + } +#endif + } + if (yychar == YYEOF) goto yyaccept; + goto yyloop; + } + if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate) + yystate = yytable[yyn]; + else + yystate = yydgoto[yym]; +#if YYDEBUG + if (yydebug) + printf("%sdebug: after reduction, shifting from state %d \ +to state %d\n", YYPREFIX, *yystack.s_mark, yystate); +#endif + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; + *++yystack.s_mark = (YYINT) yystate; + *++yystack.l_mark = yyval; + goto yyloop; + +yyoverflow: + YYERROR_CALL("yacc stack overflow"); + +yyabort: + yyfreestack(&yystack); + return (1); + +yyaccept: + yyfreestack(&yystack); + return (0); +} |