aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2010-10-29 15:36:19 +0200
committerMartin Willi <martin@revosec.ch>2011-01-05 16:45:40 +0100
commit6c2d466b900ad099dcd3ab8ef4cacb8da216e9fe (patch)
tree7c2ddc1bf931ecfe806c5015ffa62b18fcdbe1a3 /src
parent3f759bb75b52d115d908a7fcc7b04a017fe8f690 (diff)
downloadstrongswan-6c2d466b900ad099dcd3ab8ef4cacb8da216e9fe.tar.bz2
strongswan-6c2d466b900ad099dcd3ab8ef4cacb8da216e9fe.tar.xz
Support manually triggerd DPD check, even if DPD disabled in config
Diffstat (limited to 'src')
-rw-r--r--src/libcharon/sa/ike_sa.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/libcharon/sa/ike_sa.c b/src/libcharon/sa/ike_sa.c
index a4e4028ab..8d499cce4 100644
--- a/src/libcharon/sa/ike_sa.c
+++ b/src/libcharon/sa/ike_sa.c
@@ -559,13 +559,6 @@ METHOD(ike_sa_t, send_dpd, status_t,
time_t diff, delay;
delay = this->peer_cfg->get_dpd(this->peer_cfg);
-
- if (delay == 0)
- {
- /* DPD disabled */
- return SUCCESS;
- }
-
if (this->task_manager->busy(this->task_manager))
{
/* 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);
now = time_monotonic(NULL);
diff = now - last_in;
- if (diff >= delay)
+ if (!delay || diff >= delay)
{
/* to long ago, initiate dead peer detection */
task_t *task;
@@ -604,8 +597,11 @@ METHOD(ike_sa_t, send_dpd, status_t,
}
}
/* recheck in "interval" seconds */
- job = (job_t*)send_dpd_job_create(this->ike_sa_id);
- lib->scheduler->schedule_job(lib->scheduler, job, delay - diff);
+ if (delay)
+ {
+ job = (job_t*)send_dpd_job_create(this->ike_sa_id);
+ lib->scheduler->schedule_job(lib->scheduler, job, delay - diff);
+ }
return SUCCESS;
}
@@ -680,7 +676,10 @@ METHOD(ike_sa_t, set_state, void,
}
/* start DPD checks */
- send_dpd(this);
+ if (this->peer_cfg->get_dpd(this->peer_cfg))
+ {
+ send_dpd(this);
+ }
}
break;
}