diff options
author | Christian Mauderer <christian.mauderer@embedded-brains.de> | 2018-05-03 14:15:11 +0200 |
---|---|---|
committer | Christian Mauderer <christian.mauderer@embedded-brains.de> | 2018-08-02 10:25:37 +0200 |
commit | b376ae131d9e99a90ddbee2015a2e19d67244ba1 (patch) | |
tree | d8a5fd2c217baae5ab62579f02fb8401fef8f22a /ipsec-tools/src/setkey | |
parent | ipsec-tools: Apply patches from FreeBSD ports. (diff) | |
download | rtems-libbsd-b376ae131d9e99a90ddbee2015a2e19d67244ba1.tar.bz2 |
ipsec-tools: Port libipsec, setkey and racoon.
Note that this replaces the libipsec from FreeBSD with the one provided
by ipsec-tools.
Diffstat (limited to '')
-rw-r--r-- | ipsec-tools/src/setkey/config.h | 1 | ||||
-rw-r--r-- | ipsec-tools/src/setkey/package_version.h | 5 | ||||
-rw-r--r-- | ipsec-tools/src/setkey/parse.c | 4227 | ||||
-rw-r--r-- | ipsec-tools/src/setkey/parse.h | 258 | ||||
-rw-r--r-- | ipsec-tools/src/setkey/parse.y | 13 | ||||
-rw-r--r-- | ipsec-tools/src/setkey/parse_wrapper.c | 5 | ||||
-rw-r--r-- | ipsec-tools/src/setkey/rtems-bsd-setkey-data.h | 34 | ||||
-rw-r--r-- | ipsec-tools/src/setkey/rtems-bsd-setkey-namespace.h | 81 | ||||
-rw-r--r-- | ipsec-tools/src/setkey/rtems-bsd-setkey-parse_wrapper-data.h | 25 | ||||
-rw-r--r-- | ipsec-tools/src/setkey/rtems-bsd-setkey-setkey-data.h | 8 | ||||
-rw-r--r-- | ipsec-tools/src/setkey/rtems-bsd-setkey-token_wrapper-data.h | 18 | ||||
-rw-r--r-- | ipsec-tools/src/setkey/setkey.c | 69 | ||||
-rw-r--r-- | ipsec-tools/src/setkey/token.c | 673 | ||||
-rw-r--r-- | ipsec-tools/src/setkey/token_wrapper.c | 12 |
14 files changed, 2180 insertions, 3249 deletions
diff --git a/ipsec-tools/src/setkey/config.h b/ipsec-tools/src/setkey/config.h new file mode 100644 index 00000000..f97325b7 --- /dev/null +++ b/ipsec-tools/src/setkey/config.h @@ -0,0 +1 @@ +#include "../config.h" diff --git a/ipsec-tools/src/setkey/package_version.h b/ipsec-tools/src/setkey/package_version.h new file mode 100644 index 00000000..47218284 --- /dev/null +++ b/ipsec-tools/src/setkey/package_version.h @@ -0,0 +1,5 @@ +#define TOP_PACKAGE "ipsec-tools" +#define TOP_PACKAGE_NAME "ipsec-tools" +#define TOP_PACKAGE_VERSION "0.8.2" +#define TOP_PACKAGE_STRING "ipsec-tools 0.8.2" +#define TOP_PACKAGE_URL "http://ipsec-tools.sourceforge.net" 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); +} diff --git a/ipsec-tools/src/setkey/parse.h b/ipsec-tools/src/setkey/parse.h index 8f93574d..a2ba9b47 100644 --- a/ipsec-tools/src/setkey/parse.h +++ b/ipsec-tools/src/setkey/parse.h @@ -1,201 +1,69 @@ -/* A Bison parser, made by GNU Bison 2.6.2. */ - -/* Bison interface 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. */ - -#ifndef YY_PARSE_H -# define YY_PARSE_H -/* Enabling traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 +#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 +#ifdef YYSTYPE +#undef YYSTYPE_IS_DECLARED +#define YYSTYPE_IS_DECLARED 1 #endif -#if YYDEBUG -extern int yydebug; -#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 2049 of yacc.c */ -#line 110 "parse.y" - +#ifndef YYSTYPE_IS_DECLARED +#define YYSTYPE_IS_DECLARED 1 +typedef union { int num; unsigned long ulnum; vchar_t val; struct addrinfo *res; - - -/* Line 2049 of yacc.c */ -#line 179 "parse.h" } YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 -#endif - -extern YYSTYPE yylval; - -#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_PARSE_H */ +#endif /* !YYSTYPE_IS_DECLARED */ +extern YYSTYPE setkeyyylval; diff --git a/ipsec-tools/src/setkey/parse.y b/ipsec-tools/src/setkey/parse.y index fa3c45d3..1d2005ad 100644 --- a/ipsec-tools/src/setkey/parse.y +++ b/ipsec-tools/src/setkey/parse.y @@ -67,6 +67,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; @@ -75,6 +76,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; @@ -83,7 +94,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; diff --git a/ipsec-tools/src/setkey/parse_wrapper.c b/ipsec-tools/src/setkey/parse_wrapper.c new file mode 100644 index 00000000..7d5f03bf --- /dev/null +++ b/ipsec-tools/src/setkey/parse_wrapper.c @@ -0,0 +1,5 @@ +#include <machine/rtems-bsd-user-space.h> +#include <machine/rtems-bsd-program.h> +#include "rtems-bsd-setkey-namespace.h" +#include "parse.c" +#include "rtems-bsd-setkey-parse_wrapper-data.h" diff --git a/ipsec-tools/src/setkey/rtems-bsd-setkey-data.h b/ipsec-tools/src/setkey/rtems-bsd-setkey-data.h new file mode 100644 index 00000000..adf04e39 --- /dev/null +++ b/ipsec-tools/src/setkey/rtems-bsd-setkey-data.h @@ -0,0 +1,34 @@ +/* generated by userspace-header-gen.py */ +#include <rtems/linkersets.h> +/* parse_wrapper.c */ +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, extern int setkeyyydebug); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, extern int setkeyyynerrs); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, extern int setkeyyyerrflag); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, extern int setkeyyychar); +/* setkey.c */ +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, extern int f_rfcmode); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, extern int lineno); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, extern int last_msg_type); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, extern u_int32_t last_priority); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, extern int exit_now); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, extern u_char m_buf[]); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, extern u_int m_len); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, extern int f_debug); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, extern int so); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, extern int f_forever); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, extern int f_all); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, extern int f_verbose); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, extern int f_mode); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, extern int f_cmddump); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, extern int f_policy); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, extern int f_hexdump); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, extern int f_tflag); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, extern int f_notreally); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, extern int f_withports); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, extern int f_rkwarn); +/* token_wrapper.c */ +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, extern FILE *setkeyyyin); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, extern FILE *setkeyyyout); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, extern int setkeyyylineno); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, extern int setkeyyy_flex_debug); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, extern char *setkeyyytext); diff --git a/ipsec-tools/src/setkey/rtems-bsd-setkey-namespace.h b/ipsec-tools/src/setkey/rtems-bsd-setkey-namespace.h new file mode 100644 index 00000000..7d71da7e --- /dev/null +++ b/ipsec-tools/src/setkey/rtems-bsd-setkey-namespace.h @@ -0,0 +1,81 @@ +/* generated by userspace-header-gen.py */ +/* parse_wrapper.c */ +#define setkeyyydebug _bsd_setkey_setkeyyydebug +#define setkeyyynerrs _bsd_setkey_setkeyyynerrs +#define setkeyyyerrflag _bsd_setkey_setkeyyyerrflag +#define setkeyyychar _bsd_setkey_setkeyyychar +#define setkeyyyval _bsd_setkey_setkeyyyval +#define setkeyyylval _bsd_setkey_setkeyyylval +#define setkeyyyparse _bsd_setkey_setkeyyyparse +#define free_buffer _bsd_setkey_free_buffer +#define parse_init _bsd_setkey_parse_init +#define setkeymsg0 _bsd_setkey_setkeymsg0 +/* setkey.c */ +#define f_rfcmode _bsd_setkey_f_rfcmode +#define lineno _bsd_setkey_lineno +#define last_msg_type _bsd_setkey_last_msg_type +#define last_priority _bsd_setkey_last_priority +#define exit_now _bsd_setkey_exit_now +#define m_buf _bsd_setkey_m_buf +#define m_len _bsd_setkey_m_len +#define f_debug _bsd_setkey_f_debug +#define so _bsd_setkey_so +#define f_forever _bsd_setkey_f_forever +#define f_all _bsd_setkey_f_all +#define f_verbose _bsd_setkey_f_verbose +#define f_mode _bsd_setkey_f_mode +#define f_cmddump _bsd_setkey_f_cmddump +#define f_policy _bsd_setkey_f_policy +#define f_hexdump _bsd_setkey_f_hexdump +#define f_tflag _bsd_setkey_f_tflag +#define f_notreally _bsd_setkey_f_notreally +#define f_withports _bsd_setkey_f_withports +#define f_rkwarn _bsd_setkey_f_rkwarn +#define shortdump _bsd_setkey_shortdump +#define shortdump_hdr _bsd_setkey_shortdump_hdr +#define numstr _bsd_setkey_numstr +#define fileproc _bsd_setkey_fileproc +#define postproc _bsd_setkey_postproc +#define sendkeymsg _bsd_setkey_sendkeymsg +#define sendkeymsg_spigrep _bsd_setkey_sendkeymsg_spigrep +#define promisc _bsd_setkey_promisc +#define sendkeyshort _bsd_setkey_sendkeyshort +#define stdin_loop _bsd_setkey_stdin_loop +#define get_supported _bsd_setkey_get_supported +#define usage _bsd_setkey_usage +/* token_wrapper.c */ +#define setkeyyyleng _bsd_setkey_setkeyyyleng +#define setkeyyyin _bsd_setkey_setkeyyyin +#define setkeyyyout _bsd_setkey_setkeyyyout +#define setkeyyylineno _bsd_setkey_setkeyyylineno +#define setkeyyy_flex_debug _bsd_setkey_setkeyyy_flex_debug +#define setkeyyytext _bsd_setkey_setkeyyytext +#define parse_string _bsd_setkey_parse_string +#define parse _bsd_setkey_parse +#define yyerror _bsd_setkey_yyerror +#define yyfatal _bsd_setkey_yyfatal +#define setkeyyyfree _bsd_setkey_setkeyyyfree +#define setkeyyyrealloc _bsd_setkey_setkeyyyrealloc +#define setkeyyyalloc _bsd_setkey_setkeyyyalloc +#define setkeyyylex_destroy _bsd_setkey_setkeyyylex_destroy +#define setkeyyyset_debug _bsd_setkey_setkeyyyset_debug +#define setkeyyyget_debug _bsd_setkey_setkeyyyget_debug +#define setkeyyyset_out _bsd_setkey_setkeyyyset_out +#define setkeyyyset_in _bsd_setkey_setkeyyyset_in +#define setkeyyyset_lineno _bsd_setkey_setkeyyyset_lineno +#define setkeyyyget_text _bsd_setkey_setkeyyyget_text +#define setkeyyyget_leng _bsd_setkey_setkeyyyget_leng +#define setkeyyyget_out _bsd_setkey_setkeyyyget_out +#define setkeyyyget_in _bsd_setkey_setkeyyyget_in +#define setkeyyyget_lineno _bsd_setkey_setkeyyyget_lineno +#define setkeyyy_scan_bytes _bsd_setkey_setkeyyy_scan_bytes +#define setkeyyy_scan_string _bsd_setkey_setkeyyy_scan_string +#define setkeyyy_scan_buffer _bsd_setkey_setkeyyy_scan_buffer +#define setkeyyypop_buffer_state _bsd_setkey_setkeyyypop_buffer_state +#define setkeyyypush_buffer_state _bsd_setkey_setkeyyypush_buffer_state +#define setkeyyy_flush_buffer _bsd_setkey_setkeyyy_flush_buffer +#define setkeyyy_delete_buffer _bsd_setkey_setkeyyy_delete_buffer +#define setkeyyy_create_buffer _bsd_setkey_setkeyyy_create_buffer +#define setkeyyy_switch_to_buffer _bsd_setkey_setkeyyy_switch_to_buffer +#define setkeyyyrestart _bsd_setkey_setkeyyyrestart +#define setkeyyylex _bsd_setkey_setkeyyylex diff --git a/ipsec-tools/src/setkey/rtems-bsd-setkey-parse_wrapper-data.h b/ipsec-tools/src/setkey/rtems-bsd-setkey-parse_wrapper-data.h new file mode 100644 index 00000000..050924fb --- /dev/null +++ b/ipsec-tools/src/setkey/rtems-bsd-setkey-parse_wrapper-data.h @@ -0,0 +1,25 @@ +/* generated by userspace-header-gen.py */ +#include <rtems/linkersets.h> +#include "rtems-bsd-setkey-data.h" +/* parse_wrapper.c */ +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, static u_int32_t p_spi); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, static u_int p_ext); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, static u_int p_alg_enc); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, static u_int p_alg_auth); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, static u_int p_replay); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, static u_int p_mode); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, static u_int32_t p_reqid); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, static u_int p_key_enc_len); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, static u_int p_key_auth_len); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, static char const *p_key_enc); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, static char const *p_key_auth); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, static time_t p_lt_hard); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, static time_t p_lt_soft); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, static size_t p_lb_hard); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, static size_t p_lb_soft); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, static struct security_ctx sec_ctx); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, static u_int p_natt_type); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, static struct addrinfo *p_natt_oa); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, static int p_aiflags); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, static int p_aifamily); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, static YYSTACKDATA yystack); diff --git a/ipsec-tools/src/setkey/rtems-bsd-setkey-setkey-data.h b/ipsec-tools/src/setkey/rtems-bsd-setkey-setkey-data.h new file mode 100644 index 00000000..b0aa4803 --- /dev/null +++ b/ipsec-tools/src/setkey/rtems-bsd-setkey-setkey-data.h @@ -0,0 +1,8 @@ +/* generated by userspace-header-gen.py */ +#include <rtems/linkersets.h> +#include "rtems-bsd-setkey-data.h" +/* setkey.c */ +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, static time_t thiszone); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, static char const *satype[]); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, static char const *sastate[]); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, static char const *ipproto[]); diff --git a/ipsec-tools/src/setkey/rtems-bsd-setkey-token_wrapper-data.h b/ipsec-tools/src/setkey/rtems-bsd-setkey-token_wrapper-data.h new file mode 100644 index 00000000..41691d79 --- /dev/null +++ b/ipsec-tools/src/setkey/rtems-bsd-setkey-token_wrapper-data.h @@ -0,0 +1,18 @@ +/* generated by userspace-header-gen.py */ +#include <rtems/linkersets.h> +#include "rtems-bsd-setkey-data.h" +/* token_wrapper.c */ +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, static size_t yy_buffer_stack_top); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, static size_t yy_buffer_stack_max); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, static YY_BUFFER_STATE *yy_buffer_stack); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, static char yy_hold_char); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, static yy_size_t yy_n_chars); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, extern yy_size_t setkeyyyleng); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, static char *yy_c_buf_p); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, static int yy_init); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, static int yy_start); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, static int yy_did_buffer_switch_on_eof); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, static yy_state_type yy_last_accepting_state); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, static char *yy_last_accepting_cpos); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, static int yy_more_flag); +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_setkey, static int yy_more_len); diff --git a/ipsec-tools/src/setkey/setkey.c b/ipsec-tools/src/setkey/setkey.c index c400faa6..15b1c438 100644 --- a/ipsec-tools/src/setkey/setkey.c +++ b/ipsec-tools/src/setkey/setkey.c @@ -1,3 +1,10 @@ +#include <machine/rtems-bsd-user-space.h> + +#ifdef __rtems__ +#include <machine/rtems-bsd-program.h> +#include "rtems-bsd-setkey-namespace.h" +#endif /* __rtems__ */ + /* $NetBSD: setkey.c,v 1.14 2009/08/06 04:44:43 tteras Exp $ */ /* $KAME: setkey.c,v 1.36 2003/09/24 23:52:51 itojun Exp $ */ @@ -35,6 +42,12 @@ #include "config.h" #endif +#ifdef __rtems__ +#define __need_getopt_newlib +#include <getopt.h> +#include <machine/rtems-bsd-commands.h> +#include <rtems/linkersets.h> +#endif /* __rtems__ */ #include <sys/types.h> #include <sys/param.h> #include <sys/socket.h> @@ -68,11 +81,16 @@ #include "package_version.h" #define extern /* so that variables in extern.h are not extern... */ #include "extern.h" +#ifdef __rtems__ +#undef extern /* so that we can rely on the C-standard again... */ +#endif /* __rtems__ */ #define strlcpy(d,s,l) (strncpy(d,s,l), (d)[(l)-1] = '\0') void usage __P((int)); +#ifndef __rtems__ int main __P((int, char **)); +#endif /* __rtems__ */ int get_supported __P((void)); void sendkeyshort __P((u_int)); void promisc __P((void)); @@ -139,6 +157,29 @@ usage(int only_version) exit(1); } +#ifdef __rtems__ +static int main(int argc, char *argv[]); + +RTEMS_LINKER_RWSET(bsd_prog_setkey, char); + +int +rtems_bsd_command_setkey(int argc, char *argv[]) +{ + int exit_code; + void *data_begin; + size_t data_size; + + data_begin = RTEMS_LINKER_SET_BEGIN(bsd_prog_setkey); + data_size = RTEMS_LINKER_SET_SIZE(bsd_prog_setkey); + + rtems_bsd_program_lock(); + exit_code = rtems_bsd_program_call_main_with_data_restore("setkey", + main, argc, argv, data_begin, data_size); + rtems_bsd_program_unlock(); + + return exit_code; +} +#endif /* __rtems__ */ int main(argc, argv) int argc; @@ -146,6 +187,15 @@ main(argc, argv) { FILE *fp = stdin; int c; +#ifdef __rtems__ + struct getopt_data getopt_data; + memset(&getopt_data, 0, sizeof(getopt_data)); +#define optind getopt_data.optind +#define optarg getopt_data.optarg +#define opterr getopt_data.opterr +#define optopt getopt_data.optopt +#define getopt(argc, argv, opt) getopt_r(argc, argv, "+" opt, &getopt_data) +#endif /* __rtems__ */ if (argc == 1) { usage(0); @@ -382,7 +432,11 @@ void promisc() { struct sadb_msg msg; +#ifndef __rtems__ u_char rbuf[1024 * 32]; /* XXX: Enough ? Should I do MSG_PEEK ? */ +#else /* __rtems__ */ + u_char rbuf[1024 * 20]; +#endif /* __rtems__ */ ssize_t l; msg.sadb_msg_version = PF_KEY_V2; @@ -460,7 +514,11 @@ sendkeymsg_spigrep(satype, srcs, dsts, num_spi) char *buf; size_t len; ssize_t l; +#ifndef __rtems__ u_char rbuf[1024 * 32]; +#else /* __rtems__ */ + u_char rbuf[1024 * 20]; +#endif /* __rtems__ */ caddr_t mhp[SADB_EXT_MAX + 1]; struct sadb_address *saddr; struct sockaddr *s; @@ -610,7 +668,11 @@ sendkeymsg(buf, len) char *buf; size_t len; { +#ifndef __rtems__ u_char rbuf[1024 * 32]; /* XXX: Enough ? Should I do MSG_PEEK ? */ +#else /* __rtems__ */ + u_char rbuf[1024 * 20]; +#endif /* __rtems__ */ ssize_t l; struct sadb_msg *msg; @@ -837,7 +899,11 @@ fileproc(filename) ssize_t len, l; u_char *p, *ep; struct sadb_msg *msg; +#ifndef __rtems__ u_char rbuf[1024 * 32]; /* XXX: Enough ? Should I do MSG_PEEK ? */ +#else /* __rtems__ */ + u_char rbuf[1024 * 20]; +#endif /* __rtems__ */ fd = open(filename, O_RDONLY); if (fd < 0) @@ -1060,3 +1126,6 @@ gmt2local(time_t t) return (dt); } +#ifdef __rtems__ +#include "rtems-bsd-setkey-setkey-data.h" +#endif /* __rtems__ */ diff --git a/ipsec-tools/src/setkey/token.c b/ipsec-tools/src/setkey/token.c index f533cfc1..fb2c2574 100644 --- a/ipsec-tools/src/setkey/token.c +++ b/ipsec-tools/src/setkey/token.c @@ -1,10 +1,29 @@ -#line 3 "token.c" +#line 3 "<stdout>" #define YY_INT_ALIGNED short int /* A lexical scanner generated by flex */ +#define yy_create_buffer setkeyyy_create_buffer +#define yy_delete_buffer setkeyyy_delete_buffer +#define yy_flex_debug setkeyyy_flex_debug +#define yy_init_buffer setkeyyy_init_buffer +#define yy_flush_buffer setkeyyy_flush_buffer +#define yy_load_buffer_state setkeyyy_load_buffer_state +#define yy_switch_to_buffer setkeyyy_switch_to_buffer +#define yyin setkeyyyin +#define yyleng setkeyyyleng +#define yylex setkeyyylex +#define yylineno setkeyyylineno +#define yyout setkeyyyout +#define yyrestart setkeyyyrestart +#define yytext setkeyyytext +#define yywrap setkeyyywrap +#define yyalloc setkeyyyalloc +#define yyrealloc setkeyyyrealloc +#define yyfree setkeyyyfree + #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 @@ -15,6 +34,16 @@ /* First, we deal with platform-specific or compiler-specific issues. */ +#if defined(__FreeBSD__) +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS +#endif +#include <sys/cdefs.h> +#include <stdint.h> +#else +#define __dead2 +#endif + /* begin standard C headers. */ #include <stdio.h> #include <string.h> @@ -30,7 +59,8 @@ /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ -#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +#if defined(__FreeBSD__) || \ + (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, * if you want the limit (max/min) macros for int types. @@ -135,13 +165,13 @@ typedef unsigned int flex_uint32_t; #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart(yyin ) +#define YY_NEW_FILE setkeyyyrestart(setkeyyyin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #ifndef YY_BUF_SIZE -#define YY_BUF_SIZE 16384 +#define YY_BUF_SIZE 1024 #endif /* The state buf must be large enough to hold one state per character in the main buffer. @@ -158,9 +188,9 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; typedef size_t yy_size_t; #endif -extern yy_size_t yyleng; +extern yy_size_t setkeyyyleng; -extern FILE *yyin, *yyout; +extern FILE *setkeyyyin, *setkeyyyout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 @@ -172,13 +202,13 @@ extern FILE *yyin, *yyout; #define yyless(n) \ do \ { \ - /* Undo effects of setting up yytext. */ \ + /* Undo effects of setting up setkeyyytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ *yy_cp = (yy_hold_char); \ YY_RESTORE_YY_MORE_OFFSET \ (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + YY_DO_BEFORE_ACTION; /* set up setkeyyytext again */ \ } \ while ( 0 ) @@ -241,8 +271,8 @@ struct yy_buffer_state * possible backing-up. * * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. + * (via setkeyyyrestart()), so that the user can continue scanning by + * just pointing setkeyyyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 @@ -263,57 +293,58 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ : NULL) +#define yy_current_buffer YY_CURRENT_BUFFER /* Same as previous macro, but useful when we know that the buffer stack is not * NULL or when we need an lvalue. For internal use only. */ #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] -/* yy_hold_char holds the character lost when yytext is formed. */ +/* yy_hold_char holds the character lost when setkeyyytext is formed. */ static char yy_hold_char; static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ -yy_size_t yyleng; +yy_size_t setkeyyyleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ -/* Flag which is used to allow yywrap()'s to do buffer switches - * instead of setting up a fresh yyin. A bit of a hack ... +/* Flag which is used to allow setkeyyywrap()'s to do buffer switches + * instead of setting up a fresh setkeyyyin. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; -void yyrestart (FILE *input_file ); -void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); -YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); -void yy_delete_buffer (YY_BUFFER_STATE b ); -void yy_flush_buffer (YY_BUFFER_STATE b ); -void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); -void yypop_buffer_state (void ); +void setkeyyyrestart (FILE *input_file ); +void setkeyyy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE setkeyyy_create_buffer (FILE *file,int size ); +void setkeyyy_delete_buffer (YY_BUFFER_STATE b ); +void setkeyyy_flush_buffer (YY_BUFFER_STATE b ); +void setkeyyypush_buffer_state (YY_BUFFER_STATE new_buffer ); +void setkeyyypop_buffer_state (void ); -static void yyensure_buffer_stack (void ); -static void yy_load_buffer_state (void ); -static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); +static void setkeyyyensure_buffer_stack (void ); +static void setkeyyy_load_buffer_state (void ); +static void setkeyyy_init_buffer (YY_BUFFER_STATE b,FILE *file ); -#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) +#define YY_FLUSH_BUFFER setkeyyy_flush_buffer(YY_CURRENT_BUFFER ) -YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); -YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); -YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len ); +YY_BUFFER_STATE setkeyyy_scan_buffer (char *base,yy_size_t size ); +YY_BUFFER_STATE setkeyyy_scan_string (yyconst char *yy_str ); +YY_BUFFER_STATE setkeyyy_scan_bytes (yyconst char *bytes,yy_size_t len ); -void *yyalloc (yy_size_t ); -void *yyrealloc (void *,yy_size_t ); -void yyfree (void * ); +void *setkeyyyalloc (yy_size_t ); +void *setkeyyyrealloc (void *,yy_size_t ); +void setkeyyyfree (void * ); -#define yy_new_buffer yy_create_buffer +#define yy_new_buffer setkeyyy_create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ - yyensure_buffer_stack (); \ + setkeyyyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer(yyin,YY_BUF_SIZE ); \ + setkeyyy_create_buffer(setkeyyyin,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } @@ -321,9 +352,9 @@ void yyfree (void * ); #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ - yyensure_buffer_stack (); \ + setkeyyyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer(yyin,YY_BUF_SIZE ); \ + setkeyyy_create_buffer(setkeyyyin,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } @@ -334,29 +365,29 @@ void yyfree (void * ); typedef unsigned char YY_CHAR; -FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; +FILE *setkeyyyin = (FILE *) 0, *setkeyyyout = (FILE *) 0; typedef int yy_state_type; -extern int yylineno; +extern int setkeyyylineno; -int yylineno = 1; +int setkeyyylineno = 1; -extern char *yytext; -#define yytext_ptr yytext +extern char *setkeyyytext; +#define yytext_ptr setkeyyytext static yy_state_type yy_get_previous_state (void ); static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); static int yy_get_next_buffer (void ); -static void yy_fatal_error (yyconst char msg[] ); +static void yy_fatal_error (yyconst char msg[] ) __dead2; /* Done after the current pattern has been matched and before the - * corresponding action - sets up yytext. + * corresponding action - sets up setkeyyytext. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ (yytext_ptr) -= (yy_more_len); \ - yyleng = (size_t) (yy_cp - (yytext_ptr)); \ + setkeyyyleng = (size_t) (yy_cp - (yytext_ptr)); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; @@ -977,8 +1008,8 @@ static yyconst flex_int16_t yy_chk[1613] = static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; -extern int yy_flex_debug; -int yy_flex_debug = 0; +extern int setkeyyy_flex_debug; +int setkeyyy_flex_debug = 0; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. @@ -989,8 +1020,8 @@ static int yy_more_len = 0; #define yymore() ((yy_more_flag) = 1) #define YY_MORE_ADJ (yy_more_len) #define YY_RESTORE_YY_MORE_OFFSET -char *yytext; -#line 1 "token.l" +char *setkeyyytext; +#line 1 "../../ipsec-tools/src/setkey/token.l" /* $NetBSD: token.l,v 1.15 2010/06/04 13:06:03 vanhu Exp $ */ /* $KAME: token.l,v 1.44 2003/10/21 07:20:58 itojun Exp $ */ /* @@ -1021,7 +1052,7 @@ char *yytext; * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ -#line 35 "token.l" +#line 35 "../../ipsec-tools/src/setkey/token.l" #ifdef HAVE_CONFIG_H #include "config.h" @@ -1079,7 +1110,7 @@ char *yytext; /* common section */ #define YY_NO_INPUT 1 -#line 1083 "token.c" +#line 1114 "<stdout>" #define INITIAL 0 #define S_PL 1 @@ -1103,31 +1134,31 @@ static int yy_init_globals (void ); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ -int yylex_destroy (void ); +int setkeyyylex_destroy (void ); -int yyget_debug (void ); +int setkeyyyget_debug (void ); -void yyset_debug (int debug_flag ); +void setkeyyyset_debug (int debug_flag ); -YY_EXTRA_TYPE yyget_extra (void ); +YY_EXTRA_TYPE setkeyyyget_extra (void ); -void yyset_extra (YY_EXTRA_TYPE user_defined ); +void setkeyyyset_extra (YY_EXTRA_TYPE user_defined ); -FILE *yyget_in (void ); +FILE *setkeyyyget_in (void ); -void yyset_in (FILE * in_str ); +void setkeyyyset_in (FILE * in_str ); -FILE *yyget_out (void ); +FILE *setkeyyyget_out (void ); -void yyset_out (FILE * out_str ); +void setkeyyyset_out (FILE * out_str ); -yy_size_t yyget_leng (void ); +yy_size_t setkeyyyget_leng (void ); -char *yyget_text (void ); +char *setkeyyyget_text (void ); -int yyget_lineno (void ); +int setkeyyyget_lineno (void ); -void yyset_lineno (int line_number ); +void setkeyyyset_lineno (int line_number ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -1135,9 +1166,9 @@ void yyset_lineno (int line_number ); #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int yywrap (void ); +extern "C" int setkeyyywrap (void ); #else -extern int yywrap (void ); +extern int setkeyyywrap (void ); #endif #endif @@ -1169,7 +1200,7 @@ static int input (void ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) +#define ECHO do { if (fwrite( setkeyyytext, setkeyyyleng, 1, setkeyyyout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -1182,18 +1213,18 @@ static int input (void ); int c = '*'; \ size_t n; \ for ( n = 0; n < max_size && \ - (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + (c = getc( setkeyyyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ - if ( c == EOF && ferror( yyin ) ) \ + if ( c == EOF && ferror( setkeyyyin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else \ { \ errno=0; \ - while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + while ( (result = fread(buf, 1, max_size, setkeyyyin))==0 && ferror(setkeyyyin)) \ { \ if( errno != EINTR) \ { \ @@ -1201,7 +1232,7 @@ static int input (void ); break; \ } \ errno=0; \ - clearerr(yyin); \ + clearerr(setkeyyyin); \ } \ }\ \ @@ -1234,12 +1265,12 @@ static int input (void ); #ifndef YY_DECL #define YY_DECL_IS_OURS 1 -extern int yylex (void); +extern int setkeyyylex (void); -#define YY_DECL int yylex (void) +#define YY_DECL int setkeyyylex (void) #endif /* !YY_DECL */ -/* Code executed at the beginning of each rule, after yytext and yyleng +/* Code executed at the beginning of each rule, after setkeyyytext and setkeyyyleng * have been set up. */ #ifndef YY_USER_ACTION @@ -1258,15 +1289,15 @@ extern int yylex (void); */ YY_DECL { - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; + yy_state_type yy_current_state; + char *yy_cp, *yy_bp; + int yy_act; -#line 115 "token.l" +#line 115 "../../ipsec-tools/src/setkey/token.l" -#line 1270 "token.c" +#line 1301 "<stdout>" if ( !(yy_init) ) { @@ -1279,19 +1310,19 @@ YY_DECL if ( ! (yy_start) ) (yy_start) = 1; /* first start state */ - if ( ! yyin ) - yyin = stdin; + if ( ! setkeyyyin ) + setkeyyyin = stdin; - if ( ! yyout ) - yyout = stdout; + if ( ! setkeyyyout ) + setkeyyyout = stdout; if ( ! YY_CURRENT_BUFFER ) { - yyensure_buffer_stack (); + setkeyyyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer(yyin,YY_BUF_SIZE ); + setkeyyy_create_buffer(setkeyyyin,YY_BUF_SIZE ); } - yy_load_buffer_state( ); + setkeyyy_load_buffer_state( ); } while ( 1 ) /* loops until end-of-file is reached */ @@ -1304,7 +1335,7 @@ YY_DECL } yy_cp = (yy_c_buf_p); - /* Support of yytext. */ + /* Support of setkeyyytext. */ *yy_cp = (yy_hold_char); /* yy_bp points to the position in yy_ch_buf of the start of @@ -1316,7 +1347,7 @@ YY_DECL yy_match: do { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; @@ -1357,102 +1388,102 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 118 "token.l" +#line 118 "../../ipsec-tools/src/setkey/token.l" { return(ADD); } YY_BREAK case 2: YY_RULE_SETUP -#line 119 "token.l" +#line 119 "../../ipsec-tools/src/setkey/token.l" { return(DELETE); } YY_BREAK case 3: YY_RULE_SETUP -#line 120 "token.l" +#line 120 "../../ipsec-tools/src/setkey/token.l" { return(DELETEALL); } YY_BREAK case 4: YY_RULE_SETUP -#line 121 "token.l" +#line 121 "../../ipsec-tools/src/setkey/token.l" { return(GET); } YY_BREAK case 5: YY_RULE_SETUP -#line 122 "token.l" +#line 122 "../../ipsec-tools/src/setkey/token.l" { return(FLUSH); } YY_BREAK case 6: YY_RULE_SETUP -#line 123 "token.l" +#line 123 "../../ipsec-tools/src/setkey/token.l" { return(DUMP); } YY_BREAK case 7: YY_RULE_SETUP -#line 124 "token.l" +#line 124 "../../ipsec-tools/src/setkey/token.l" { return(EXIT); } YY_BREAK case 8: YY_RULE_SETUP -#line 125 "token.l" +#line 125 "../../ipsec-tools/src/setkey/token.l" { return(EXIT); } YY_BREAK case 9: YY_RULE_SETUP -#line 126 "token.l" +#line 126 "../../ipsec-tools/src/setkey/token.l" { return(EXIT); } YY_BREAK /* for management SPD */ case 10: YY_RULE_SETUP -#line 129 "token.l" +#line 129 "../../ipsec-tools/src/setkey/token.l" { return(SPDADD); } YY_BREAK case 11: YY_RULE_SETUP -#line 130 "token.l" +#line 130 "../../ipsec-tools/src/setkey/token.l" { return(SPDUPDATE); } YY_BREAK case 12: YY_RULE_SETUP -#line 131 "token.l" +#line 131 "../../ipsec-tools/src/setkey/token.l" { return(SPDDELETE); } YY_BREAK case 13: YY_RULE_SETUP -#line 132 "token.l" +#line 132 "../../ipsec-tools/src/setkey/token.l" { return(SPDDUMP); } YY_BREAK case 14: YY_RULE_SETUP -#line 133 "token.l" +#line 133 "../../ipsec-tools/src/setkey/token.l" { return(SPDFLUSH); } YY_BREAK case 15: YY_RULE_SETUP -#line 134 "token.l" +#line 134 "../../ipsec-tools/src/setkey/token.l" { return(TAGGED); } YY_BREAK case 16: YY_RULE_SETUP -#line 135 "token.l" +#line 135 "../../ipsec-tools/src/setkey/token.l" { BEGIN S_PL; return(F_POLICY); } YY_BREAK case 17: /* rule 17 can match eol */ YY_RULE_SETUP -#line 136 "token.l" +#line 136 "../../ipsec-tools/src/setkey/token.l" { yymore(); /* count up for nl */ { char *p; - for (p = yytext; *p != '\0'; p++) + for (p = setkeyyytext; *p != '\0'; p++) if (*p == '\n') lineno++; } - yylval.val.len = strlen(yytext); - yylval.val.buf = strdup(yytext); + yylval.val.len = strlen(setkeyyytext); + yylval.val.buf = strdup(setkeyyytext); if (!yylval.val.buf) yyfatal("insufficient memory"); @@ -1461,16 +1492,16 @@ YY_RULE_SETUP YY_BREAK case 18: YY_RULE_SETUP -#line 154 "token.l" +#line 154 "../../ipsec-tools/src/setkey/token.l" { BEGIN INITIAL; return(EOT); } YY_BREAK /* address resolution flags */ case 19: YY_RULE_SETUP -#line 157 "token.l" +#line 157 "../../ipsec-tools/src/setkey/token.l" { - yylval.val.len = strlen(yytext); - yylval.val.buf = strdup(yytext); + yylval.val.len = strlen(setkeyyytext); + yylval.val.buf = strdup(setkeyyytext); if (!yylval.val.buf) yyfatal("insufficient memory"); return(F_AIFLAGS); @@ -1479,37 +1510,37 @@ YY_RULE_SETUP /* security protocols */ case 20: YY_RULE_SETUP -#line 166 "token.l" +#line 166 "../../ipsec-tools/src/setkey/token.l" { yylval.num = 0; return(PR_AH); } YY_BREAK case 21: YY_RULE_SETUP -#line 167 "token.l" +#line 167 "../../ipsec-tools/src/setkey/token.l" { yylval.num = 0; return(PR_ESP); } YY_BREAK case 22: YY_RULE_SETUP -#line 168 "token.l" +#line 168 "../../ipsec-tools/src/setkey/token.l" { yylval.num = 1; return(PR_AH); } YY_BREAK case 23: YY_RULE_SETUP -#line 169 "token.l" +#line 169 "../../ipsec-tools/src/setkey/token.l" { yylval.num = 1; return(PR_ESP); } YY_BREAK case 24: YY_RULE_SETUP -#line 170 "token.l" +#line 170 "../../ipsec-tools/src/setkey/token.l" { yylval.num = 0; return(PR_ESPUDP); } YY_BREAK case 25: YY_RULE_SETUP -#line 171 "token.l" +#line 171 "../../ipsec-tools/src/setkey/token.l" { yylval.num = 0; return(PR_IPCOMP); } YY_BREAK case 26: YY_RULE_SETUP -#line 172 "token.l" +#line 172 "../../ipsec-tools/src/setkey/token.l" { yylval.num = 0; return(PR_TCP); } @@ -1517,72 +1548,72 @@ YY_RULE_SETUP /* authentication alogorithm */ case 27: YY_RULE_SETUP -#line 177 "token.l" +#line 177 "../../ipsec-tools/src/setkey/token.l" { BEGIN S_AUTHALG; return(F_AUTH); } YY_BREAK case 28: YY_RULE_SETUP -#line 178 "token.l" +#line 178 "../../ipsec-tools/src/setkey/token.l" { yylval.num = SADB_AALG_MD5HMAC; BEGIN INITIAL; return(ALG_AUTH); } YY_BREAK case 29: YY_RULE_SETUP -#line 179 "token.l" +#line 179 "../../ipsec-tools/src/setkey/token.l" { yylval.num = SADB_AALG_SHA1HMAC; BEGIN INITIAL; return(ALG_AUTH); } YY_BREAK case 30: YY_RULE_SETUP -#line 180 "token.l" +#line 180 "../../ipsec-tools/src/setkey/token.l" { yylval.num = SADB_X_AALG_MD5; BEGIN INITIAL; return(ALG_AUTH); } YY_BREAK case 31: YY_RULE_SETUP -#line 181 "token.l" +#line 181 "../../ipsec-tools/src/setkey/token.l" { yylval.num = SADB_X_AALG_SHA; BEGIN INITIAL; return(ALG_AUTH); } YY_BREAK case 32: YY_RULE_SETUP -#line 182 "token.l" +#line 182 "../../ipsec-tools/src/setkey/token.l" { yylval.num = SADB_X_AALG_SHA2_256; BEGIN INITIAL; return(ALG_AUTH); } YY_BREAK case 33: YY_RULE_SETUP -#line 183 "token.l" +#line 183 "../../ipsec-tools/src/setkey/token.l" { yylval.num = SADB_X_AALG_SHA2_256; BEGIN INITIAL; return(ALG_AUTH); } YY_BREAK case 34: YY_RULE_SETUP -#line 184 "token.l" +#line 184 "../../ipsec-tools/src/setkey/token.l" { yylval.num = SADB_X_AALG_SHA2_384; BEGIN INITIAL; return(ALG_AUTH); } YY_BREAK case 35: YY_RULE_SETUP -#line 185 "token.l" +#line 185 "../../ipsec-tools/src/setkey/token.l" { yylval.num = SADB_X_AALG_SHA2_384; BEGIN INITIAL; return(ALG_AUTH); } YY_BREAK case 36: YY_RULE_SETUP -#line 186 "token.l" +#line 186 "../../ipsec-tools/src/setkey/token.l" { yylval.num = SADB_X_AALG_SHA2_512; BEGIN INITIAL; return(ALG_AUTH); } YY_BREAK case 37: YY_RULE_SETUP -#line 187 "token.l" +#line 187 "../../ipsec-tools/src/setkey/token.l" { yylval.num = SADB_X_AALG_SHA2_512; BEGIN INITIAL; return(ALG_AUTH); } YY_BREAK case 38: YY_RULE_SETUP -#line 188 "token.l" +#line 188 "../../ipsec-tools/src/setkey/token.l" { yylval.num = SADB_X_AALG_RIPEMD160HMAC; BEGIN INITIAL; return(ALG_AUTH); } YY_BREAK case 39: YY_RULE_SETUP -#line 189 "token.l" +#line 189 "../../ipsec-tools/src/setkey/token.l" { yylval.num = SADB_X_AALG_AES_XCBC_MAC; BEGIN INITIAL; return(ALG_AUTH); } YY_BREAK case 40: YY_RULE_SETUP -#line 190 "token.l" +#line 190 "../../ipsec-tools/src/setkey/token.l" { #ifdef SADB_X_AALG_TCP_MD5 yylval.num = SADB_X_AALG_TCP_MD5; @@ -1593,63 +1624,63 @@ YY_RULE_SETUP YY_BREAK case 41: YY_RULE_SETUP -#line 197 "token.l" +#line 197 "../../ipsec-tools/src/setkey/token.l" { yylval.num = SADB_X_AALG_NULL; BEGIN INITIAL; return(ALG_AUTH_NOKEY); } YY_BREAK /* encryption alogorithm */ case 42: YY_RULE_SETUP -#line 200 "token.l" +#line 200 "../../ipsec-tools/src/setkey/token.l" { BEGIN S_ENCALG; return(F_ENC); } YY_BREAK case 43: YY_RULE_SETUP -#line 201 "token.l" +#line 201 "../../ipsec-tools/src/setkey/token.l" { yylval.num = SADB_EALG_DESCBC; BEGIN INITIAL; return(ALG_ENC); } YY_BREAK case 44: YY_RULE_SETUP -#line 202 "token.l" +#line 202 "../../ipsec-tools/src/setkey/token.l" { yylval.num = SADB_EALG_3DESCBC; BEGIN INITIAL; return(ALG_ENC); } YY_BREAK case 45: YY_RULE_SETUP -#line 203 "token.l" +#line 203 "../../ipsec-tools/src/setkey/token.l" { yylval.num = SADB_EALG_NULL; BEGIN INITIAL; return(ALG_ENC_NOKEY); } YY_BREAK case 46: YY_RULE_SETUP -#line 204 "token.l" +#line 204 "../../ipsec-tools/src/setkey/token.l" { yylval.num = SADB_EALG_NULL; BEGIN INITIAL; return(ALG_ENC_OLD); } YY_BREAK case 47: YY_RULE_SETUP -#line 205 "token.l" +#line 205 "../../ipsec-tools/src/setkey/token.l" { yylval.num = SADB_X_EALG_BLOWFISHCBC; BEGIN INITIAL; return(ALG_ENC); } YY_BREAK case 48: YY_RULE_SETUP -#line 206 "token.l" +#line 206 "../../ipsec-tools/src/setkey/token.l" { yylval.num = SADB_X_EALG_CAST128CBC; BEGIN INITIAL; return(ALG_ENC); } YY_BREAK case 49: YY_RULE_SETUP -#line 207 "token.l" +#line 207 "../../ipsec-tools/src/setkey/token.l" { yylval.num = SADB_EALG_DESCBC; BEGIN INITIAL; return(ALG_ENC_DESDERIV); } YY_BREAK case 50: YY_RULE_SETUP -#line 208 "token.l" +#line 208 "../../ipsec-tools/src/setkey/token.l" { yylval.num = SADB_EALG_DESCBC; BEGIN INITIAL; return(ALG_ENC_DES32IV); } YY_BREAK case 51: YY_RULE_SETUP -#line 209 "token.l" +#line 209 "../../ipsec-tools/src/setkey/token.l" { yylval.num = SADB_X_EALG_TWOFISHCBC; BEGIN INITIAL; return(ALG_ENC); } YY_BREAK case 52: YY_RULE_SETUP -#line 210 "token.l" +#line 210 "../../ipsec-tools/src/setkey/token.l" { #ifdef SADB_X_EALG_AESCBC yylval.num = SADB_X_EALG_AESCBC; BEGIN INITIAL; return(ALG_ENC); @@ -1658,7 +1689,7 @@ YY_RULE_SETUP YY_BREAK case 53: YY_RULE_SETUP -#line 215 "token.l" +#line 215 "../../ipsec-tools/src/setkey/token.l" { #ifdef SADB_X_EALG_AESCBC yylval.num = SADB_X_EALG_AESCBC; BEGIN INITIAL; return(ALG_ENC); @@ -1667,12 +1698,12 @@ YY_RULE_SETUP YY_BREAK case 54: YY_RULE_SETUP -#line 220 "token.l" +#line 220 "../../ipsec-tools/src/setkey/token.l" { yylval.num = SADB_X_EALG_AESCTR; BEGIN INITIAL; return(ALG_ENC); } YY_BREAK case 55: YY_RULE_SETUP -#line 221 "token.l" +#line 221 "../../ipsec-tools/src/setkey/token.l" { #ifdef SADB_X_EALG_CAMELLIACBC yylval.num = SADB_X_EALG_CAMELLIACBC; BEGIN INITIAL; return(ALG_ENC); @@ -1682,164 +1713,164 @@ YY_RULE_SETUP /* compression algorithms */ case 56: YY_RULE_SETUP -#line 228 "token.l" +#line 228 "../../ipsec-tools/src/setkey/token.l" { return(F_COMP); } YY_BREAK case 57: YY_RULE_SETUP -#line 229 "token.l" +#line 229 "../../ipsec-tools/src/setkey/token.l" { yylval.num = SADB_X_CALG_OUI; return(ALG_COMP); } YY_BREAK case 58: YY_RULE_SETUP -#line 230 "token.l" +#line 230 "../../ipsec-tools/src/setkey/token.l" { yylval.num = SADB_X_CALG_DEFLATE; return(ALG_COMP); } YY_BREAK case 59: YY_RULE_SETUP -#line 231 "token.l" +#line 231 "../../ipsec-tools/src/setkey/token.l" { yylval.num = SADB_X_CALG_LZS; return(ALG_COMP); } YY_BREAK case 60: YY_RULE_SETUP -#line 232 "token.l" +#line 232 "../../ipsec-tools/src/setkey/token.l" { return(F_RAWCPI); } YY_BREAK /* extension */ case 61: YY_RULE_SETUP -#line 235 "token.l" +#line 235 "../../ipsec-tools/src/setkey/token.l" { return(F_MODE); } YY_BREAK case 62: YY_RULE_SETUP -#line 236 "token.l" +#line 236 "../../ipsec-tools/src/setkey/token.l" { yylval.num = IPSEC_MODE_TRANSPORT; return(MODE); } YY_BREAK case 63: YY_RULE_SETUP -#line 237 "token.l" +#line 237 "../../ipsec-tools/src/setkey/token.l" { yylval.num = IPSEC_MODE_TUNNEL; return(MODE); } YY_BREAK case 64: YY_RULE_SETUP -#line 238 "token.l" +#line 238 "../../ipsec-tools/src/setkey/token.l" { return(F_REQID); } YY_BREAK case 65: YY_RULE_SETUP -#line 239 "token.l" +#line 239 "../../ipsec-tools/src/setkey/token.l" { return(F_EXT); } YY_BREAK case 66: YY_RULE_SETUP -#line 240 "token.l" +#line 240 "../../ipsec-tools/src/setkey/token.l" { yylval.num = SADB_X_EXT_PRAND; return(EXTENSION); } YY_BREAK case 67: YY_RULE_SETUP -#line 241 "token.l" +#line 241 "../../ipsec-tools/src/setkey/token.l" { yylval.num = SADB_X_EXT_PSEQ; return(EXTENSION); } YY_BREAK case 68: YY_RULE_SETUP -#line 242 "token.l" +#line 242 "../../ipsec-tools/src/setkey/token.l" { yylval.num = SADB_X_EXT_PZERO; return(EXTENSION); } YY_BREAK case 69: YY_RULE_SETUP -#line 243 "token.l" +#line 243 "../../ipsec-tools/src/setkey/token.l" { return(NOCYCLICSEQ); } YY_BREAK case 70: YY_RULE_SETUP -#line 244 "token.l" +#line 244 "../../ipsec-tools/src/setkey/token.l" { return(F_REPLAY); } YY_BREAK case 71: YY_RULE_SETUP -#line 245 "token.l" +#line 245 "../../ipsec-tools/src/setkey/token.l" { return(F_LIFETIME_HARD); } YY_BREAK case 72: YY_RULE_SETUP -#line 246 "token.l" +#line 246 "../../ipsec-tools/src/setkey/token.l" { return(F_LIFETIME_SOFT); } YY_BREAK case 73: YY_RULE_SETUP -#line 247 "token.l" +#line 247 "../../ipsec-tools/src/setkey/token.l" { return(F_LIFEBYTE_HARD); } YY_BREAK case 74: YY_RULE_SETUP -#line 248 "token.l" +#line 248 "../../ipsec-tools/src/setkey/token.l" { return(F_LIFEBYTE_SOFT); } YY_BREAK case 75: YY_RULE_SETUP -#line 249 "token.l" +#line 249 "../../ipsec-tools/src/setkey/token.l" { return(SECURITY_CTX); } YY_BREAK /* ... */ case 76: YY_RULE_SETUP -#line 252 "token.l" +#line 252 "../../ipsec-tools/src/setkey/token.l" { return(ANY); } YY_BREAK case 77: YY_RULE_SETUP -#line 253 "token.l" +#line 253 "../../ipsec-tools/src/setkey/token.l" { } YY_BREAK case 78: /* rule 78 can match eol */ YY_RULE_SETUP -#line 254 "token.l" +#line 254 "../../ipsec-tools/src/setkey/token.l" { lineno++; } YY_BREAK case 79: YY_RULE_SETUP -#line 255 "token.l" +#line 255 "../../ipsec-tools/src/setkey/token.l" YY_BREAK case 80: YY_RULE_SETUP -#line 256 "token.l" +#line 256 "../../ipsec-tools/src/setkey/token.l" { return(EOT); } YY_BREAK /* for address parameters: /prefix, [port] */ case 81: YY_RULE_SETUP -#line 259 "token.l" +#line 259 "../../ipsec-tools/src/setkey/token.l" { return SLASH; } YY_BREAK case 82: YY_RULE_SETUP -#line 260 "token.l" +#line 260 "../../ipsec-tools/src/setkey/token.l" { return BLCL; } YY_BREAK case 83: YY_RULE_SETUP -#line 261 "token.l" +#line 261 "../../ipsec-tools/src/setkey/token.l" { return ELCL; } YY_BREAK /* parameter */ case 84: YY_RULE_SETUP -#line 264 "token.l" +#line 264 "../../ipsec-tools/src/setkey/token.l" { char *bp; - yylval.ulnum = strtoul(yytext, &bp, 10); + yylval.ulnum = strtoul(setkeyyytext, &bp, 10); return(DECSTRING); } YY_BREAK case 85: YY_RULE_SETUP -#line 271 "token.l" +#line 271 "../../ipsec-tools/src/setkey/token.l" { - yylval.val.buf = strdup(yytext + 2); + yylval.val.buf = strdup(setkeyyytext + 2); if (!yylval.val.buf) yyfatal("insufficient memory"); yylval.val.len = strlen(yylval.val.buf); @@ -1850,14 +1881,14 @@ YY_RULE_SETUP case 86: /* rule 86 can match eol */ YY_RULE_SETUP -#line 280 "token.l" +#line 280 "../../ipsec-tools/src/setkey/token.l" { - char *p = yytext; + char *p = setkeyyytext; while (*++p != '"') ; *p = '\0'; - yytext++; - yylval.val.len = yyleng - 2; - yylval.val.buf = strdup(yytext); + setkeyyytext++; + yylval.val.len = setkeyyyleng - 2; + yylval.val.buf = strdup(setkeyyytext); if (!yylval.val.buf) yyfatal("insufficient memory"); @@ -1866,10 +1897,10 @@ YY_RULE_SETUP YY_BREAK case 87: YY_RULE_SETUP -#line 293 "token.l" +#line 293 "../../ipsec-tools/src/setkey/token.l" { - yylval.val.len = yyleng; - yylval.val.buf = strdup(yytext); + yylval.val.len = setkeyyyleng; + yylval.val.buf = strdup(setkeyyytext); if (!yylval.val.buf) yyfatal("insufficient memory"); return(STRING); @@ -1877,10 +1908,10 @@ YY_RULE_SETUP YY_BREAK case 88: YY_RULE_SETUP -#line 301 "token.l" +#line 301 "../../ipsec-tools/src/setkey/token.l" { - yylval.val.len = yyleng; - yylval.val.buf = strdup(yytext); + yylval.val.len = setkeyyyleng; + yylval.val.buf = strdup(setkeyyytext); if (!yylval.val.buf) yyfatal("insufficient memory"); return(STRING); @@ -1888,7 +1919,7 @@ YY_RULE_SETUP YY_BREAK case 89: YY_RULE_SETUP -#line 309 "token.l" +#line 309 "../../ipsec-tools/src/setkey/token.l" { yyfatal("Syntax error"); /*NOTREACHED*/ @@ -1896,10 +1927,10 @@ YY_RULE_SETUP YY_BREAK case 90: YY_RULE_SETUP -#line 314 "token.l" +#line 314 "../../ipsec-tools/src/setkey/token.l" ECHO; YY_BREAK -#line 1903 "token.c" +#line 1934 "<stdout>" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(S_PL): case YY_STATE_EOF(S_AUTHALG): @@ -1919,15 +1950,15 @@ case YY_STATE_EOF(S_ENCALG): { /* We're scanning a new file or input source. It's * possible that this happened because the user - * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure + * just pointed setkeyyyin at a new source and called + * setkeyyylex(). If so, then we have to assure * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = setkeyyyin; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } @@ -1980,11 +2011,11 @@ case YY_STATE_EOF(S_ENCALG): { (yy_did_buffer_switch_on_eof) = 0; - if ( yywrap( ) ) + if ( setkeyyywrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up - * yytext, we can now set up + * setkeyyytext, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the @@ -2033,7 +2064,7 @@ case YY_STATE_EOF(S_ENCALG): "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ -} /* end of yylex */ +} /* end of setkeyyylex */ /* yy_get_next_buffer - try to read in a new buffer * @@ -2044,9 +2075,9 @@ case YY_STATE_EOF(S_ENCALG): */ static int yy_get_next_buffer (void) { - register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - register char *source = (yytext_ptr); - register int number_to_move, i; + char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + char *source = (yytext_ptr); + int number_to_move, i; int ret_val; if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) @@ -2111,7 +2142,7 @@ static int yy_get_next_buffer (void) b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ - yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); + setkeyyyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); } else /* Can't grow it, we don't own it. */ @@ -2143,7 +2174,7 @@ static int yy_get_next_buffer (void) if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; - yyrestart(yyin ); + setkeyyyrestart(setkeyyyin ); } else @@ -2160,7 +2191,7 @@ static int yy_get_next_buffer (void) if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) setkeyyyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); } @@ -2178,14 +2209,14 @@ static int yy_get_next_buffer (void) static yy_state_type yy_get_previous_state (void) { - register yy_state_type yy_current_state; - register char *yy_cp; + yy_state_type yy_current_state; + char *yy_cp; yy_current_state = (yy_start); for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; @@ -2210,10 +2241,10 @@ static int yy_get_next_buffer (void) */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) { - register int yy_is_jam; - register char *yy_cp = (yy_c_buf_p); + int yy_is_jam; + char *yy_cp = (yy_c_buf_p); - register YY_CHAR yy_c = 1; + YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; @@ -2272,13 +2303,13 @@ static int yy_get_next_buffer (void) */ /* Reset buffer status. */ - yyrestart(yyin ); + setkeyyyrestart(setkeyyyin ); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { - if ( yywrap( ) ) + if ( setkeyyywrap( ) ) return EOF; if ( ! (yy_did_buffer_switch_on_eof) ) @@ -2298,7 +2329,7 @@ static int yy_get_next_buffer (void) } c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ - *(yy_c_buf_p) = '\0'; /* preserve yytext */ + *(yy_c_buf_p) = '\0'; /* preserve setkeyyytext */ (yy_hold_char) = *++(yy_c_buf_p); return c; @@ -2310,32 +2341,32 @@ static int yy_get_next_buffer (void) * * @note This function does not reset the start condition to @c INITIAL . */ - void yyrestart (FILE * input_file ) + void setkeyyyrestart (FILE * input_file ) { if ( ! YY_CURRENT_BUFFER ){ - yyensure_buffer_stack (); + setkeyyyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer(yyin,YY_BUF_SIZE ); + setkeyyy_create_buffer(setkeyyyin,YY_BUF_SIZE ); } - yy_init_buffer(YY_CURRENT_BUFFER,input_file ); - yy_load_buffer_state( ); + setkeyyy_init_buffer(YY_CURRENT_BUFFER,input_file ); + setkeyyy_load_buffer_state( ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * */ - void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) + void setkeyyy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) { /* TODO. We should be able to replace this entire function body * with - * yypop_buffer_state(); - * yypush_buffer_state(new_buffer); + * setkeyyypop_buffer_state(); + * setkeyyypush_buffer_state(new_buffer); */ - yyensure_buffer_stack (); + setkeyyyensure_buffer_stack (); if ( YY_CURRENT_BUFFER == new_buffer ) return; @@ -2348,21 +2379,21 @@ static int yy_get_next_buffer (void) } YY_CURRENT_BUFFER_LVALUE = new_buffer; - yy_load_buffer_state( ); + setkeyyy_load_buffer_state( ); /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe + * EOF (setkeyyywrap()) processing, but the only time this flag + * is looked at is after setkeyyywrap() is called, so it's safe * to go ahead and always set it. */ (yy_did_buffer_switch_on_eof) = 1; } -static void yy_load_buffer_state (void) +static void setkeyyy_load_buffer_state (void) { (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; - yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + setkeyyyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; (yy_hold_char) = *(yy_c_buf_p); } @@ -2372,35 +2403,35 @@ static void yy_load_buffer_state (void) * * @return the allocated buffer state. */ - YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) + YY_BUFFER_STATE setkeyyy_create_buffer (FILE * file, int size ) { YY_BUFFER_STATE b; - b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); + b = (YY_BUFFER_STATE) setkeyyyalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in setkeyyy_create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ - b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); + b->yy_ch_buf = (char *) setkeyyyalloc(b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in setkeyyy_create_buffer()" ); b->yy_is_our_buffer = 1; - yy_init_buffer(b,file ); + setkeyyy_init_buffer(b,file ); return b; } /** Destroy the buffer. - * @param b a buffer created with yy_create_buffer() + * @param b a buffer created with setkeyyy_create_buffer() * */ - void yy_delete_buffer (YY_BUFFER_STATE b ) + void setkeyyy_delete_buffer (YY_BUFFER_STATE b ) { if ( ! b ) @@ -2410,27 +2441,27 @@ static void yy_load_buffer_state (void) YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) - yyfree((void *) b->yy_ch_buf ); + setkeyyyfree((void *) b->yy_ch_buf ); - yyfree((void *) b ); + setkeyyyfree((void *) b ); } /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, - * such as during a yyrestart() or at EOF. + * such as during a setkeyyyrestart() or at EOF. */ - static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) + static void setkeyyy_init_buffer (YY_BUFFER_STATE b, FILE * file ) { int oerrno = errno; - yy_flush_buffer(b ); + setkeyyy_flush_buffer(b ); b->yy_input_file = file; b->yy_fill_buffer = 1; - /* If b is the current buffer, then yy_init_buffer was _probably_ - * called from yyrestart() or through yy_get_next_buffer. + /* If b is the current buffer, then setkeyyy_init_buffer was _probably_ + * called from setkeyyyrestart() or through yy_get_next_buffer. * In that case, we don't want to reset the lineno or column. */ if (b != YY_CURRENT_BUFFER){ @@ -2447,7 +2478,7 @@ static void yy_load_buffer_state (void) * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. * */ - void yy_flush_buffer (YY_BUFFER_STATE b ) + void setkeyyy_flush_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; @@ -2467,7 +2498,7 @@ static void yy_load_buffer_state (void) b->yy_buffer_status = YY_BUFFER_NEW; if ( b == YY_CURRENT_BUFFER ) - yy_load_buffer_state( ); + setkeyyy_load_buffer_state( ); } /** Pushes the new state onto the stack. The new state becomes @@ -2476,14 +2507,14 @@ static void yy_load_buffer_state (void) * @param new_buffer The new state. * */ -void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) +void setkeyyypush_buffer_state (YY_BUFFER_STATE new_buffer ) { if (new_buffer == NULL) return; - yyensure_buffer_stack(); + setkeyyyensure_buffer_stack(); - /* This block is copied from yy_switch_to_buffer. */ + /* This block is copied from setkeyyy_switch_to_buffer. */ if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ @@ -2497,8 +2528,8 @@ void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) (yy_buffer_stack_top)++; YY_CURRENT_BUFFER_LVALUE = new_buffer; - /* copied from yy_switch_to_buffer. */ - yy_load_buffer_state( ); + /* copied from setkeyyy_switch_to_buffer. */ + setkeyyy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } @@ -2506,18 +2537,18 @@ void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) * The next element becomes the new top. * */ -void yypop_buffer_state (void) +void setkeyyypop_buffer_state (void) { if (!YY_CURRENT_BUFFER) return; - yy_delete_buffer(YY_CURRENT_BUFFER ); + setkeyyy_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; if ((yy_buffer_stack_top) > 0) --(yy_buffer_stack_top); if (YY_CURRENT_BUFFER) { - yy_load_buffer_state( ); + setkeyyy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } } @@ -2525,7 +2556,7 @@ void yypop_buffer_state (void) /* Allocates the stack if it does not exist. * Guarantees space for at least one push. */ -static void yyensure_buffer_stack (void) +static void setkeyyyensure_buffer_stack (void) { yy_size_t num_to_alloc; @@ -2536,11 +2567,11 @@ static void yyensure_buffer_stack (void) * immediate realloc on the next call. */ num_to_alloc = 1; - (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc + (yy_buffer_stack) = (struct yy_buffer_state**)setkeyyyalloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + YY_FATAL_ERROR( "out of dynamic memory in setkeyyyensure_buffer_stack()" ); memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); @@ -2555,12 +2586,12 @@ static void yyensure_buffer_stack (void) int grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; - (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc + (yy_buffer_stack) = (struct yy_buffer_state**)setkeyyyrealloc ((yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + YY_FATAL_ERROR( "out of dynamic memory in setkeyyyensure_buffer_stack()" ); /* zero only the new slots.*/ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); @@ -2574,7 +2605,7 @@ static void yyensure_buffer_stack (void) * * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) +YY_BUFFER_STATE setkeyyy_scan_buffer (char * base, yy_size_t size ) { YY_BUFFER_STATE b; @@ -2584,9 +2615,9 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) /* They forgot to leave room for the EOB's. */ return 0; - b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); + b = (YY_BUFFER_STATE) setkeyyyalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in setkeyyy_scan_buffer()" ); b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; @@ -2598,53 +2629,53 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; - yy_switch_to_buffer(b ); + setkeyyy_switch_to_buffer(b ); return b; } -/** Setup the input buffer state to scan a string. The next call to yylex() will +/** Setup the input buffer state to scan a string. The next call to setkeyyylex() will * scan from a @e copy of @a str. * @param yystr a NUL-terminated string to scan * * @return the newly allocated buffer state object. * @note If you want to scan bytes that may contain NUL values, then use - * yy_scan_bytes() instead. + * setkeyyy_scan_bytes() instead. */ -YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) +YY_BUFFER_STATE setkeyyy_scan_string (yyconst char * yystr ) { - return yy_scan_bytes(yystr,strlen(yystr) ); + return setkeyyy_scan_bytes(yystr,strlen(yystr) ); } -/** Setup the input buffer state to scan the given bytes. The next call to yylex() will +/** Setup the input buffer state to scan the given bytes. The next call to setkeyyylex() will * scan from a @e copy of @a bytes. * @param yybytes the byte buffer to scan * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) +YY_BUFFER_STATE setkeyyy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) { YY_BUFFER_STATE b; char *buf; yy_size_t n; - int i; + yy_size_t i; /* Get memory for full buffer, including space for trailing EOB's. */ n = _yybytes_len + 2; - buf = (char *) yyalloc(n ); + buf = (char *) setkeyyyalloc(n ); if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + YY_FATAL_ERROR( "out of dynamic memory in setkeyyy_scan_bytes()" ); for ( i = 0; i < _yybytes_len; ++i ) buf[i] = yybytes[i]; buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - b = yy_scan_buffer(buf,n ); + b = setkeyyy_scan_buffer(buf,n ); if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + YY_FATAL_ERROR( "bad buffer in setkeyyy_scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. @@ -2670,14 +2701,14 @@ static void yy_fatal_error (yyconst char* msg ) #define yyless(n) \ do \ { \ - /* Undo effects of setting up yytext. */ \ + /* Undo effects of setting up setkeyyytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ - yytext[yyleng] = (yy_hold_char); \ - (yy_c_buf_p) = yytext + yyless_macro_arg; \ + setkeyyytext[setkeyyyleng] = (yy_hold_char); \ + (yy_c_buf_p) = setkeyyytext + yyless_macro_arg; \ (yy_hold_char) = *(yy_c_buf_p); \ *(yy_c_buf_p) = '\0'; \ - yyleng = yyless_macro_arg; \ + setkeyyyleng = yyless_macro_arg; \ } \ while ( 0 ) @@ -2686,85 +2717,85 @@ static void yy_fatal_error (yyconst char* msg ) /** Get the current line number. * */ -int yyget_lineno (void) +int setkeyyyget_lineno (void) { - return yylineno; + return setkeyyylineno; } /** Get the input stream. * */ -FILE *yyget_in (void) +FILE *setkeyyyget_in (void) { - return yyin; + return setkeyyyin; } /** Get the output stream. * */ -FILE *yyget_out (void) +FILE *setkeyyyget_out (void) { - return yyout; + return setkeyyyout; } /** Get the length of the current token. * */ -yy_size_t yyget_leng (void) +yy_size_t setkeyyyget_leng (void) { - return yyleng; + return setkeyyyleng; } /** Get the current token. * */ -char *yyget_text (void) +char *setkeyyyget_text (void) { - return yytext; + return setkeyyytext; } /** Set the current line number. * @param line_number * */ -void yyset_lineno (int line_number ) +void setkeyyyset_lineno (int line_number ) { - yylineno = line_number; + setkeyyylineno = line_number; } /** Set the input stream. This does not discard the current * input buffer. * @param in_str A readable stream. * - * @see yy_switch_to_buffer + * @see setkeyyy_switch_to_buffer */ -void yyset_in (FILE * in_str ) +void setkeyyyset_in (FILE * in_str ) { - yyin = in_str ; + setkeyyyin = in_str ; } -void yyset_out (FILE * out_str ) +void setkeyyyset_out (FILE * out_str ) { - yyout = out_str ; + setkeyyyout = out_str ; } -int yyget_debug (void) +int setkeyyyget_debug (void) { - return yy_flex_debug; + return setkeyyy_flex_debug; } -void yyset_debug (int bdebug ) +void setkeyyyset_debug (int bdebug ) { - yy_flex_debug = bdebug ; + setkeyyy_flex_debug = bdebug ; } static int yy_init_globals (void) { /* Initialization is the same as for the non-reentrant scanner. - * This function is called from yylex_destroy(), so don't allocate here. + * This function is called from setkeyyylex_destroy(), so don't allocate here. */ (yy_buffer_stack) = 0; @@ -2776,36 +2807,36 @@ static int yy_init_globals (void) /* Defined in main.c */ #ifdef YY_STDINIT - yyin = stdin; - yyout = stdout; + setkeyyyin = stdin; + setkeyyyout = stdout; #else - yyin = (FILE *) 0; - yyout = (FILE *) 0; + setkeyyyin = (FILE *) 0; + setkeyyyout = (FILE *) 0; #endif /* For future reference: Set errno on error, since we are called by - * yylex_init() + * setkeyyylex_init() */ return 0; } -/* yylex_destroy is for both reentrant and non-reentrant scanners. */ -int yylex_destroy (void) +/* setkeyyylex_destroy is for both reentrant and non-reentrant scanners. */ +int setkeyyylex_destroy (void) { /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ - yy_delete_buffer(YY_CURRENT_BUFFER ); + setkeyyy_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; - yypop_buffer_state(); + setkeyyypop_buffer_state(); } /* Destroy the stack itself. */ - yyfree((yy_buffer_stack) ); + setkeyyyfree((yy_buffer_stack) ); (yy_buffer_stack) = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time - * yylex() is called, initialization will occur. */ + * setkeyyylex() is called, initialization will occur. */ yy_init_globals( ); return 0; @@ -2818,7 +2849,7 @@ int yylex_destroy (void) #ifndef yytext_ptr static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) { - register int i; + int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } @@ -2827,7 +2858,7 @@ static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * s ) { - register int n; + int n; for ( n = 0; s[n]; ++n ) ; @@ -2835,12 +2866,12 @@ static int yy_flex_strlen (yyconst char * s ) } #endif -void *yyalloc (yy_size_t size ) +void *setkeyyyalloc (yy_size_t size ) { return (void *) malloc( size ); } -void *yyrealloc (void * ptr, yy_size_t size ) +void *setkeyyyrealloc (void * ptr, yy_size_t size ) { /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those @@ -2852,14 +2883,14 @@ void *yyrealloc (void * ptr, yy_size_t size ) return (void *) realloc( (char *) ptr, size ); } -void yyfree (void * ptr ) +void setkeyyyfree (void * ptr ) { - free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ + free( (char *) ptr ); /* see setkeyyyrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" -#line 314 "token.l" +#line 314 "../../ipsec-tools/src/setkey/token.l" @@ -2875,14 +2906,14 @@ void yyerror(s) const char *s; { - printf("line %d: %s at [%s]\n", lineno, s, yytext); + printf("line %d: %s at [%s]\n", lineno, s, setkeyyytext); } int parse(fp) FILE **fp; { - yyin = *fp; + setkeyyyin = *fp; lineno = 1; parse_init(); @@ -2901,9 +2932,9 @@ parse_string (char *src) int result; YY_BUFFER_STATE buf_state; - buf_state = yy_scan_string(src); + buf_state = setkeyyy_scan_string(src); result = yyparse(); - yy_delete_buffer(buf_state); + setkeyyy_delete_buffer(buf_state); return result; } diff --git a/ipsec-tools/src/setkey/token_wrapper.c b/ipsec-tools/src/setkey/token_wrapper.c new file mode 100644 index 00000000..92c7c5f1 --- /dev/null +++ b/ipsec-tools/src/setkey/token_wrapper.c @@ -0,0 +1,12 @@ +#include <machine/rtems-bsd-user-space.h> +#include <machine/rtems-bsd-program.h> +#include "rtems-bsd-setkey-namespace.h" +#define yylval setkeyyylval +#define yyparse setkeyyyparse +static int +setkeyyywrap(void) +{ + return 1; +} +#include "token.c" +#include "rtems-bsd-setkey-token_wrapper-data.h" |