aboutsummaryrefslogtreecommitdiffstats
path: root/src/stroke
diff options
context:
space:
mode:
authorMartin Willi <martin@strongswan.org>2006-05-29 11:09:45 +0000
committerMartin Willi <martin@strongswan.org>2006-05-29 11:09:45 +0000
commit9fe14f4b8a3ae487134854eb8ebdfcb49cea4027 (patch)
treeefc4aa1a147e18e3b24b53e0d917e12e0b9a5cde /src/stroke
parent4c59264d9b73d8eb2b29189cacd9ff3b60e2ec13 (diff)
downloadstrongswan-9fe14f4b8a3ae487134854eb8ebdfcb49cea4027.tar.bz2
strongswan-9fe14f4b8a3ae487134854eb8ebdfcb49cea4027.tar.xz
- policies contain a connections name now
- used for initiate and delete - connections won't get initiated twice anymore - deleting of connections is now possible, which allows us to use ipsec update and ipsec reload
Diffstat (limited to 'src/stroke')
-rw-r--r--src/stroke/stroke.c21
-rw-r--r--src/stroke/stroke.h4
2 files changed, 23 insertions, 2 deletions
diff --git a/src/stroke/stroke.c b/src/stroke/stroke.c
index d104f8dd6..9bcc39ad4 100644
--- a/src/stroke/stroke.c
+++ b/src/stroke/stroke.c
@@ -116,6 +116,16 @@ static int add_connection(char *name,
return send_stroke_msg(&msg);
}
+static int del_connection(char *name)
+{
+ stroke_msg_t msg;
+
+ msg.length = offsetof(stroke_msg_t, buffer);
+ msg.type = STR_DEL_CONN;
+ msg.initiate.name = push_string(&msg, name);
+ return send_stroke_msg(&msg);
+}
+
static int initiate_connection(char *name)
{
stroke_msg_t msg;
@@ -201,6 +211,9 @@ static void exit_usage(char *error)
printf(" ADDR is a IPv4 address\n");
printf(" NET is a IPv4 address of the subnet to tunnel\n");
printf(" NETBITS is the size of the subnet, as the \"24\" in 192.168.0.0/24\n");
+ printf(" Delete a connection:\n");
+ printf(" stroke delete NAME\n");
+ printf(" where: NAME is a connection name added with \"stroke add\"\n");
printf(" Initiate a connection:\n");
printf(" stroke up NAME\n");
printf(" where: NAME is a connection name added with \"stroke add\"\n");
@@ -273,6 +286,14 @@ int main(int argc, char *argv[])
argv[7], argv[8],
atoi(argv[9]), atoi(argv[10]));
}
+ else if (streq(op, "delete"))
+ {
+ if (argc < 3)
+ {
+ exit_usage("\"delete\" needs a connection name");
+ }
+ res = del_connection(argv[2]);
+ }
else if (streq(op, "logtype"))
{
if (argc < 5)
diff --git a/src/stroke/stroke.h b/src/stroke/stroke.h
index f860b3690..a5e26af4a 100644
--- a/src/stroke/stroke.h
+++ b/src/stroke/stroke.h
@@ -65,10 +65,10 @@ struct stroke_msg_t {
} type;
union {
- /* data for STR_INITIATE, STR_INSTALL, STR_UP, STR_DOWN */
+ /* data for STR_INITIATE, STR_INSTALL, STR_UP, STR_DOWN, ... */
struct {
char *name;
- } initiate, install, terminate, status;
+ } initiate, install, terminate, status, del_conn;
/* data for STR_ADD_CONN */
struct {