#!/bin/sh

# icd2 start ipv6 configuration after ipv4 is done
# so icd2 not working on ipv6 only networks
# this script will tell to icd2 that ipv4 configuraiton
# was successfull if kernel received ipv6 route via RA

if test "$1" != "deconfig"; then exit 0; fi

(
i=10
while test $i -gt 0; do
	sleep 1
	if ip -6 route show dev $interface | grep '^[^\ ]*  proto kernel' | grep -q -v 'fe80::/64'; then
		/usr/bin/dbus-send --system --dest=com.nokia.icd /com/nokia/icd/autoconf com.nokia.icd.autoconf.autoconf_changed string:$interface string:DHCP string:CONNECTED
		break
	fi
	i=$((i-1))
done
) &

exit 0
