Store shorter soft lifetime of in- and outbound SAs only
authorMartin Willi <martin@revosec.ch>
Tue, 5 Jun 2012 14:16:07 +0000 (16:16 +0200)
committerMartin Willi <martin@revosec.ch>
Fri, 8 Jun 2012 08:22:03 +0000 (10:22 +0200)
src/libcharon/sa/child_sa.c

index 76cccee..d5adb25 100644 (file)
@@ -632,7 +632,14 @@ METHOD(child_sa_t, install, status_t,
        now = time_monotonic(NULL);
        if (lifetime->time.rekey)
        {
-               this->rekey_time = now + lifetime->time.rekey;
+               if (this->rekey_time)
+               {
+                       this->rekey_time = min(this->rekey_time, now + lifetime->time.rekey);
+               }
+               else
+               {
+                       this->rekey_time = now + lifetime->time.rekey;
+               }
        }
        if (lifetime->time.life)
        {