diff options
author | Florin Coras <fcoras@cisco.com> | 2017-11-07 17:06:36 -0800 |
---|---|---|
committer | Chris Luke <chris_luke@comcast.com> | 2017-11-08 02:22:12 +0000 |
commit | e1682c40447137a055af4e61a32cd605a5ad3c4f (patch) | |
tree | b0ac9a5412ecf72f000144c8f707a8e312d517d2 /src/vnet/ip/lookup.c | |
parent | 85dbac081d3168064131727553370d2b9983ddd6 (diff) |
ip: fix container proxy coverity warning
Change-Id: I5e35921acb65157a3de8ea0c53b3a6fa5cfca044
Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/ip/lookup.c')
-rw-r--r-- | src/vnet/ip/lookup.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/vnet/ip/lookup.c b/src/vnet/ip/lookup.c index a376e51d789..9bb53f5e8c0 100644 --- a/src/vnet/ip/lookup.c +++ b/src/vnet/ip/lookup.c @@ -1505,14 +1505,14 @@ ip_container_cmd (vlib_main_t * vm, { unformat_input_t _line_input, *line_input = &_line_input; fib_prefix_t pfx; - - u32 is_del; + u32 is_del, addr_set = 0; vnet_main_t *vnm; u32 sw_if_index; vnm = vnet_get_main (); is_del = 0; sw_if_index = ~0; + memset (&pfx, 0, sizeof (pfx)); /* Get a line of input. */ if (!unformat_user (main_input, unformat_line_input, line_input)) @@ -1524,12 +1524,14 @@ ip_container_cmd (vlib_main_t * vm, { pfx.fp_proto = FIB_PROTOCOL_IP4; pfx.fp_len = 32; + addr_set = 1; } else if (unformat (line_input, "%U", unformat_ip6_address, &pfx.fp_addr.ip6)) { pfx.fp_proto = FIB_PROTOCOL_IP6; pfx.fp_len = 128; + addr_set = 1; } else if (unformat (line_input, "%U", unformat_vnet_sw_interface, vnm, &sw_if_index)) @@ -1541,9 +1543,10 @@ ip_container_cmd (vlib_main_t * vm, format_unformat_error, line_input)); } - if (~0 == sw_if_index) + if (~0 == sw_if_index || !addr_set) { - return (clib_error_return (0, "no interface")); + vlib_cli_output (vm, "interface and address must be set"); + return 0; } vnet_ip_container_proxy_args_t args = { |