#!/bin/sh

#resolv.conf This file should not be modified -- make local changes to
# /etc/ppp/ip-up.local instead

#LOGDEVICE=$6
#REALDEVICE=$1
#WAN_IP=$4

#export PATH=/sbin:/usr/sbin:/bin:/usr/bin

#if [ $# -lt 1 ]; then echo "Usage: $1 {dhcpc | static}"; exit 1 ; fi

/bin/create_flash.sh

#include file
. /etc/flash.inc

# DNS Setting

DNS_MODE=0
if [ "$DNS1" != '0.0.0.0' ]; then
	DNS_MODE=1
fi
if [ "$DNS2" != '0.0.0.0' ]; then
	DNS_MODE=1
fi
if [ "$DNS3" != '0.0.0.0' ]; then
	DNS_MODE=1
fi

if [ "$1" = "dhcpc" ]; then
		/bin/rdisc -s &
		/bin/rdisc -f
		/bin/cat /etc/resolv.master /etc/udhcpc/resolv.conf > /etc/resolv.conf 2> /dev/null

elif [ "$1" = "static" ]; then
	if [ $DNS_MODE != 1 ]; then
		echo "nameserver 168.95.1.1" > /etc/resolv.conf
	fi

else
	/bin/cat /etc/resolv.master /etc/ppp/resolv.conf > /etc/resolv.conf 2> /dev/null
fi

/bin/dnrd.sh

#echo "********** set Time Zone **********"
/bin/sntp.sh
		
echo "********** run firewall.sh **********"
/bin/firewall.sh 

exit 0
