[Feature][ZXW-452]merge P54U02 version

Only Configure: No
Affected branch: master
Affected module: unknow
Is it affected on both ZXIC and MTK: only ZXIC
Self-test: Yes
Doc Update: No

Change-Id: I17e6795ab66e2b9d1cbbfec4b7c0028d666e177d
diff --git a/ap/app/Script/scripts/lan.sh b/ap/app/Script/scripts/lan.sh
index 6c471e9..c7dddbb 100755
--- a/ap/app/Script/scripts/lan.sh
+++ b/ap/app/Script/scripts/lan.sh
@@ -140,6 +140,16 @@
     ipv6lanipaddrcmd="ifconfig $br_name | grep Scope:Link | sed 's/^.*addr: //g' | sed 's/\/.*$//g'"
     ipv6lanipaddr=`eval $ipv6lanipaddrcmd`
     nv set ipv6_lan_ipaddr=$ipv6lanipaddr
+	gw_in_cap=`nv get gw_in_cap`
+	if [ "x$gw_in_cap" == "x1" ]; then
+		lan_if_cap=`nv get lan_name_cap`
+		ap_ip=`nv get lan_ipaddr_cap`
+		ap_ipv6=`nv get lan_ipv6addr_cap`
+		
+		ip route add default via $ap_ip
+		ip -6 route add default via $ap_ipv6 dev $lan_if_cap
+		echo "nameserver $ap_ip" >> /etc/resolv.conf
+	fi
 }
 
 main
diff --git a/ap/app/Script/scripts/psext_up_ipv6.sh b/ap/app/Script/scripts/psext_up_ipv6.sh
index 302b842..5861350 100755
--- a/ap/app/Script/scripts/psext_up_ipv6.sh
+++ b/ap/app/Script/scripts/psext_up_ipv6.sh
@@ -73,9 +73,10 @@
     rt_num=`expr $c_id + 150`
     ip -6 route add default dev $ps_if table $rt_num
     ip -6 rule add from $pdp_ip/64 fwmark $marknum table $rt_num
-
+	gw_in_cap=`nv get gw_in_cap`
+	if [ "x$gw_in_cap" != "x1" ]; then
     ip6tables -t filter -A FORWARD -p icmpv6 --icmpv6-type 135 -j DROP
-	
+	fi
     ip -6 route flush cache
 
 	route_info=`ip -6 route|grep default`
diff --git a/ap/app/Script/scripts/user-config-udhcpd.sh b/ap/app/Script/scripts/user-config-udhcpd.sh
old mode 100644
new mode 100755
index 62eefd7..dd03b71
--- a/ap/app/Script/scripts/user-config-udhcpd.sh
+++ b/ap/app/Script/scripts/user-config-udhcpd.sh
@@ -45,6 +45,11 @@
 lease=`expr $lease \* 3600`
 pidfile=$path_conf"/udhcpd.pid"
 leasesfile=$path_conf"/udhcpd.leases"
+gw_in_cap=`nv get gw_in_cap`
+if [ "x$gw_in_cap" == "x1" ]; then
+	dns=`nv get dhcpDns_cap`
+	gw=`nv get lan_ipaddr_cap`
+fi
 
 sh $path_sh/config-udhcpd.sh "lan" -s $start
 sh $path_sh/config-udhcpd.sh "lan" -e $end
diff --git a/ap/app/Script/scripts/wan_ipv4.sh b/ap/app/Script/scripts/wan_ipv4.sh
index e985e7b..7c0ba39 100755
--- a/ap/app/Script/scripts/wan_ipv4.sh
+++ b/ap/app/Script/scripts/wan_ipv4.sh
@@ -116,10 +116,7 @@
 		pswan_secdns=`nv get $wan_if"_secdns"`
 		pswan_nm=`nv get $wan_if"_nm"`
 		
-		ifconfig $wan_if down 2>>$test_log
-		if [ $? -ne 0 ];then
-	        echo "Error: ifconfig $wan_if down failed." >> $test_log
-        fi
+		#ifconfig $wan_if down 2>>$test_log
 		ifconfig $wan_if $pswan_ip netmask 255.255.255.0 up 2>>$test_log
 		if [ $? -ne 0 ];then
 	        echo "Error: ifconfig $wan_if $pswan_ip up failed." >> $test_log