freebsd-src/usr.sbin/arp
Gleb Smirnoff 6a3e87e130 arp: fix arp -s/-S
When setting a permanent ARP entry, the route(4) would use
rtm->rtm_rmx.rmx_expire == 0 as a flag for installing a static entry, but
netlink(4) is looking for explicit NTF_STICKY flag in the request.  The
arp(8) utility was adopted to use netlink(4) by default, but it has lots
of route-era guts internally. Specifically there is global variable 'opts'
that shares configuration for both protocols, and it is still initialized
with route(4) specific RTF_xxx flags.  In set_nl() these flags are
translated to netlink(4) parameters. However, RTF_STATIC is a flag that is
never set by default, so attempt to use it as a proxy flag manifesting
-s/-S results in losing it.  Use zero opts.expire_time as a manifest of
-s/-S operation.  This is a minimal fix.  A better one would be to fully
get rid of route(4) legacy.

The change also corrects the logic to set NUD_PERMANENT flag for
consistency.  This flag is ignored by our kernel (now).

Reviewed by:		melifaro, tuexen, emaste
PR:			277063
Fixes:			6ad73dbf65
Differential Revision:	https://reviews.freebsd.org/D43983
2024-02-20 10:31:05 -08:00
..
arp.4 usr.sbin: Remove ancient SCCS tags. 2023-11-26 22:23:56 -07:00
arp.8 usr.sbin: Remove ancient SCCS tags. 2023-11-26 22:23:56 -07:00
arp.c Remove copyright strings ifdef'd out 2023-11-26 22:23:58 -07:00
arp.h arp(8): fix by-interface and by-host filtering when using netlink 2023-09-14 10:14:10 +02:00
arp_netlink.c arp: fix arp -s/-S 2024-02-20 10:31:05 -08:00
Makefile usr.sbin: Remove ancient SCCS tags. 2023-11-26 22:23:56 -07:00
Makefile.depend Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00