From 0277936a2cb2228eb5367b83297707d360721fb3 Mon Sep 17 00:00:00 2001 From: Visakha Erina Date: Wed, 19 Jun 2019 06:38:31 -0700 Subject: [PATCH] lib: Keep proper count of prefix-list hit-count when used When a prefix-list is applied to a BGP neighbor to deny the learning of specific routes, the hit count is showing 0 for BGP even though the routes are being filtered correctly due to the configured prefix-list. Before fix: c1# show ip prefix-list nag seq 10 ZEBRA: seq 10 permit any (hit count: 0, refcount: 0) BGP: seq 10 permit any (hit count: 0, refcount: 0) c1# show ip prefix-list nag seq 5 ZEBRA: seq 5 deny 1.0.1.0/24 (hit count: 0, refcount: 0) BGP: seq 5 deny 1.0.1.0/24 (hit count: 0, refcount: 0) Fix: Increment the prefix-list's hit count whenever a rule match occurs. After Fix: c1# show ip prefix-list nag seq 10 ZEBRA: seq 10 permit any (hit count: 0, refcount: 0) BGP: seq 10 permit any (hit count: 6, refcount: 0) c1# show ip prefix-list nag seq 5 ZEBRA: seq 5 deny 1.0.1.0/24 (hit count: 0, refcount: 0) BGP: seq 5 deny 1.0.1.0/24 (hit count: 1, refcount: 0) Signed-off-by: Visakha Erina visakha.erina@broadcom.com --- lib/plist.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/plist.c b/lib/plist.c index 54ea742c66..1ba8982499 100644 --- a/lib/plist.c +++ b/lib/plist.c @@ -750,6 +750,7 @@ enum prefix_list_type prefix_list_apply_which_prefix( if (pbest == NULL) return PREFIX_DENY; + pbest->hitcnt++; return pbest->type; } -- 2.39.5