ikev2: Use CHILD_REKEYED for replaced CHILD_SAs after rekeying
This allows handling collisions better, in particular with deletions.
This commit is contained in:
@@ -157,9 +157,8 @@ static void process_payloads(private_child_delete_t *this, message_t *message)
|
||||
|
||||
switch (child_sa->get_state(child_sa))
|
||||
{
|
||||
case CHILD_REKEYING:
|
||||
case CHILD_REKEYED:
|
||||
this->rekeyed = TRUE;
|
||||
/* we reply as usual, rekeying will fail */
|
||||
break;
|
||||
case CHILD_DELETING:
|
||||
/* we don't send back a delete if we initiated ourself */
|
||||
@@ -168,11 +167,14 @@ static void process_payloads(private_child_delete_t *this, message_t *message)
|
||||
continue;
|
||||
}
|
||||
/* fall through */
|
||||
case CHILD_REKEYING:
|
||||
/* we reply as usual, rekeying will fail */
|
||||
case CHILD_INSTALLED:
|
||||
if (!this->initiator)
|
||||
{ /* reestablish installed children if required */
|
||||
this->check_delete_action = TRUE;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -204,7 +206,7 @@ static status_t destroy_and_reestablish(private_child_delete_t *this)
|
||||
enumerator = this->child_sas->create_enumerator(this->child_sas);
|
||||
while (enumerator->enumerate(enumerator, (void**)&child_sa))
|
||||
{
|
||||
/* signal child down event if we are not rekeying */
|
||||
/* signal child down event if we weren't rekeying */
|
||||
if (!this->rekeyed)
|
||||
{
|
||||
charon->bus->child_updown(charon->bus, child_sa, FALSE);
|
||||
@@ -306,7 +308,7 @@ METHOD(task_t, build_i, status_t,
|
||||
this->spi = child_sa->get_spi(child_sa, TRUE);
|
||||
}
|
||||
this->child_sas->insert_last(this->child_sas, child_sa);
|
||||
if (child_sa->get_state(child_sa) == CHILD_REKEYING)
|
||||
if (child_sa->get_state(child_sa) == CHILD_REKEYED)
|
||||
{
|
||||
this->rekeyed = TRUE;
|
||||
}
|
||||
|
||||
@@ -241,6 +241,7 @@ METHOD(task_t, build_r, status_t,
|
||||
config = this->child_sa->get_config(this->child_sa);
|
||||
this->child_create->set_config(this->child_create, config->get_ref(config));
|
||||
this->child_create->task.build(&this->child_create->task, message);
|
||||
this->child_sa->set_state(this->child_sa, CHILD_REKEYING);
|
||||
|
||||
if (message->get_payload(message, PLV2_SECURITY_ASSOCIATION) == NULL)
|
||||
{
|
||||
@@ -249,7 +250,7 @@ METHOD(task_t, build_r, status_t,
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
this->child_sa->set_state(this->child_sa, CHILD_REKEYING);
|
||||
this->child_sa->set_state(this->child_sa, CHILD_REKEYED);
|
||||
|
||||
/* invoke rekey hook */
|
||||
charon->bus->child_rekey(charon->bus, this->child_sa,
|
||||
@@ -289,9 +290,9 @@ static child_sa_t *handle_collision(private_child_rekey_t *this)
|
||||
if (child_sa)
|
||||
{
|
||||
child_sa->set_close_action(child_sa, ACTION_NONE);
|
||||
if (child_sa->get_state(child_sa) != CHILD_REKEYING)
|
||||
if (child_sa->get_state(child_sa) != CHILD_REKEYED)
|
||||
{
|
||||
child_sa->set_state(child_sa, CHILD_REKEYING);
|
||||
child_sa->set_state(child_sa, CHILD_REKEYED);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -410,9 +411,9 @@ METHOD(task_t, process_i, status_t,
|
||||
return SUCCESS;
|
||||
}
|
||||
/* disable updown event for redundant CHILD_SA */
|
||||
if (to_delete->get_state(to_delete) != CHILD_REKEYING)
|
||||
if (to_delete->get_state(to_delete) != CHILD_REKEYED)
|
||||
{
|
||||
to_delete->set_state(to_delete, CHILD_REKEYING);
|
||||
to_delete->set_state(to_delete, CHILD_REKEYED);
|
||||
}
|
||||
spi = to_delete->get_spi(to_delete, TRUE);
|
||||
protocol = to_delete->get_protocol(to_delete);
|
||||
|
||||
Reference in New Issue
Block a user