configure NAT keep alive interval using the charon.keep_alive key

This commit is contained in:
Andreas Steffen
2008-09-03 18:49:06 +00:00
parent 6283b1f1f8
commit 3dfecde4c0
+9 -2
View File
@@ -259,6 +259,11 @@ struct private_ike_sa_t {
*/ */
u_int32_t pending_updates; u_int32_t pending_updates;
/**
* NAT keep alive interval
*/
u_int32_t keepalive_interval;
/** /**
* Timestamps for this IKE_SA * Timestamps for this IKE_SA
*/ */
@@ -469,7 +474,7 @@ static void send_keepalive(private_ike_sa_t *this)
diff = now - last_out; diff = now - last_out;
if (diff >= KEEPALIVE_INTERVAL) if (diff >= this->keepalive_interval)
{ {
packet_t *packet; packet_t *packet;
chunk_t data; chunk_t data;
@@ -487,7 +492,7 @@ static void send_keepalive(private_ike_sa_t *this)
} }
job = send_keepalive_job_create(this->ike_sa_id); job = send_keepalive_job_create(this->ike_sa_id);
charon->scheduler->schedule_job(charon->scheduler, (job_t*)job, charon->scheduler->schedule_job(charon->scheduler, (job_t*)job,
(KEEPALIVE_INTERVAL - diff) * 1000); (this->keepalive_interval - diff) * 1000);
} }
/** /**
@@ -2616,6 +2621,8 @@ ike_sa_t * ike_sa_create(ike_sa_id_t *ike_sa_id)
this->skp_build = chunk_empty; this->skp_build = chunk_empty;
this->child_prf = NULL; this->child_prf = NULL;
this->state = IKE_CREATED; this->state = IKE_CREATED;
this->keepalive_interval = lib->settings->get_int(lib->settings,
"charon.keep_alive", KEEPALIVE_INTERVAL);
this->time.inbound = this->time.outbound = time(NULL); this->time.inbound = this->time.outbound = time(NULL);
this->time.established = 0; this->time.established = 0;
this->time.rekey = 0; this->time.rekey = 0;