diff --git a/src/lib/ip b/src/lib/ip index b7847a2..e74c5bb 100644 --- a/src/lib/ip +++ b/src/lib/ip @@ -82,7 +82,7 @@ ip_set() { ;; esac - if [[ $IP ]]; then + if [[ $IP != @(|no) ]]; then # Add static IP routes for route in "${Routes[@]}"; do if ! do_debug ip route add $route dev "$Interface"; then @@ -100,20 +100,15 @@ ip_set() { fi fi - case "$IP6" in - dhcp|dhcp-noaddr) - dhcp_call "${DHCP6Client:-dhclient}" start 6 ${IP6:5} || return - ;; - stateless|static) - for addr in "${Address6[@]}"; do - if ! do_debug ip -6 addr add $addr $(is_yes "${SkipDAD:-no}" && printf nodad) dev "$Interface"; then - report_error "Could not add address '$addr' to interface '$Interface'" - fi - done - ;; - esac + if [[ $IP6 != @(|no) ]]; then + if [[ $IP6 == @(stateless|static) ]]; then + for addr in "${Address6[@]}"; do + if ! do_debug ip -6 addr add $addr $(is_yes "${SkipDAD:-no}" && printf nodad) dev "$Interface"; then + report_error "Could not add address '$addr' to interface '$Interface'" + fi + done + fi - if [[ $IP6 ]]; then if ! is_yes "${SkipDAD:-no}"; then # Wait for Duplicate Address Detection to finish if ! timeout_wait "${TimeoutDAD:-3}" '[[ -z "$(ip -6 addr show dev "$Interface" tentative)" ]]'; then @@ -122,6 +117,11 @@ ip_set() { fi fi + # Start a DHCPv6 client after DAD has finished for the link-local address + if [[ $IP6 == @(dhcp|dhcp-noaddr) ]]; then + dhcp_call "${DHCP6Client:-dhclient}" start 6 ${IP6:5} || return + fi + # Add static IPv6 routes after DAD has finished for route in "${Routes6[@]}"; do if ! do_debug ip -6 route add $route dev "$Interface"; then