#!/bin/sh /etc/rc.common
START=60

lease_file=/var/dhclient6.leases
config_file=/etc/dhclient6.conf
pid_file=/var/run/dhclient6.pid
script_file=/usr/sbin/dhclient-script

start() {
	echo Starting isc-dhclient

	/usr/sbin/dhclient -q -nw -6 -cf $config_file -lf $lease_file -pf $pid_file -sf $script_file `/sbin/uci get network.wan.ifname`
	
	if [ $? -ne 0 ]; then
		echo "  isc-dhclient failed to start"
	fi
}

stop() {
	echo Stopping isc-dhclient
	if [ -e $pid_file ]; then
		kill -9 `cat $pid_file`

		if [ $? -ne 0 ]; then
			echo "  PID " `cat $pid_file` not found
			echo "  Is the DHCP client running?"
		fi
	
		rm $pid_file
	else
		echo "  $pid_file not found"
	fi
}