Module Name:    src
Committed By:   ozaki-r
Date:           Wed Jul  5 01:22:40 UTC 2017

Modified Files:
        src/crypto/dist/ipsec-tools/src/setkey: parse.y token.l

Log Message:
Add update command for testing

Updating an SA (SADB_UPDATE) requires that a process issuing
SADB_UPDATE is the same as a process issued SADB_ADD (or SADB_GETSPI).
This means that update command must be used with add command in a
configuration of setkey. This usage is normally meaningless but
useful for testing (and debugging) purposes.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/crypto/dist/ipsec-tools/src/setkey/parse.y
cvs rdiff -u -r1.19 -r1.20 src/crypto/dist/ipsec-tools/src/setkey/token.l

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/crypto/dist/ipsec-tools/src/setkey/parse.y
diff -u src/crypto/dist/ipsec-tools/src/setkey/parse.y:1.18 src/crypto/dist/ipsec-tools/src/setkey/parse.y:1.19
--- src/crypto/dist/ipsec-tools/src/setkey/parse.y:1.18	Thu Apr 13 01:19:17 2017
+++ src/crypto/dist/ipsec-tools/src/setkey/parse.y	Wed Jul  5 01:22:40 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.y,v 1.18 2017/04/13 01:19:17 ozaki-r Exp $	*/
+/*	$NetBSD: parse.y,v 1.19 2017/07/05 01:22:40 ozaki-r Exp $	*/
 
 /*	$KAME: parse.y,v 1.81 2003/07/01 04:01:48 itojun Exp $	*/
 
@@ -115,7 +115,7 @@ static int setkeymsg_add __P((unsigned i
 }
 
 %token EOT SLASH BLCL ELCL
-%token ADD GET DELETE DELETEALL FLUSH DUMP EXIT
+%token ADD UPDATE GET DELETE DELETEALL FLUSH DUMP EXIT
 %token PR_ESP PR_AH PR_IPCOMP PR_ESPUDP PR_TCP
 %token F_PROTOCOL F_AUTH F_ENC F_REPLAY F_COMP F_RAWCPI
 %token F_MODE MODE F_REQID
@@ -160,6 +160,7 @@ commands
 
 command
 	:	add_command
+	|	update_command
 	|	get_command
 	|	delete_command
 	|	deleteall_command
@@ -186,6 +187,18 @@ add_command
 		}
 	;
 
+	/* update */
+update_command
+	:	UPDATE ipaddropts ipandport ipandport protocol_spec spi extension_spec algorithm_spec EOT
+		{
+			int status;
+
+			status = setkeymsg_add(SADB_UPDATE, $5, $3, $4);
+			if (status < 0)
+				return -1;
+		}
+	;
+
 	/* delete */
 delete_command
 	:	DELETE ipaddropts ipandport ipandport protocol_spec spi extension_spec EOT

Index: src/crypto/dist/ipsec-tools/src/setkey/token.l
diff -u src/crypto/dist/ipsec-tools/src/setkey/token.l:1.19 src/crypto/dist/ipsec-tools/src/setkey/token.l:1.20
--- src/crypto/dist/ipsec-tools/src/setkey/token.l:1.19	Wed Sep 10 21:01:33 2014
+++ src/crypto/dist/ipsec-tools/src/setkey/token.l	Wed Jul  5 01:22:40 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: token.l,v 1.19 2014/09/10 21:01:33 christos Exp $	*/
+/*	$NetBSD: token.l,v 1.20 2017/07/05 01:22:40 ozaki-r Exp $	*/
 
 /*	$KAME: token.l,v 1.44 2003/10/21 07:20:58 itojun Exp $	*/
 
@@ -116,6 +116,7 @@ hostname	{name}(({dot}{name})+{dot}?)?
 
 
 add		{ return(ADD); }
+update		{ return(UPDATE); }
 delete		{ return(DELETE); }
 deleteall	{ return(DELETEALL); }
 get		{ return(GET); }

Reply via email to