diff options
Diffstat (limited to 'src/vnet/ip')
-rw-r--r-- | src/vnet/ip/ip4_punt_drop.c | 18 | ||||
-rw-r--r-- | src/vnet/ip/ip6_punt_drop.c | 18 |
2 files changed, 28 insertions, 8 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); diff --git a/src/vnet/ip/ip6_punt_drop.c b/src/vnet/ip/ip6_punt_drop.c index a46b7d9024f..88527756966 100644 --- a/src/vnet/ip/ip6_punt_drop.c +++ b/src/vnet/ip/ip6_punt_drop.c @@ -301,8 +301,8 @@ ip6_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; @@ -340,9 +340,19 @@ ip6_punt_redirect_cmd (vlib_main_t * vm, } if (is_add) - ip6_punt_redirect_add (rx_sw_if_index, tx_sw_if_index, &nh); + { + if (rx_sw_if_index && tx_sw_if_index) + { + ip6_punt_redirect_add (rx_sw_if_index, tx_sw_if_index, &nh); + } + } else - ip6_punt_redirect_del (rx_sw_if_index); + { + if (rx_sw_if_index) + { + ip6_punt_redirect_del (rx_sw_if_index); + } + } done: unformat_free (line_input); |