git: 2356b60be702 - main - arp(8): allow -i with -s
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 23 May 2024 20:04:15 UTC
The branch main has been updated by imp:
URL: https://cgit.FreeBSD.org/src/commit/?id=2356b60be7024b10ddc4361fc22f96205b55fbbb
commit 2356b60be7024b10ddc4361fc22f96205b55fbbb
Author: Lexi Winter <lexi@le-Fay.ORG>
AuthorDate: 2024-05-05 18:21:06 +0000
Commit: Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-05-23 20:02:57 +0000
arp(8): allow -i with -s
arp(8) usually disallows adding a static ARP entry for an IP address
which is not configured on a local interface.
Change this to allow such ARP entries to be added if '-i' is provided to
specify the interface the ARP entry relates to.
Due to limitations in the kernel lltable, this still requires that a
host route exists for the target address, but allows static ARP entries
to be configured to proxy ARP for, e.g., local jails which use an IPv4
address with a /32 route.
Reviewed by: imp, zlei
Pull Request: https://github.com/freebsd/freebsd-src/pull/1220
---
usr.sbin/arp/arp.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/usr.sbin/arp/arp.c b/usr.sbin/arp/arp.c
index e5b94ca053e1..8cd18d875820 100644
--- a/usr.sbin/arp/arp.c
+++ b/usr.sbin/arp/arp.c
@@ -144,7 +144,7 @@ main(int argc, char *argv[])
if (!func)
func = F_GET;
if (opts.rifname) {
- if (func != F_GET && !(func == F_DELETE && opts.aflag))
+ if (func != F_GET && func != F_SET && !(func == F_DELETE && opts.aflag))
xo_errx(1, "-i not applicable to this operation");
if ((opts.rifindex = if_nametoindex(opts.rifname)) == 0) {
if (errno == ENXIO)
@@ -375,7 +375,7 @@ set(int argc, char **argv)
}
}
#ifndef WITHOUT_NETLINK
- return (set_nl(0, dst, &sdl_m, host));
+ return (set_nl(opts.rifindex, dst, &sdl_m, host));
#else
return (set_rtsock(dst, &sdl_m, host));
#endif