Added a stroke rekey command to trigger IKE/CHILD_SA rekeying manually

This commit is contained in:
Martin Willi
2010-11-03 15:12:05 +01:00
parent 49a9028201
commit 851d60484e
7 changed files with 150 additions and 28 deletions
+17
View File
@@ -197,6 +197,16 @@ static int terminate_connection_srcip(char *start, char *end)
return send_stroke_msg(&msg);
}
static int rekey_connection(char *name)
{
stroke_msg_t msg;
msg.type = STR_REKEY;
msg.length = offsetof(stroke_msg_t, buffer);
msg.rekey.name = push_string(&msg, name);
return send_stroke_msg(&msg);
}
static int route_connection(char *name)
{
stroke_msg_t msg;
@@ -443,6 +453,13 @@ int main(int argc, char *argv[])
}
res = terminate_connection_srcip(argv[2], argc > 3 ? argv[3] : NULL);
break;
case STROKE_REKEY:
if (argc < 3)
{
exit_usage("\"rekey\" needs a connection name");
}
res = rekey_connection(argv[2]);
break;
case STROKE_ROUTE:
if (argc < 3)
{
+1
View File
@@ -25,6 +25,7 @@ typedef enum {
STROKE_UP,
STROKE_DOWN,
STROKE_DOWN_SRCIP,
STROKE_REKEY,
STROKE_LOGLEVEL,
STROKE_STATUS,
STROKE_STATUSALL,
+1
View File
@@ -32,6 +32,7 @@ unroute, STROKE_UNROUTE
up, STROKE_UP
down, STROKE_DOWN
down-srcip, STROKE_DOWN_SRCIP
rekey, STROKE_REKEY
loglevel, STROKE_LOGLEVEL
status, STROKE_STATUS
statusall, STROKE_STATUSALL
+3 -1
View File
@@ -183,6 +183,8 @@ struct stroke_msg_t {
STR_TERMINATE,
/* terminate connection by peers srcip/virtual ip */
STR_TERMINATE_SRCIP,
/* rekey a connection */
STR_REKEY,
/* show connection status */
STR_STATUS,
/* show verbose connection status */
@@ -215,7 +217,7 @@ struct stroke_msg_t {
/* data for STR_INITIATE, STR_ROUTE, STR_UP, STR_DOWN, ... */
struct {
char *name;
} initiate, route, unroute, terminate, status, del_conn, del_ca;
} initiate, route, unroute, terminate, rekey, status, del_conn, del_ca;
/* data for STR_TERMINATE_SRCIP */
struct {