Starter unroutes removed or changed connections before loading and routing new ones
authorTobias Brunner <tobias@strongswan.org>
Thu, 4 Oct 2012 09:22:44 +0000 (11:22 +0200)
committerTobias Brunner <tobias@strongswan.org>
Thu, 18 Oct 2012 12:42:11 +0000 (14:42 +0200)
src/starter/starter.c
src/starter/starterstroke.c
src/starter/starterstroke.h

index c6efcb2..9ba6120 100644 (file)
@@ -594,6 +594,10 @@ int main (int argc, char **argv)
                                        {
                                                if (starter_charon_pid())
                                                {
+                                                       if (conn->startup == STARTUP_ROUTE)
+                                                       {
+                                                               starter_stroke_unroute_conn(conn);
+                                                       }
                                                        starter_stroke_del_conn(conn);
                                                }
                                                conn->state = STATE_TO_ADD;
@@ -651,6 +655,10 @@ int main (int argc, char **argv)
                                        {
                                                if (starter_charon_pid())
                                                {
+                                                       if (conn->startup == STARTUP_ROUTE)
+                                                       {
+                                                               starter_stroke_unroute_conn(conn);
+                                                       }
                                                        starter_stroke_del_conn(conn);
                                                }
                                        }
index d6ad3eb..9cff78c 100644 (file)
@@ -270,6 +270,16 @@ int starter_stroke_route_conn(starter_conn_t *conn)
        return send_stroke_msg(&msg);
 }
 
+int starter_stroke_unroute_conn(starter_conn_t *conn)
+{
+       stroke_msg_t msg;
+
+       msg.type = STR_UNROUTE;
+       msg.length = offsetof(stroke_msg_t, buffer);
+       msg.route.name = push_string(&msg, connection_name(conn));
+       return send_stroke_msg(&msg);
+}
+
 int starter_stroke_initiate_conn(starter_conn_t *conn)
 {
        stroke_msg_t msg;
index fd2a3e3..1264863 100644 (file)
@@ -21,6 +21,7 @@
 int starter_stroke_add_conn(starter_config_t *cfg, starter_conn_t *conn);
 int starter_stroke_del_conn(starter_conn_t *conn);
 int starter_stroke_route_conn(starter_conn_t *conn);
+int starter_stroke_unroute_conn(starter_conn_t *conn);
 int starter_stroke_initiate_conn(starter_conn_t *conn);
 int starter_stroke_add_ca(starter_ca_t *ca);
 int starter_stroke_del_ca(starter_ca_t *ca);