git: 54bd53672395 - stable/14 - dhclient: rc.conf option to disable ARP resolution

From: Colin Percival <cperciva_at_FreeBSD.org>
Date: Tue, 20 Aug 2024 04:58:20 UTC
The branch stable/14 has been updated by cperciva:

URL: https://cgit.FreeBSD.org/src/commit/?id=54bd53672395c9902058da58cf7c9d4443785e5a

commit 54bd53672395c9902058da58cf7c9d4443785e5a
Author:     Isaac Cilia Attard <icattard@FreeBSD.org>
AuthorDate: 2024-07-13 10:07:29 +0000
Commit:     Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2024-08-20 04:57:09 +0000

    dhclient: rc.conf option to disable ARP resolution
    
    Introduce a new rc.conf option to not wait for ARP resolution within
    dhclient. This is plausible on many modern networks where it is possible
    to trust the DHCP server to know whether an IP address is available.
    
    Sponsored by:   Google LLC (GSoC 2024)
    Signed-off-by:  Isaac Cilia Attard <icattard@FreeBSD.org>
    MFC after:      10 days
    Reviwed by:     cperciva, brooks, Tom Hukins, Alexander Ziaee
    Pull Request:   https://github.com/freebsd/freebsd-src/pull/1368
    
    (cherry picked from commit 503adcdf1db35eab0f3d35392947a6da3bd19539)
---
 libexec/rc/rc.conf       | 1 +
 libexec/rc/rc.d/dhclient | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/libexec/rc/rc.conf b/libexec/rc/rc.conf
index 5073718e91f4..8b56a490b5ec 100644
--- a/libexec/rc/rc.conf
+++ b/libexec/rc/rc.conf
@@ -144,6 +144,7 @@ dhclient_flags=""		# Extra flags to pass to dhcp client.
 #dhclient_flags_em0=""		# Extra dhclient flags for em0 only
 background_dhclient="NO"	# Start dhcp client in the background.
 #background_dhclient_em0="YES"	# Start dhcp client on em0 in the background.
+dhclient_arpwait="YES"		# Wait for ARP resolution
 synchronous_dhclient="NO"	# Start dhclient directly on configured
 				# interfaces during startup.
 defaultroute_delay="30"		# Time to wait for a default route on a DHCP interface.
diff --git a/libexec/rc/rc.d/dhclient b/libexec/rc/rc.d/dhclient
index e2f204076eb6..3e6511fb6f26 100755
--- a/libexec/rc/rc.d/dhclient
+++ b/libexec/rc/rc.d/dhclient
@@ -48,6 +48,10 @@ dhclient_prestart()
 		rc_flags="${rc_flags} -b"
 	fi
 
+	dhclient_arpwait=$(get_if_var $ifn dhclient_arpwait_IF $dhclient_arpwait)
+	if ! checkyesno dhclient_arpwait; then
+		rc_flags="${rc_flags} -n"
+	fi
 
 	# /var/run/dhclient is not guaranteed to exist,
 	# e.g. if /var/run is a tmpfs