summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSwarup Nayak <swarupnpvt@gmail.com>2017-12-11 13:52:44 +0530
committerSwarup Nayak <swarupnpvt@gmail.com>2017-12-20 06:13:44 +0000
commitecf844cbaecd6cd3a69fd5b7c747dce616a86de8 (patch)
tree9c8e205af03df079fed570176511f5f4d56e6067
parentbe302d72031a7620fd1e79a620a99e8822bbac28 (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>
-rw-r--r--src/vnet/ip/ip4_punt_drop.c18
-rw-r--r--src/vnet/ip/ip6_punt_drop.c18
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);