From e68550b8d8371db16d9c7600bfb625354ae4395c Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Thu, 24 Oct 2024 11:40:56 -0400 Subject: [PATCH] bgpd: Only grab the confed path count if we are comparing it This is just a small optimization but when calling path_info_cmp hundreds of millions of times this adds up. Signed-off-by: Donald Sharp --- bgpd/bgp_route.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 53cc9a10b5..6fa1505998 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -1133,9 +1133,9 @@ int bgp_path_info_cmp(struct bgp *bgp, struct bgp_path_info *new, /* 4. AS path length check. */ if (!CHECK_FLAG(bgp->flags, BGP_FLAG_ASPATH_IGNORE)) { int exist_hops = aspath_count_hops(existattr->aspath); - int exist_confeds = aspath_count_confeds(existattr->aspath); if (CHECK_FLAG(bgp->flags, BGP_FLAG_ASPATH_CONFED)) { + int exist_confeds = aspath_count_confeds(existattr->aspath); int aspath_hops; aspath_hops = aspath_count_hops(newattr->aspath);