Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/crypto/dist/ipsec-tools/src/setkey Add update command for te...



details:   https://anonhg.NetBSD.org/src/rev/8acc3ff90036
branches:  trunk
changeset: 354935:8acc3ff90036
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Wed Jul 05 01:22:40 2017 +0000

description:
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.

diffstat:

 crypto/dist/ipsec-tools/src/setkey/parse.y |  17 +++++++++++++++--
 crypto/dist/ipsec-tools/src/setkey/token.l |   3 ++-
 2 files changed, 17 insertions(+), 3 deletions(-)

diffs (62 lines):

diff -r a2e1ed841e68 -r 8acc3ff90036 crypto/dist/ipsec-tools/src/setkey/parse.y
--- a/crypto/dist/ipsec-tools/src/setkey/parse.y        Wed Jul 05 01:09:17 2017 +0000
+++ b/crypto/dist/ipsec-tools/src/setkey/parse.y        Wed Jul 05 01:22:40 2017 +0000
@@ -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 @@
 }
 
 %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 @@
 
 command
        :       add_command
+       |       update_command
        |       get_command
        |       delete_command
        |       deleteall_command
@@ -186,6 +187,18 @@
                }
        ;
 
+       /* 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
diff -r a2e1ed841e68 -r 8acc3ff90036 crypto/dist/ipsec-tools/src/setkey/token.l
--- a/crypto/dist/ipsec-tools/src/setkey/token.l        Wed Jul 05 01:09:17 2017 +0000
+++ b/crypto/dist/ipsec-tools/src/setkey/token.l        Wed Jul 05 01:22:40 2017 +0000
@@ -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 @@
 
 
 add            { return(ADD); }
+update         { return(UPDATE); }
 delete         { return(DELETE); }
 deleteall      { return(DELETEALL); }
 get            { return(GET); }



Home | Main Index | Thread Index | Old Index