mirror of
https://github.com/strongswan/strongswan.git
synced 2025-10-03 00:00:24 -04:00
unit-tests: Support multiple proposals in exchange tests
This commit is contained in:
parent
d4fb07911f
commit
37c56affa1
@ -98,21 +98,27 @@ static ike_cfg_t *create_ike_cfg(bool initiator, exchange_test_sa_conf_t *conf)
|
||||
.remote = "127.0.0.1",
|
||||
.remote_port = IKEV2_UDP_PORT,
|
||||
};
|
||||
enumerator_t *enumerator;
|
||||
ike_cfg_t *ike_cfg;
|
||||
char *proposal = NULL;
|
||||
char *proposals = NULL, *proposal;
|
||||
|
||||
if (conf)
|
||||
{
|
||||
ike.childless = initiator ? conf->initiator.childless
|
||||
: conf->responder.childless;
|
||||
proposal = initiator ? conf->initiator.ike : conf->responder.ike;
|
||||
proposals = initiator ? conf->initiator.ike : conf->responder.ike;
|
||||
}
|
||||
|
||||
ike_cfg = ike_cfg_create(&ike);
|
||||
if (proposal)
|
||||
if (proposals)
|
||||
{
|
||||
ike_cfg->add_proposal(ike_cfg,
|
||||
enumerator = enumerator_create_token(proposals, ",", "");
|
||||
while (enumerator->enumerate(enumerator, &proposal))
|
||||
{
|
||||
ike_cfg->add_proposal(ike_cfg,
|
||||
proposal_create_from_string(PROTO_IKE, proposal));
|
||||
}
|
||||
enumerator->destroy(enumerator);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -124,21 +130,27 @@ static ike_cfg_t *create_ike_cfg(bool initiator, exchange_test_sa_conf_t *conf)
|
||||
static child_cfg_t *create_child_cfg(bool initiator,
|
||||
exchange_test_sa_conf_t *conf)
|
||||
{
|
||||
enumerator_t *enumerator;
|
||||
child_cfg_t *child_cfg;
|
||||
child_cfg_create_t child = {
|
||||
.mode = MODE_TUNNEL,
|
||||
};
|
||||
char *proposal = NULL;
|
||||
char *proposals = NULL, *proposal;
|
||||
|
||||
child_cfg = child_cfg_create(initiator ? "init" : "resp", &child);
|
||||
if (conf)
|
||||
{
|
||||
proposal = initiator ? conf->initiator.esp : conf->responder.esp;
|
||||
proposals = initiator ? conf->initiator.esp : conf->responder.esp;
|
||||
}
|
||||
if (proposal)
|
||||
if (proposals)
|
||||
{
|
||||
child_cfg->add_proposal(child_cfg,
|
||||
enumerator = enumerator_create_token(proposals, ",", "");
|
||||
while (enumerator->enumerate(enumerator, &proposal))
|
||||
{
|
||||
child_cfg->add_proposal(child_cfg,
|
||||
proposal_create_from_string(PROTO_ESP, proposal));
|
||||
}
|
||||
enumerator->destroy(enumerator);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user