summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonald Sharp <donaldsharp72@gmail.com>2024-01-28 09:20:56 -0500
committerGitHub <noreply@github.com>2024-01-28 09:20:56 -0500
commit4d92badcde7573b97d2acc2228d0ca5fe7168e1e (patch)
tree9e98970fc49dfa57d93efca6e5c720cb1d49b979
parent4cb03cacd94ef57989a160e626fd2c273b9d1888 (diff)
parentdb1bb52c4b618c68407cbde3e65386fa44824d6f (diff)
Merge pull request #15236 from louis-6wind/fix-label-cmp
bgpd: fix mpls label pointer comparison
-rw-r--r--bgpd/bgp_route.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index ae3a88ddcc..8bcbd3dd8c 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -4520,12 +4520,12 @@ void bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
hook_call(bgp_process, bgp, afi, safi, dest, peer, true);
/* Same attribute comes in. */
- if (!CHECK_FLAG(pi->flags, BGP_PATH_REMOVED)
- && same_attr
- && (!has_valid_label
- || memcmp(&(bgp_path_info_extra_get(pi))->label, label,
- num_labels * sizeof(mpls_label_t))
- == 0)) {
+ if (!CHECK_FLAG(pi->flags, BGP_PATH_REMOVED) && same_attr &&
+ (!has_valid_label ||
+ (bgp_path_info_extra_get(pi) &&
+ bgp_labels_same((const mpls_label_t *)pi->extra->label,
+ pi->extra->num_labels, label,
+ num_labels)))) {
if (CHECK_FLAG(bgp->af_flags[afi][safi],
BGP_CONFIG_DAMPENING)
&& peer->sort == BGP_PEER_EBGP
@@ -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;