-
Notifications
You must be signed in to change notification settings - Fork 7.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
ZOOKEEPER-3726: invalid ipv6 address comparison #1252
Conversation
Hi guys, can you please review changes, or may be point me to some required actions? |
LGTM, I have one question which I'm not sure about at all, just seems logical to me. (See my code comment) Anyway, I would need someone else to also take a look, perhaps @symat who has more C experience. |
LGTM in general, nice catch! We already have similar logics here: zookeeper/zookeeper-client/zookeeper-client-c/src/zookeeper.c Lines 4957 to 4992 in db87335
It would be great to add a unit test for it (both for IPv4 and IPv6), but it seems to be a complicated issue to reproduce with unit tests. Please think about it. But I am OK to commit this without tests as well. |
Well, for sure it's almost impossible to reproduce full problem behavior. But it's possible to show how new addrvec_contains differs from the old one. In second commit I generate all addresses that differ by one bit from source. These tests can't pass on previous implementation. Also, I found 2 duplicate tickets for my issue: Both tickets have patches attached. ZOOKEEPER-2490 is not very elegant, but ZOOKEEPER-1677 even had tests (on which mine are based now). I am not really sure why they weren't merged, it looks like I am not the first one to encounter the bug. |
@symat 7 years have passed since bug discovery, I think it's time to merge the fix. |
agree, and I also like your unit tests, thanks for taking the time to implement them! :) |
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.
Okay, LGTM!
Sure, thanks for the notification! I'll merge it on Tuesday, if noone else does before. |
The kids woke up late, I think I can merge it now :) |
Thank you! |
Fix for https://issues.apache.org/jira/browse/ZOOKEEPER-3726 sockaddr_storage can contain ipv4 or ipv6 address. If address is ipv6, then we need to compare more bytes. In this PR correct comparison of sockaddr_storage was added. Author: Vladislav Tyulbashev <[email protected]> Reviewers: Norbert Kalmar <[email protected]>, Mate Szalay-Beko <[email protected]> Closes #1252 from vtyulb/ZOOKEEPER-3726 (cherry picked from commit 726f684) Signed-off-by: Mate Szalay-Beko <[email protected]>
Fix for https://issues.apache.org/jira/browse/ZOOKEEPER-3726 sockaddr_storage can contain ipv4 or ipv6 address. If address is ipv6, then we need to compare more bytes. In this PR correct comparison of sockaddr_storage was added. Author: Vladislav Tyulbashev <[email protected]> Reviewers: Norbert Kalmar <[email protected]>, Mate Szalay-Beko <[email protected]> Closes #1252 from vtyulb/ZOOKEEPER-3726 (cherry picked from commit 726f684) Signed-off-by: Mate Szalay-Beko <[email protected]>
I compiled and re-executed the C client tests on all branches (as this commit was tested by the CI a long time ago), everything seemed to be fine. @vtyulb Thanks again for your help and your patience! :) |
Fix for https://issues.apache.org/jira/browse/ZOOKEEPER-3726 sockaddr_storage can contain ipv4 or ipv6 address. If address is ipv6, then we need to compare more bytes. In this PR correct comparison of sockaddr_storage was added. Author: Vladislav Tyulbashev <[email protected]> Reviewers: Norbert Kalmar <[email protected]>, Mate Szalay-Beko <[email protected]> Closes #1252 from vtyulb/ZOOKEEPER-3726 (cherry picked from commit 726f684) Signed-off-by: Mate Szalay-Beko <[email protected]>
Fix for https://issues.apache.org/jira/browse/ZOOKEEPER-3726 sockaddr_storage can contain ipv4 or ipv6 address. If address is ipv6, then we need to compare more bytes. In this PR correct comparison of sockaddr_storage was added. Author: Vladislav Tyulbashev <[email protected]> Reviewers: Norbert Kalmar <[email protected]>, Mate Szalay-Beko <[email protected]> Closes apache#1252 from vtyulb/ZOOKEEPER-3726
Fix for https://issues.apache.org/jira/browse/ZOOKEEPER-3726 sockaddr_storage can contain ipv4 or ipv6 address. If address is ipv6, then we need to compare more bytes. In this PR correct comparison of sockaddr_storage was added. Author: Vladislav Tyulbashev <[email protected]> Reviewers: Norbert Kalmar <[email protected]>, Mate Szalay-Beko <[email protected]> Closes apache#1252 from vtyulb/ZOOKEEPER-3726
Fix for https://issues.apache.org/jira/browse/ZOOKEEPER-3726 sockaddr_storage can contain ipv4 or ipv6 address. If address is ipv6, then we need to compare more bytes. In this PR correct comparison of sockaddr_storage was added. Author: Vladislav Tyulbashev <[email protected]> Reviewers: Norbert Kalmar <[email protected]>, Mate Szalay-Beko <[email protected]> Closes apache#1252 from vtyulb/ZOOKEEPER-3726
Fix for https://issues.apache.org/jira/browse/ZOOKEEPER-3726 sockaddr_storage can contain ipv4 or ipv6 address. If address is ipv6, then we need to compare more bytes. In this PR correct comparison of sockaddr_storage was added. Author: Vladislav Tyulbashev <[email protected]> Reviewers: Norbert Kalmar <[email protected]>, Mate Szalay-Beko <[email protected]> Closes apache#1252 from vtyulb/ZOOKEEPER-3726
Fix for https://issues.apache.org/jira/browse/ZOOKEEPER-3726 sockaddr_storage can contain ipv4 or ipv6 address. If address is ipv6, then we need to compare more bytes. In this PR correct comparison of sockaddr_storage was added. Author: Vladislav Tyulbashev <[email protected]> Reviewers: Norbert Kalmar <[email protected]>, Mate Szalay-Beko <[email protected]> Closes apache#1252 from vtyulb/ZOOKEEPER-3726
Fix for https://issues.apache.org/jira/browse/ZOOKEEPER-3726
sockaddr_storage can contain ipv4 or ipv6 address. If address is ipv6, then we need to compare more bytes.
In this PR correct comparison of sockaddr_storage was added.