VPP-1092 Correcting ip punt delete flow, when recv if index valid but doesnt exist in configuration
Change-Id: I01a69c4eef2c6224a24907b8fed12dcb1b642307
Signed-off-by: Swarup Nayak <swarupnpvt@gmail.com>
diff --git a/src/vnet/ip/ip4_punt_drop.c b/src/vnet/ip/ip4_punt_drop.c
index ceb1bb8..5f40e14 100644
--- a/src/vnet/ip/ip4_punt_drop.c
+++ b/src/vnet/ip/ip4_punt_drop.c
@@ -115,6 +115,7 @@
ip_punt_redirect_t ip4_punt_redirect_cfg = {
.any_rx_sw_if_index = {
.tx_sw_if_index = ~0,
+ .adj_index = ADJ_INDEX_INVALID,
},
};
/* *INDENT-ON* */
@@ -309,6 +310,7 @@
*/
ip_punt_redirect_rx_t uninit_rx_redirect = {
.tx_sw_if_index = ~0,
+ .adj_index = ADJ_INDEX_INVALID,
};
void
@@ -351,6 +353,9 @@
old = &cfg->redirect_by_rx_sw_if_index[rx_sw_if_index];
}
+ if ((old == NULL) || (old->adj_index == ADJ_INDEX_INVALID))
+ return;
+
adj_unlock (old->adj_index);
*old = uninit_rx_redirect;
}
diff --git a/src/vnet/ip/ip6_punt_drop.c b/src/vnet/ip/ip6_punt_drop.c
index 4c4240e..a46b7d9 100644
--- a/src/vnet/ip/ip6_punt_drop.c
+++ b/src/vnet/ip/ip6_punt_drop.c
@@ -207,14 +207,15 @@
.function = ip6_punt_police_cmd,
.short_help = "ip6 punt policer [add|del] <index>",
};
-/* *INDENT-ON* */
+
ip_punt_redirect_t ip6_punt_redirect_cfg = {
.any_rx_sw_if_index = {
- .tx_sw_if_index = ~0,
- }
- ,
+ .tx_sw_if_index = ~0,
+ .adj_index = ADJ_INDEX_INVALID,
+ },
};
+/* *INDENT-ON* */
#define foreach_ip6_punt_redirect_error \
_(DROP, "ip6 punt redirect drop")