From: Martin Willi Date: Thu, 19 Feb 2015 17:03:08 +0000 (+0100) Subject: child-sa: Sort traffic selectors after adding CHILD_SA policies X-Git-Tag: 5.3.0dr1~81^2~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5499473c332c7369496f48c28be4fd15703dad7b;p=thirdparty%2Fstrongswan.git child-sa: Sort traffic selectors after adding CHILD_SA policies Having traffic selectors sorted properly makes comparing them much simpler. --- diff --git a/src/libcharon/sa/child_sa.c b/src/libcharon/sa/child_sa.c index 6f5e046c56..2028aba734 100644 --- a/src/libcharon/sa/child_sa.c +++ b/src/libcharon/sa/child_sa.c @@ -799,12 +799,15 @@ METHOD(child_sa_t, add_policies, status_t, array_insert(this->my_ts, ARRAY_TAIL, my_ts->clone(my_ts)); } enumerator->destroy(enumerator); + array_sort(this->my_ts, (void*)traffic_selector_cmp, NULL); + enumerator = other_ts_list->create_enumerator(other_ts_list); while (enumerator->enumerate(enumerator, &other_ts)) { array_insert(this->other_ts, ARRAY_TAIL, other_ts->clone(other_ts)); } enumerator->destroy(enumerator); + array_sort(this->other_ts, (void*)traffic_selector_cmp, NULL); if (this->config->install_policy(this->config)) {