Report the number of processed packets in "ipsec statusall"
authorMartin Willi <martin@revosec.ch>
Wed, 13 Mar 2013 10:46:32 +0000 (11:46 +0100)
committerMartin Willi <martin@revosec.ch>
Thu, 14 Mar 2013 13:20:54 +0000 (14:20 +0100)
src/libcharon/plugins/stroke/stroke_list.c

index de5fa0e..ab33933 100644 (file)
@@ -205,7 +205,7 @@ static void log_ike_sa(FILE *out, ike_sa_t *ike_sa, bool all)
 static void log_child_sa(FILE *out, child_sa_t *child_sa, bool all)
 {
        time_t use_in, use_out, rekey, now;
-       u_int64_t bytes_in, bytes_out;
+       u_int64_t bytes_in, bytes_out, packets_in, packets_out;
        proposal_t *proposal;
        child_cfg_t *config = child_sa->get_config(child_sa);
 
@@ -273,18 +273,22 @@ static void log_child_sa(FILE *out, child_sa_t *child_sa, bool all)
                                }
                        }
 
-                       child_sa->get_usestats(child_sa, TRUE, &use_in, &bytes_in, NULL);
+                       child_sa->get_usestats(child_sa, TRUE,
+                                                                  &use_in, &bytes_in, &packets_in);
                        fprintf(out, ", %" PRIu64 " bytes_i", bytes_in);
                        if (use_in)
                        {
-                               fprintf(out, " (%" PRIu64 "s ago)", (u_int64_t)(now - use_in));
+                               fprintf(out, " (%" PRIu64 " pkts, %" PRIu64 "s ago)",
+                                               packets_in, (u_int64_t)(now - use_in));
                        }
 
-                       child_sa->get_usestats(child_sa, FALSE, &use_out, &bytes_out, NULL);
+                       child_sa->get_usestats(child_sa, FALSE,
+                                                                  &use_out, &bytes_out, &packets_out);
                        fprintf(out, ", %" PRIu64 " bytes_o", bytes_out);
                        if (use_out)
                        {
-                               fprintf(out, " (%" PRIu64 "s ago)", (u_int64_t)(now - use_out));
+                               fprintf(out, " (%" PRIu64 " pkts, %" PRIu64 "s ago)",
+                                               packets_out, (u_int64_t)(now - use_out));
                        }
                        fprintf(out, ", rekeying ");