summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2013-11-15 05:49:37 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2013-11-15 05:49:37 +0100
commitefdd366144118b5f1a7bcef983a1888975aeefa0 (patch)
tree07c5a879c3f1e268926d528caea557fb1f4471bd
parent0504f57c91eb7dd2ac4adfc6906e006f775a76e4 (diff)
downloadfastd-efdd366144118b5f1a7bcef983a1888975aeefa0.tar
fastd-efdd366144118b5f1a7bcef983a1888975aeefa0.zip
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.
-rw-r--r--src/config.c12
1 files changed, 6 insertions, 6 deletions
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");