From a18b49e7c6271b0079fd673ceb3479399ed8099c Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 30 Nov 2013 04:36:24 +0100 Subject: Clean up some parts of the configuration handling (and fix a few little bugs) --- src/config.y | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) (limited to 'src/config.y') diff --git a/src/config.y b/src/config.y index 68d41a4..dfa8a18 100644 --- a/src/config.y +++ b/src/config.y @@ -242,10 +242,7 @@ log: TOK_LEVEL log_level { conf->log_syslog_level = $5; } | TOK_TO TOK_STRING maybe_log_level { - if (!fastd_config_add_log_file(ctx, conf, $2->str, $3)) { - fastd_config_error(&@$, ctx, conf, filename, depth, "unable to set log file"); - YYERROR; - } + fastd_config_add_log_file(ctx, conf, $2->str, $3); } ; @@ -275,10 +272,7 @@ interface: TOK_STRING { free(conf->ifname); conf->ifname = strdup($1->str); } ; bind: bind_address maybe_bind_interface maybe_bind_default { - if (!fastd_config_bind_address(ctx, conf, &$1, $2 ? $2->str : NULL, $3 == AF_UNSPEC || $3 == AF_INET, $3 == AF_UNSPEC || $3 == AF_INET6)) { - fastd_config_error(&@$, ctx, conf, filename, depth, "invalid bind directive"); - YYERROR; - } + fastd_config_bind_address(ctx, conf, &$1, $2 ? $2->str : NULL, $3 == AF_UNSPEC || $3 == AF_INET, $3 == AF_UNSPEC || $3 == AF_INET6); } ; @@ -325,7 +319,7 @@ bind_default: ; mtu: TOK_UINT { - if (conf->mtu < 576 || $1 > 65535) { + if ($1 < 576 || $1 > 65535) { fastd_config_error(&@$, ctx, conf, filename, depth, "invalid MTU"); YYERROR; } @@ -342,10 +336,7 @@ mode: TOK_TAP { conf->mode = MODE_TAP; } ; protocol: TOK_STRING { - if (!fastd_config_protocol(ctx, conf, $1->str)) { - fastd_config_error(&@$, ctx, conf, filename, depth, "unsupported protocol"); - YYERROR; - } + fastd_config_protocol(ctx, conf, $1->str); } ; @@ -470,7 +461,11 @@ peer_remote: TOK_ADDR4 port { (*remote)->hostname = strdup($2->str); (*remote)->address.sa.sa_family = $1; (*remote)->address.in.sin_port = htons($3); - conf->peers->floating = conf->peers->dynamic_float_deprecated = $4; + + if ($4) { + conf->peers->floating = true; + conf->peers->dynamic_float_deprecated = true; + } } ; -- cgit v1.2.3