diff options
author | Swarup Nayak <swarupnpvt@gmail.com> | 2017-12-11 13:52:44 +0530 |
---|---|---|
committer | Swarup Nayak <swarupnpvt@gmail.com> | 2017-12-20 06:13:44 +0000 |
commit | ecf844cbaecd6cd3a69fd5b7c747dce616a86de8 (patch) | |
tree | 9c8e205af03df079fed570176511f5f4d56e6067 /src/vnet/ip/ip4_punt_drop.c | |
parent | be302d72031a7620fd1e79a620a99e8822bbac28 (diff) |
VPP-1083 "ip punt redirect add" crashed if not mentioned any other parameter
Change-Id: Ibb6f450783d0ab64bd943c19f12d0954b0a94b24
Signed-off-by: Swarup Nayak <swarupnpvt@gmail.com>
Diffstat (limited to 'src/vnet/ip/ip4_punt_drop.c')
-rw-r--r-- | src/vnet/ip/ip4_punt_drop.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/vnet/ip/ip4_punt_drop.c b/src/vnet/ip/ip4_punt_drop.c index 5f40e14754a..4e74963f742 100644 --- a/src/vnet/ip/ip4_punt_drop.c +++ b/src/vnet/ip/ip4_punt_drop.c @@ -390,8 +390,8 @@ ip4_punt_redirect_cmd (vlib_main_t * vm, { unformat_input_t _line_input, *line_input = &_line_input; clib_error_t *error = 0; - u32 rx_sw_if_index; - u32 tx_sw_if_index; + u32 rx_sw_if_index = 0; + u32 tx_sw_if_index = 0; ip46_address_t nh; vnet_main_t *vnm; u8 is_add; @@ -429,9 +429,19 @@ ip4_punt_redirect_cmd (vlib_main_t * vm, } if (is_add) - ip4_punt_redirect_add (rx_sw_if_index, tx_sw_if_index, &nh); + { + if (rx_sw_if_index && tx_sw_if_index) + { + ip4_punt_redirect_add (rx_sw_if_index, tx_sw_if_index, &nh); + } + } else - ip4_punt_redirect_del (rx_sw_if_index); + { + if (rx_sw_if_index) + { + ip4_punt_redirect_del (rx_sw_if_index); + } + } done: unformat_free (line_input); |