From f7cdd48892dafe00b8956cd2b087814d0257bdb4 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 16 Dec 2013 21:51:04 +0100 Subject: config: don't check configuration before logging has been set up --- src/config.c | 7 ++----- src/config.h | 1 + src/fastd.c | 3 +++ 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/config.c b/src/config.c index 6b91383..9e04299 100644 --- a/src/config.c +++ b/src/config.c @@ -529,12 +529,9 @@ void fastd_configure(fastd_context_t *ctx, fastd_config_t *conf, int argc, char if (!conf->log_stderr_level && !conf->log_syslog_level && !conf->log_files) conf->log_stderr_level = FASTD_DEFAULT_LOG_LEVEL; +} - ctx->conf = conf; - - if (conf->generate_key || conf->show_key) - return; - +void fastd_config_check(fastd_context_t *ctx, fastd_config_t *conf) { if (conf->ifname) { if (strchr(conf->ifname, '/')) exit_error(ctx, "config error: invalid interface name"); diff --git a/src/config.h b/src/config.h index d12e5ef..9484598 100644 --- a/src/config.h +++ b/src/config.h @@ -40,6 +40,7 @@ void fastd_config_peer_group_push(fastd_context_t *ctx, fastd_config_t *conf, co void fastd_config_peer_group_pop(fastd_context_t *ctx, fastd_config_t *conf); void fastd_config_release(fastd_context_t *ctx, fastd_config_t *conf); void fastd_configure(fastd_context_t *ctx, fastd_config_t *conf, int argc, char *const argv[]); +void fastd_config_check(fastd_context_t *ctx, fastd_config_t *conf); void fastd_config_load_peer_dirs(fastd_context_t *ctx, fastd_config_t *conf); void fastd_config_handle_options(fastd_context_t *ctx, fastd_config_t *conf, int argc, char *const argv[]); diff --git a/src/fastd.c b/src/fastd.c index d6bfa2f..e456f14 100644 --- a/src/fastd.c +++ b/src/fastd.c @@ -879,6 +879,7 @@ int main(int argc, char *argv[]) { fastd_config_t conf; fastd_configure(&ctx, &conf, argc, argv); + ctx.conf = &conf; if (conf.generate_key) { conf.protocol->generate_key(&ctx); @@ -899,6 +900,8 @@ int main(int argc, char *argv[]) { init_log(&ctx); + fastd_config_check(&ctx, &conf); + update_time(&ctx); conf.long_ago = ctx.now; -- cgit v1.2.3