child-sa: Sort traffic selectors after adding CHILD_SA policies

Having traffic selectors sorted properly makes comparing them much simpler.
This commit is contained in:
Martin Willi
2015-02-20 13:34:48 +01:00
parent fc978f192f
commit 5499473c33
+3
View File
@@ -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))
{