-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bgpd: fix mpls label pointer comparison #15236
Conversation
bgpd/bgp_route.c
Outdated
@@ -4710,7 +4710,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(pi); | |||
if (extra->label != label) { | |||
if (memcmp(&extra->label[0], &label[0], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is bgp_labels_same insufficient?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I even think this is wrong now that I look at it some more. if label( that is passed in ) has 1 label in the array and extra->label has 2, we are not comparing anything of value here at all. Look at num_labels passed in as well as extra->num_labels they should be taken into account.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done - I had put it in draft form while I fixed it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe BGP should be using bgp_labels_same() instead of this. Please adjust.
ecfeeb3
to
94cf78c
Compare
do you ahve a specific scenario where this failed? In other words how did you find it? |
Oh, this seems not finished yet, compile issues. |
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: 8ba7105 ("bgpd: fix valgrind flagged errors") Signed-off-by: Philippe Guibert <[email protected]> Signed-off-by: Louis Scalbert <[email protected]>
94cf78c
to
f254f4b
Compare
No specific scenario. Just by working on extra->label to attr->label move |
Use bgp_labels_same() for all label comparisons in bgpd. Signed-off-by: Louis Scalbert <[email protected]>
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: 8ba7105 ("bgpd: fix valgrind flagged errors")