summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShivaShankarK <shivaashankar1204@gmail.com>2020-04-10 18:20:02 +0530
committerAndrew Yourtchenko <ayourtch@gmail.com>2020-08-13 17:20:47 +0000
commitc36a90318c0e487296c0123815cd9cfc879bc3cf (patch)
treeb86aaa05c4b59e151ce978c5170b941113fa7a72
parente8a333e2f203dd504667ad268587ee72c7b22798 (diff)
fib: fix accessing empty dpo pool elements
Type: fix Signed-off-by: ShivaShankarK <shivaashankar1204@gmail.com> Change-Id: Iee88a2101ce42d7f1cdb65df532c349d14829e4c (cherry picked from commit 35acaac1843839f94e9bd40ad45a8d170a155f22)
-rw-r--r--src/vnet/dpo/lookup_dpo.c5
-rw-r--r--src/vnet/dpo/replicate_dpo.c5
2 files changed, 8 insertions, 2 deletions
diff --git a/src/vnet/dpo/lookup_dpo.c b/src/vnet/dpo/lookup_dpo.c
index ec2cd02653b..daa2352f649 100644
--- a/src/vnet/dpo/lookup_dpo.c
+++ b/src/vnet/dpo/lookup_dpo.c
@@ -1467,7 +1467,10 @@ lookup_dpo_show (vlib_main_t * vm,
if (INDEX_INVALID != lkdi)
{
- vlib_cli_output (vm, "%U", format_lookup_dpo, lkdi);
+ if (pool_is_free_index(lookup_dpo_pool, lkdi))
+ vlib_cli_output (vm, "no such index %d", lkdi);
+ else
+ vlib_cli_output (vm, "%U", format_lookup_dpo, lkdi);
}
else
{
diff --git a/src/vnet/dpo/replicate_dpo.c b/src/vnet/dpo/replicate_dpo.c
index 998a729dcd2..cd753dcd35b 100644
--- a/src/vnet/dpo/replicate_dpo.c
+++ b/src/vnet/dpo/replicate_dpo.c
@@ -687,7 +687,10 @@ replicate_show (vlib_main_t * vm,
if (INDEX_INVALID != repi)
{
- vlib_cli_output (vm, "%U", format_replicate, repi,
+ if (pool_is_free_index (replicate_pool, repi))
+ vlib_cli_output (vm, "no such index %d", repi);
+ else
+ vlib_cli_output (vm, "%U", format_replicate, repi,
REPLICATE_FORMAT_DETAIL);
}
else