summaryrefslogtreecommitdiffstats
path: root/usr.sbin/setkey/token.l
diff options
context:
space:
mode:
authoritojun <itojun@FreeBSD.org>2000-07-04 16:22:05 +0000
committeritojun <itojun@FreeBSD.org>2000-07-04 16:22:05 +0000
commit0bbd943f404b5100a81abdec2bd8519971e0c58e (patch)
treeb98b84ed27cb35ed58163ab9530a39ecc47f3254 /usr.sbin/setkey/token.l
parent993cb1d94fc91849b548394143e230fa61400d5b (diff)
downloadFreeBSD-src-0bbd943f404b5100a81abdec2bd8519971e0c58e.zip
FreeBSD-src-0bbd943f404b5100a81abdec2bd8519971e0c58e.tar.gz
synchronize with latest kame tree.
behavior change: policy syntax was changed. you may need to update your setkey(8) configuration files.
Diffstat (limited to 'usr.sbin/setkey/token.l')
-rw-r--r--usr.sbin/setkey/token.l81
1 files changed, 37 insertions, 44 deletions
diff --git a/usr.sbin/setkey/token.l b/usr.sbin/setkey/token.l
index 0154bee..8916fdd 100644
--- a/usr.sbin/setkey/token.l
+++ b/usr.sbin/setkey/token.l
@@ -1,7 +1,10 @@
+/* $FreeBSD$ */
+/* $KAME: token.l,v 1.13 2000/06/07 00:29:14 itojun Exp $ */
+
/*
* Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -13,7 +16,7 @@
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -25,8 +28,6 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $FreeBSD$
*/
%{
@@ -63,18 +64,19 @@
#define PREPROC DECHO CMDARG
-int lineno = 1;
-char cmdarg[8192]; /* XXX: BUFSIZ is the better ? */
+int lineno = 1;
+char cmdarg[8192]; /* XXX: BUFSIZ is the better ? */
-extern u_char m_buf[BUFSIZ];
-extern u_int m_len;
-extern int f_debug;
+extern u_char m_buf[BUFSIZ];
+extern u_int m_len;
+extern int f_debug;
-int yylex __P((void));
-void yyerror __P((char *s));
-extern void parse_init __P((void));
-int parse __P((FILE **));
-int yyparse __P((void));
+int yylex __P((void));
+void yyfatal __P((const char *s));
+void yyerror __P((const char *s));
+extern void parse_init __P((void));
+int parse __P((FILE **));
+int yyparse __P((void));
%}
@@ -106,9 +108,7 @@ decstring {digit}+
hexpair {hexdigit}{hexdigit}
hexstring 0[xX]{hexdigit}+
octetstring {octet}({dot}{octet})+
-ipaddress {ipv4addr}|{ipv6addr}
-ipv4addr {digit}{1,3}({dot}{digit}{1,3}){0,3}
-ipv6addr {hexdigit}{0,4}({colon}{hexdigit}{0,4}){2,7}(%{letter}{letter}+)?
+ipaddress [a-fA-F0-9:]([a-fA-F0-9:\.]*|[a-fA-F0-9:\.]*%[a-zA-Z0-9]*)
ipaddrmask {slash}{digit}{1,3}
ipaddrport {blcl}{decstring}{elcl}
keyword {letter}{letter}+
@@ -186,11 +186,12 @@ lzs { PREPROC; yylval.num = SADB_X_CALG_LZS; return(ALG_COMP); }
{hyphen}m { PREPROC; return(F_MODE); }
transport { PREPROC; yylval.num = IPSEC_MODE_TRANSPORT; return(MODE); }
tunnel { PREPROC; yylval.num = IPSEC_MODE_TUNNEL; return(MODE); }
+{hyphen}u { PREPROC; return(F_REQID); }
{hyphen}f { PREPROC; return(F_EXT); }
random-pad { PREPROC; yylval.num = SADB_X_EXT_PRAND; return(EXTENSION); }
seq-pad { PREPROC; yylval.num = SADB_X_EXT_PSEQ; return(EXTENSION); }
zero-pad { PREPROC; yylval.num = SADB_X_EXT_PZERO; return(EXTENSION); }
-cyclic-seq { PREPROC; yylval.num = SADB_X_EXT_CYCSEQ; return(EXTENSION); }
+nocyclic-seq { PREPROC; return(NOCYCLICSEQ); }
{hyphen}r { PREPROC; return(F_REPLAY); }
{hyphen}lh { PREPROC; return(F_LIFETIME_HARD); }
{hyphen}ls { PREPROC; return(F_LIFETIME_SOFT); }
@@ -214,35 +215,17 @@ any { PREPROC; return(ANY); }
char *bp;
PREPROC;
- yylval.num = strtol(yytext, &bp, 10);
+ yylval.num = strtoul(yytext, &bp, 10);
return(DECSTRING);
}
-{ipv4addr} {
- /*
- * I can't supprt the type without dot,
- * because it's umbiguous against {decstring}.
- * e.g. 127
- */
+{ipaddress} {
PREPROC;
- yylval.val.len = sizeof(struct sockaddr_in);
+ yylval.val.len = yyleng;
yylval.val.buf = strdup(yytext);
- return(IP4_ADDRESS);
- }
-
-{ipv6addr} {
-#ifdef INET6
- PREPROC;
-
- yylval.val.len = sizeof(struct sockaddr_in6);
- yylval.val.buf = strdup(yytext);
-
- return(IP6_ADDRESS);
-#else
- yyerror("IPv6 address not supported");
-#endif
+ return(ADDRESS);
}
{ipaddrmask} {
@@ -263,7 +246,6 @@ any { PREPROC; return(ANY); }
}
{blcl}any{elcl} {
- char *p = yytext;
PREPROC;
return(PORTANY);
}
@@ -294,12 +276,24 @@ any { PREPROC; return(ANY); }
return(QUOTEDSTRING);
}
-. { yyerror("Syntax error"); }
+. {
+ yyfatal("Syntax error");
+ /*NOTREACHED*/
+ }
%%
void
-yyerror(char *s)
+yyfatal(s)
+ const char *s;
+{
+ yyerror(s);
+ exit(1);
+}
+
+void
+yyerror(s)
+ const char *s;
{
printf("line %d: %s at [%s]\n", lineno, s, yytext);
}
@@ -319,4 +313,3 @@ parse(fp)
return(0);
}
-
OpenPOWER on IntegriCloud