utils: Add enum name for pseudo log group 'any'
authorTobias Brunner <tobias@strongswan.org>
Fri, 5 Feb 2016 14:41:39 +0000 (15:41 +0100)
committerTobias Brunner <tobias@strongswan.org>
Fri, 5 Feb 2016 14:41:39 +0000 (15:41 +0100)
src/libcharon/plugins/stroke/stroke_socket.c
src/libstrongswan/utils/debug.c

index 29563e3..ee32dbc 100644 (file)
@@ -590,17 +590,10 @@ static void stroke_loglevel(private_stroke_socket_t *this,
                fprintf(out, "command not allowed!\n");
                return;
        }
-       if (strcaseeq(msg->loglevel.type, "any"))
+       if (!enum_from_name(debug_names, msg->loglevel.type, &group))
        {
-               group = DBG_ANY;
-       }
-       else
-       {
-               if (!enum_from_name(debug_names, msg->loglevel.type, &group))
-               {
-                       fprintf(out, "unknown type '%s'!\n", msg->loglevel.type);
-                       return;
-               }
+               fprintf(out, "unknown type '%s'!\n", msg->loglevel.type);
+               return;
        }
        charon->set_level(charon, group, msg->loglevel.level);
 }
index e8c9e6b..8a80b81 100644 (file)
@@ -17,7 +17,7 @@
 
 #include "debug.h"
 
-ENUM(debug_names, DBG_DMN, DBG_LIB,
+ENUM(debug_names, DBG_DMN, DBG_ANY,
        "DMN",
        "MGR",
        "IKE",
@@ -36,9 +36,10 @@ ENUM(debug_names, DBG_DMN, DBG_LIB,
        "APP",
        "ESP",
        "LIB",
+       "ANY",
 );
 
-ENUM(debug_lower_names, DBG_DMN, DBG_LIB,
+ENUM(debug_lower_names, DBG_DMN, DBG_ANY,
        "dmn",
        "mgr",
        "ike",
@@ -57,6 +58,7 @@ ENUM(debug_lower_names, DBG_DMN, DBG_LIB,
        "app",
        "esp",
        "lib",
+       "any",
 );
 
 /**