more concise listing of ESP algorithms
authorAndreas Steffen <andreas.steffen@strongswan.org>
Mon, 8 Jun 2009 15:42:26 +0000 (17:42 +0200)
committerMartin Willi <martin@strongswan.org>
Tue, 9 Jun 2009 09:03:35 +0000 (11:03 +0200)
src/pluto/kernel_alg.c
src/pluto/rcv_whack.c

index 98ea628..d5301c6 100644 (file)
@@ -428,47 +428,53 @@ struct sadb_alg* kernel_alg_esp_sadb_alg(u_int alg_id)
 
 void kernel_alg_list(void)
 {
+       char buf[BUF_LEN];
+       char *pos;
+       int n, len;
        u_int sadb_id;
 
        whack_log(RC_COMMENT, " ");
-       whack_log(RC_COMMENT, "List of registered ESP Encryption Algorithms:");
+       whack_log(RC_COMMENT, "List of registered ESP Algorithms:");
        whack_log(RC_COMMENT, " ");
 
+       pos = buf;
+       *pos = '\0';
+       len = BUF_LEN;
        for (sadb_id = 1; sadb_id <= SADB_EALG_MAX; sadb_id++)
        {
                if (ESP_EALG_PRESENT(sadb_id))
                {
-                       struct sadb_alg *alg_p = &esp_ealg[sadb_id];
-
-                       whack_log(RC_COMMENT, "#%-5d %s, blocksize: %d, keylen: %d-%d"
-                               , sadb_id
-                               , enum_name(&esp_transformid_names, sadb_id)
-                               , alg_p->sadb_alg_ivlen
-                               , alg_p->sadb_alg_minbits
-                               , alg_p->sadb_alg_maxbits
-                       );
+                       n = snprintf(pos, len, " %s",
+                                                enum_name(&esp_transformid_names, sadb_id));
+                       pos += n;
+                       len -= n;
+                       if (len <= 0)
+                       {
+                               break;
+                       }
                }
        }
+       whack_log(RC_COMMENT, "  encryption:%s", buf);
        
-       whack_log(RC_COMMENT, " ");
-       whack_log(RC_COMMENT, "List of registered ESP Authentication Algorithms:");
-       whack_log(RC_COMMENT, " ");
-
+       pos = buf;
+       *pos = '\0';
+       len = BUF_LEN;
        for (sadb_id = 1; sadb_id <= SADB_AALG_MAX; sadb_id++)
        {
                if (ESP_AALG_PRESENT(sadb_id))
                {
                        u_int aaid = alg_info_esp_sadb2aa(sadb_id);
-                       struct sadb_alg *alg_p = &esp_aalg[sadb_id];
-
-                       whack_log(RC_COMMENT, "#%-5d %s, keylen: %d-%d"
-                               , aaid
-                               , enum_name(&auth_alg_names, aaid)
-                               , alg_p->sadb_alg_minbits
-                               , alg_p->sadb_alg_maxbits
-                       );
+
+                       n = snprintf(pos, len, " %s", enum_name(&auth_alg_names, aaid));
+                       pos += n;
+                       len -= n;
+                       if (len <= 0)
+                       {
+                               break;
+                       }
                }
        }
+       whack_log(RC_COMMENT, "  integrity: %s", buf);
 }
 
 void kernel_alg_show_connection(struct connection *c, const char *instance)
index 01f721e..013deb4 100644 (file)
@@ -480,11 +480,6 @@ whack_handle(int whackctlfd)
                free_ocsp_cache();
        }
 
-       if (msg.whack_list & LIST_ALGS)
-       {
-               ike_alg_list();
-               kernel_alg_list();
-       }
    if (msg.whack_list & LIST_PUBKEYS)
        {
                list_public_keys(msg.whack_utc);
@@ -542,6 +537,12 @@ whack_handle(int whackctlfd)
                scx_list(msg.whack_utc);
        }
 
+       if (msg.whack_list & LIST_ALGS)
+       {
+               ike_alg_list();
+               kernel_alg_list();
+       }
+
        if (msg.whack_key)
        {
                /* add a public key */