From 9e730ef9df7a4c24186185967727df052cde0ca9 Mon Sep 17 00:00:00 2001 From: Tobias Brunner Date: Thu, 4 Oct 2012 11:22:44 +0200 Subject: [PATCH] Starter unroutes removed or changed connections before loading and routing new ones --- src/starter/starter.c | 8 ++++++++ src/starter/starterstroke.c | 10 ++++++++++ src/starter/starterstroke.h | 1 + 3 files changed, 19 insertions(+) diff --git a/src/starter/starter.c b/src/starter/starter.c index c6efcb2f4..9ba61205a 100644 --- a/src/starter/starter.c +++ b/src/starter/starter.c @@ -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); } } diff --git a/src/starter/starterstroke.c b/src/starter/starterstroke.c index d6ad3eb89..9cff78c7d 100644 --- a/src/starter/starterstroke.c +++ b/src/starter/starterstroke.c @@ -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; diff --git a/src/starter/starterstroke.h b/src/starter/starterstroke.h index fd2a3e320..126486325 100644 --- a/src/starter/starterstroke.h +++ b/src/starter/starterstroke.h @@ -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);