vici-config: Same order for default ESP proposals if unset or set to "default"
The order was different when not setting `esp_proposals` or explicitly
configuring `default`.
Fixes: 33412158f5 ("ike: Send AEAD ESP default proposal first")
This commit is contained in:
@@ -601,6 +601,34 @@ static void free_child_data(child_data_t *data)
|
|||||||
free(data->cfg.interface);
|
free(data->cfg.interface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add the default proposals for the given protocol. We currently prefer AEAD
|
||||||
|
* for ESP but not for IKE.
|
||||||
|
*/
|
||||||
|
static void add_default_proposals(linked_list_t *list, protocol_id_t proto)
|
||||||
|
{
|
||||||
|
proposal_t *first, *second;
|
||||||
|
|
||||||
|
if (proto == PROTO_IKE)
|
||||||
|
{
|
||||||
|
first = proposal_create_default(proto);
|
||||||
|
second = proposal_create_default_aead(proto);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
first = proposal_create_default_aead(proto);
|
||||||
|
second = proposal_create_default(proto);
|
||||||
|
}
|
||||||
|
if (first)
|
||||||
|
{
|
||||||
|
list->insert_last(list, first);
|
||||||
|
}
|
||||||
|
if (second)
|
||||||
|
{
|
||||||
|
list->insert_last(list, second);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Common proposal parsing
|
* Common proposal parsing
|
||||||
*/
|
*/
|
||||||
@@ -615,16 +643,7 @@ static bool parse_proposal(linked_list_t *list, protocol_id_t proto, chunk_t v)
|
|||||||
}
|
}
|
||||||
if (strcaseeq("default", buf))
|
if (strcaseeq("default", buf))
|
||||||
{
|
{
|
||||||
proposal = proposal_create_default(proto);
|
add_default_proposals(list, proto);
|
||||||
if (proposal)
|
|
||||||
{
|
|
||||||
list->insert_last(list, proposal);
|
|
||||||
}
|
|
||||||
proposal = proposal_create_default_aead(proto);
|
|
||||||
if (proposal)
|
|
||||||
{
|
|
||||||
list->insert_last(list, proposal);
|
|
||||||
}
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
proposal = proposal_create_from_string(proto, buf);
|
proposal = proposal_create_from_string(proto, buf);
|
||||||
@@ -2134,16 +2153,7 @@ CALLBACK(children_sn, bool,
|
|||||||
}
|
}
|
||||||
if (child.proposals->get_count(child.proposals) == 0)
|
if (child.proposals->get_count(child.proposals) == 0)
|
||||||
{
|
{
|
||||||
proposal = proposal_create_default_aead(PROTO_ESP);
|
add_default_proposals(child.proposals, PROTO_ESP);
|
||||||
if (proposal)
|
|
||||||
{
|
|
||||||
child.proposals->insert_last(child.proposals, proposal);
|
|
||||||
}
|
|
||||||
proposal = proposal_create_default(PROTO_ESP);
|
|
||||||
if (proposal)
|
|
||||||
{
|
|
||||||
child.proposals->insert_last(child.proposals, proposal);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
check_lifetimes(&child.cfg.lifetime);
|
check_lifetimes(&child.cfg.lifetime);
|
||||||
@@ -2740,16 +2750,7 @@ CALLBACK(config_sn, bool,
|
|||||||
}
|
}
|
||||||
if (peer.proposals->get_count(peer.proposals) == 0)
|
if (peer.proposals->get_count(peer.proposals) == 0)
|
||||||
{
|
{
|
||||||
proposal = proposal_create_default(PROTO_IKE);
|
add_default_proposals(peer.proposals, PROTO_IKE);
|
||||||
if (proposal)
|
|
||||||
{
|
|
||||||
peer.proposals->insert_last(peer.proposals, proposal);
|
|
||||||
}
|
|
||||||
proposal = proposal_create_default_aead(PROTO_IKE);
|
|
||||||
if (proposal)
|
|
||||||
{
|
|
||||||
peer.proposals->insert_last(peer.proposals, proposal);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (!peer.local_addrs)
|
if (!peer.local_addrs)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user