Skip to content
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

example: fix key type of xdp example #1178

Merged
merged 2 commits into from
Oct 20, 2023
Merged

Conversation

BillyChen1
Copy link
Contributor

The IP address output by xdp demo is empty. Although it can be solved by directly changing the key type to netip.Addr after go1.18 version, I still use a more general way to fix it.
Issue: #1175

Signed-off-by: chenqiming <whqscqm@outlook.com>
@rgo3
Copy link
Contributor

rgo3 commented Oct 19, 2023

Thanks for opening a PR! Given that the library requires Go 1.20 to be the minimum version I don't see a real benefit in going with the more general way. Just using netip.Addr looks cleaner and would also work if someone wants to extend the example with ipv6 support.

Signed-off-by: chenqiming <whqscqm@outlook.com>
@BillyChen1
Copy link
Contributor Author

@rgo3 done

Copy link
Contributor

@rgo3 rgo3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

I've noticed that this broke once we merged 4609dc7 and it's likely that fixing the internals would probably prevent us from making this change necessary. But switching to netip.Addr seems sensible either way as the only reason we didn't use it in the first place was that 1.18 wasn't the minimum required Go version.

Copy link
Collaborator

@lmb lmb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, netip.Addr works as a key since it implements BinaryUnmarshaler!

@lmb lmb merged commit c13934f into cilium:main Oct 20, 2023
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants