rc: Improve netwait DAD logic

Disable if IPv6 is not supported, and instead of 10 seconds, default to
one more than the value of net.inet6.ip6.dad_count.

Fixes:		5ead817c3b ("rc: Teach netwait to wait for DAD")
Reviewed by:	bz
Differential Revision:	https://reviews.freebsd.org/D52905
This commit is contained in:
Dag-Erling Smørgrav 2025-10-05 20:40:39 +02:00
parent 5000d023a4
commit ec6ad605ec
3 changed files with 14 additions and 8 deletions

View file

@ -501,7 +501,8 @@ netwait_timeout="60" # Total number of seconds to perform pings.
#netwait_if="" # Wait for active link on each intf in this list.
netwait_if_timeout="30" # Total number of seconds to monitor link state.
netwait_dad="NO" # Wait for DAD to complete
netwait_dad_timeout="10" # Total number of seconds to wait for DAD.
netwait_dad_timeout="" # Total number of seconds to wait for DAD, zero
# or unset to autodetect
### Miscellaneous network options: ###
icmp_bmcastecho="NO" # respond to broadcast ping packets

View file

@ -36,13 +36,15 @@ netwait_start()
err 1 "Nothing to wait for"
fi
if ! [ "${netwait_if_timeout}" -ge 1 ]; then
if ! [ "${netwait_if_timeout:=0}" -ge 1 ]; then
err 1 "netwait_if_timeout must be >= 1"
fi
if ! [ "${netwait_dad_timeout}" -ge 1 ]; then
err 1 "netwait_dad_timeout must be >= 1"
if ! check_kern_features inet6; then
netwait_dad="NO"
elif ! [ "${netwait_dad_timeout:=0}" -ge 1 ]; then
netwait_dad_timeout=$(($(sysctl -n net.inet6.ip6.dad_count)+1))
fi
if ! [ "${netwait_timeout}" -ge 1 ]; then
if ! [ "${netwait_timeout:=0}" -ge 1 ]; then
err 1 "netwait_timeout must be >= 1"
fi

View file

@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd October 2, 2025
.Dd October 5, 2025
.Dt RC.CONF 5
.Os
.Sh NAME
@ -4618,8 +4618,11 @@ Set to
to enable waiting for DAD to complete.
.It Va netwait_dad_timeout
.Pq Vt int
Indicates the total number of seconds to wait for DAD to complete.
The default is 10.
Unset by default.
Indicates the maximum number of seconds to wait for DAD to complete.
If zero or unset, the timeout will be one more than the value of the
.Va net.inet6.ip6.dad_count
sysctl variable.
.It Va rctl_enable
.Pq Vt bool
If set to