child-rekey: Don't change state to INSTALLED if it was already REKEYING

This happens if there is a rekey collision and the peers disagree on the
DH group.
This commit is contained in:
Tobias Brunner
2016-06-17 18:48:03 +02:00
parent 557e262f04
commit 5ef033c53b
+5 -3
View File
@@ -218,6 +218,7 @@ METHOD(task_t, build_r, status_t,
{ {
child_cfg_t *config; child_cfg_t *config;
uint32_t reqid; uint32_t reqid;
child_sa_state_t state;
if (!this->child_sa) if (!this->child_sa)
{ {
@@ -241,12 +242,13 @@ METHOD(task_t, build_r, status_t,
config = this->child_sa->get_config(this->child_sa); config = this->child_sa->get_config(this->child_sa);
this->child_create->set_config(this->child_create, config->get_ref(config)); this->child_create->set_config(this->child_create, config->get_ref(config));
this->child_create->task.build(&this->child_create->task, message); this->child_create->task.build(&this->child_create->task, message);
state = this->child_sa->get_state(this->child_sa);
this->child_sa->set_state(this->child_sa, CHILD_REKEYING); this->child_sa->set_state(this->child_sa, CHILD_REKEYING);
if (message->get_payload(message, PLV2_SECURITY_ASSOCIATION) == NULL) if (message->get_payload(message, PLV2_SECURITY_ASSOCIATION) == NULL)
{ { /* rekeying failed, reuse old child */
/* rekeying failed, reuse old child */ this->child_sa->set_state(this->child_sa, state);
this->child_sa->set_state(this->child_sa, CHILD_INSTALLED);
return SUCCESS; return SUCCESS;
} }