]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: fix mpls label pointer comparison
authorPhilippe Guibert <philippe.guibert@6wind.com>
Wed, 15 Feb 2023 13:37:45 +0000 (14:37 +0100)
committerLouis Scalbert <louis.scalbert@6wind.com>
Fri, 26 Jan 2024 09:16:11 +0000 (10:16 +0100)
Comparing pointers is not the appropriate way to know
if the label values are the same or not. Perform a
memcmp call instead is better.

Fixes: 8ba710505735 ("bgpd: fix valgrind flagged errors")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
bgpd/bgp_route.c

index ae3a88ddcc2c978cc9acb2ec99a97be3daaac351..997d57117ca4a4b4e0d3289d2b5dda45b3bb0556 100644 (file)
@@ -4710,7 +4710,9 @@ 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(pi);
-                       if (extra->label != label) {
+                       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;
@@ -4909,7 +4911,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 (extra->label != label) {
+               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;