ike-sa-manager: Rename checkout_new() to create_new()

We don't actually check that SA out (i.e. it's not registered with the
manager).  That was originally different but had to be changed with
86993d6b90 to avoid that SAs created for rekeying don't block other
threads on the manager.
This commit is contained in:
Tobias Brunner 2021-01-15 16:08:20 +01:00
parent 7f6386afd9
commit bde5bd47bd
8 changed files with 28 additions and 28 deletions

View File

@ -2186,8 +2186,8 @@ METHOD(ike_sa_t, reestablish, status_t,
return FAILED;
}
new = charon->ike_sa_manager->checkout_new(charon->ike_sa_manager,
this->version, TRUE);
new = charon->ike_sa_manager->create_new(charon->ike_sa_manager,
this->version, TRUE);
if (!new)
{
return FAILED;
@ -2270,8 +2270,8 @@ static bool redirect_established(private_ike_sa_t *this, identification_t *to)
host_t *other;
time_t redirect;
new = charon->ike_sa_manager->checkout_new(charon->ike_sa_manager,
this->version, TRUE);
new = charon->ike_sa_manager->create_new(charon->ike_sa_manager,
this->version, TRUE);
if (!new)
{
return FALSE;

View File

@ -1241,7 +1241,7 @@ METHOD(ike_sa_manager_t, checkout, ike_sa_t*,
return ike_sa;
}
METHOD(ike_sa_manager_t, checkout_new, ike_sa_t*,
METHOD(ike_sa_manager_t, create_new, ike_sa_t*,
private_ike_sa_manager_t* this, ike_version_t version, bool initiator)
{
ike_sa_id_t *ike_sa_id;
@ -1489,7 +1489,7 @@ METHOD(ike_sa_manager_t, checkout_by_config, ike_sa_t*,
if (!this->reuse_ikesa && peer_cfg->get_ike_version(peer_cfg) != IKEV1)
{ /* IKE_SA reuse disabled by config (not possible for IKEv1) */
ike_sa = checkout_new(this, peer_cfg->get_ike_version(peer_cfg), TRUE);
ike_sa = create_new(this, peer_cfg->get_ike_version(peer_cfg), TRUE);
ike_sa->set_peer_cfg(ike_sa, peer_cfg);
segment = create_and_put_entry(this, ike_sa, &entry);
@ -1564,7 +1564,7 @@ METHOD(ike_sa_manager_t, checkout_by_config, ike_sa_t*,
if (!ike_sa)
{
ike_sa = checkout_new(this, peer_cfg->get_ike_version(peer_cfg), TRUE);
ike_sa = create_new(this, peer_cfg->get_ike_version(peer_cfg), TRUE);
ike_sa->set_peer_cfg(ike_sa, peer_cfg);
segment = create_and_put_entry(this, ike_sa, &entry);
@ -2467,8 +2467,8 @@ ike_sa_manager_t *ike_sa_manager_create()
INIT(this,
.public = {
.create_new = _create_new,
.checkout = _checkout,
.checkout_new = _checkout_new,
.checkout_by_message = _checkout_by_message,
.checkout_by_config = _checkout_by_config,
.checkout_by_id = _checkout_by_id,

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2008-2017 Tobias Brunner
* Copyright (C) 2008-2021 Tobias Brunner
* Copyright (C) 2005-2008 Martin Willi
* Copyright (C) 2005 Jan Hutter
* HSR Hochschule fuer Technik Rapperswil
@ -49,6 +49,16 @@ typedef uint64_t (*spi_cb_t)(void *data);
*/
struct ike_sa_manager_t {
/**
* Create a new IKE_SA.
*
* @param version IKE version of this SA
* @param initiator TRUE for initiator, FALSE otherwise
* @returns created IKE_SA (not registered/checked out)
*/
ike_sa_t *(*create_new)(ike_sa_manager_t* this, ike_version_t version,
bool initiator);
/**
* Checkout an existing IKE_SA.
*
@ -59,16 +69,6 @@ struct ike_sa_manager_t {
*/
ike_sa_t* (*checkout) (ike_sa_manager_t* this, ike_sa_id_t *sa_id);
/**
* Create and check out a new IKE_SA.
*
* @param version IKE version of this SA
* @param initiator TRUE for initiator, FALSE otherwise
* @returns created and checked out IKE_SA
*/
ike_sa_t* (*checkout_new) (ike_sa_manager_t* this, ike_version_t version,
bool initiator);
/**
* Checkout an IKE_SA by a message.
*

View File

@ -1636,7 +1636,7 @@ METHOD(task_manager_t, queue_ike_reauth, void,
ike_sa_t *new;
host_t *host;
new = charon->ike_sa_manager->checkout_new(charon->ike_sa_manager,
new = charon->ike_sa_manager->create_new(charon->ike_sa_manager,
this->ike_sa->get_version(this->ike_sa), TRUE);
if (!new)
{ /* shouldn't happen */

View File

@ -1905,7 +1905,7 @@ static void trigger_mbb_reauth(private_task_manager_t *this)
queued_task_t *queued;
bool children = FALSE;
new = charon->ike_sa_manager->checkout_new(charon->ike_sa_manager,
new = charon->ike_sa_manager->create_new(charon->ike_sa_manager,
this->ike_sa->get_version(this->ike_sa), TRUE);
if (!new)
{ /* shouldn't happen */

View File

@ -167,7 +167,7 @@ METHOD(task_t, build_i, status_t,
if (this->new_sa == NULL)
{
version = this->ike_sa->get_version(this->ike_sa);
this->new_sa = charon->ike_sa_manager->checkout_new(
this->new_sa = charon->ike_sa_manager->create_new(
charon->ike_sa_manager, version, TRUE);
if (!this->new_sa)
{ /* shouldn't happen */
@ -236,7 +236,7 @@ METHOD(task_t, process_r, status_t,
return NEED_MORE;
}
this->new_sa = charon->ike_sa_manager->checkout_new(charon->ike_sa_manager,
this->new_sa = charon->ike_sa_manager->create_new(charon->ike_sa_manager,
this->ike_sa->get_version(this->ike_sa), FALSE);
if (!this->new_sa)
{ /* shouldn't happen */

View File

@ -509,7 +509,7 @@ METHOD(trap_manager_t, acquire, void,
if (wildcard)
{ /* the peer config would match IKE_SAs with other peers */
ike_sa = charon->ike_sa_manager->checkout_new(charon->ike_sa_manager,
ike_sa = charon->ike_sa_manager->create_new(charon->ike_sa_manager,
peer->get_ike_version(peer), TRUE);
if (ike_sa)
{

View File

@ -237,11 +237,11 @@ METHOD(exchange_test_helper_t, create_sa, child_cfg_t*,
peer_cfg_t *peer_cfg;
child_cfg_t *child_cfg;
*init = charon->ike_sa_manager->checkout_new(charon->ike_sa_manager,
IKEV2, TRUE);
*init = charon->ike_sa_manager->create_new(charon->ike_sa_manager,
IKEV2, TRUE);
*resp = charon->ike_sa_manager->checkout_new(charon->ike_sa_manager,
IKEV2, FALSE);
*resp = charon->ike_sa_manager->create_new(charon->ike_sa_manager,
IKEV2, FALSE);
peer_cfg = create_peer_cfg(FALSE, conf);
child_cfg = create_child_cfg(FALSE, conf);