Skip to content

netmap: Reply to ARP requests from gateway for scan source IPs#807

Merged
phillip-stephens merged 3 commits intozmap:mainfrom
droe:droe/netmap-arp
Mar 5, 2024
Merged

netmap: Reply to ARP requests from gateway for scan source IPs#807
phillip-stephens merged 3 commits intozmap:mainfrom
droe:droe/netmap-arp

Conversation

@droe
Copy link
Contributor

@droe droe commented Mar 4, 2024

In netmap mode, the OS network stack never gets to see incoming packets unless we explicitly forward them to the host rings; hence the kernel will not be responding to ARP requests. To remove the need for static ARP entries on the gateway, respond to ARP requests from the gateway for any of the source IPs of the scan.

The recv thread can now submit packets for sending to send thread 0 via a zqueue. This is used to respond to ARP requests that arrive after having let loose the send threads. While still waiting for end-to-end connectivity with --netmap-wait-ping, ARP requests are responded to by sending directly from the recv thread, just like the ICMP Echo requests.

I did not see any significant netmap perf change from this at 10 GbE.

Tested on both FreeBSD and Linux. Verified to correctly respond both to arping, as well as to real ARP by deleting ARP entries from the gateway's ARP table and observing the ARP table getting repopulated as well as packets on the wire.

droe and others added 2 commits March 4, 2024 22:15
In netmap mode, the OS network stack never gets to see incoming packets
unless we explicitly forward them to the host rings; hence the kernel
will not be responding to ARP requests.  To remove the need for static
ARP entries on the gateway, respond to ARP requests from the gateway for
any of the source IPs of the scan.
@phillip-stephens phillip-stephens self-requested a review March 5, 2024 19:13
Copy link
Contributor

@phillip-stephens phillip-stephens left a comment

Choose a reason for hiding this comment

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

Reviewed the code and looks great and make sense to me. If we can just add some context around the ARP replies, I think this LGTM!

@droe droe requested a review from phillip-stephens March 5, 2024 19:37
Copy link
Contributor

@phillip-stephens phillip-stephens left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @droe !!!

@phillip-stephens phillip-stephens merged commit 660f7d9 into zmap:main Mar 5, 2024
@droe droe deleted the droe/netmap-arp branch March 11, 2024 08:01
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.

2 participants