--- network/connections/ethernet.orig 2012-05-04 17:24:53.000000000 +0200 +++ network/connections/ethernet 2012-05-16 19:44:04.927790992 +0200 @@ -6,13 +6,28 @@ . /usr/lib/network/network -report_iproute() -{ +report_iproute() { report_fail "$*" bring_interface down "$INTERFACE" exit 1 } +wait_for_dad() { + local timeout="${DAD_TIMEOUT:-3}" + + if [[ -n "$(ip -6 addr show dev $INTERFACE tentative)" && $timeout -gt 0 ]]; then + report_debug "Waiting for DAD to complete" + + sleep 1 + let timeout-- + + while [[ -n "$(ip -6 addr show dev $INTERFACE tentative)" && $timeout -gt 0 ]]; do + sleep 1 + let timeout-- + done + fi +} + ethernet_up() { load_profile "$1" SYSCTL_INTERFACE="${INTERFACE/.//}" @@ -128,7 +143,11 @@ report_debug ethernet_iproute_up ip "$line" if ! ip $line; then - report_iproute "Could not configure interface ($line)." + wait_for_dad + + if ! ip $line; then + report_iproute "Could not configure interface ($line)." + fi fi done fi @@ -180,6 +199,9 @@ fi done fi + + wait_for_dad + if [[ -n "$GATEWAY6" ]]; then report_debug ethernet_iproute_up ip -6 route replace default via "$GATEWAY6" dev "$INTERFACE" if ! ip -6 route replace default via "$GATEWAY6" dev "$INTERFACE"; then @@ -199,6 +221,8 @@ ;; esac + wait_for_dad + # Set hostname if [[ -n "$HOSTNAME" ]]; then report_debug ethernet_iproute_up hostname "$HOSTNAME"