summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2023-09-07 15:25:27 -0400
committerDonald Sharp <sharpd@nvidia.com>2023-09-07 15:31:55 -0400
commitc2f0fd315f661ceb9238959e5854db41ccea010a (patch)
treea2941724b55d3c76c4beba5037693a8fb114edd3
parentd16d013ca3d191b4768365934fbb3ebebf3facc3 (diff)
bgpd: Properly use bgp_path_info_cmp for evpn usage
Currently evpn passes into bgp_path_info_cmp the pfx_buf uninitialized. The bgp_path_info_cmp functionality actually expects this value to be initialized. Additionally the evpn section of bgp_path_info_comp was resetting the new_buf and exist_buf values that were already being set above to the same values if !debug was on( which precluded it ever from happening ) Signed-off-by: Donald Sharp <sharpd@nvidia.com>
-rw-r--r--bgpd/bgp_route.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index dadc100706..aaa43d8a74 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -715,16 +715,6 @@ int bgp_path_info_cmp(struct bgp *bgp, struct bgp_path_info *new,
* sticky flag.
*/
if (newattr->sticky != existattr->sticky) {
- if (!debug) {
- prefix2str(new_p, pfx_buf,
- sizeof(*pfx_buf)
- * PREFIX2STR_BUFFER);
- bgp_path_info_path_with_addpath_rx_str(
- new, new_buf, sizeof(new_buf));
- bgp_path_info_path_with_addpath_rx_str(
- exist, exist_buf, sizeof(exist_buf));
- }
-
if (newattr->sticky && !existattr->sticky) {
*reason = bgp_path_selection_evpn_sticky_mac;
if (debug)
@@ -1505,6 +1495,10 @@ int bgp_evpn_path_info_cmp(struct bgp *bgp, struct bgp_path_info *new,
char pfx_buf[PREFIX2STR_BUFFER] = {};
bool debug = false;
+ if (debug)
+ prefix2str(bgp_dest_get_prefix(new->net), pfx_buf,
+ sizeof(pfx_buf));
+
return bgp_path_info_cmp(bgp, new, exist, paths_eq, NULL, debug,
pfx_buf, AFI_L2VPN, SAFI_EVPN, &reason);
}