Support manually triggerd DPD check, even if DPD disabled in config
This commit is contained in:
+10
-11
@@ -559,13 +559,6 @@ METHOD(ike_sa_t, send_dpd, status_t,
|
|||||||
time_t diff, delay;
|
time_t diff, delay;
|
||||||
|
|
||||||
delay = this->peer_cfg->get_dpd(this->peer_cfg);
|
delay = this->peer_cfg->get_dpd(this->peer_cfg);
|
||||||
|
|
||||||
if (delay == 0)
|
|
||||||
{
|
|
||||||
/* DPD disabled */
|
|
||||||
return SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this->task_manager->busy(this->task_manager))
|
if (this->task_manager->busy(this->task_manager))
|
||||||
{
|
{
|
||||||
/* an exchange is in the air, no need to start a DPD check */
|
/* an exchange is in the air, no need to start a DPD check */
|
||||||
@@ -578,7 +571,7 @@ METHOD(ike_sa_t, send_dpd, status_t,
|
|||||||
last_in = get_use_time(this, TRUE);
|
last_in = get_use_time(this, TRUE);
|
||||||
now = time_monotonic(NULL);
|
now = time_monotonic(NULL);
|
||||||
diff = now - last_in;
|
diff = now - last_in;
|
||||||
if (diff >= delay)
|
if (!delay || diff >= delay)
|
||||||
{
|
{
|
||||||
/* to long ago, initiate dead peer detection */
|
/* to long ago, initiate dead peer detection */
|
||||||
task_t *task;
|
task_t *task;
|
||||||
@@ -604,8 +597,11 @@ METHOD(ike_sa_t, send_dpd, status_t,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* recheck in "interval" seconds */
|
/* recheck in "interval" seconds */
|
||||||
job = (job_t*)send_dpd_job_create(this->ike_sa_id);
|
if (delay)
|
||||||
lib->scheduler->schedule_job(lib->scheduler, job, delay - diff);
|
{
|
||||||
|
job = (job_t*)send_dpd_job_create(this->ike_sa_id);
|
||||||
|
lib->scheduler->schedule_job(lib->scheduler, job, delay - diff);
|
||||||
|
}
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -680,7 +676,10 @@ METHOD(ike_sa_t, set_state, void,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* start DPD checks */
|
/* start DPD checks */
|
||||||
send_dpd(this);
|
if (this->peer_cfg->get_dpd(this->peer_cfg))
|
||||||
|
{
|
||||||
|
send_dpd(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user