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

garp: Introduce Gratuitous ARP Cell #25254

Merged
merged 1 commit into from May 23, 2023

Conversation

markpash
Copy link
Contributor

@markpash markpash commented May 3, 2023

Gratuitous ARP is the process of broadcasting unsolicited ARP packets, usually with the goal of informing all Layer 2 devices of a new IP/MAC association on the L2 domain and forcing any switches to relearn the MAC address.

Here we add the garp cell. While not really useful yet, the purpose is to provide a simple Hive Cell that implements the new garp.Sender interface, so that any other Cell may send gratuitous ARP packets.

Signed-off-by: Mark Pashmfouroush mark@isovalent.com

@maintainer-s-little-helper maintainer-s-little-helper bot added the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label May 3, 2023
@markpash markpash force-pushed the pr/markpash/gratuitous-arp-cell branch from 995c3a8 to 22d41d5 Compare May 4, 2023 13:01
@markpash markpash added kind/feature This introduces new functionality. release-note/misc This PR makes changes that have no direct user impact. labels May 4, 2023
@maintainer-s-little-helper maintainer-s-little-helper bot removed the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label May 4, 2023
@markpash markpash force-pushed the pr/markpash/gratuitous-arp-cell branch from 22d41d5 to 64ad887 Compare May 4, 2023 13:24
@markpash markpash marked this pull request as ready for review May 4, 2023 14:05
@markpash markpash requested review from a team as code owners May 4, 2023 14:05
@markpash markpash requested review from rolinh and jibi May 4, 2023 14:05
@dylandreimerink dylandreimerink self-requested a review May 4, 2023 14:16
pkg/datapath/garp/garp.go Outdated Show resolved Hide resolved
@brb
Copy link
Member

brb commented May 5, 2023

👋 We used to have a well tested arping library which later got removed - 8a8ac6c. Maybe we could reuse it?

Copy link
Member

@rolinh rolinh left a comment

Choose a reason for hiding this comment

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

Vendor changes lgtm.

@dylandreimerink
Copy link
Member

We used to have a well tested arping library which later got removed - 8a8ac6c. Maybe we could reuse it?

The library you point out creates ARP requests and parses replies, that is not what we need since we are sending ARP Replies out without getting a request.

pkg/datapath/garp/garp.go Outdated Show resolved Hide resolved
pkg/datapath/garp/garp.go Outdated Show resolved Hide resolved

// Send implements Sender
func (s *sender) Send(ip netip.Addr) error {
arpClient, err := arp.Dial(s.iface)
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to create the client each time or can it be initialized once in newGARPSender?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The client that's created uses a raw socket underneath. I'm worried about keeping a raw socket open all the time, and figured it would be better to create and destroy on-demand. If there's no issue with keeping raw sockets open, then I'm happy to create the client in the constructor.

@markpash markpash force-pushed the pr/markpash/gratuitous-arp-cell branch 2 times, most recently from c75356a to b65238d Compare May 12, 2023 15:29
@markpash
Copy link
Contributor Author

wave We used to have a well tested arping library which later got removed - 8a8ac6c. Maybe we could reuse it?

In addition to @dylandreimerink 's comments, I also believe the current approach is less code, relies on an existing dependency, and that the library used is also a well-tested one.

Gratuitous ARP is the process of broadcasting unsolicited ARP packets,
usually with the goal of informing all Layer 2 devices of a new IP/MAC
association on the L2 domain and forcing any switches to relearn the MAC
address.

Here we add the `garp` cell. While not really useful yet, the purpose is
to provide a simple Hive Cell that implements the new `garp.Sender`
interface, so that any other Cell may send gratuitous ARP packets.

Signed-off-by: Mark Pashmfouroush <mark@isovalent.com>
@markpash markpash force-pushed the pr/markpash/gratuitous-arp-cell branch from b65238d to 4eed933 Compare May 22, 2023 10:58
@markpash
Copy link
Contributor Author

/test

@markpash markpash added ready-to-merge This PR has passed all tests and received consensus from code owners to merge. dependencies Pull requests that update a dependency file labels May 22, 2023
@borkmann borkmann merged commit 66de2bf into cilium:main May 23, 2023
57 of 58 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file kind/feature This introduces new functionality. ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-note/misc This PR makes changes that have no direct user impact.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants