#!/bin/sh
cat /var/etc/resolv.conf /var/etc/resolv_ipv6.conf > /var/etc/resolv_dual.conf
ipv6_autoconfig=$(nvram get ipv6_autoconfig)

if [ "$ipv6_autoconfig" = "ipv6_autoconfig = 1" ]; then
	ipv6_autoconfig_type=$(nvram get ipv6_autoconfig_type)
	if [ "$ipv6_autoconfig_type" = "ipv6_autoconfig_type = stateless" ]; then
		killall -SIGQUIT timer
	elif [ "$ipv6_autoconfig_type" = "ipv6_autoconfig_type = stateful" ]; then
		count=0
		while [ "$count" -lt 5 ]; do
			read rc_flag < /var/etc/rc_flag.conf
			if [ "$rc_flag" = "i" ]; then
				killall -SIGABRT rc
				break
			elif [ "$rc_flag" = "b" ]; then		
				count=$(($count+1))
				sleep 2
			else
				break
			fi
		done
	fi
fi
