summaryrefslogtreecommitdiffstats
path: root/src/vnet/ip
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/ip')
-rw-r--r--src/vnet/ip/punt.c22
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;
}
/*?