Show expiration time of rekeyed CHILD_SAs in statusall
authorMartin Willi <martin@revosec.ch>
Tue, 5 Jun 2012 08:29:06 +0000 (10:29 +0200)
committerMartin Willi <martin@revosec.ch>
Tue, 5 Jun 2012 08:29:43 +0000 (10:29 +0200)
src/libcharon/plugins/stroke/stroke_list.c

index caceab4..a179adf 100644 (file)
@@ -192,6 +192,7 @@ static void log_child_sa(FILE *out, child_sa_t *child_sa, bool all)
        proposal_t *proposal;
        child_cfg_t *config = child_sa->get_config(child_sa);
 
+       now = time_monotonic(NULL);
 
        fprintf(out, "%12s{%d}:  %N, %N%s",
                        child_sa->get_name(child_sa), child_sa->get_reqid(child_sa),
@@ -255,7 +256,6 @@ static void log_child_sa(FILE *out, child_sa_t *child_sa, bool all)
                                }
                        }
 
-                       now = time_monotonic(NULL);
                        child_sa->get_usestats(child_sa, TRUE, &use_in, &bytes_in);
                        fprintf(out, ", %" PRIu64 " bytes_i", bytes_in);
                        if (use_in)
@@ -290,6 +290,11 @@ static void log_child_sa(FILE *out, child_sa_t *child_sa, bool all)
 
                }
        }
+       else if (child_sa->get_state(child_sa) == CHILD_REKEYING)
+       {
+               rekey = child_sa->get_lifetime(child_sa, TRUE);
+               fprintf(out, ", expires in %V", &now, &rekey);
+       }
 
        fprintf(out, "\n%12s{%d}:   %#R=== %#R\n",
                        child_sa->get_name(child_sa), child_sa->get_reqid(child_sa),