diff --git a/libexec/rc/network.subr b/libexec/rc/network.subr --- a/libexec/rc/network.subr +++ b/libexec/rc/network.subr @@ -423,7 +423,27 @@ esac done - checkyesno synchronous_dhclient + checkyesno synchronous_dhclient && return + + # Auto-switching to SYNCDHCP must only happen if DHCP is defined, so + # check for dhcpif (again for ifconfig_up() usage, but to be safe for + # other/future consumers) + dhcpif $1 || return + + # Assume user wants SYNCDHCP if devd(8) was (intentionally) disabled, + # but overseen that ifconfig="DHCP" won't work in that case. + checkyesno devd_enable || return 0 + + # If $skip doesn't list any keyword starting with "nojail" return with + # non zero since the result from 'checkyesno synchronous_dhclient' was + # non zero. + [ "${skip}" != "${skip#* nojail}" ] || return + + # If $skip doesn't list keyword "nojailvnet" (but "nojail" was found, + # otherwise we would return above), auto-switching to SYNCDHCP happens. + # The test reflects non zero checkyesno synchronous_dhclient' result + # otherwise. + [ "${skip}" = "${skip#* nojailvnet}" ] } # wpaif if