diff options
author | Martin Willi <martin@strongswan.org> | 2006-10-18 11:46:57 +0000 |
---|---|---|
committer | Martin Willi <martin@strongswan.org> | 2006-10-18 11:46:57 +0000 |
commit | 107936f55a0b49d84db0072c91aa87cb19476852 (patch) | |
tree | 256947d75248bd31a4cf4da3db8fb29eed3d5b84 /src | |
parent | 60356f3375da67375e48691bb1d732c02d1681a1 (diff) | |
download | strongswan-107936f55a0b49d84db0072c91aa87cb19476852.tar.bz2 strongswan-107936f55a0b49d84db0072c91aa87cb19476852.tar.xz |
added charondebug config parameter to set debug level at startup
Diffstat (limited to 'src')
-rw-r--r-- | src/starter/args.c | 3 | ||||
-rw-r--r-- | src/starter/confread.h | 3 | ||||
-rw-r--r-- | src/starter/invokecharon.c | 35 | ||||
-rw-r--r-- | src/starter/ipsec.conf.5 | 11 | ||||
-rw-r--r-- | src/starter/keywords.h | 3 | ||||
-rw-r--r-- | src/starter/keywords.txt | 1 |
6 files changed, 52 insertions, 4 deletions
diff --git a/src/starter/args.c b/src/starter/args.c index a473cf639..5cf96abde 100644 --- a/src/starter/args.c +++ b/src/starter/args.c @@ -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.plutostart), LST_bool }, - /* pluto keywords */ + /* pluto/charon keywords */ { 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.postpluto), NULL }, { ARG_ENUM, offsetof(starter_config_t, setup.uniqueids), LST_bool }, diff --git a/src/starter/confread.h b/src/starter/confread.h index 465652c02..918dea397 100644 --- a/src/starter/confread.h +++ b/src/starter/confread.h @@ -152,8 +152,9 @@ struct starter_config { bool charonstart; bool plutostart; - /* pluto keywords */ + /* pluto/charon keywords */ char **plutodebug; + char *charondebug; char *prepluto; char *postpluto; bool uniqueids; diff --git a/src/starter/invokecharon.c b/src/starter/invokecharon.c index 1a03dff20..02239daf1 100644 --- a/src/starter/invokecharon.c +++ b/src/starter/invokecharon.c @@ -102,7 +102,10 @@ starter_start_charon (starter_config_t *cfg, bool debug) struct stat stb; int argc = 1; 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) @@ -114,6 +117,36 @@ starter_start_charon (starter_config_t *cfg, bool debug) 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) { plog("starter_start_charon(): charon already started..."); diff --git a/src/starter/ipsec.conf.5 b/src/starter/ipsec.conf.5 index a0e926078..324b041ad 100644 --- a/src/starter/ipsec.conf.5 +++ b/src/starter/ipsec.conf.5 @@ -1076,6 +1076,17 @@ separated by white space) are enabled; for details on available debugging types, see .IR ipsec_pluto (8). .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 additional options to pass to pluto upon startup. See .IR ipsec_pluto (8). diff --git a/src/starter/keywords.h b/src/starter/keywords.h index d62a83df8..f574c77b0 100644 --- a/src/starter/keywords.h +++ b/src/starter/keywords.h @@ -25,8 +25,9 @@ typedef enum { KW_CHARONSTART, KW_PLUTOSTART, - /* pluto keywords */ + /* pluto/charon keywords */ KW_PLUTODEBUG, + KW_CHARONDEBUG, KW_PREPLUTO, KW_POSTPLUTO, KW_UNIQUEIDS, diff --git a/src/starter/keywords.txt b/src/starter/keywords.txt index 789c8f3a7..6952d4e9b 100644 --- a/src/starter/keywords.txt +++ b/src/starter/keywords.txt @@ -32,6 +32,7 @@ charonstart, KW_CHARONSTART plutostart, KW_PLUTOSTART klipsdebug, KW_KLIPSDEBUG plutodebug, KW_PLUTODEBUG +charondebug, KW_CHARONDEBUG prepluto, KW_PREPLUTO postpluto, KW_POSTPLUTO fragicmp, KW_FRAGICMP |