Show total and half-open SA count in statusall
authorMartin Willi <martin@revosec.ch>
Thu, 5 May 2011 08:31:45 +0000 (10:31 +0200)
committerMartin Willi <martin@revosec.ch>
Mon, 16 May 2011 13:24:15 +0000 (15:24 +0200)
src/libcharon/plugins/stroke/stroke_list.c

index 7f2097d..e4a9bd5 100644 (file)
@@ -399,6 +399,7 @@ METHOD(stroke_list_t, status, void,
        ike_sa_t *ike_sa;
        bool first, found = FALSE;
        char *name = msg->status.name;
+       u_int half_open;
 
        if (all)
        {
@@ -535,7 +536,11 @@ METHOD(stroke_list_t, status, void,
        }
        enumerator->destroy(enumerator);
 
-       fprintf(out, "Security Associations:\n");
+       half_open = charon->ike_sa_manager->get_half_open_count(
+                                                                                               charon->ike_sa_manager, NULL);
+       fprintf(out, "Security Associations (%u up, %u connecting):\n",
+               charon->ike_sa_manager->get_count(charon->ike_sa_manager) - half_open,
+               half_open);
        enumerator = charon->controller->create_ike_sa_enumerator(
                                                                                                        charon->controller, wait);
        while (enumerator->enumerate(enumerator, &ike_sa))