[Feature][ZXW-65]merged P49 base code

Change-Id: I3e09c0c3d47483bc645f02310380ecb7fc6f4041
diff --git a/ap/app/Script/scripts/lan.sh b/ap/app/Script/scripts/lan.sh
index 407c47b..a1c74d1 100755
--- a/ap/app/Script/scripts/lan.sh
+++ b/ap/app/Script/scripts/lan.sh
@@ -120,9 +120,9 @@
         echo 1 > /sys/module/fast_common/parameters/lan_dos_enable
     fi
 
+	dhcps_in_cap=`nv get dhcps_in_cap`
 
-
-
+	if [ "x$dhcps_in_cap" != "x1" ]; then
     echo "" > $path_conf/udhcpd.leases
 
     . $path_sh/user-config-udhcpd.sh
@@ -132,7 +132,7 @@
         echo "Info: config-udhcpd.sh lan -r 1 start" >> $test_log
         . $path_sh/config-udhcpd.sh "lan" -r 1
     fi
-
+	fi
     dnsmasq -i $lan_if -r $path_conf/resolv.conf &
     . $path_sh/upnp.sh
     
diff --git a/ap/app/Script/scripts/ppp_updown.sh b/ap/app/Script/scripts/ppp_updown.sh
index f36ea86..c9662d8 100755
--- a/ap/app/Script/scripts/ppp_updown.sh
+++ b/ap/app/Script/scripts/ppp_updown.sh
@@ -47,7 +47,7 @@
 
 	ps_ip=$ps_ip_ab"."$ps_ip_c1"."$ps_ip_d
 	
-	ifconfig $ps_if $ps_ip up
+	ifconfig $ps_if $ps_ip netmask 255.255.255.0 up
 	if [ $? -ne 0 ];then
 	    echo "Error: ifconfig $ps_if $ps_ip up failed." >> $test_log
     fi
@@ -98,6 +98,19 @@
 	route_info=`ip route|grep default`
 	
 	if [ "$route_info" == "" ];then
+		dns=`nv get $ps_if"_pridns"`
+		dns2=`nv get $ps_if"_secdns"`
+		if [ "-$dns" == "-" -o "-$dns" == "-0.0.0.0" ] && [ "-$dns2" == "-" -o "-$dns2" == "-0.0.0.0" ]; then
+			echo "Error:PPP no valid dns, use default dns." >> $test_log
+			dns="114.114.114.114"
+			dns2="8.8.8.8"
+		fi
+		if [ "-$dns" != "-" -a "-$dns" != "-0.0.0.0" ]; then
+			echo "nameserver $dns" >> /etc/resolv.conf
+		fi
+		if [ "-$dns2" != "-" -a "-$dns2" != "-0.0.0.0" ]; then
+			echo "nameserver $dns2" >> /etc/resolv.conf
+		fi
 		route add default dev $ps_if
 	else
 		echo "Debug: default route already exist." >> $test_log
@@ -477,6 +490,9 @@
 		linkdown_dhcpv6_server_set
 		route6_del
 		slaac_kill
+	fi
+	route_info=`ip route|grep default`
+	if [ "$route_info" == "" ];then
 		echo "" > /etc/resolv.conf
 	fi
 fi
diff --git a/ap/app/Script/scripts/psext_up.sh b/ap/app/Script/scripts/psext_up.sh
index 7a51bbf..d0f79aa 100755
--- a/ap/app/Script/scripts/psext_up.sh
+++ b/ap/app/Script/scripts/psext_up.sh
@@ -5,6 +5,7 @@
 fi
 echo "Info: psext_up.sh $1 start" >> $test_log
 path_conf=`nv get path_conf`
+dhcps_in_cap=`nv get dhcps_in_cap`
 
 echo 1 > /proc/sys/net/ipv4/ip_forward
 c_id=$1
@@ -27,12 +28,14 @@
 	if [ $? -ne 0 ];then
 	    echo "Error: ifconfig $eth_br netmask $mask failed." >> $test_log
 	fi
+	if [ "x$dhcps_in_cap" != "x1" ]; then
     if [ -e ${pidfile} ]; then
       kill `cat $pidfile`
 	  rm -f $pidfile
     fi
 	touch $leases
 	udhcpd -f $confile &
+	fi
 }
 
 #»ñÈ¡ip²¢ÅäÖÃps¡¢eth
@@ -41,7 +44,7 @@
     pdp_ip=`nv get $ps_if"_pdp_ip"`
 	ps_ip=`nv get $ps_if"_ip"`
 	br_ip=`nv get $ext_br"_ip"`
-	ifconfig $ps_if $ps_ip up 2>>$test_log
+	ifconfig $ps_if $ps_ip netmask 255.255.255.0 up 2>>$test_log
 	if [ $? -ne 0 ];then
 	    echo "Error: ifconfig $ps_if $ps_ip up failed." >> $test_log
     fi
diff --git a/ap/app/Script/scripts/psext_up_ipv6.sh b/ap/app/Script/scripts/psext_up_ipv6.sh
index 07ef6dc..3432452 100755
--- a/ap/app/Script/scripts/psext_up_ipv6.sh
+++ b/ap/app/Script/scripts/psext_up_ipv6.sh
@@ -23,6 +23,7 @@
 ps_ip=`nv get $ps_if"_ipv6_ip"`
 pdp_ip=`nv get $ps_if"_ipv6_pdp"`
 local_ipv6_addr=`nv get $ps_if"_ipv6_local"`
+dhcps_in_cap=`nv get dhcps_in_cap`
 
 #获取ip并配置ps、eth
 linkup_get_addr()
@@ -88,18 +89,23 @@
     echo 1 > /proc/sys/net/ipv6/conf/$br_if/accept_ra
     #enable ipv6 neigh discovery proxy
     echo 1 > /proc/sys/net/ipv6/conf/all/proxy_ndp
-
+	if [ "x$dhcps_in_cap" != "x1" ]; then
     zte_ndp -a -s $br_if -d $ps_if -l $ndp_log -p &
+	fi
 }
 
 linkup_dhcpv6_set()
 {
+	if [ "x$dhcps_in_cap" != "x1" ]; then
 	dhcp6s -dDf -c $dhcp6s_conf $br_if &
+	fi
 }
 
 linkup_radvd_set() 
 {
+	if [ "x$dhcps_in_cap" != "x1" ]; then
 	radvd -d 3 -C $radvd_conf -p $radvd_pidfile &
+	fi
 }
 
 mtu=`nv get mtu`