[Feature][task-view-306]merge P56U08(patch6) 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: I8e809511ac30c97228dd110c304b4a08f4af36d7
diff --git a/ap/app/Script/scripts/internet.sh b/ap/app/Script/scripts/internet.sh
index c741406..d432fe0 100755
--- a/ap/app/Script/scripts/internet.sh
+++ b/ap/app/Script/scripts/internet.sh
@@ -7,7 +7,7 @@
 path_sh=`nv get path_sh`
 . $path_sh/global.sh
 echo "Info: internet.sh start" > $test_log
-echo "Info: `date +%m-%d %H:%M:%S`" >> $test_log
+echo "Info: `date +%m-%d_%H:%M:%S`" >> $test_log
 
 genSysFiles()
 {
diff --git a/ap/app/Script/scripts/lan.sh b/ap/app/Script/scripts/lan.sh
index c7dddbb..253dc29 100755
--- a/ap/app/Script/scripts/lan.sh
+++ b/ap/app/Script/scripts/lan.sh
@@ -55,6 +55,25 @@
             echo "Error: brctl addif $br_name $device failed." >> $test_log
         fi
     done
+    br_node_num=`nv get br_node_num`
+    while [ $br_node_num -gt 0 ]
+    do
+        br_node_num=`expr $br_node_num - 1`
+		br_node=`nv get br_node$br_node_num`
+		if [ "x$br_node" != "x" ]; then
+			brname="bridge"$br_node_num
+			brctl addbr $brname 2>>$test_log
+			brctl setfd $brname 0.1 2>>$test_log
+			ifconfig $brname up 2>>$test_log
+			echo 1 > /proc/sys/net/ipv4/conf/$brname/arp_notify
+			for device in $br_node
+			do
+				ifconfig $device up 2>>$test_log
+				brctl addif $brname $device 2>>$test_log
+				nv set lan_name_$device=$brname
+			done
+		fi
+    done
     IFS=$IFS_OLD
     
 }
diff --git a/ap/app/Script/scripts/landev_updown.sh b/ap/app/Script/scripts/landev_updown.sh
old mode 100644
new mode 100755
index 8bf322e..e13c7ae
--- a/ap/app/Script/scripts/landev_updown.sh
+++ b/ap/app/Script/scripts/landev_updown.sh
@@ -38,7 +38,10 @@
 			fi
 
 	else
-		br_name=`nv get lan_name`
+		br_name=`nv get lan_name_$landev_name`
+		if [ "x$br_name" == "x" ]; then
+			br_name=`nv get lan_name`
+		fi
 		ifconfig $landev_name down 2>>$test_log
 		if [ $? -ne 0 ];then
 			echo "Error: ifconfig $landev_name down failed." >> $test_log
@@ -60,7 +63,10 @@
 		echo "Error: ifconfig $landev_name down failed." >> $test_log
 	fi
 	if [ "-$lan_enable" == "-1" ]; then
-		br_name=`nv get lan_name`
+		br_name=`nv get lan_name_$landev_name`
+		if [ "x$br_name" == "x" ]; then
+			br_name=`nv get lan_name`
+		fi
 		brctl delif $br_name $landev_name 2>>$test_log
 		if [ $? -ne 0 ];then
 			echo "Error: brctl delif $br_name $landev_name" >> $test_log
diff --git a/ap/app/Script/scripts/ppp_updown.sh b/ap/app/Script/scripts/ppp_updown.sh
index c9662d8..0081d4f 100755
--- a/ap/app/Script/scripts/ppp_updown.sh
+++ b/ap/app/Script/scripts/ppp_updown.sh
@@ -47,7 +47,9 @@
 
 	ps_ip=$ps_ip_ab"."$ps_ip_c1"."$ps_ip_d
 	
-	ifconfig $ps_if $ps_ip netmask 255.255.255.0 up
+	ifconfig $ps_if $ps_ip up 2>>$test_log
+	wan_nm=`nv get static_wan_netmask`
+	ifconfig $ps_if netmask $wan_nm 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.sh b/ap/app/Script/scripts/psext_up.sh
index 580ce71..e324c8d 100755
--- a/ap/app/Script/scripts/psext_up.sh
+++ b/ap/app/Script/scripts/psext_up.sh
@@ -44,7 +44,9 @@
     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 netmask 255.255.255.0 up 2>>$test_log
+	ifconfig $ps_if $ps_ip up 2>>$test_log
+	wan_nm=`nv get static_wan_netmask`
+	ifconfig $ps_if netmask $wan_nm 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_updown.sh b/ap/app/Script/scripts/psext_updown.sh
index 9f74350..1117d1c 100755
--- a/ap/app/Script/scripts/psext_updown.sh
+++ b/ap/app/Script/scripts/psext_updown.sh
@@ -277,7 +277,9 @@
 		get_netmask_btrunk $pdp_ip
 	fi
 	
-	ifconfig $ps_if $ps_ip netmask 255.255.255.0 up 2>>$test_log
+	ifconfig $ps_if $ps_ip up 2>>$test_log
+	wan_nm=`nv get static_wan_netmask`
+	ifconfig $ps_if netmask $wan_nm 2>>$test_log
 	if [ $? -ne 0 ];then
 	    echo "Error: ifconfig $ps_if $ps_ip up failed." >> $test_log
     fi
@@ -326,7 +328,11 @@
     br="br"$c_id
     brctl addbr $br
     brctl setfd $br 0.1
-    ifconfig $br up 2>>$test_log
+	if [ "$eth_if" != "zvnet"$c_id ]; then
+	ifconfig $br up 2>>$test_log
+	else
+	ifconfig $br -arp up  2>>$test_log
+	fi
 	if [ $? -ne 0 ];then
 	    echo "Error: ifconfig $br up failed." >> $test_log
     fi
@@ -447,7 +453,11 @@
         brctl addbr $ext_br
         brctl setfd $ext_br 0.1
         brctl addif $ext_br $eth_if
-        ifconfig $ext_br up
+		if [ "$eth_if" != "zvnet"$c_id ]; then
+		ifconfig $ext_br up 2>>$test_log
+		else
+		ifconfig $ext_br -arp up 2>>$test_log
+		fi
         get_ipaddr
 		dhcp_set
 	    route_set
diff --git a/ap/app/Script/scripts/psext_updown_ipv6.sh b/ap/app/Script/scripts/psext_updown_ipv6.sh
index 83d471c..06bee36 100755
--- a/ap/app/Script/scripts/psext_updown_ipv6.sh
+++ b/ap/app/Script/scripts/psext_updown_ipv6.sh
@@ -151,7 +151,11 @@
         brctl addbr $br_if
         brctl setfd $br_if 0.1
         nv set $br_if"_ipv6_ip"=$br_ip
-        ifconfig $br_if up 2>>$test_log
+		if [ "$eth_if" != "zvnet"$c_id ]; then
+		ifconfig $br_if up 2>>$test_log
+		else
+		ifconfig $br_if -arp up 2>>$test_log
+		fi
 		if [ $? -ne 0 ];then
             echo "Error: ifconfig $br_if up failed." >> $test_log
         fi
diff --git a/ap/app/Script/scripts/wan_ipv4.sh b/ap/app/Script/scripts/wan_ipv4.sh
index 7aac6ff..e71850d 100755
--- a/ap/app/Script/scripts/wan_ipv4.sh
+++ b/ap/app/Script/scripts/wan_ipv4.sh
@@ -120,7 +120,9 @@
 		pswan_nm=`nv get $wan_if"_nm"`
 		
 		#ifconfig $wan_if down 2>>$test_log
-		ifconfig $wan_if $pswan_ip netmask 255.255.255.0 up 2>>$test_log
+		ifconfig $wan_if $pswan_ip up 2>>$test_log
+		wan_nm=`nv get static_wan_netmask`
+		ifconfig $wan_if netmask $wan_nm 2>>$test_log
 		if [ $? -ne 0 ];then
 	        echo "Error: ifconfig $wan_if $pswan_ip up failed." >> $test_log
         fi
@@ -299,4 +301,4 @@
 		tc_tbf.sh down $def_cid
 	fi
 	linkdown $2 $3	
-fi
+fi
\ No newline at end of file