Page MenuHomeFreeBSD

arp(8): fix by-interface and by-host filtering when using netlink
ClosedPublic

Authored by rcm on Sep 13 2023, 12:30 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Nov 25, 3:15 PM
Unknown Object (File)
Thu, Nov 21, 2:28 AM
Unknown Object (File)
Sep 1 2024, 2:06 PM
Unknown Object (File)
Aug 15 2024, 11:43 PM
Unknown Object (File)
Jul 10 2024, 11:20 AM
Unknown Object (File)
Jul 8 2024, 8:55 PM
Unknown Object (File)
Jul 4 2024, 3:37 PM
Unknown Object (File)
Jul 2 2024, 8:01 AM
Subscribers

Details

Reviewers
melifaro
kp
Summary

arp(8) has traditionally supported filtering by interface via -i and by hostname.
However, this functionality was omitted from the initial netlink-ification of arp.
This patch re-introduces this filtering functionality.

This patch also improves by-interface filtering by storing and using the ifindex of the
requested interface for filtering instead of comparing interface name strings

Sponsored by: Rubicon Communications, LLC ("Netgate")

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

rcm requested review of this revision.Sep 13 2023, 12:30 AM
rcm retitled this revision from arp(8): implement by interface and by host filtering with netlink to arp(8): implement by-interface and by-host filtering with netlink.Sep 13 2023, 8:46 AM
rcm edited the summary of this revision. (Show Details)

Give melifaro@ a few days to review too though.

This revision is now accepted and ready to land.Sep 13 2023, 10:18 AM
melifaro added inline comments.
usr.sbin/arp/arp.c
161

You should br able to pass ifname as a filter to the kernel netlink request directly

usr.sbin/arp/arp_netlink.c
313

It should be filtered in the kernel already

usr.sbin/arp/arp.c
161

cool, I admit I don't know much about netlink beyond what it took to work on this patch. I will look at that! thanks

rcm marked an inline comment as done.

Removed the unnecessary userspace filtering by-interface, the kernel is already doing
that now which I accidentally fixed by calling print_entries_nl with a valid (non-zero) ifindex

This revision now requires review to proceed.Sep 13 2023, 4:43 PM
rcm marked an inline comment as done.Sep 13 2023, 4:44 PM
rcm retitled this revision from arp(8): implement by-interface and by-host filtering with netlink to arp(8): fix by-interface and by-host filtering when using netlink.Sep 13 2023, 5:08 PM
This revision is now accepted and ready to land.Sep 13 2023, 9:44 PM

Committed in https://cgit.freebsd.org/src/commit/?id=79278872ad966e5f54805efbeb692c8cbc0306c8 but I forgot to add the 'Differential Revision' tag, so it didn't auto-close.