From efdd366144118b5f1a7bcef983a1888975aeefa0 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Fri, 15 Nov 2013 05:49:37 +0100 Subject: config: move check for no configured method First check all error conditions before getting to the warnings (this is important for --generate-key). Also, downgrade the exit_bug to exit_error if method `null' is not supported. --- src/config.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/config.c') diff --git a/src/config.c b/src/config.c index f46bb68..9f8fab7 100644 --- a/src/config.c +++ b/src/config.c @@ -508,12 +508,6 @@ 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; - if (!conf->methods) { - pr_warn(ctx, "no encryption method configured, falling back to method `null' (unencrypted)"); - if (!fastd_config_method(ctx, conf, "null")) - exit_bug(ctx, "method `null' not supported"); - } - ctx->conf = conf; if (conf->generate_key || conf->show_key) @@ -541,6 +535,12 @@ void fastd_configure(fastd_context_t *ctx, fastd_config_t *conf, int argc, char exit_error(ctx, "config error: setting pmtu is not supported on this system"); #endif + if (!conf->methods) { + pr_warn(ctx, "no encryption method configured, falling back to method `null' (unencrypted)"); + if (!fastd_config_method(ctx, conf, "null")) + exit_error(ctx, "method `null' not supported"); + } + if (!conf->secure_handshakes_set) pr_warn(ctx, "`secure handshakes' not set, please read the documentation about this option; defaulting to no"); -- cgit v1.2.3