#!/bin/sh
LOCK_FILE=/var/run/ipv6_restart_lan.pid
WAIT_COUNT=1
while [ -f $LOCK_FILE ]; do
	if [ $WAIT_COUNT -ge 10 ]; then
		echo "rdnssd restart ipv6 lan failed" > /dev/ttyS0
		exit 1
	fi
	echo "waiting for ipv6 restart lan $WAIT_COUNT" > /dev/ttyS0
	WAIT_COUNT=$(($WAIT_COUNT+1))
	sleep 1
done

echo > $LOCK_FILE

cat /var/etc/resolv_ipv6.conf /var/etc/resolv.conf > /var/etc/resolv_dual.conf

cli ipv6 radvd stop
cli ipv6 dhcp6d stop
cli ipv6 radvd start
cli ipv6 dhcp6d start
cli ipv6 route start

rm $LOCK_FILE
