added charondebug config parameter to set debug level at startup

This commit is contained in:
Martin Willi
2006-10-18 11:46:57 +00:00
parent 60356f3375
commit 107936f55a
6 changed files with 52 additions and 4 deletions
+2 -1
View File
@@ -151,8 +151,9 @@ static const token_info_t token_info[] =
{ ARG_ENUM, offsetof(starter_config_t, setup.charonstart), LST_bool }, { ARG_ENUM, offsetof(starter_config_t, setup.charonstart), LST_bool },
{ ARG_ENUM, offsetof(starter_config_t, setup.plutostart), LST_bool }, { ARG_ENUM, offsetof(starter_config_t, setup.plutostart), LST_bool },
/* pluto keywords */ /* pluto/charon keywords */
{ ARG_LST, offsetof(starter_config_t, setup.plutodebug), LST_plutodebug }, { ARG_LST, offsetof(starter_config_t, setup.plutodebug), LST_plutodebug },
{ ARG_STR, offsetof(starter_config_t, setup.charondebug), NULL },
{ ARG_STR, offsetof(starter_config_t, setup.prepluto), NULL }, { ARG_STR, offsetof(starter_config_t, setup.prepluto), NULL },
{ ARG_STR, offsetof(starter_config_t, setup.postpluto), NULL }, { ARG_STR, offsetof(starter_config_t, setup.postpluto), NULL },
{ ARG_ENUM, offsetof(starter_config_t, setup.uniqueids), LST_bool }, { ARG_ENUM, offsetof(starter_config_t, setup.uniqueids), LST_bool },
+2 -1
View File
@@ -152,8 +152,9 @@ struct starter_config {
bool charonstart; bool charonstart;
bool plutostart; bool plutostart;
/* pluto keywords */ /* pluto/charon keywords */
char **plutodebug; char **plutodebug;
char *charondebug;
char *prepluto; char *prepluto;
char *postpluto; char *postpluto;
bool uniqueids; bool uniqueids;
+34 -1
View File
@@ -102,7 +102,10 @@ starter_start_charon (starter_config_t *cfg, bool debug)
struct stat stb; struct stat stb;
int argc = 1; int argc = 1;
char *arg[] = { char *arg[] = {
CHARON_CMD, NULL, NULL, NULL CHARON_CMD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
}; };
if (!debug) if (!debug)
@@ -114,6 +117,36 @@ starter_start_charon (starter_config_t *cfg, bool debug)
arg[argc++] = "--strictcrlpolicy"; arg[argc++] = "--strictcrlpolicy";
} }
{ /* parse debug string */
char *pos, *level, *buf_pos, type[4], buffer[512];
pos = cfg->setup.charondebug;
buf_pos = buffer;
while (pos && sscanf(pos, "%4s %d,", type, &level) == 2)
{
snprintf(buf_pos, buffer + sizeof(buffer) - buf_pos, "--debug-%s", type);
arg[argc++] = buf_pos;
buf_pos += strlen(buf_pos) + 1;
if (buf_pos >= buffer + sizeof(buffer))
{
break;
}
snprintf(buf_pos, buffer + sizeof(buffer) - buf_pos, "%d", level);
arg[argc++] = buf_pos;
buf_pos += strlen(buf_pos) + 1;
if (buf_pos >= buffer + sizeof(buffer))
{
break;
}
/* get next */
pos = strchr(pos, ',');
if (pos)
{
pos++;
}
}
}
if (_charon_pid) if (_charon_pid)
{ {
plog("starter_start_charon(): charon already started..."); plog("starter_start_charon(): charon already started...");
+11
View File
@@ -1076,6 +1076,17 @@ separated by white space) are enabled;
for details on available debugging types, see for details on available debugging types, see
.IR ipsec_pluto (8). .IR ipsec_pluto (8).
.TP .TP
.B charondebug
how much Charon debugging output should be logged.
A comma separated list containing type level/pairs may
be specified, e.g:
.B dmn 3, ike 1, net -1.
Acceptable values for types are
.B dmn, mgr, ike, chd, job, cfg, knl, net, enc, lib
and the level is one of
.B -1, 0, 1, 2, 3, 4
(for silent, audit, control, controlmore, raw, private)
.TP
.B plutoopts .B plutoopts
additional options to pass to pluto upon startup. See additional options to pass to pluto upon startup. See
.IR ipsec_pluto (8). .IR ipsec_pluto (8).
+2 -1
View File
@@ -25,8 +25,9 @@ typedef enum {
KW_CHARONSTART, KW_CHARONSTART,
KW_PLUTOSTART, KW_PLUTOSTART,
/* pluto keywords */ /* pluto/charon keywords */
KW_PLUTODEBUG, KW_PLUTODEBUG,
KW_CHARONDEBUG,
KW_PREPLUTO, KW_PREPLUTO,
KW_POSTPLUTO, KW_POSTPLUTO,
KW_UNIQUEIDS, KW_UNIQUEIDS,
+1
View File
@@ -32,6 +32,7 @@ charonstart, KW_CHARONSTART
plutostart, KW_PLUTOSTART plutostart, KW_PLUTOSTART
klipsdebug, KW_KLIPSDEBUG klipsdebug, KW_KLIPSDEBUG
plutodebug, KW_PLUTODEBUG plutodebug, KW_PLUTODEBUG
charondebug, KW_CHARONDEBUG
prepluto, KW_PREPLUTO prepluto, KW_PREPLUTO
postpluto, KW_POSTPLUTO postpluto, KW_POSTPLUTO
fragicmp, KW_FRAGICMP fragicmp, KW_FRAGICMP