Skip to content

Commit

Permalink
bgpd: Only grab the confed path count if we are comparing it
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
donaldsharp committed Dec 13, 2024
1 parent 9546dfd commit 60e8a96
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bgpd/bgp_route.c
Original file line number Diff line number Diff line change
Expand Up @@ -1096,9 +1096,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);
Expand Down

0 comments on commit 60e8a96

Please sign in to comment.