From 1b708845633f7ddb816f81aed82f55fd9522fbcf Mon Sep 17 00:00:00 2001 From: Swarup Nayak Date: Wed, 13 Dec 2017 13:27:23 +0530 Subject: VPP-1100 Fix loop in "set punt tcp/udp command" Change-Id: I23081ea25a8d40d8ebe1fcb6efe4143e9c5a0fc6 Signed-off-by: Swarup Nayak --- src/vnet/ip/punt.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'src/vnet') diff --git a/src/vnet/ip/punt.c b/src/vnet/ip/punt.c index db3ea332fbd..568350cda82 100644 --- a/src/vnet/ip/punt.c +++ b/src/vnet/ip/punt.c @@ -739,7 +739,7 @@ punt_cli (vlib_main_t * vm, u32 port; bool is_add = true; u32 protocol = ~0; - clib_error_t *error; + clib_error_t *error = NULL; while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) { @@ -750,22 +750,34 @@ punt_cli (vlib_main_t * vm, /* punt both IPv6 and IPv4 when used in CLI */ error = vnet_punt_add_del (vm, ~0, protocol, ~0, is_add); if (error) - clib_error_report (error); + { + clib_error_report (error); + goto done; + } } else if (unformat (input, "%d", &port)) { /* punt both IPv6 and IPv4 when used in CLI */ error = vnet_punt_add_del (vm, ~0, protocol, port, is_add); if (error) - clib_error_report (error); + { + clib_error_report (error); + goto done; + } } else if (unformat (input, "udp")) protocol = IP_PROTOCOL_UDP; else if (unformat (input, "tcp")) protocol = IP_PROTOCOL_TCP; + else + { + error = clib_error_return (0, "parse error: '%U'", + format_unformat_error, input); + goto done; + } } - - return 0; +done: + return error; } /*? -- cgit 1.2.3-korg