fixed some rekey collision issues
added retry with jitter when rekeying fails
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
#include <daemon.h>
|
||||
#include <encoding/payloads/notify_payload.h>
|
||||
#include <sa/tasks/child_create.h>
|
||||
#include <queues/jobs/rekey_child_sa_job.h>
|
||||
|
||||
|
||||
typedef struct private_child_rekey_t private_child_rekey_t;
|
||||
@@ -165,12 +166,10 @@ static status_t build_r(private_child_rekey_t *this, message_t *message)
|
||||
{
|
||||
/* rekeying failed, reuse old child */
|
||||
this->child_sa->set_state(this->child_sa, CHILD_INSTALLED);
|
||||
/* TODO: reschedule rekeying */
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
this->child_sa->set_state(this->child_sa, CHILD_REKEYING);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@@ -191,8 +190,17 @@ static status_t process_i(private_child_rekey_t *this, message_t *message)
|
||||
if (!(this->collision &&
|
||||
this->collision->get_type(this->collision) == CHILD_DELETE))
|
||||
{
|
||||
job_t *job;
|
||||
u_int32_t retry = charon->configuration->get_retry_interval(
|
||||
charon->configuration);
|
||||
job = (job_t*)rekey_child_sa_job_create(
|
||||
this->child_sa->get_reqid(this->child_sa),
|
||||
this->child_sa->get_protocol(this->child_sa),
|
||||
this->child_sa->get_spi(this->child_sa, TRUE));
|
||||
DBG1(DBG_IKE, "CHILD_SA rekeying failed, "
|
||||
"trying again in %d seconds", retry);
|
||||
this->child_sa->set_state(this->child_sa, CHILD_INSTALLED);
|
||||
/* TODO: rescedule rekeying */
|
||||
charon->event_queue->add_relative(charon->event_queue, job, retry * 1000);
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <encoding/payloads/notify_payload.h>
|
||||
#include <sa/tasks/ike_init.h>
|
||||
#include <queues/jobs/delete_ike_sa_job.h>
|
||||
#include <queues/jobs/rekey_ike_sa_job.h>
|
||||
|
||||
|
||||
typedef struct private_ike_rekey_t private_ike_rekey_t;
|
||||
@@ -180,8 +181,15 @@ static status_t process_i(private_ike_rekey_t *this, message_t *message)
|
||||
if (!(this->collision &&
|
||||
this->collision->get_type(this->collision) == IKE_DELETE))
|
||||
{
|
||||
job_t *job;
|
||||
u_int32_t retry = charon->configuration->get_retry_interval(
|
||||
charon->configuration);
|
||||
job = (job_t*)rekey_ike_sa_job_create(
|
||||
this->ike_sa->get_id(this->ike_sa), FALSE);
|
||||
DBG1(DBG_IKE, "IKE_SA rekeying failed, "
|
||||
"trying again in %d seconds", retry);
|
||||
this->ike_sa->set_state(this->ike_sa, IKE_ESTABLISHED);
|
||||
/* TODO: reschedule rekeying */
|
||||
charon->event_queue->add_relative(charon->event_queue, job, retry * 1000);
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user