child-cfg: Ignore duplicate proposals

If ESP proposals are added once with and once without DH groups
duplicates result during IKE_AUTH when DH groups are stripped.
This commit is contained in:
Tobias Brunner
2014-09-12 10:18:14 +02:00
parent 8e52dc2733
commit f92399ef18
+11
View File
@@ -163,6 +163,11 @@ METHOD(child_cfg_t, add_proposal, void,
}
}
static bool match_proposal(proposal_t *item, proposal_t *proposal)
{
return item->equals(item, proposal);
}
METHOD(child_cfg_t, get_proposals, linked_list_t*,
private_child_cfg_t *this, bool strip_dh)
{
@@ -178,6 +183,12 @@ METHOD(child_cfg_t, get_proposals, linked_list_t*,
{
current->strip_dh(current, MODP_NONE);
}
if (proposals->find_first(proposals, (linked_list_match_t)match_proposal,
NULL, current) == SUCCESS)
{
current->destroy(current);
continue;
}
proposals->insert_last(proposals, current);
}
enumerator->destroy(enumerator);