-
Notifications
You must be signed in to change notification settings - Fork 454
selectors: support ipv4-mapped ipv6 addresses #3714
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
selectors: support ipv4-mapped ipv6 addresses #3714
Conversation
With this fix policy from the issue works correctly:
|
@kkourt |
ec2af8f
to
a4f73c0
Compare
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.
Thanks, the change makes sense to me but I believe the implementation could be improved.
CC: @kevsecurity
✅ Deploy Preview for tetragon ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
@kkourt Added unit tests, covering every case of the function. |
Thanks! Can you please squash the changes from my feedback into the relevant original commits? ( Also, once done, please force-push the new branch and notify the reviewers by clicking on the github button "Re-request review". Thanks! |
56af3c5
to
f5c87bb
Compare
f5c87bb
to
aa97cf4
Compare
@kkourt |
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.
Thanks, this looks great to me!
Please find a minor comment below.
aa97cf4
to
613ad51
Compare
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.
Thanks, LGTM!
I kicked off the CI as well. Assuming everything's green I'll merge the PR when the CI is done.
@kkourt |
The errors keep happening, even though I agree that they do not seem to be related. Would need to investigate fruther. |
IPv4 addresses can be represented in IPv6 form as `::ffff:X.X.X.X` and may be used during connections with address family AF_INET6. This patch supports ipv4-mapped ipv6 address by using `netip` for parsing addresses, which parses ipv4-mapped addresses correctly. Fixes: cilium#3712 Signed-off-by: Kobrin Ilay <[email protected]>
613ad51
to
bb742ff
Compare
@kkourt @kevsecurity |
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.
Yep, that looks much better.
Thanks. I hit merge as @kkourt had previously approved, and I wasn't sure if you have merge permissions. |
I don't, thanks! |
There were some CI issues that I was hoping to resolve before merging the PR. |
Sorry. It looked complete here, except with quay failures. |
Fixes: #3712
Description
Currently Tetragon parses ip address as only ipv4 or ipv6, while all ipv4 address can be used as ipv6 in
::ffff:X.X.X.X
form.In Go
IP.To4()
method works correctly if the address have such form, so Tetragon will add this address only in IPv4 map.Later, when this address is used with AF_INET6, Tetragon BPF code will try to use only ipv6 map, leading to false positive event.
To fix this, we need to add ipv4 address in both ipv4 and ipv6 maps in case the original string contains colon (meaning IPv4-mapped form).
Changelog