summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2024-10-24 17:40:56 +0200
committerDonald Sharp <sharpd@nvidia.com>2024-10-25 03:01:26 +0200
commite68550b8d8371db16d9c7600bfb625354ae4395c (patch)
treebc0b9543a987c88b5901e56c3ba6b11056689fa4
parentbgpd: Store aspath count after aspath has changed (diff)
downloadfrr-e68550b8d8371db16d9c7600bfb625354ae4395c.tar.xz
frr-e68550b8d8371db16d9c7600bfb625354ae4395c.zip
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 <sharpd@nvidia.com>
-rw-r--r--bgpd/bgp_route.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 53cc9a10b..6fa150599 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);