#! /bin/sh

# Wait for the IP address to become available but (by default) do not send
# any actual advertisements. Only works with statically configured IPv6
# interfces.
#
# The following options are available for use in /etc/network/interfaces
# stanzas (shown with default values):
#
# iface eth0 inet6 static
#	send-na-wait 5        # wait this long before giving up
#	send-na-repeat 0      # send this many advertisements

case $MODE,$ADDRFAM,$METHOD,$IF_ADDRESS in start,inet6,static,*:*)
	: ${IF_SEND_NA_WAIT=5}
	: ${IF_SEND_NA_REPEAT=0}
	case $(( IF_SEND_NA_WAIT > 0 || IF_SEND_NA_REPEAT > 0 )) in 1)
		send_na --syslog \
			--wait="$IF_SEND_NA_WAIT" \
			--repeat="$IF_SEND_NA_WAIT" \
			-- "$IFACE" "$IF_ADDRESS" || :
	esac
esac
