diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-11-30 04:36:24 +0100 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-11-30 04:36:24 +0100 |
commit | a18b49e7c6271b0079fd673ceb3479399ed8099c (patch) | |
tree | 6b21b121ea9c8e0b8037b85ebc88fe7ec3052315 /src/config.y | |
parent | d5a043a7c0672df5da19a6024da4ab1af45151a9 (diff) | |
download | fastd-a18b49e7c6271b0079fd673ceb3479399ed8099c.tar fastd-a18b49e7c6271b0079fd673ceb3479399ed8099c.zip |
Clean up some parts of the configuration handling (and fix a few little bugs)
Diffstat (limited to 'src/config.y')
-rw-r--r-- | src/config.y | 23 |
1 files changed, 9 insertions, 14 deletions
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; + } } ; |