diff options
author | Swarup Nayak <swarupnpvt@gmail.com> | 2017-12-13 13:27:23 +0530 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2017-12-14 20:33:58 +0000 |
commit | 1b708845633f7ddb816f81aed82f55fd9522fbcf (patch) | |
tree | 0a97293af3ae79d0c14d1445a44a574449b61085 /src/vnet/ip/punt.c | |
parent | 2752b89ead002d1f07d840db0e925f3229e0f178 (diff) |
VPP-1100 Fix loop in "set punt tcp/udp command"
Change-Id: I23081ea25a8d40d8ebe1fcb6efe4143e9c5a0fc6
Signed-off-by: Swarup Nayak <swarupnpvt@gmail.com>
Diffstat (limited to 'src/vnet/ip/punt.c')
-rw-r--r-- | src/vnet/ip/punt.c | 22 |
1 files changed, 17 insertions, 5 deletions
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; } /*? |