]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: optimize label copy for new path_info
authorLouis Scalbert <louis.scalbert@6wind.com>
Mon, 26 Feb 2024 11:16:16 +0000 (12:16 +0100)
committerLouis Scalbert <louis.scalbert@6wind.com>
Wed, 5 Jun 2024 09:08:46 +0000 (11:08 +0200)
In bgp_update(), path_info *new has just been created and has void
labels. bgp_labels_same() is always false.

Do not compare previous labels before setting them.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
bgpd/bgp_route.c

index b8fdb8999638edc8e7498f1bde46026bd6e84563..8da30e789563d02fd226c6e81a94f8e60e8bc2de 100644 (file)
@@ -5239,12 +5239,8 @@ void bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
        /* Update MPLS label */
        if (has_valid_label) {
                extra = bgp_path_info_extra_get(new);
-               if (!bgp_labels_same((const mpls_label_t *)extra->label,
-                                    extra->num_labels, label, num_labels)) {
-                       memcpy(&extra->label, label,
-                              num_labels * sizeof(mpls_label_t));
-                       extra->num_labels = num_labels;
-               }
+               memcpy(&extra->label, label, num_labels * sizeof(mpls_label_t));
+               extra->num_labels = num_labels;
                if (!(afi == AFI_L2VPN && safi == SAFI_EVPN))
                        bgp_set_valid_label(&extra->label[0]);
        }