aboutsummaryrefslogtreecommitdiffstats
path: root/src/starter/invokecharon.c
diff options
context:
space:
mode:
authorMartin Willi <martin@strongswan.org>2006-10-18 11:46:57 +0000
committerMartin Willi <martin@strongswan.org>2006-10-18 11:46:57 +0000
commit107936f55a0b49d84db0072c91aa87cb19476852 (patch)
tree256947d75248bd31a4cf4da3db8fb29eed3d5b84 /src/starter/invokecharon.c
parent60356f3375da67375e48691bb1d732c02d1681a1 (diff)
downloadstrongswan-107936f55a0b49d84db0072c91aa87cb19476852.tar.bz2
strongswan-107936f55a0b49d84db0072c91aa87cb19476852.tar.xz
added charondebug config parameter to set debug level at startup
Diffstat (limited to 'src/starter/invokecharon.c')
-rw-r--r--src/starter/invokecharon.c35
1 files changed, 34 insertions, 1 deletions
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...");