From b2e576bb172fcce419e639216393126c94fc99fa Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 23 Mar 2015 05:20:03 +0100 Subject: Improve ifname configuration handling --- src/config.y | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/config.y') diff --git a/src/config.y b/src/config.y index 36b7368..fb2ceee 100644 --- a/src/config.y +++ b/src/config.y @@ -302,7 +302,12 @@ log_level: TOK_FATAL { $$ = LL_FATAL; } | TOK_DEBUG2 { $$ = LL_DEBUG2; } ; -interface: TOK_STRING { free(conf.ifname); conf.ifname = fastd_strdup($1->str); } +interface: TOK_STRING { + if (!fastd_config_ifname(NULL, $1->str)) { + fastd_config_error(&@$, state, "invalid interface name"); + YYERROR; + } + } ; bind: bind_address maybe_bind_interface maybe_bind_default { @@ -528,8 +533,10 @@ peer_key: TOK_STRING { ; peer_interface: TOK_STRING { - free(state->peer->ifname); - state->peer->ifname = fastd_strdup($1->str); + if (!fastd_config_ifname(state->peer, $1->str)) { + fastd_config_error(&@$, state, "invalid interface name"); + YYERROR; + } } ; -- cgit v1.2.3