aboutsummaryrefslogtreecommitdiffstats
path: root/src/stroke
diff options
context:
space:
mode:
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 {