-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Miscellaneous improvements to the gneigh subsystem #40939
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The [mdlayher/arp.Dial] function strictly requires an IPv4 address to be assigned to the target interface, returning an error otherwise, even if not actually necessary to send a gARP. Let's relax this requirement by manually creating a [packet.Conn] object and reimplementing a copy of [Client.WriteTo] based on it. Even better, we could simply relax the check upstream, but there's already an open PR for that, and the repo has seen no updates since 2022. Still, the logic is fairly simple, and doesn't add much extra boilerplate here. Signed-off-by: Marco Iorio <marco.iorio@isovalent.com>
According to RFC5227 [1], ARP announcements should be performed using ARP request packets, instead of reply ones. Even though this is mostly for historical reasons, and it is unlikely to make a practical difference, let's still make this change to better comply with the standard. [1]: https://www.rfc-editor.org/rfc/rfc5227.html#section-3 Suggested-by: Harsimran Pabla <hpabla@isovalent.com> Signed-off-by: Marco Iorio <marco.iorio@isovalent.com>
Currently, a new RAW socket needs to be always instantiated every time a new gratuitous ARP or ND packet is to be sent. While this is simple and works great in most occasions, there may be cases in which multiple packets need to be sent out of the same interface, and having to create a new socket every time looks suboptimal from a performance point of view. Hence, let's extend the [gneigh.Sender] interface to also allow creating a client that can be reused multiple times, if appropriate. Signed-off-by: Marco Iorio <marco.iorio@isovalent.com>
The ARP/ND clients are only used to send packets, never to receive them. Hence, let's configure the appropriate filters to make sure that they get discarded upfront by the kernel, instead of unnecessarily sitting in the read buffer forever. This is especially important now that we can create long-lived clients. Signed-off-by: Marco Iorio <marco.iorio@isovalent.com>
/test |
dylandreimerink
approved these changes
Aug 5, 2025
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.
Changes look good to me. Thanks!
HadrienPatte
approved these changes
Aug 5, 2025
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.
Vendor LGTM
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area/agent
Cilium agent related.
area/datapath
Impacts bpf/ or low-level forwarding details, including map management and monitor messages.
release-note/misc
This PR makes changes that have no direct user impact.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Please review commit by commit, and refer to the individual commit messages for additional information.