inactivity-job: Schedule job by CHILD_SA unique ID instead of reqid
This commit is contained in:
@@ -30,9 +30,9 @@ struct private_inactivity_job_t {
|
|||||||
inactivity_job_t public;
|
inactivity_job_t public;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reqid of CHILD_SA to check
|
* Unique CHILD_SA identifier to check
|
||||||
*/
|
*/
|
||||||
u_int32_t reqid;
|
u_int32_t id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inactivity timeout
|
* Inactivity timeout
|
||||||
@@ -57,8 +57,8 @@ METHOD(job_t, execute, job_requeue_t,
|
|||||||
ike_sa_t *ike_sa;
|
ike_sa_t *ike_sa;
|
||||||
u_int32_t reschedule = 0;
|
u_int32_t reschedule = 0;
|
||||||
|
|
||||||
ike_sa = charon->ike_sa_manager->checkout_by_id(charon->ike_sa_manager,
|
ike_sa = charon->child_sa_manager->checkout_by_id(charon->child_sa_manager,
|
||||||
this->reqid, TRUE);
|
this->id, NULL);
|
||||||
if (ike_sa)
|
if (ike_sa)
|
||||||
{
|
{
|
||||||
enumerator_t *enumerator;
|
enumerator_t *enumerator;
|
||||||
@@ -69,9 +69,9 @@ METHOD(job_t, execute, job_requeue_t,
|
|||||||
status_t status = SUCCESS;
|
status_t status = SUCCESS;
|
||||||
|
|
||||||
enumerator = ike_sa->create_child_sa_enumerator(ike_sa);
|
enumerator = ike_sa->create_child_sa_enumerator(ike_sa);
|
||||||
while (enumerator->enumerate(enumerator, (void**)&child_sa))
|
while (enumerator->enumerate(enumerator, &child_sa))
|
||||||
{
|
{
|
||||||
if (child_sa->get_reqid(child_sa) == this->reqid)
|
if (child_sa->get_unique_id(child_sa) == this->id)
|
||||||
{
|
{
|
||||||
time_t in, out, install, diff;
|
time_t in, out, install, diff;
|
||||||
|
|
||||||
@@ -136,7 +136,7 @@ METHOD(job_t, get_priority, job_priority_t,
|
|||||||
/**
|
/**
|
||||||
* See header
|
* See header
|
||||||
*/
|
*/
|
||||||
inactivity_job_t *inactivity_job_create(u_int32_t reqid, u_int32_t timeout,
|
inactivity_job_t *inactivity_job_create(u_int32_t unique_id, u_int32_t timeout,
|
||||||
bool close_ike)
|
bool close_ike)
|
||||||
{
|
{
|
||||||
private_inactivity_job_t *this;
|
private_inactivity_job_t *this;
|
||||||
@@ -149,7 +149,7 @@ inactivity_job_t *inactivity_job_create(u_int32_t reqid, u_int32_t timeout,
|
|||||||
.destroy = _destroy,
|
.destroy = _destroy,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
.reqid = reqid,
|
.id = unique_id,
|
||||||
.timeout = timeout,
|
.timeout = timeout,
|
||||||
.close_ike = close_ike,
|
.close_ike = close_ike,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -42,12 +42,12 @@ struct inactivity_job_t {
|
|||||||
/**
|
/**
|
||||||
* Create a inactivity_job instance.
|
* Create a inactivity_job instance.
|
||||||
*
|
*
|
||||||
* @param reqid reqid of CHILD_SA to check for inactivity
|
* @param unique_id unique CHILD_SA identifier to check for inactivity
|
||||||
* @param timeout inactivity timeout in s
|
* @param timeout inactivity timeout in s
|
||||||
* @param close_ike close IKE_SA if the last remaining CHILD_SA is inactive?
|
* @param close_ike close IKE_SA if the last remaining CHILD_SA is inactive?
|
||||||
* @return inactivity checking job
|
* @return inactivity checking job
|
||||||
*/
|
*/
|
||||||
inactivity_job_t *inactivity_job_create(u_int32_t reqid, u_int32_t timeout,
|
inactivity_job_t *inactivity_job_create(u_int32_t unique_id, u_int32_t timeout,
|
||||||
bool close_ike);
|
bool close_ike);
|
||||||
|
|
||||||
#endif /** INACTIVITY_JOB_H_ @}*/
|
#endif /** INACTIVITY_JOB_H_ @}*/
|
||||||
|
|||||||
@@ -206,8 +206,8 @@ static void schedule_inactivity_timeout(private_quick_mode_t *this)
|
|||||||
close_ike = lib->settings->get_bool(lib->settings,
|
close_ike = lib->settings->get_bool(lib->settings,
|
||||||
"%s.inactivity_close_ike", FALSE, lib->ns);
|
"%s.inactivity_close_ike", FALSE, lib->ns);
|
||||||
lib->scheduler->schedule_job(lib->scheduler, (job_t*)
|
lib->scheduler->schedule_job(lib->scheduler, (job_t*)
|
||||||
inactivity_job_create(this->child_sa->get_reqid(this->child_sa),
|
inactivity_job_create(this->child_sa->get_unique_id(this->child_sa),
|
||||||
timeout, close_ike), timeout);
|
timeout, close_ike), timeout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -406,10 +406,7 @@ static bool install(private_quick_mode_t *this)
|
|||||||
{
|
{
|
||||||
charon->bus->child_updown(charon->bus, this->child_sa, TRUE);
|
charon->bus->child_updown(charon->bus, this->child_sa, TRUE);
|
||||||
}
|
}
|
||||||
if (!this->rekey)
|
schedule_inactivity_timeout(this);
|
||||||
{
|
|
||||||
schedule_inactivity_timeout(this);
|
|
||||||
}
|
|
||||||
this->child_sa = NULL;
|
this->child_sa = NULL;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -296,7 +296,7 @@ static bool allocate_spi(private_child_create_t *this)
|
|||||||
*/
|
*/
|
||||||
static void schedule_inactivity_timeout(private_child_create_t *this)
|
static void schedule_inactivity_timeout(private_child_create_t *this)
|
||||||
{
|
{
|
||||||
u_int32_t timeout;
|
u_int32_t timeout, id;
|
||||||
bool close_ike;
|
bool close_ike;
|
||||||
|
|
||||||
timeout = this->config->get_inactivity(this->config);
|
timeout = this->config->get_inactivity(this->config);
|
||||||
@@ -304,9 +304,9 @@ static void schedule_inactivity_timeout(private_child_create_t *this)
|
|||||||
{
|
{
|
||||||
close_ike = lib->settings->get_bool(lib->settings,
|
close_ike = lib->settings->get_bool(lib->settings,
|
||||||
"%s.inactivity_close_ike", FALSE, lib->ns);
|
"%s.inactivity_close_ike", FALSE, lib->ns);
|
||||||
|
id = this->child_sa->get_unique_id(this->child_sa);
|
||||||
lib->scheduler->schedule_job(lib->scheduler, (job_t*)
|
lib->scheduler->schedule_job(lib->scheduler, (job_t*)
|
||||||
inactivity_job_create(this->child_sa->get_reqid(this->child_sa),
|
inactivity_job_create(id, timeout, close_ike), timeout);
|
||||||
timeout, close_ike), timeout);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -693,10 +693,7 @@ static status_t select_and_install(private_child_create_t *this,
|
|||||||
this->ike_sa->add_child_sa(this->ike_sa, this->child_sa);
|
this->ike_sa->add_child_sa(this->ike_sa, this->child_sa);
|
||||||
this->established = TRUE;
|
this->established = TRUE;
|
||||||
|
|
||||||
if (!this->rekey)
|
schedule_inactivity_timeout(this);
|
||||||
{ /* a rekeyed SA uses the same reqid, no need for a new job */
|
|
||||||
schedule_inactivity_timeout(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
my_ts = linked_list_create_from_enumerator(
|
my_ts = linked_list_create_from_enumerator(
|
||||||
this->child_sa->create_ts_enumerator(this->child_sa, TRUE));
|
this->child_sa->create_ts_enumerator(this->child_sa, TRUE));
|
||||||
|
|||||||
Reference in New Issue
Block a user