opnsense-src/usr.sbin/arp
Gleb Smirnoff 1e74fc9504 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

(cherry picked from commit 6a3e87e1306d5058d63f7552a25ed6376422f658)
2024-02-25 10:03:17 -08:00
..
arp.4 Remove $FreeBSD$: one-line nroff pattern 2023-08-16 11:55:15 -06:00
arp.8 Remove $FreeBSD$: one-line nroff pattern 2023-08-16 11:55:15 -06:00
arp.c arp(8): fix by-interface and by-host filtering when using netlink 2023-09-30 13:26:12 +00:00
arp.h arp(8): fix by-interface and by-host filtering when using netlink 2023-09-30 13:26:12 +00:00
arp_netlink.c arp: fix arp -s/-S 2024-02-25 10:03:17 -08:00
Makefile Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
Makefile.depend Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00