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)
Tue, Apr 30, 8:51 PM
Unknown Object (File)
Tue, Apr 30, 8:28 PM
Unknown Object (File)
Tue, Apr 30, 8:27 PM
Unknown Object (File)
Tue, Apr 30, 6:40 PM
Unknown Object (File)
Fri, Apr 26, 1:44 AM
Unknown Object (File)
Tue, Apr 23, 9:23 PM
Unknown Object (File)
Sat, Apr 6, 8:53 PM
Unknown Object (File)
Sat, Apr 6, 3:35 PM
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.