utils: Add enum name for pseudo log group 'any'

This commit is contained in:
Tobias Brunner
2016-02-05 15:41:39 +01:00
parent e8140531fc
commit 10c5981d3b
2 changed files with 7 additions and 12 deletions
+3 -10
View File
@@ -590,17 +590,10 @@ static void stroke_loglevel(private_stroke_socket_t *this,
fprintf(out, "command not allowed!\n"); fprintf(out, "command not allowed!\n");
return; return;
} }
if (strcaseeq(msg->loglevel.type, "any")) if (!enum_from_name(debug_names, msg->loglevel.type, &group))
{ {
group = DBG_ANY; fprintf(out, "unknown type '%s'!\n", msg->loglevel.type);
} return;
else
{
if (!enum_from_name(debug_names, msg->loglevel.type, &group))
{
fprintf(out, "unknown type '%s'!\n", msg->loglevel.type);
return;
}
} }
charon->set_level(charon, group, msg->loglevel.level); charon->set_level(charon, group, msg->loglevel.level);
} }
+4 -2
View File
@@ -17,7 +17,7 @@
#include "debug.h" #include "debug.h"
ENUM(debug_names, DBG_DMN, DBG_LIB, ENUM(debug_names, DBG_DMN, DBG_ANY,
"DMN", "DMN",
"MGR", "MGR",
"IKE", "IKE",
@@ -36,9 +36,10 @@ ENUM(debug_names, DBG_DMN, DBG_LIB,
"APP", "APP",
"ESP", "ESP",
"LIB", "LIB",
"ANY",
); );
ENUM(debug_lower_names, DBG_DMN, DBG_LIB, ENUM(debug_lower_names, DBG_DMN, DBG_ANY,
"dmn", "dmn",
"mgr", "mgr",
"ike", "ike",
@@ -57,6 +58,7 @@ ENUM(debug_lower_names, DBG_DMN, DBG_LIB,
"app", "app",
"esp", "esp",
"lib", "lib",
"any",
); );
/** /**