diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/config.y | 4 | ||||
-rw-r--r-- | src/options.c | 4 | ||||
-rw-r--r-- | src/options.def.h | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/src/config.y b/src/config.y index deaa100..55d0e94 100644 --- a/src/config.y +++ b/src/config.y @@ -311,7 +311,7 @@ bind_default: ; mtu: TOK_UINT { - if ($1 > 65535) { + if (conf->mtu < 576 || $1 > 65535) { fastd_config_error(&@$, ctx, conf, filename, depth, "invalid MTU"); YYERROR; } @@ -544,7 +544,7 @@ colon_or_port: ':' ; port: colon_or_port TOK_UINT { - if ($2 > 65535) { + if ($2 < 1 || $2 > 65535) { fastd_config_error(&@$, ctx, conf, filename, depth, "invalid port"); YYERROR; } diff --git a/src/options.c b/src/options.c index aba6bd6..7bab8bc 100644 --- a/src/options.c +++ b/src/options.c @@ -151,7 +151,7 @@ static void option_mtu(fastd_context_t *ctx, fastd_config_t *conf, const char *a char *endptr; conf->mtu = strtol(arg, &endptr, 10); - if (*endptr || conf->mtu < 576) + if (*endptr || conf->mtu < 576 || conf->mtu > 65535) exit_error(ctx, "invalid mtu `%s'", arg); } @@ -185,7 +185,7 @@ static void option_bind(fastd_context_t *ctx, fastd_config_t *conf, const char * if (charptr) { l = strtol(charptr+1, &endptr, 10); - if (*endptr || l < 0 || l > 65535) + if (*endptr || l < 1 || l > 65535) exit_error(ctx, "invalid bind port `%s'", charptr+1); } else { diff --git a/src/options.def.h b/src/options.def.h index 42e6d6f..dfb4983 100644 --- a/src/options.def.h +++ b/src/options.def.h @@ -15,7 +15,7 @@ OPTION_ARG(option_config_peer_dir, "--config-peer-dir", "<dir>", "Loads all file OPTION_ARG(option_mode, "--mode" OR "-m", "tap|tun", "Sets the mode of the interface"); OPTION_ARG(option_interface, "--interface" OR "-i", "<name>", "Sets the name of the TUN/TAP interface to use"); OPTION_ARG(option_mtu, "--mtu" OR "-M", "<mtu>", "Sets the MTU; must be at least 576"); -OPTION_ARG(option_bind, "--bind" OR "-b", "<address>:<port>", "Sets the bind address"); +OPTION_ARG(option_bind, "--bind" OR "-b", "<address>[:<port>]", "Sets the bind address"); OPTION_ARG(option_protocol, "--protocol" OR "-p", "<protocol>", "Sets the protocol"); OPTION_ARG(option_method, "--method", "<method>", "Sets the encryption method"); OPTION(option_forward, "--forward", "Enables forwarding of packets between peers; read the documentation before use!"); |