From 791fde166998fa1f48c837576ec155e38bcdd1be Mon Sep 17 00:00:00 2001 From: Martin Willi Date: Mon, 9 Sep 2013 10:43:44 +0200 Subject: [PATCH] stroke: don't remove a matching peer config if used by other child configs When configurations get merged during add, we should not remove peer configs if other connection entries use the same peer config. --- src/libcharon/plugins/stroke/stroke_config.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/libcharon/plugins/stroke/stroke_config.c b/src/libcharon/plugins/stroke/stroke_config.c index c069d5083..edfa8a9c3 100644 --- a/src/libcharon/plugins/stroke/stroke_config.c +++ b/src/libcharon/plugins/stroke/stroke_config.c @@ -1235,7 +1235,7 @@ METHOD(stroke_config_t, del, void, this->mutex->lock(this->mutex); enumerator = this->list->create_enumerator(this->list); - while (enumerator->enumerate(enumerator, (void**)&peer)) + while (enumerator->enumerate(enumerator, &peer)) { bool keep = FALSE; @@ -1256,12 +1256,11 @@ METHOD(stroke_config_t, del, void, } children->destroy(children); - /* if peer config matches, or has no children anymore, remove it */ - if (!keep || streq(peer->get_name(peer), msg->del_conn.name)) + /* if peer config has no children anymore, remove it */ + if (!keep) { this->list->remove_at(this->list, enumerator); peer->destroy(peer); - deleted = TRUE; } } enumerator->destroy(enumerator);