From: Martin Willi Date: Mon, 9 Sep 2013 08:43:44 +0000 (+0200) Subject: stroke: don't remove a matching peer config if used by other child configs X-Git-Tag: 5.1.1dr4~30 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=791fde166998fa1f48c837576ec155e38bcdd1be;p=thirdparty%2Fstrongswan.git 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. --- diff --git a/src/libcharon/plugins/stroke/stroke_config.c b/src/libcharon/plugins/stroke/stroke_config.c index c069d50838..edfa8a9c3f 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);