Page MenuHomeFreeBSD

rc: Improve netwait DAD logic
ClosedPublic

Authored by des on Oct 4 2025, 6:32 PM.
Tags
None
Referenced Files
F134878449: D52905.id163562.diff
Wed, Nov 5, 12:16 AM
Unknown Object (File)
Thu, Oct 30, 5:36 AM
Unknown Object (File)
Sat, Oct 25, 5:41 PM
Unknown Object (File)
Sat, Oct 25, 5:26 PM
Unknown Object (File)
Sat, Oct 25, 5:24 PM
Unknown Object (File)
Sat, Oct 25, 5:19 PM
Unknown Object (File)
Sat, Oct 25, 2:59 PM
Unknown Object (File)
Wed, Oct 22, 11:41 PM
Subscribers

Details

Summary

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: 5ead817c3b7a ("rc: Teach netwait to wait for DAD")

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 67551
Build 64434: arc lint + arc unit

Event Timeline

des requested review of this revision.Oct 4 2025, 6:32 PM
bz requested changes to this revision.Oct 4 2025, 6:45 PM

Apart from that, thank you for improving it so quickly!

With the change applied I am happy and it can just go in.

libexec/rc/rc.d/netwait
44
netwait_dad_timeout=""

if ! [ "${netwait_dad_timeout}" -ge 1 ]; then
        echo foo
fi

yields

[: : bad number
foo

You probably need a

${netwait_dad_timeout:=0}

or something there.

Was bad before already in case it was unset.

Also ! -ge is -lt

So:

if [ "${netwait_dad_timeout:=0}" -lt 1 ]; then

should work?

This revision now requires changes to proceed.Oct 4 2025, 6:45 PM
des marked an inline comment as done.Oct 4 2025, 8:39 PM
des added inline comments.
libexec/rc/rc.d/netwait
44

! -ge and -lt are not equivalent, as you yourself demonstrated. The former was deliberately chosen because it will dtrt if the variable is set to something that isn't a number. I just forgot, rather stupidly, to consider the null case.

des marked an inline comment as done.Oct 4 2025, 8:39 PM
bz added inline comments.
libexec/rc/rc.d/netwait
44
netwait_dad_timeout="BLAH"
if ! [ "${netwait_dad_timeout:=0}" -ge 1 ]; then
        echo foo
fi

will like a -lt comparison still yield

[: BLAH: bad number
foo
This revision is now accepted and ready to land.Oct 4 2025, 8:47 PM
des marked an inline comment as done.Oct 5 2025, 6:40 PM
des added inline comments.
libexec/rc/rc.d/netwait
44

Both versions will print an error message, but only ! -gt will enter the correct branch.

This revision was automatically updated to reflect the committed changes.
des marked an inline comment as done.