]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: Properly use bgp_path_info_cmp for evpn usage
authorDonald Sharp <sharpd@nvidia.com>
Thu, 7 Sep 2023 19:25:27 +0000 (15:25 -0400)
committerDonald Sharp <sharpd@nvidia.com>
Thu, 7 Sep 2023 19:31:55 +0000 (15:31 -0400)
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>
bgpd/bgp_route.c

index dadc100706976723703d8cb291b94a9f14dc4dfa..aaa43d8a7409d030941db76c59c28a46e61b2d0e 100644 (file)
@@ -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);
 }