From: Tobias Brunner Date: Fri, 21 Sep 2012 16:13:42 +0000 (+0200) Subject: Make sure we propose a dynamic TS if we don't have hosts to derive a TS from X-Git-Tag: 5.0.1~79 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6676769e8c686f9eba5f82ef83a9300d97187eec;p=thirdparty%2Fstrongswan.git Make sure we propose a dynamic TS if we don't have hosts to derive a TS from 7ee37114 removed this behavior. --- diff --git a/src/libcharon/config/child_cfg.c b/src/libcharon/config/child_cfg.c index e65f320223..b675c908ff 100644 --- a/src/libcharon/config/child_cfg.c +++ b/src/libcharon/config/child_cfg.c @@ -258,19 +258,17 @@ METHOD(child_cfg_t, get_traffic_selectors, linked_list_t*, /* In a first step, replace "dynamic" TS with the host list */ while (e1->enumerate(e1, &ts1)) { - if (ts1->is_dynamic(ts1)) + if (hosts && hosts->get_count(hosts) && + ts1->is_dynamic(ts1)) { - if (hosts) + e2 = hosts->create_enumerator(hosts); + while (e2->enumerate(e2, &host)) { - e2 = hosts->create_enumerator(hosts); - while (e2->enumerate(e2, &host)) - { - ts2 = ts1->clone(ts1); - ts2->set_address(ts2, host); - result->insert_last(derived, ts2); - } - e2->destroy(e2); + ts2 = ts1->clone(ts1); + ts2->set_address(ts2, host); + derived->insert_last(derived, ts2); } + e2->destroy(e2); } else {