Page MenuHomeFreeBSD

rc: Improve netwait DAD logic
ClosedPublic

Authored by des on Sat, Oct 4, 6:32 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Oct 9, 11:49 PM
Unknown Object (File)
Thu, Oct 9, 11:49 PM
Unknown Object (File)
Thu, Oct 9, 7:55 PM
Unknown Object (File)
Thu, Oct 9, 7:55 PM
Unknown Object (File)
Thu, Oct 9, 7:55 PM
Unknown Object (File)
Thu, Oct 9, 7:55 PM
Unknown Object (File)
Thu, Oct 9, 5:14 PM
Unknown Object (File)
Thu, Oct 9, 3:14 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 Not Applicable
Unit
Tests Not Applicable

Event Timeline

des requested review of this revision.Sat, Oct 4, 6:32 PM
bz requested changes to this revision.Sat, Oct 4, 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.Sat, Oct 4, 6:45 PM
des marked an inline comment as done.Sat, Oct 4, 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.Sat, Oct 4, 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.Sat, Oct 4, 8:47 PM
des marked an inline comment as done.Sun, Oct 5, 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.