From: Andreas Steffen Date: Wed, 10 Jan 2007 08:18:52 +0000 (-0000) Subject: show rekeying|reauthentication time X-Git-Tag: 4.0.6^0 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=31e5d441d8160a059c90e5557cc79588cc019a8e;p=thirdparty%2Fstrongswan.git show rekeying|reauthentication time --- diff --git a/src/charon/sa/ike_sa.c b/src/charon/sa/ike_sa.c index 60266a51f0..225a9254a3 100644 --- a/src/charon/sa/ike_sa.c +++ b/src/charon/sa/ike_sa.c @@ -177,6 +177,11 @@ struct private_ike_sa_t { */ u_int32_t message_id_out; + /** + * will the IKE_SA be fully reauthenticated or rekeyed only? + */ + bool reauth; + /** * Timestamps for this IKE_SA */ @@ -1741,10 +1746,13 @@ static void set_lifetimes(private_ike_sa_t *this, bool reauth, u_int32_t soft_lifetime, u_int32_t hard_lifetime) { job_t *job; - + u_int32_t now = time(NULL); + + this->reauth = reauth; + if (soft_lifetime) { - this->time.rekey = this->time.established + soft_lifetime; + this->time.rekey = now + soft_lifetime; job = (job_t*)rekey_ike_sa_job_create(this->ike_sa_id, reauth); charon->event_queue->add_relative(charon->event_queue, job, soft_lifetime * 1000); @@ -1752,7 +1760,7 @@ static void set_lifetimes(private_ike_sa_t *this, bool reauth, if (hard_lifetime) { - this->time.delete = this->time.established + hard_lifetime; + this->time.delete = now + hard_lifetime; job = (job_t*)delete_ike_sa_job_create(this->ike_sa_id, TRUE); charon->event_queue->add_relative(charon->event_queue, job, hard_lifetime * 1000); @@ -1954,7 +1962,10 @@ static int print(FILE *stream, const struct printf_info *info, written = fprintf(stream, "%12s: %N, %H[%D]...%H[%D]", this->name, ike_sa_state_names, this->state, this->my_host, this->my_id, this->other_host, this->other_id); - written += fprintf(stream, "\n%12s: IKE SPIs: %J", this->name, this->ike_sa_id); + written += fprintf(stream, "\n%12s: IKE SPIs: %J, %s in %ds", + this->name, this->ike_sa_id, + this->reauth? "reauthentication":"rekeying", + this->time.rekey - time(NULL)); if (info->alt) {