[Feature][YUKUAI_patch]add 18.02 code
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: I7f71153004f10fc0ea5adfa083866aaeeb1053ac
diff --git a/rootfs/sbin/acpid b/rootfs/sbin/acpid
new file mode 120000
index 0000000..e6e5559
--- /dev/null
+++ b/rootfs/sbin/acpid
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/acpid
\ No newline at end of file
diff --git a/rootfs/sbin/adjtimex b/rootfs/sbin/adjtimex
new file mode 120000
index 0000000..bfd91fc
--- /dev/null
+++ b/rootfs/sbin/adjtimex
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/adjtimex
\ No newline at end of file
diff --git a/rootfs/sbin/arp b/rootfs/sbin/arp
new file mode 120000
index 0000000..7f0c29a
--- /dev/null
+++ b/rootfs/sbin/arp
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/arp
\ No newline at end of file
diff --git a/rootfs/sbin/auto_dial.sh b/rootfs/sbin/auto_dial.sh
new file mode 100755
index 0000000..f6508cc
--- /dev/null
+++ b/rootfs/sbin/auto_dial.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+path_sh=`nv get path_sh`
+. $path_sh/global.sh
+
+echo "Info: auto_dial.sh $1 start" >> $test_log
+
+wanlan_select()
+{
+ auto_wan_if=`nv get $1`
+ ifconfig $auto_wan_if down 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $auto_wan_if down" >> $test_log
+ fi
+ ifconfig $auto_wan_if up 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $auto_wan_if up" >> $test_log
+ fi
+ (eth_auto_connect || echo "Error: eth_auto_connect failed." >> $test_log) &
+}
+
+
+wanlan_select $1
diff --git a/rootfs/sbin/badblocks b/rootfs/sbin/badblocks
new file mode 100755
index 0000000..e31657d
--- /dev/null
+++ b/rootfs/sbin/badblocks
Binary files differ
diff --git a/rootfs/sbin/blkid b/rootfs/sbin/blkid
new file mode 120000
index 0000000..10720b3
--- /dev/null
+++ b/rootfs/sbin/blkid
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/blkid
\ No newline at end of file
diff --git a/rootfs/sbin/blockdev b/rootfs/sbin/blockdev
new file mode 120000
index 0000000..e3fa40e
--- /dev/null
+++ b/rootfs/sbin/blockdev
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/blockdev
\ No newline at end of file
diff --git a/rootfs/sbin/bootchartd b/rootfs/sbin/bootchartd
new file mode 120000
index 0000000..45ed139
--- /dev/null
+++ b/rootfs/sbin/bootchartd
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/bootchartd
\ No newline at end of file
diff --git a/rootfs/sbin/bridge b/rootfs/sbin/bridge
new file mode 100755
index 0000000..25c2a25
--- /dev/null
+++ b/rootfs/sbin/bridge
Binary files differ
diff --git a/rootfs/sbin/clat_config.sh b/rootfs/sbin/clat_config.sh
new file mode 100755
index 0000000..c1a9b2b
--- /dev/null
+++ b/rootfs/sbin/clat_config.sh
@@ -0,0 +1,63 @@
+#!/bin/sh
+
+path_sh=`nv get path_sh`
+. $path_sh/global.sh
+
+echo "Info: clat_config.sh $1 $2 start" >> $test_log
+
+if [ "x$2" != "x" ]; then
+ wan1_ipv6_prefix_info=`nv get $2"_ipv6_prefix_info"`
+fi
+
+if [ "x$wan1_ipv6_prefix_info" != "x" ]; then
+ clat6_ipv6="$wan1_ipv6_prefix_info"":464"
+fi
+
+ipv4_fake_subnet=`nv get ipv4_fake_subnet`
+clat_fake_subnet=`nv get clat_fake_subnet`
+ipv6_fake_addr=`nv get ipv6_fake_subnet`
+if [ "x$ipv6_fake_addr" != "x" ];then
+ ipv6_fake_subnet=$ipv6_fake_addr"/64"
+fi
+
+case $1 in
+ "up")
+ if [ "x$ipv4_fake_subnet" == "x" -a "x$clat_fake_subnet" == "x" -a "x$ipv6_fake_addr" == "x" ];then
+ echo "Info: ipv4_fake_subnet and clat_fake_subnet not exist, please check!!!" >> $test_log
+ fi
+
+ # for 46
+ route add default dev clat4 metric 40
+ route add -net $ipv4_fake_subnet netmask 255.255.0.0 dev clat4
+ iptables -t nat -A POSTROUTING -o clat4 -j MASQUERADE
+
+ if [ "x$clat6_ipv6" != "x" -a "x$2" != "x" ]; then
+ ip -6 neigh add proxy $clat6_ipv6 dev $2
+ fi
+
+ echo 1 > /proc/sys/net/ipv4/ip_forward
+
+ #for 64
+ #ip -6 route add $ipv6_fake_subnet dev clat
+ #route add -net $clat_fake_subnet netmask 255.255.255.0 dev clat4
+ ;;
+
+ "down")
+
+ # for 46
+ route del default dev clat4 metric 40
+ route del -net $ipv4_fake_subnet netmask 255.255.0.0 dev clat4
+ iptables -t nat -D POSTROUTING -o clat4 -j MASQUERADE
+
+ if [ "x$clat6_ipv6" != "x" -a "x$2" != "x" ]; then
+ ip -6 neigh del proxy $clat6_ipv6 dev $2
+ fi
+
+ #for 64
+ #ip -6 route del $ipv6_fake_subnet dev clat
+ #route del -net $clat_fake_subnet netmask 255.255.255.0 dev clat4
+ ;;
+
+esac
+
+
diff --git a/rootfs/sbin/config-dns.sh b/rootfs/sbin/config-dns.sh
new file mode 100755
index 0000000..5237ca3
--- /dev/null
+++ b/rootfs/sbin/config-dns.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+#
+# $Id: config-dns.sh, v10.08.05, 2010-08-05 15:00:00
+#
+# usage: config-dns.sh [<dns1>] [<dns2>]
+#
+path_sh=`nv get path_sh`
+. $path_sh/global.sh
+echo "Info: config-dns.sh $1 $2 start" >> $test_log
+fname=$path_conf"/etc/resolv.conf"
+fbak=$path_conf"/etc/resolv_conf.bak"
+
+# in case no previous file
+touch $fname
+
+# backup file without nameserver part
+sed -e '/nameserver/d' $fname > $fbak
+
+# set primary and seconday DNS
+if [ "x$1" != "x" ]; then
+ echo "nameserver $1" > $fname
+else # empty dns
+ rm -f $fname
+fi
+if [ "x$2" != "x" ]; then
+ echo "nameserver $2" >> $fname
+fi
+
+cat $fbak >> $fname
+rm -f $fbak
+
diff --git a/rootfs/sbin/config-hostname.sh b/rootfs/sbin/config-hostname.sh
new file mode 100755
index 0000000..bf4c5cc
--- /dev/null
+++ b/rootfs/sbin/config-hostname.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+path_sh=`nv get path_sh`
+. $path_sh/global.sh
+echo "Info: config-hostname.sh $1 $2 start" >> $test_log
+fname=$path_conf"/hostname_mac_file"
+fbak=$path_conf"/hostname_mac_file_bak"
+
+if [ "x$1" = "x" ]; then
+ echo "insufficient arguments.."
+elif [ "x$2" = "x" ]; then
+ sed -e "/$1/d" $fname > $fbak
+ cat $fbak > $fname
+ rm -f $fbak
+else # $1 mac, $2 hostname
+ sed -e "/$1/d" $fname > $fbak
+ echo "$1 $2" >> $fbak
+ cat $fbak > $fname
+ rm -f $fbak
+fi
+
+
diff --git a/rootfs/sbin/config-igmpproxy.sh b/rootfs/sbin/config-igmpproxy.sh
new file mode 100755
index 0000000..353970e
--- /dev/null
+++ b/rootfs/sbin/config-igmpproxy.sh
@@ -0,0 +1,52 @@
+#!/bin/sh
+#
+# usage: see function usage()
+
+path_sh=`nv get path_sh`
+. $path_sh/global.sh
+
+
+usage () {
+ echo "usage: config-udhcpd.sh [option]..."
+ echo "options:"
+ echo " -h : print this help"
+ echo " -c : clean the conf file"
+ echo " -u interface : set upstream interface for server"
+ echo " -d interface1 [interface2].. : set downstream interface for client"
+ echo " -s addr : set gateway of upstream interface"
+ echo " -r : run igmpproxy"
+ exit
+}
+
+config () {
+ case "$1" in
+ "-c")
+ sed -i '36,$d' $fname;;
+ "-u")
+ sed -i "30c phyint $2 upstream ratelimit 0 threshold 1" $fname;;
+ "-d")
+ sed -i '$a phyint '"$2"' downstream ratelimit 0 threshold 1' $fname
+ sed -i '$a' $fname;;
+ "-s")
+ sed -i "31c altnet $2/24" $fname;;
+
+ esac
+
+}
+
+
+fname=$path_conf"/igmpproxy.conf"
+
+case "$1" in
+
+
+ "-h") usage;;
+ "-c") config "$1";;
+ "-u") config "$1" "$2";;
+ "-s") config "$1" "$2";;
+ "-d") config "$1" "$2" "$3" "$4";;
+ "-r") igmpproxy& ;;
+ *) usage;;
+esac
+
+
diff --git a/rootfs/sbin/config-parents.sh b/rootfs/sbin/config-parents.sh
new file mode 100755
index 0000000..b38ff67
--- /dev/null
+++ b/rootfs/sbin/config-parents.sh
@@ -0,0 +1,66 @@
+#!/bin/sh
+
+path_sh=`nv get path_sh`
+. $path_sh/global.sh
+echo "Info: config-parents $1 $2 $3 start" >> $test_log
+
+device()
+{
+ fname=$path_conf"/children_device_file"
+ fbak=$path_conf"/children_device_file_bak"
+
+ if [ "x$1" = "x" ]; then
+ echo "insufficient arguments.."
+ elif [ "x$2" = "x" ]; then
+ sed -e "/$1/d" $fname > $fbak
+ cat $fbak > $fname
+ rm -f $fbak
+ else # $1 mac, $2 hostname
+ sed -e "/$1/d" $fname > $fbak
+ echo "$1 $2" >> $fbak
+ cat $fbak > $fname
+ rm -f $fbak
+ fi
+}
+white_site()
+{
+ fname=${path_conf}/white_site_file
+ fbak=${path_conf}/white_site_file_bak
+ if [ "x$1" = "x" ]; then
+ echo "no action"
+ elif [ "x$1" = "x-A" ]; then
+ if [ "x$2" = "x" ]; then
+ echo "no site to add"
+ else #s2:site s3:name
+ #sed -i "s%$2.*%%" $fname
+ #sed -i "/^$/d" $fname
+ echo "$2,$3" >> $fname
+ #cat $fbak > $fname
+ #rm -f $fbak
+ fi
+ elif [ "x$1" = "x-D" ]; then
+ if [ "x$2" = "x" ]; then
+ echo "no site to delete"
+ else #s2:ids
+ ids=$2
+ if [ -n "$ids" ]; then
+ echo $ids|grep ",$"
+ if [ 0 -eq $? ]; then
+ echo "_____1"
+ echo $ids|sed 's/\(,\)/d;/g'|sed 's%^\(.*\)%sed -i "\1"%'|sed "s,$, $fname,"|sh
+ else
+ echo "______2"
+ echo $ids|sed 's/\(,\)/d;/g'|sed 's%^\(.*\)%sed -i "\1d"%'|sed "s,$, $fname," |sh
+ fi
+ fi
+ fi
+ else # $1 mac, $2 hostname
+ echo "error action"
+ fi
+}
+
+if [ "$1" = "white_site" ]; then
+ white_site $2 $3 $4
+elif [ "$1" = "device" ]; then
+ device $2 $3
+fi
\ No newline at end of file
diff --git a/rootfs/sbin/config-udhcpd.sh b/rootfs/sbin/config-udhcpd.sh
new file mode 100755
index 0000000..dfbd2c1
--- /dev/null
+++ b/rootfs/sbin/config-udhcpd.sh
@@ -0,0 +1,271 @@
+#!/bin/sh
+#
+# $Id: config-udhcpd.sh,v 1.10 2010-06-18 06:33:21 steven Exp $
+#
+# usage: see function usage()
+
+path_sh=`nv get path_sh`
+. $path_sh/global.sh
+
+dhcp_type=$1
+
+usage () {
+ echo "usage: config-udhcpd.sh [option]..."
+ echo "options:"
+ echo " -h : print this help"
+ echo " -s ipaddr : set ipaddr as start of the IP lease block"
+ echo " -e ipaddr : set ipaddr as end of the IP lease block"
+ echo " -i ifc : set ifc as the interface that udhcpd will use"
+ echo " -d dns1 [dns2] : set dns1 and dns2 as DNS"
+ echo " -m mask : set mask as subnet netmask"
+ echo " -g gateway : set gateway as router's IP address"
+ echo " -t time : set time seconds as the IP life time"
+ echo " -r [sleep_time] : run dhcp server"
+ echo " -k : kill the running dhcp server"
+ echo " -S [mac ipaddr] : statically assign IP to given MAC address"
+
+ exit
+}
+
+config () {
+ case "$1" in
+ "-s")
+ sed -e '/start/d' $fname > $fbak
+ echo "start $2" >> $fbak ;;
+ "-e")
+ sed -e '/end/d' $fname > $fbak
+ echo "end $2" >> $fbak ;;
+ "-i")
+ sed -e '/interface/d' $fname > $fbak
+ echo "interface $2" >> $fbak ;;
+ "-p")
+ sed -e '/pidfile/d' $fname > $fbak
+ echo "pidfile $2" >> $fbak ;;
+ "-l")
+ sed -e '/lease_file/d' $fname > $fbak
+ echo "lease_file $2" >> $fbak ;;
+ "-d")
+ sed -e '/option *dns/d' $fname > $fbak
+ echo "option dns $2 $3" >> $fbak ;;
+ "-m")
+ sed -e '/option *subnet/d' $fname > $fbak
+ echo "option subnet $2" >> $fbak ;;
+ "-g")
+ sed -e '/option *router/d' $fname > $fbak
+ echo "option router $2" >> $fbak ;;
+ "-t")
+ sed -e '/option *lease/d' $fname > $fbak
+ echo "option lease $2" >> $fbak ;;
+ "-S")
+ if [ "$2" = "" ]; then
+ sed -e '/static_lease/d' $fname > $fbak
+ elif [ "$3" = "" ]; then
+ echo "insufficient arguments.."
+ usage
+ else
+ sed -e "/$2/d" $fname > $fbak
+ echo "static_lease $2 $3" >> $fbak
+ cat $fbak > $fname
+ rm -f $fbak
+ sed -e "/$2/d" $fname_static > $fbak_static
+ echo "$2 $3" >> $fbak_static
+ cat $fbak_static > $fname_static
+ rm -f $fbak_static
+ return
+ fi
+ ;;
+ "-x")
+ sed -e '/static_netmask/d' $fname > $fbak
+ echo "static_netmask $2" >> $fbak ;;
+ "-y")
+ sed -e '/static_router/d' $fname > $fbak
+ echo "static_router $2" >> $fbak ;;
+ "-D")
+ sed -e "/$2/d" $fname > $fbak
+ sed -e "/$2/d" $fname_static > $fbak_static
+ cat $fbak_static > $fname_static
+ rm -f $fbak_static;;
+ "-E")
+ while read LINE
+ do
+ echo "static_lease $LINE" >> $fbak
+ done < $fname_static ;;
+ *) return;;
+ esac
+ cat $fbak > $fname
+ rm -f $fbak
+ return
+}
+
+# arg1: phy address.
+link_down()
+{
+ # get original register value
+ get_mii=`mii_mgr -g -p $1 -r 0`
+ orig=`echo $get_mii | sed 's/^.....................//'`
+
+ # stupid hex value calculation.
+ pre=`echo $orig | sed 's/...$//'`
+ post=`echo $orig | sed 's/^..//'`
+ num_hex=`echo $orig | sed 's/^.//' | sed 's/..$//'`
+ case $num_hex in
+ "0") rep="8" ;;
+ "1") rep="9" ;;
+ "2") rep="a" ;;
+ "3") rep="b" ;;
+ "4") rep="c" ;;
+ "5") rep="d" ;;
+ "6") rep="e" ;;
+ "7") rep="f" ;;
+ # The power is already down
+ *) echo "Port$1 is down. Skip.";return;;
+ esac
+ new=$pre$rep$post
+ # power down
+ mii_mgr -s -p $1 -r 0 -v $new 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: mii_mgr -s -p $1 -r 0 -v $new" >> $test_log
+ fi
+}
+
+link_up()
+{
+ # get original register value
+ get_mii=`mii_mgr -g -p $1 -r 0`
+ orig=`echo $get_mii | sed 's/^.....................//'`
+
+ # stupid hex value calculation.
+ pre=`echo $orig | sed 's/...$//'`
+ post=`echo $orig | sed 's/^..//'`
+ num_hex=`echo $orig | sed 's/^.//' | sed 's/..$//'`
+ case $num_hex in
+ "8") rep="0" ;;
+ "9") rep="1" ;;
+ "a") rep="2" ;;
+ "b") rep="3" ;;
+ "c") rep="4" ;;
+ "d") rep="5" ;;
+ "e") rep="6" ;;
+ "f") rep="7" ;;
+ # The power is already up
+ *) echo "Port$1 is up. Skip.";return;;
+ esac
+ new=$pre$rep$post
+ # power up
+ mii_mgr -s -p $1 -r 0 -v $new 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: mii_mgr -s -p $1 -r 0 -v $new" >> $test_log
+ fi
+}
+
+reset_all_phys()
+{
+ sleep_time=$1
+
+ if [ "x$CONFIG_RAETH_ROUTER" != "xy" -a "x$CONFIG_RT_3052_ESW" != "xy" ]; then
+ return
+ fi
+
+ opmode=`nvram_get 2860 OperationMode`
+
+ #skip WAN port
+ if [ "x$opmode" != "x1" ]; then #no wan port
+ link_down 0
+ link_down 4
+ elif [ "x$CONFIG_WAN_AT_P4" = "xy" ]; then #wan port at port4
+ link_down 0
+ elif [ "x$CONFIG_WAN_AT_P0" = "xy" ]; then #wan port at port0
+ link_down 4
+ fi
+ link_down 1
+ link_down 2
+ link_down 3
+
+ #force Windows clients to renew IP and update DNS server
+ sleep $sleep_time
+
+ #skip WAN port
+ if [ "x$opmode" != "x1" ]; then #no wan port
+ link_up 0
+ link_up 4
+ elif [ "x$CONFIG_WAN_AT_P4" = "xy" ]; then #wan port at port4
+ link_up 0
+ elif [ "x$CONFIG_WAN_AT_P0" = "xy" ]; then #wan port at port0
+ link_up 4
+ fi
+ link_up 1
+ link_up 2
+ link_up 3
+}
+
+# argv 1 is empty
+if [ "$1" = "" ]; then
+ usage
+fi
+
+# argv 2 is empty
+if [ "$2" = "" ]; then
+ if [ "$1" != "-r" -a "$1" != "-k" -a "$1" != "-S" ]; then
+ usage
+ fi
+fi
+
+
+if [ "x$1" == "xlan" ]; then
+ fname=$path_conf"/udhcpd.conf"
+ fbak=$path_conf"/udhcpd.conf_bak"
+ pidfile=$path_conf"/udhcpd.pid"
+ leases=$path_conf"/udhcpd.leases"
+else
+ fname=$path_conf"/udhcpd"$1".conf"
+ fbak=$path_conf"/udhcpd"$1".conf_bak"
+ pidfile=$path_conf"/udhcpd"$1".pid"
+ leases=$path_conf"/udhcpd"$1".leases"
+fi
+fname_static=$path_conf"/static_macip_file"
+fbak_static=$path_conf"/static_macip_file_bak"
+touch $fname
+
+case "$2" in
+
+ "-r")
+
+ if [ -e ${pidfile} ]; then
+ kill `cat $pidfile`
+ fi
+ rm -f $pidfile
+ touch $leases
+ sed '/^lease_file /d' $fname > $fbak
+ cat $fbak > $fname
+ echo "lease_file $leases" >> $fname
+ linenum=`cat $fname|wc -l`
+ if [ $linenum -ne 9 -a "$dhcp_type" == "lan" ]; then
+ . $path_sh/user-config-udhcpd.sh
+ fi
+ udhcpd -f $fname &
+ reset_all_phys $3
+ ;;
+ "-h") usage;;
+ "-p") config "$2" "$3";;
+ "-l") config "$2" "$3";;
+ "-s") config "$2" "$3";;
+ "-e") config "$2" "$3";;
+ "-i") config "$2" "$3";;
+ "-d") config "$2" "$3" "$4";;
+ "-m") config "$2" "$3";;
+ "-g") config "$2" "$3";;
+ "-t") config "$2" "$3";;
+ "-S") config "$2" "$3" "$4";;
+ "-D") config "$2" "$3";;
+ "-E") config "$2";;
+ "-k")
+ if [ -e ${pidfile} ]; then
+ kill `cat $pidfile`
+ fi
+ rm -f $pidfile ;;
+ "-x") config "$2" "$3";;
+ "-y") config "$2" "$3";;
+ *) usage;;
+esac
+
+
diff --git a/rootfs/sbin/customer_type.sh b/rootfs/sbin/customer_type.sh
new file mode 100755
index 0000000..aa3a7d4
--- /dev/null
+++ b/rootfs/sbin/customer_type.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+# ´Ë½Ç¶ÈÓÃÓÚ¿Í»§¶¨Öƹ¦ÄÜ
+
+# Ϊ¹úµç¶¨ÖÆ£¬Èç¹ûÊǹúµç£¬Ç¿Ðгõʼ»¯¹úµçÏà¹ØNV£¬ÐèÒªÔÚÏà¹ØÓ¦ÓÃÆô¶¯Ç°
+customer_type=$(nv get customer_type)
+if [ x"${customer_type}" == x"guodian" ];then
+ # fota
+ nv set fota_updateMode=0
+ nv set pwron_auto_check=0
+ # mmi
+ nv set mmi_showmode=led
+ nv set mmi_task_tab=net_task+ctrl_task
+ nv set mmi_led_mode=sleep_mode
+ zte_mmi &
+ # uart
+ nv set self_adaption_port=/dev/ttyS0
+elif [ x"${customer_type}" == x"nandian" ]; then
+ # fota
+ nv set fota_updateMode=0
+ nv set pwron_auto_check=0
+ # mmi
+ nv set mmi_showmode=led
+ nv set mmi_task_tab=net_task+ctrl_task+key_task
+ nv set mmi_led_mode=sleep_mode
+ zte_mmi &
+ # uart
+ nv set self_adaption_port=/dev/ttyS0
+fi
diff --git a/rootfs/sbin/ddns.sh b/rootfs/sbin/ddns.sh
new file mode 100755
index 0000000..baac6c0
--- /dev/null
+++ b/rootfs/sbin/ddns.sh
@@ -0,0 +1,51 @@
+#!/bin/sh
+#
+# $Id: ddns.sh,v 1.1 2007-09-24 09:34:52 winfred Exp $
+#
+# usage: ddns.sh
+#
+path_sh=`nv get path_sh`
+. $path_sh/global.sh
+echo "Info: ddns.sh start" >> $test_log
+
+srv=`nv get DDNSProvider`
+ddns=`nv get DDNS`
+ddns_hash=`nv get DDNS_Hash_Value`
+u=`nv get DDNSAccount`
+pw=`nv get DDNSPassword`
+ddns_enable=`nv get DDNS_Enable`
+
+killall -q inadyn
+rm -rf $path_conf/inadyn.status
+
+if [ "x$ddns_enable" = "x0" ]; then
+ exit 0
+fi
+if [ "x$srv" = "x" -o "x$srv" = "xnone" ]; then
+ exit 0
+fi
+if [ "x$ddns" = "x" -o "x$u" = "x" -o "x$pw" = "x" ]; then
+ exit 0
+fi
+
+# debug
+echo "srv=$srv"
+echo "ddns=$ddns"
+echo "ddns_hash=$ddns_hash"
+echo "u=$u"
+echo "pw=$pw"
+
+
+if [ "x$srv" = "xdyndns.org" ]; then
+ inadyn -u $u -p $pw -a $ddns --dyndns_system dyndns@$srv &
+elif [ "x$srv" = "xfreedns.afraid.org" ]; then
+ inadyn -u $u -p $pw -a $ddns,$ddns_hash --dyndns_system default@$srv &
+elif [ "x$srv" = "xzoneedit.com" ]; then
+ inadyn -u $u -p $pw -a $ddns --dyndns_system default@$srv &
+elif [ "x$srv" = "xno-ip.com" ]; then
+ inadyn -u $u -p $pw -a $ddns --dyndns_system default@$srv &
+else
+ inadyn -u $u -p $pw -a $ddns --dyndns_system default@$srv &
+ echo "unknown DDNS provider: $srv"
+fi
+
diff --git a/rootfs/sbin/debugfs b/rootfs/sbin/debugfs
new file mode 100755
index 0000000..f6a620e
--- /dev/null
+++ b/rootfs/sbin/debugfs
Binary files differ
diff --git a/rootfs/sbin/defwan_set.sh b/rootfs/sbin/defwan_set.sh
new file mode 100755
index 0000000..bac6f8f
--- /dev/null
+++ b/rootfs/sbin/defwan_set.sh
@@ -0,0 +1,144 @@
+#!/bin/sh
+
+path_sh=`nv get path_sh`
+. $path_sh/global.sh
+echo "Info: defwan_set.sh $1 start" >> $test_log
+nd_dns=`nv get lan_ipaddr`
+#linuxϵͳetcĿ¼¿É¶Áд£¬resolv.conf¿ÉÒÔÖ±½Ó·ÅÔÚetcÏ£¬Í¬²½uc´úÂëʱעÒâ²»Òª½«´Ë´¦Í¬²½
+resolv_conf=/etc/resolv.conf
+dnsmasq_conf=$path_conf/dnsmasq.conf
+
+killall -9 dnsmasq
+def_cid=`nv get default_cid`
+
+if [ "-$1" == "-pswan" ]; then
+ ipaddr_type=`nv get "pdp_act_type"$def_cid`
+elif [ "-$1" == "-ethwan" ]; then
+ ipaddr_type=`nv get eth_act_type`
+elif [ "-$1" == "-wifiwan" ]; then
+ ipaddr_type=`nv get wifi_act_type`
+fi
+
+#»ñȡĬÈÏÍø¿Ú
+wan_if=$defwan_if
+wan6_if=$defwan6_if
+
+echo "" > $dnsmasq_conf
+
+#Èç¹û±¾µØÓ¦ÓÃÐèҪʹÓÃdnsmasqµÄ¹¦ÄÜ£¬ÐèÒªÔÚ"/etc/resolv.conf" ÎļþÖÐÌí¼Ó "127.0.0.1"£¬±ØÐë·ÅÔÚµÚÒ»Ìõ
+echo "" > $resolv_conf
+echo nameserver 127.0.0.1 > $resolv_conf
+
+
+#DNS¶ÔÓÚÍ¬Ò»Íø¿Ú£¬²»Çå³þ½«À´ÐèÇóÊÇ·ñÖ§³Ö·Ö±ð¶Ôv4¡¢v6½øÐÐauto¡¢manualÉèÖ㬴˴¦ÔÝʱ×ö³É¿É·Ö±ðÉèÖÃ
+#ÉèÖÃIPv4 ȱʡ·ÓÉ DNS
+if [ "-$ipaddr_type" == "-IPv4" -o "-$ipaddr_type" == "-IPv4v6" -o "-$ipaddr_type" == "-IPV4V6" -o "-$ipaddr_type" == "-" ];then
+ #ÉèÖÃIPv4µÄĬÈÏÍø¹Ø
+ route del default
+ Flag=`route | grep -w "default"`
+ if [ "-$Flag" != "-" ];then
+ echo "Error: route del default failed." >> $test_log
+ fi
+
+ defwan_gw=`nv get $wan_if"_gw"`
+ if [ "-$defwan_gw" != "-" -o "-$defwan_rel" != "-" ];then
+ route add default gw $defwan_gw dev $defwan_rel 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: route add default gw $defwan_gw dev $defwan_rel failed." >> $test_log
+ fi
+ fi
+
+
+
+
+ #dnsmodeÓÉatserver´¦Àí£¬´«Êµ¼ÊʹÓõÄÖµ£¬´Ë´¦½öʹÓÃÒ»¸önv£¬²»Çø·Öauto manual
+ dns_mode=`nv get $1"_dns_mode"`
+ if [ "-$1" == "-pswan" -o "-$dns_mode" == "-auto" -o "-$dns_mode" == "-" ]; then
+ pridns=`nv get $wan_if"_pridns"`
+ secdns=`nv get $wan_if"_secdns"`
+ elif [ "-$dns_mode" == "-manual" ]; then
+ pridns=`nv get $1"_pridns_manual"`
+ secdns=`nv get $1"_secdns_manual"`
+ fi
+
+ if [ "-$pridns" == "-" -o "-$pridns" == "-0.0.0.0" ] && [ "-$secdns" == "-" -o "-$secdns" == "-0.0.0.0" ]; then
+ pridns="114.114.114.114"
+ secdns="8.8.8.8"
+ fi
+
+ if [ "-$pridns" != "-" -a "-$pridns" != "-0.0.0.0" ]; then
+ echo nameserver $pridns > $dnsmasq_conf
+ fi
+ if [ "-$secdns" != "-" -a "-$secdns" != "-0.0.0.0" ]; then
+ echo nameserver $secdns >> $dnsmasq_conf
+ fi
+
+ dns_extern=`nv get dns_extern`
+ if [ -n "$dns_extern" ]; then
+ echo nameserver $dns_extern >> $dnsmasq_conf
+ fi
+ if [ "-$1" == "-pswan" ]; then
+ tc_tbf.sh up $def_cid
+ fi
+fi
+
+#ÒÑÉèÖúÃÍâÍø¿ÚÔò¿ª×ª·¢
+if [ "-$wan_if" != "-" ]; then
+ echo 1 > /proc/sys/net/ipv4/ip_forward
+fi
+
+#ÉèÖÃIPv6 DNS
+if [ "-$ipaddr_type" == "-IPv6" -o "-$ipaddr_type" == "-IPV6" -o "-$ipaddr_type" == "-IPv4v6" -o "-$ipaddr_type" == "-IPV4V6" ];then
+ #dnsmodeÓÉatserver´¦Àí£¬´«Êµ¼ÊʹÓõÄÖµ£¬´Ë´¦½öʹÓÃÒ»¸önv£¬²»Çø·Öauto manual
+ ipv6_dns_mode=`nv get $1"_ipv6_dns_mode"`
+ if [ "-$1" == "-pswan" -o "-$ipv6_dns_mode" == "-auto" -o "-$ipv6_dns_mode" == "-" ]; then
+ ipv6_pridns=`nv get $wan6_if"_ipv6_pridns_auto"`
+ ipv6_secdns=`nv get $wan6_if"_ipv6_secdns_auto"`
+ elif [ "-$ipv6_dns_mode" == "-manual" ]; then
+ ipv6_pridns=`nv get $1"_ipv6_pridns_manual"`
+ ipv6_secdns=`nv get $1"_ipv6_secdns_manual"`
+ fi
+
+ nv set $wan6_if"_radvd_ipv6_dns_servers"=$ipv6_pridns,$ipv6_secdns
+
+ if [ -n "$ipv6_pridns" ] && [ "$ipv6_pridns" != "::" ] && [ "$ipv6_pridns" != "::0" ] && [ "$ipv6_pridns" != "0000:0000:0000:0000:0000:0000:0000:0000" ];then
+ echo nameserver $ipv6_pridns >> $dnsmasq_conf
+ fi
+
+ if [ -n "$ipv6_secdns" ] && [ "$ipv6_secdns" != "::" ] && [ "$ipv6_secdns" != "::0" ] && [ "$ipv6_secdns" != "0000:0000:0000:0000:0000:0000:0000:0000" ];then
+ echo nameserver $ipv6_secdns >> $dnsmasq_conf
+ fi
+
+ ipv6_dns_extern=`nv get ipv6_dns_extern`
+ if [ -n "$ipv6_dns_extern" ]; then
+ echo nameserver $ipv6_dns_extern >> $dnsmasq_conf
+ fi
+ if [ "-$1" == "-pswan" ]; then
+ tc_tbf.sh up $def_cid
+ fi
+fi
+
+nv set $wan6_if"_radvd_ipv6_dns_servers"=$ipv6_pridns,$ipv6_secdns
+
+#ÉèÖøøÒ³ÃæÏÔʾµ±Ç°ÍâÍøIPµØÖ·
+#ÉèÖÃIPv4Ò³ÃæÏÔʾµØÖ·
+if [ "-$ipaddr_type" == "-IPv4" -o "-$ipaddr_type" == "-IPV4" -o "-$ipaddr_type" == "-IPv4v6" -o "-$ipaddr_type" == "-IPV4V6" -o "-$ipaddr_type" == "-" ]; then
+ wan4_ip=`nv get $wan_if"_ip"`
+ nv set wan_ipaddr="$wan4_ip"
+fi
+
+#ÉèÖÃIPv6Ò³ÃæÏÔʾµØÖ·
+if [ "-$ipaddr_type" == "-IPv6" -o "-$ipaddr_type" == "-IPV6" -o "-$ipaddr_type" == "-IPv4v6" -o "-$ipaddr_type" == "-IPV4V6" ]; then
+ wan6_ip=`nv get $wan6_if"_ipv6_ip"`
+ nv set ipv6_wan_ipaddr="$wan6_ip"
+fi
+
+dnsmasq -i $lan_if -r $dnsmasq_conf &
+
+# ppp0ÐèÒªÉèÖÃMSS×Ϊ1440£¬·ñÔò¿ÉÄÜtcp²»Í¨
+if [ "$defwan_rel" == "ppp0" ]; then
+ echo "Info: dns_set ppp0 set MSS 1440" >> $test_log
+ iptables -A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --set-mss 1440
+fi
+
+
diff --git a/rootfs/sbin/del_netlog.sh b/rootfs/sbin/del_netlog.sh
new file mode 100755
index 0000000..6dc60d8
--- /dev/null
+++ b/rootfs/sbin/del_netlog.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+#
+#¸Ã½Å±¾ÓÃÓÚÔÚlog³¬¹ýÏÞÖÆºóɾ³ýlogÎļþ
+#
+
+####»ñȡͨÓÃnv±äÁ¿####
+path_conf=`nv get path_conf`
+test_log=`nv get telog_path`
+if [ "$test_log" == "" ]; then
+ test_log=`nv get path_log`"te.log"
+fi
+
+####delete####
+max_size=`nv get comm_logsize`
+file_size=`wc -c $test_log | awk '{print $1}'`
+if [ $file_size -gt $max_size ]; then
+ rm -f $test_log
+ echo "The log has been deleted." >> $test_log
+fi
diff --git a/rootfs/sbin/depmod b/rootfs/sbin/depmod
new file mode 120000
index 0000000..525af93
--- /dev/null
+++ b/rootfs/sbin/depmod
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/depmod
\ No newline at end of file
diff --git a/rootfs/sbin/devmem b/rootfs/sbin/devmem
new file mode 120000
index 0000000..edc7473
--- /dev/null
+++ b/rootfs/sbin/devmem
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/devmem
\ No newline at end of file
diff --git a/rootfs/sbin/dumpe2fs b/rootfs/sbin/dumpe2fs
new file mode 100755
index 0000000..fc6871d
--- /dev/null
+++ b/rootfs/sbin/dumpe2fs
Binary files differ
diff --git a/rootfs/sbin/e2freefrag b/rootfs/sbin/e2freefrag
new file mode 100755
index 0000000..45f0753
--- /dev/null
+++ b/rootfs/sbin/e2freefrag
Binary files differ
diff --git a/rootfs/sbin/e2fsck b/rootfs/sbin/e2fsck
new file mode 100755
index 0000000..8a7fc05
--- /dev/null
+++ b/rootfs/sbin/e2fsck
Binary files differ
diff --git a/rootfs/sbin/e2image b/rootfs/sbin/e2image
new file mode 100755
index 0000000..33f8892
--- /dev/null
+++ b/rootfs/sbin/e2image
Binary files differ
diff --git a/rootfs/sbin/e2mmpstatus b/rootfs/sbin/e2mmpstatus
new file mode 100755
index 0000000..fc6871d
--- /dev/null
+++ b/rootfs/sbin/e2mmpstatus
Binary files differ
diff --git a/rootfs/sbin/e2undo b/rootfs/sbin/e2undo
new file mode 100755
index 0000000..4cfb1c8
--- /dev/null
+++ b/rootfs/sbin/e2undo
Binary files differ
diff --git a/rootfs/sbin/e4crypt b/rootfs/sbin/e4crypt
new file mode 100755
index 0000000..1197ed7
--- /dev/null
+++ b/rootfs/sbin/e4crypt
Binary files differ
diff --git a/rootfs/sbin/e4defrag b/rootfs/sbin/e4defrag
new file mode 100755
index 0000000..5b62687
--- /dev/null
+++ b/rootfs/sbin/e4defrag
Binary files differ
diff --git a/rootfs/sbin/fbsplash b/rootfs/sbin/fbsplash
new file mode 120000
index 0000000..641372d
--- /dev/null
+++ b/rootfs/sbin/fbsplash
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/fbsplash
\ No newline at end of file
diff --git a/rootfs/sbin/fdisk b/rootfs/sbin/fdisk
new file mode 120000
index 0000000..d85fd18
--- /dev/null
+++ b/rootfs/sbin/fdisk
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/fdisk
\ No newline at end of file
diff --git a/rootfs/sbin/fdisk_emmc.sh b/rootfs/sbin/fdisk_emmc.sh
new file mode 100755
index 0000000..ad96881
--- /dev/null
+++ b/rootfs/sbin/fdisk_emmc.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+fdisk /dev/mmcblk1 <<EOF
+d
+5
+d
+4
+d
+3
+d
+2
+d
+1
+n
+p
+1
+
++256M
+n
+p
+2
+
++2048M
+n
+p
+3
+
++2048M
+n
+e
+
+
+n
+
+
+w
+EOF
\ No newline at end of file
diff --git a/rootfs/sbin/filefrag b/rootfs/sbin/filefrag
new file mode 100755
index 0000000..0221083
--- /dev/null
+++ b/rootfs/sbin/filefrag
Binary files differ
diff --git a/rootfs/sbin/findfs b/rootfs/sbin/findfs
new file mode 120000
index 0000000..a5914d8
--- /dev/null
+++ b/rootfs/sbin/findfs
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/findfs
\ No newline at end of file
diff --git a/rootfs/sbin/firewall_init.sh b/rootfs/sbin/firewall_init.sh
new file mode 100755
index 0000000..b28f885
--- /dev/null
+++ b/rootfs/sbin/firewall_init.sh
@@ -0,0 +1,79 @@
+#!/bin/sh
+# Created by LiuWei @ 2010.8.27
+# init firewall
+#
+
+path_sh=`nv get path_sh`
+. $path_sh/global.sh
+echo "Info: firewall_init.sh start" >> $test_log
+
+
+ZTE_FILTER_CHAIN=macipport_filter
+ZTE_WEB_FILTER_CHAIN=web_filter
+ZTE_CLILDREN_CHAIN=children_filter
+ZTE_CLILDREN_WEB_CHAIN=children_web_filter
+ZTE_CLILDREN_WEB_PHONECHAIN=children_web_filter_phone
+
+#clear filter
+iptables -t filter -F
+iptables -t filter -X $ZTE_FILTER_CHAIN
+iptables -t filter -X $ZTE_WEB_FILTER_CHAIN
+iptables -t filter -X $ZTE_CLILDREN_CHAIN
+iptables -t filter -X $ZTE_CLILDREN_WEB_CHAIN
+iptables -t filter -X $ZTE_CLILDREN_WEB_PHONECHAIN
+
+ip6tables -t filter -F
+ip6tables -t filter -X $ZTE_FILTER_CHAIN
+
+#make a new chain for filter
+iptables -t filter -N $ZTE_FILTER_CHAIN
+iptables -t filter -N $ZTE_WEB_FILTER_CHAIN
+iptables -t filter -N $ZTE_CLILDREN_CHAIN
+iptables -t filter -N $ZTE_CLILDREN_WEB_CHAIN
+iptables -t filter -N $ZTE_CLILDREN_WEB_PHONECHAIN
+ip6tables -t filter -N $ZTE_FILTER_CHAIN
+
+iptables -t filter -A FORWARD -j $ZTE_WEB_FILTER_CHAIN
+iptables -t filter -A FORWARD -j $ZTE_FILTER_CHAIN
+iptables -t filter -A FORWARD -j $ZTE_CLILDREN_CHAIN
+iptables -t filter -A INPUT -j $ZTE_CLILDREN_WEB_CHAIN
+iptables -t filter -A FORWARD -j $ZTE_CLILDREN_WEB_PHONECHAIN
+ip6tables -t filter -A FORWARD -j $ZTE_FILTER_CHAIN
+
+ip6tables -t filter -A $ZTE_FILTER_CHAIN -m state --state RELATED,ESTABLISHED -j ACCEPT
+
+#Close unused port
+iptables -t filter -A INPUT -i $defwan_rel -p udp --dport 53 -j DROP
+iptables -t filter -A INPUT -i $defwan_rel -p tcp --dport 53 -j DROP
+iptables -t filter -A INPUT -p tcp --dport 7777 -j DROP
+iptables -t filter -A INPUT -p udp --dport 7777 -j DROP
+iptables -t filter -I INPUT -i $defwan_rel -p icmp --icmp-type echo-reply -j ACCEPT
+
+permit_gw=`nv get permit_gw`
+permit_nm=`nv get permit_nm`
+if [ "-${permit_gw}" != "-" ]; then
+ iptables -A FORWARD -o $defwan_rel -d $permit_gw/$permit_nm -j ACCEPT
+ iptables -A FORWARD -o $defwan_rel -j DROP
+ iptables -A OUTPUT -o $defwan_rel -d $permit_gw/$permit_nm -j ACCEPT
+ iptables -A OUTPUT -o $defwan_rel -j DROP
+fi
+
+permit_ip6=`nv get permit_ip6`
+if [ "-${permit_ip6}" != "-" ]; then
+ ip6tables -A FORWARD -o $defwan6_rel -d $permit_ip6 -j ACCEPT
+ ip6tables -A FORWARD -o $defwan6_rel -j DROP
+ ip6tables -A OUTPUT -o $defwan6_rel -d $permit_ip6 -j ACCEPT
+ ip6tables -A OUTPUT -o $defwan6_rel -j DROP
+fi
+
+
+if [ "-$defwan_rel" == "-ppp0" ]; then
+ mtu=`nv get mtu`
+ pppoe_mtu=`expr $mtu - 60`
+ iptables -A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --set-mss $pppoe_mtu
+else
+ iptables -A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
+fi
+# firewall will flush nat and filter, so upnp should run after it.
+#sh $path_sh/upnp.sh
+
diff --git a/rootfs/sbin/fota_release_space.sh b/rootfs/sbin/fota_release_space.sh
new file mode 100755
index 0000000..9cc1bb0
--- /dev/null
+++ b/rootfs/sbin/fota_release_space.sh
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+echo "Begin release space..."
+
+#ɱµôÓ¦ÓÃ
+killall at_ctl
+killall dnsmasq
+killall radvd
+killall dhcp6
+killall zte_ndp
+killall zte_mainctrl
+killall zte_hotplug
+killall sntp
+killall rtc-service
+killall zte_audio_ctrl
+killall sms
+killall phonebook
+#EC 616000558980
+#killall zte_mmi
+
+killall fluxstat
+killall goahead
+killall wpa_supplicant-2.6
+killall hostapd
+killall zte_volte
+killall wifi_manager
+killall hostapd
+killall udhcpd
+killall sd_hotplug
+
+killall syslogd
+rm -rf /mnt/userdata/log
+
+#EC 616000558980
+killall zte_mifi
+killall zte_cpe
+echo 7 >/proc/sys/vm/drop_caches
+
+#¿ÉÄÜ»¹ÒªÉ¾³ýijЩռÄÚ´æµÄÏß³Ì
+
diff --git a/rootfs/sbin/freeramdisk b/rootfs/sbin/freeramdisk
new file mode 120000
index 0000000..de14120
--- /dev/null
+++ b/rootfs/sbin/freeramdisk
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/freeramdisk
\ No newline at end of file
diff --git a/rootfs/sbin/fsck b/rootfs/sbin/fsck
new file mode 120000
index 0000000..9ae60c9
--- /dev/null
+++ b/rootfs/sbin/fsck
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/fsck
\ No newline at end of file
diff --git a/rootfs/sbin/fsck.ext2 b/rootfs/sbin/fsck.ext2
new file mode 100755
index 0000000..8a7fc05
--- /dev/null
+++ b/rootfs/sbin/fsck.ext2
Binary files differ
diff --git a/rootfs/sbin/fsck.ext3 b/rootfs/sbin/fsck.ext3
new file mode 100755
index 0000000..8a7fc05
--- /dev/null
+++ b/rootfs/sbin/fsck.ext3
Binary files differ
diff --git a/rootfs/sbin/fsck.ext4 b/rootfs/sbin/fsck.ext4
new file mode 100755
index 0000000..8a7fc05
--- /dev/null
+++ b/rootfs/sbin/fsck.ext4
Binary files differ
diff --git a/rootfs/sbin/fsck.minix b/rootfs/sbin/fsck.minix
new file mode 120000
index 0000000..8511253
--- /dev/null
+++ b/rootfs/sbin/fsck.minix
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/fsck.minix
\ No newline at end of file
diff --git a/rootfs/sbin/fstrim b/rootfs/sbin/fstrim
new file mode 120000
index 0000000..42a65b1
--- /dev/null
+++ b/rootfs/sbin/fstrim
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/fstrim
\ No newline at end of file
diff --git a/rootfs/sbin/gateway_send_arp.sh b/rootfs/sbin/gateway_send_arp.sh
new file mode 100755
index 0000000..6a8664a
--- /dev/null
+++ b/rootfs/sbin/gateway_send_arp.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+test_log=`nv get path_log`"te.log"
+
+lan_if=br0
+
+ip=`nv get lan_ipaddr`
+
+arping -U -I $lan_if -c 1 $ip
+
diff --git a/rootfs/sbin/get_errinfo.sh b/rootfs/sbin/get_errinfo.sh
new file mode 100755
index 0000000..5ac323d
--- /dev/null
+++ b/rootfs/sbin/get_errinfo.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+line=`grep "^$1" -n /sbin/app_errmsg.txt | awk -F: '{print $1}'`
+awk -F= -v c=$2 -v n=$line '(NR - n == c) {print $2}' /sbin/app_errmsg.txt
diff --git a/rootfs/sbin/getpid.sh b/rootfs/sbin/getpid.sh
new file mode 100755
index 0000000..bb28f3f
--- /dev/null
+++ b/rootfs/sbin/getpid.sh
@@ -0,0 +1,12 @@
+#/bin/sh
+
+TMPLINE=`ps|grep -s "[[:digit:]]\+:[[:digit:]]\+ \(/.*/\)*$1\>"`
+
+if [ -z "${TMPLINE}" ]; then
+ echo "nono"
+ exit 127
+else
+ echo "${TMPLINE}"|awk '{print $1}'
+ exit 0
+fi
+
diff --git a/rootfs/sbin/getty b/rootfs/sbin/getty
new file mode 120000
index 0000000..c2c56af
--- /dev/null
+++ b/rootfs/sbin/getty
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/getty
\ No newline at end of file
diff --git a/rootfs/sbin/global.sh b/rootfs/sbin/global.sh
new file mode 100755
index 0000000..05038fd
--- /dev/null
+++ b/rootfs/sbin/global.sh
@@ -0,0 +1,90 @@
+#!/bin/sh
+
+#
+#¸Ã½Å±¾ÓÃÓÚ»ñȡһЩͨÓõÄnv±äÁ¿¼°¶¨Ò幫¹²º¯ÊýʹÓÃ
+#
+
+####»ñȡͨÓÃnv±äÁ¿####
+path_conf=`nv get path_conf`
+test_log=`nv get telog_path_cap`
+if [ "$test_log" == "" ]; then
+ test_log=`nv get path_log`"te.log"
+fi
+path_tmp=`nv get path_tmp`
+path_ro=`nv get path_ro`
+
+##getLanIfName
+lan_if=`nv get lan_name`
+#echo "LanIfName=$lan_if"
+##getLanIfName
+lan_if_cap=`nv get lan_name_cap`
+
+##getWanIfName
+pswan_name=`nv get pswan`
+def_cid_tmp=`nv get default_cid`
+pswan_if=$pswan_name$def_cid_tmp
+ethwan_if=`nv get ethwan`
+wifiwan_if=`nv get wifiwan`
+pswan_cap_name=`nv get pswan_cap`
+pswan_cap_if=$pswan_cap_name$def_cid_tmp
+#ipv4
+defwan_if=`nv get default_wan_name`
+defwan_rel=`nv get default_wan_rel`
+
+#ipv6
+defwan6_if=`nv get default_wan6_name`
+defwan6_rel=`nv get default_wan6_rel`
+
+####¹«¹²º¯Êý####
+#²éÕÒ¶ÔÓ¦dhcpc½ø³ÌºÅ²¢É±ËÀ
+udhcpc_kill()
+{
+ ps > ${path_tmp}/udhcpc.sh.$$
+ udhcpc_pid=`awk 'BEGIN{temp1="'"${wan_if}"'";temp2="'$path_sh/udhcpc.sh'"}{if(index($0,temp1)>0 && index($0,temp2)>0){print $1}}' ${path_tmp}/udhcpc.sh.$$`
+ rm -f ${path_tmp}/udhcpc.sh.$$
+ [ -n "$udhcpc_pid" ] && { kill -9 $udhcpc_pid; echo "Info: kill udhcpc $udhcpc_pid " >> $test_log ; }
+}
+#²éÕÒ¶ÔÓ¦pppoe½ø³ÌºÅ²¢É±ËÀ
+pppoe_kill()
+{
+ ps > ${path_tmp}/pppoecd.${wan_if}.$$
+ pppoe_pid=`awk 'BEGIN{temp1="'"${wan_if}"'";temp2="pppoecd"}{if(index($0,temp1)>0 && index($0,temp2)>0){print $1}}' ${path_tmp}/pppoecd.${wan_if}.$$`
+ rm -f ${path_tmp}/pppoecd.${wan_if}.$$
+ [ -n "$pppoe_pid" ] && { kill -9 $pppoe_pid; echo "Info: kill pppoecd $pppoe_pid " >> $test_log ; }
+}
+#²éÕÒ¶ÔÓ¦dhcp6s½ø³ÌºÅ²¢É±ËÀ
+dhcp6s_kill()
+{
+ ps > ${path_tmp}/${dhcp6s_conf##*/}.$$
+ dhcp6s_pid=`awk 'BEGIN{temp1="'"${dhcp6s_conf}"'";temp2="dhcp6s"}{if(index($0,temp1)>0 && index($0,temp2)>0){print $1}}' ${path_tmp}/${dhcp6s_conf##*/}.$$`
+ rm -f ${path_tmp}/${dhcp6s_conf##*/}.$$
+ [ -n "$dhcp6s_pid" ] && { kill -9 $dhcp6s_pid; echo "Info: kill dhcp6s $dhcp6s_pid " >> $test_log ; }
+}
+
+#²éÕÒ¶ÔÓ¦radvd½ø³ÌºÅ²¢É±ËÀ
+radvd_kill()
+{
+ ps > ${path_tmp}/${radvd_conf##*/}.$$
+ radvd_pid=`awk 'BEGIN{temp1="'"${radvd_conf}"'";temp2="radvd"}{if(index($0,temp1)>0 && index($0,temp2)>0){print $1}}' ${path_tmp}/${radvd_conf##*/}.$$`
+ rm -f ${path_tmp}/${radvd_conf##*/}.$$
+ [ -n "$radvd_pid" ] && { kill -9 $radvd_pid; echo "Info: kill radvd $radvd_pid " >> $test_log ; }
+}
+
+#²éÕÒ¶ÔÓ¦dhcp6c½ø³ÌºÅ²¢É±ËÀ
+dhcp6c_kill()
+{
+ ps > ${path_tmp}/dhcp6c.${wan_if}.$$
+ dhcp6c_pid=`awk 'BEGIN{temp1="'"${wan_if}"'";temp2="dhcp6c"}{if(index($0,temp1)>0 && index($0,temp2)>0){print $1}}' ${path_tmp}/dhcp6c.${wan_if}.$$`
+ rm -f ${path_tmp}/dhcp6c.${wan_if}.$$
+ [ -n "$dhcp6c_pid" ] && { kill -9 $dhcp6c_pid; echo "Info: kill dhcp6c $dhcp6c_pid " >> $test_log ; }
+}
+
+#²éÕÒ¶ÔÓ¦ndp½ø³ÌºÅ²¢É±ËÀ
+ndp_kill()
+{
+ ps > ${path_tmp}/${ndp_log##*/}.$$
+ ndp_pid=`awk 'BEGIN{temp1="'"${ndp_log}"'";temp2="zte_ndp"}{if(index($0,temp1)>0 && index($0,temp2)>0){print $1}}' ${path_tmp}/${ndp_log##*/}.$$`
+ rm -f ${path_tmp}/${ndp_log##*/}.$$
+ [ -n "$ndp_pid" ] && { kill -9 $ndp_pid; echo "Info: kill ndp $ndp_pid " >> $test_log ; }
+}
+
diff --git a/rootfs/sbin/halt b/rootfs/sbin/halt
new file mode 120000
index 0000000..00ab8a5
--- /dev/null
+++ b/rootfs/sbin/halt
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/halt
\ No newline at end of file
diff --git a/rootfs/sbin/hdparm b/rootfs/sbin/hdparm
new file mode 120000
index 0000000..832c4b4
--- /dev/null
+++ b/rootfs/sbin/hdparm
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/hdparm
\ No newline at end of file
diff --git a/rootfs/sbin/hwclock b/rootfs/sbin/hwclock
new file mode 120000
index 0000000..fbb73c0
--- /dev/null
+++ b/rootfs/sbin/hwclock
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/hwclock
\ No newline at end of file
diff --git a/rootfs/sbin/ifcfg b/rootfs/sbin/ifcfg
new file mode 100755
index 0000000..5b34dec
--- /dev/null
+++ b/rootfs/sbin/ifcfg
@@ -0,0 +1,150 @@
+#! /bin/sh
+# SPDX-License-Identifier: GPL-2.0
+
+CheckForwarding () {
+ local sbase fwd
+ sbase=/proc/sys/net/ipv4/conf
+ fwd=0
+ if [ -d $sbase ]; then
+ for dir in $sbase/*/forwarding; do
+ fwd=$(( fwd + $(cat "$dir") ))
+ done
+ else
+ fwd=2
+ fi
+ return $fwd
+}
+
+RestartRDISC () {
+ killall -HUP rdisc || rdisc -fs
+}
+
+ABCMaskLen () {
+ local class;
+
+ class=${1%%.*}
+ if [ "$1" = "" -o $class -eq 0 -o $class -ge 224 ]; then return 0
+ elif [ $class -ge 224 ]; then return 0
+ elif [ $class -ge 192 ]; then return 24
+ elif [ $class -ge 128 ]; then return 16
+ else return 8; fi
+}
+
+label="label $1"
+ldev="$1"
+dev=${1%:*}
+if [ "$dev" = "" -o "$1" = "help" ]; then
+ echo "Usage: ifcfg DEV [[add|del [ADDR[/LEN]] [PEER] | stop]" 1>&2
+ echo " add - add new address" 1>&2
+ echo " del - delete address" 1>&2
+ echo " stop - completely disable IP" 1>&2
+ exit 1
+fi
+shift
+
+CheckForwarding
+fwd=$?
+if [ $fwd -ne 0 ]; then
+ echo "Forwarding is ON or its state is unknown ($fwd). OK, No RDISC." 1>&2
+fi
+
+
+deleting=0
+case "$1" in
+add) shift ;;
+stop)
+ if [ "$ldev" != "$dev" ]; then
+ echo "Cannot stop alias $ldev" 1>&2
+ exit 1;
+ fi
+ ip -4 addr flush dev $dev $label || exit 1
+ if [ $fwd -eq 0 ]; then RestartRDISC; fi
+ exit 0 ;;
+del*)
+ deleting=1; shift ;;
+*)
+esac
+
+ipaddr=
+pfxlen=
+if [ "$1" != "" ]; then
+ ipaddr=${1%/*}
+ if [ "$1" != "$ipaddr" ]; then
+ pfxlen=${1#*/}
+ fi
+ if [ "$ipaddr" = "" ]; then
+ echo "$1 is bad IP address." 1>&2
+ exit 1
+ fi
+fi
+shift
+
+peer=$1
+if [ "$peer" != "" ]; then
+ if [ "$pfxlen" != "" -a "$pfxlen" != "32" ]; then
+ echo "Peer address with non-trivial netmask." 1>&2
+ exit 1
+ fi
+ pfx="$ipaddr peer $peer"
+else
+ if [ "$ipaddr" = "" ]; then
+ echo "Missing IP address argument." 1>&2
+ exit 1
+ fi
+ if [ "$pfxlen" = "" ]; then
+ ABCMaskLen $ipaddr
+ pfxlen=$?
+ fi
+ pfx="$ipaddr/$pfxlen"
+fi
+
+if [ "$ldev" = "$dev" -a "$ipaddr" != "" ]; then
+ label=
+fi
+
+if [ $deleting -ne 0 ]; then
+ ip addr del $pfx dev $dev $label || exit 1
+ if [ $fwd -eq 0 ]; then RestartRDISC; fi
+ exit 0
+fi
+
+
+if ! ip link set up dev $dev ; then
+ echo "Error: cannot enable interface $dev." 1>&2
+ exit 1
+fi
+if [ "$ipaddr" = "" ]; then exit 0; fi
+
+if ! arping -q -c 2 -w 3 -D -I $dev $ipaddr ; then
+ echo "Error: some host already uses address $ipaddr on $dev." 1>&2
+ exit 1
+fi
+
+if ! ip address add $pfx brd + dev $dev $label; then
+ echo "Error: failed to add $pfx on $dev." 1>&2
+ exit 1
+fi
+
+arping -q -A -c 1 -I $dev $ipaddr
+noarp=$?
+( sleep 2 ;
+ arping -q -U -c 1 -I $dev $ipaddr ) >/dev/null 2>&1 </dev/null &
+
+ip route add unreachable 224.0.0.0/24 >/dev/null 2>&1
+ip route add unreachable 255.255.255.255 >/dev/null 2>&1
+if [ "`ip link ls $dev | grep -c MULTICAST`" -ge 1 ]; then
+ ip route add 224.0.0.0/4 dev $dev scope global >/dev/null 2>&1
+fi
+
+if [ $fwd -eq 0 ]; then
+ if [ $noarp -eq 0 ]; then
+ ip ro append default dev $dev metric 30000 scope global
+ elif [ "$peer" != "" ]; then
+ if ping -q -c 2 -w 4 $peer ; then
+ ip ro append default via $peer dev $dev metric 30001
+ fi
+ fi
+ RestartRDISC
+fi
+
+exit 0
diff --git a/rootfs/sbin/ifconfig b/rootfs/sbin/ifconfig
new file mode 120000
index 0000000..62b95be
--- /dev/null
+++ b/rootfs/sbin/ifconfig
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/ifconfig
\ No newline at end of file
diff --git a/rootfs/sbin/ifdown b/rootfs/sbin/ifdown
new file mode 120000
index 0000000..cc49efc
--- /dev/null
+++ b/rootfs/sbin/ifdown
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/ifdown
\ No newline at end of file
diff --git a/rootfs/sbin/ifenslave b/rootfs/sbin/ifenslave
new file mode 120000
index 0000000..b19819f
--- /dev/null
+++ b/rootfs/sbin/ifenslave
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/ifenslave
\ No newline at end of file
diff --git a/rootfs/sbin/ifup b/rootfs/sbin/ifup
new file mode 120000
index 0000000..e3279ec
--- /dev/null
+++ b/rootfs/sbin/ifup
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/ifup
\ No newline at end of file
diff --git a/rootfs/sbin/init b/rootfs/sbin/init
new file mode 120000
index 0000000..2cdb55c
--- /dev/null
+++ b/rootfs/sbin/init
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/init
\ No newline at end of file
diff --git a/rootfs/sbin/init_sctel_rw_dir.sh b/rootfs/sbin/init_sctel_rw_dir.sh
new file mode 100755
index 0000000..01d0f1d
--- /dev/null
+++ b/rootfs/sbin/init_sctel_rw_dir.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+############################################################################
+# Init RW_DATA of ZCORE&MMI.
+############################################################################
+if [ ! -f "/etc_rw/sc_tel/zcore_init_file_flag" ]
+then
+ mkdir -p /etc_rw/sc_tel
+ mkdir -p /etc_rw/sc_tel/system
+ cp -rf /etc_ro/sc_tel/system /etc_rw/sc_tel
+ cp -rf /etc_ro/sc_tel/zbl /etc_rw/sc_tel
+ #mv -rf /etc_ro/app2/system/data /etc_rw/sc_tel/system
+ echo "Initializing RW data has been done!" > /etc_rw/sc_tel/zcore_init_file_flag
+fi
+
diff --git a/rootfs/sbin/insmod b/rootfs/sbin/insmod
new file mode 120000
index 0000000..0e1a4e1
--- /dev/null
+++ b/rootfs/sbin/insmod
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/insmod
\ No newline at end of file
diff --git a/rootfs/sbin/internet.sh b/rootfs/sbin/internet.sh
new file mode 100755
index 0000000..a674513
--- /dev/null
+++ b/rootfs/sbin/internet.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+#
+# internet.sh,v 10.08.05 2010-08-05 15:00:00
+#
+# usage: internet.sh
+#
+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 7200 > /proc/sys/net/netfilter/nf_conntrack_tcp_timeout_established
+
+#½«br_name,usblan_name´«¸øÄÚºËʵÏÖÆ½Ì¨»¯
+fast_usb=`nv get fast_usb`
+
+echo $lan_if > /proc/net/br_name
+
+echo $fast_usb > /proc/net/usb_name
+
+echo "" > /etc/resolv.conf
+
+#br0´î½¨£¬¼°ÄÚÍødhcp
+sh $path_sh/lan.sh
+
+#½«¿ìËÙת·¢¼¶±ð´«¸øÄÚºË
+fastnat_level=`nv get fastnat_level`
+echo "Info: set fastnat_level£º$fastnat_level" >> $test_log
+echo $fastnat_level > /proc/net/fastnat_level
+
+fastbr_level=`nv get fastbr_level`
+echo "Info: set fastbr_level: $fastbr_level" >> $test_log
+echo $fastbr_level > /proc/net/fastbr_level
+
+#½«²»Ö§³Ö¿ìËÙת·¢µÄÐÒé¶Ë¿ÚºÅ´«¸øÄÚºË
+nofast_port=`nv get nofast_port`
+echo "Info: set nofast_port£º$nofast_port" >> $test_log
+echo $nofast_port > /proc/net/nofast_port
diff --git a/rootfs/sbin/ip b/rootfs/sbin/ip
new file mode 120000
index 0000000..6a21825
--- /dev/null
+++ b/rootfs/sbin/ip
@@ -0,0 +1 @@
+/sbin/ip.iproute2
\ No newline at end of file
diff --git a/rootfs/sbin/ip.iproute2 b/rootfs/sbin/ip.iproute2
new file mode 100755
index 0000000..8f988dd
--- /dev/null
+++ b/rootfs/sbin/ip.iproute2
Binary files differ
diff --git a/rootfs/sbin/ipaddr b/rootfs/sbin/ipaddr
new file mode 120000
index 0000000..bc69b39
--- /dev/null
+++ b/rootfs/sbin/ipaddr
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/ipaddr
\ No newline at end of file
diff --git a/rootfs/sbin/iplink b/rootfs/sbin/iplink
new file mode 120000
index 0000000..8c8d40a
--- /dev/null
+++ b/rootfs/sbin/iplink
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/iplink
\ No newline at end of file
diff --git a/rootfs/sbin/ipneigh b/rootfs/sbin/ipneigh
new file mode 120000
index 0000000..a2f4909
--- /dev/null
+++ b/rootfs/sbin/ipneigh
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/ipneigh
\ No newline at end of file
diff --git a/rootfs/sbin/iproute b/rootfs/sbin/iproute
new file mode 120000
index 0000000..d62aa6b
--- /dev/null
+++ b/rootfs/sbin/iproute
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/iproute
\ No newline at end of file
diff --git a/rootfs/sbin/iprule b/rootfs/sbin/iprule
new file mode 120000
index 0000000..ab04fb8
--- /dev/null
+++ b/rootfs/sbin/iprule
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/iprule
\ No newline at end of file
diff --git a/rootfs/sbin/iptunnel b/rootfs/sbin/iptunnel
new file mode 120000
index 0000000..dddae7d
--- /dev/null
+++ b/rootfs/sbin/iptunnel
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/iptunnel
\ No newline at end of file
diff --git a/rootfs/sbin/klogd b/rootfs/sbin/klogd
new file mode 120000
index 0000000..6bb11ca
--- /dev/null
+++ b/rootfs/sbin/klogd
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/klogd
\ No newline at end of file
diff --git a/rootfs/sbin/lan.sh b/rootfs/sbin/lan.sh
new file mode 100755
index 0000000..2d6fa29
--- /dev/null
+++ b/rootfs/sbin/lan.sh
@@ -0,0 +1,121 @@
+#!/bin/sh
+#
+# $Id: lan.sh
+#
+path_sh=`nv get path_sh`
+. $path_sh/global.sh
+
+br_set()
+{
+ br_name=$lan_if_cap
+
+ #ÉèÖÃÍøÇÅ
+ killall -9 udhcpd
+ echo "ifconfig $br_name start...................."
+ ifconfig $br_name down
+ brctl delbr $br_name
+ brctl addbr $br_name 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: brctl addbr $br_name failed." >> $test_log
+ fi
+ brctl setfd $br_name 0.1 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: brctl setfd $br_name 0.1 failed." >> $test_log
+ fi
+ ifconfig lo up 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig lo up failed." >> $test_log
+ fi
+ ifconfig $br_name up 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $br_name up failed." >> $test_log
+ fi
+
+ #´ò¿ªÍøÇŵØÖ·¸Ä±ä֪ͨµÄ¿ª¹Ø
+ echo 1 > /proc/sys/net/ipv4/conf/$br_name/arp_notify
+ prj=`cat /sys/gmac/gmacconfig/type`
+ if [ "$prj" == "cpe" ]; then
+ ifconfig eth0 up 2>>$test_log
+ brctl addif $br_name eth0 2>>$test_log
+ fi
+ br_node=`nv get br_node_cap`
+
+ #analysis br_node ex: usb0+wifi0+¡
+ IFS_OLD=$IFS
+ IFS="+"
+ for device in $br_node
+ do
+ ifconfig $device up
+
+ brctl addif $br_name $device 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: brctl addif $br_name $device failed." >> $test_log
+ fi
+ done
+ IFS=$IFS_OLD
+}
+
+lan_set()
+{
+ ip=`nv get lan_ipaddr_cap`
+ nm=`nv get lan_netmask_cap`
+ ifconfig $lan_if_cap $ip netmask $nm 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $lan_if_cap $ip netmask $nm failed." >> $test_log
+ fi
+
+ webv6_enable=`nv get webv6_enable`
+ ipv6=`nv get lan_ipv6addr_cap`
+ if [ "x$webv6_enable" == "x1" ]; then
+ ifconfig $lan_if_cap $ipv6/64
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $lan_if_cap $ipv6 failed." >> $test_log
+ fi
+ fi
+}
+
+main()
+{
+ lan_enable=`nv get LanEnable_cap`
+ if [ "x$lan_enable" == "x0" ]; then
+ exit 0
+ fi
+
+ echo "Info: lan.sh start" >> $test_log
+
+ if [ "x$lan_enable" == "x1" ]; then
+ br_set
+ fi
+
+ if [ "x$lan_if_cap" != "x" ]; then
+ lan_set
+ fi
+
+ dhcps_in_cap=`nv get dhcps_in_cap`
+
+ if [ "x$dhcps_in_cap" == "x1" ]; then
+ echo "" > $path_conf/udhcpd.leases
+ rm -rf $path_conf/udhcpd.conf
+ . $path_sh/user-config-udhcpd.sh
+
+ dhcp=`nv get dhcpEnabled`
+ if [ "$dhcp" == "1" ]; then
+ 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_cap -r $path_conf/resolv.conf &
+ gw_in_cap=`nv get gw_in_cap`
+ if [ "x$gw_in_cap" != "x1" ]; then
+ ap_ip=`nv get lan_ipaddr`
+ ap_ipv6=`nv get lan_ipv6addr`
+
+ 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
+ else
+ echo 1 > /proc/net/ct_iptables_syn
+ fi
+}
+
+main
diff --git a/rootfs/sbin/landev_updown.sh b/rootfs/sbin/landev_updown.sh
new file mode 100755
index 0000000..8bf322e
--- /dev/null
+++ b/rootfs/sbin/landev_updown.sh
@@ -0,0 +1,133 @@
+#!/bin/sh
+path_sh=`nv get path_sh`
+. $path_sh/global.sh
+echo "Info: landev_updown.sh $1 $2 start" >> $test_log
+lan_enable=`nv get LanEnable`
+
+xgw_lan()
+{
+ . $path_sh/xjz_init.sh
+ xgwlan=`nv get lan_name`
+ real_gw=`nv get lan_ipaddr`
+ real_nm=`nv get lan_netmask`
+ ifconfig $xgwlan down
+ ifconfig $xgwlan $real_gw netmask $real_nm up
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $xgwlan $real_gw netmask $real_nm up failed." >> $test_log
+ fi
+
+ echo "stop gtp_proxy .... " >> $test_log
+ killall -9 gtp_proxy
+ gtp_proxy &
+ echo "start gtp_proxy .... " >> $test_log
+}
+
+landev_up()
+{
+ if [ "-$1" == "-ethwan" ]; then
+ (router_msg_proxy del_timer ethwan 1>> $test_log 2>&1 || echo "Error: router_msg_proxy del_timer failed." >> $test_log) &
+ fi
+ landev_name=`nv get $1`
+ if [ "-$lan_enable" == "-2" ]; then
+
+ ip=`nv get lan_ipaddr`
+ nm=`nv get lan_netmask`
+ ifconfig $landev_name $ip netmask $nm up 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $lan_if $ip netmask $nm failed." >> $test_log
+ fi
+
+ else
+ br_name=`nv get lan_name`
+ ifconfig $landev_name down 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $landev_name down failed." >> $test_log
+ fi
+ ifconfig $landev_name up 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $landev_name up failed." >> $test_log
+ fi
+ brctl addif $br_name $landev_name
+
+ fi
+}
+
+landev_down()
+{
+ landev_name=`nv get $1`
+ ifconfig $landev_name down 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $landev_name down failed." >> $test_log
+ fi
+ if [ "-$lan_enable" == "-1" ]; then
+ br_name=`nv get lan_name`
+ brctl delif $br_name $landev_name 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: brctl delif $br_name $landev_name" >> $test_log
+ fi
+ fi
+ if [ "-$lan_enable" == "-2" ]; then
+ ps > ${path_tmp}/landev_updown.sh.$$
+ udhcpd_pid=`awk 'BEGIN{temp1="'"${landev_name}"'";temp2="'dhcpd'"}{if(index($0,temp1)>0 && index($0,temp2)>0){print $1}}' ${path_tmp}/landev_updown.sh.$$`
+ rm -f ${path_tmp}/landev_updown.sh.$$
+ [ -n "$udhcpd_pid" ] && { kill $udhcpd_pid; echo "Info: kill udhcpd $udhcpd_pid " >> $test_log ; }
+ fi
+}
+
+get_cid()
+{
+ ps_ext_cid=$1
+ c_id=${ps_ext_cid##ps_ext}
+}
+
+ps_ext_up()
+{
+ landev_name=`nv get $1`
+ get_cid $1
+ landev_name=`nv get $1`
+ get_cid $1
+ br="br"$c_id
+ br_ip6=`nv get $br"_ipv6_ip"`
+ up_flag="0"
+ if [ "-$br_ip6" != "-" -a "-$br_ip6" != "-::" ]; then
+ up_flag="1"
+ fi
+ br_ip=`nv get $br"_ip"`
+ if [ "-$br_ip" != "-" -a "-$br_ip" != "-0.0.0.0" ]; then
+ up_flag="1"
+ fi
+ if [ "-$up_flag" == "-1" ]; then
+ ifconfig $landev_name up 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $landev_name up failed." >> $test_log
+ fi
+ #for usb remove netlink
+ brctl addif $br $landev_name
+ fi
+}
+
+ps_ext_down()
+{
+ landev_name=`nv get $1`
+ ifconfig $landev_name down 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $landev_name down failed." >> $test_log
+ fi
+}
+
+if [ "-$1" == "-ethlan" -o "-$1" == "-wifilan" -o "-$1" == "-wifilan2" -o "-$1" == "-usblan" -o "-$1" == "-ethwan" ]; then
+ if [ "-$2" == "-up" ]; then
+ landev_up $1
+ else
+ landev_down $1
+ fi
+else #ps_ext
+ ps_ext_state=`nv get $1"_pdpstate"`
+ if [ "-$ps_ext_state" == "-working" ]; then
+ if [ "-$2" == "-up" ]; then
+ ps_ext_up $1
+ else
+ ps_ext_down $1
+ fi
+ fi
+fi
\ No newline at end of file
diff --git a/rootfs/sbin/ldconfig b/rootfs/sbin/ldconfig
new file mode 100755
index 0000000..472415e
--- /dev/null
+++ b/rootfs/sbin/ldconfig
Binary files differ
diff --git a/rootfs/sbin/loadkmap b/rootfs/sbin/loadkmap
new file mode 120000
index 0000000..5f19c26
--- /dev/null
+++ b/rootfs/sbin/loadkmap
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/loadkmap
\ No newline at end of file
diff --git a/rootfs/sbin/logread b/rootfs/sbin/logread
new file mode 120000
index 0000000..f2ee5db
--- /dev/null
+++ b/rootfs/sbin/logread
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/logread
\ No newline at end of file
diff --git a/rootfs/sbin/logsave b/rootfs/sbin/logsave
new file mode 100755
index 0000000..4ae3576
--- /dev/null
+++ b/rootfs/sbin/logsave
Binary files differ
diff --git a/rootfs/sbin/losetup b/rootfs/sbin/losetup
new file mode 120000
index 0000000..159217e
--- /dev/null
+++ b/rootfs/sbin/losetup
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/losetup
\ No newline at end of file
diff --git a/rootfs/sbin/lsmod b/rootfs/sbin/lsmod
new file mode 120000
index 0000000..f9f16bf
--- /dev/null
+++ b/rootfs/sbin/lsmod
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/lsmod
\ No newline at end of file
diff --git a/rootfs/sbin/makedevs b/rootfs/sbin/makedevs
new file mode 120000
index 0000000..b484a64
--- /dev/null
+++ b/rootfs/sbin/makedevs
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/makedevs
\ No newline at end of file
diff --git a/rootfs/sbin/mdev b/rootfs/sbin/mdev
new file mode 120000
index 0000000..12a89a6
--- /dev/null
+++ b/rootfs/sbin/mdev
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/mdev
\ No newline at end of file
diff --git a/rootfs/sbin/mkdosfs b/rootfs/sbin/mkdosfs
new file mode 120000
index 0000000..e52d08d
--- /dev/null
+++ b/rootfs/sbin/mkdosfs
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/mkdosfs
\ No newline at end of file
diff --git a/rootfs/sbin/mke2fs b/rootfs/sbin/mke2fs
new file mode 120000
index 0000000..8179859
--- /dev/null
+++ b/rootfs/sbin/mke2fs
@@ -0,0 +1 @@
+/sbin/mke2fs.e2fsprogs
\ No newline at end of file
diff --git a/rootfs/sbin/mke2fs.e2fsprogs b/rootfs/sbin/mke2fs.e2fsprogs
new file mode 100755
index 0000000..a61a52e
--- /dev/null
+++ b/rootfs/sbin/mke2fs.e2fsprogs
Binary files differ
diff --git a/rootfs/sbin/mkfs.ext2 b/rootfs/sbin/mkfs.ext2
new file mode 120000
index 0000000..ecf44eb
--- /dev/null
+++ b/rootfs/sbin/mkfs.ext2
@@ -0,0 +1 @@
+/sbin/mkfs.ext2.e2fsprogs
\ No newline at end of file
diff --git a/rootfs/sbin/mkfs.ext2.e2fsprogs b/rootfs/sbin/mkfs.ext2.e2fsprogs
new file mode 100755
index 0000000..a61a52e
--- /dev/null
+++ b/rootfs/sbin/mkfs.ext2.e2fsprogs
Binary files differ
diff --git a/rootfs/sbin/mkfs.ext3 b/rootfs/sbin/mkfs.ext3
new file mode 100755
index 0000000..a61a52e
--- /dev/null
+++ b/rootfs/sbin/mkfs.ext3
Binary files differ
diff --git a/rootfs/sbin/mkfs.ext4 b/rootfs/sbin/mkfs.ext4
new file mode 100755
index 0000000..a61a52e
--- /dev/null
+++ b/rootfs/sbin/mkfs.ext4
Binary files differ
diff --git a/rootfs/sbin/mkfs.minix b/rootfs/sbin/mkfs.minix
new file mode 120000
index 0000000..00edf8f
--- /dev/null
+++ b/rootfs/sbin/mkfs.minix
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/mkfs.minix
\ No newline at end of file
diff --git a/rootfs/sbin/mkfs.vfat b/rootfs/sbin/mkfs.vfat
new file mode 120000
index 0000000..e772c60
--- /dev/null
+++ b/rootfs/sbin/mkfs.vfat
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/mkfs.vfat
\ No newline at end of file
diff --git a/rootfs/sbin/mklost+found b/rootfs/sbin/mklost+found
new file mode 100755
index 0000000..df21ade
--- /dev/null
+++ b/rootfs/sbin/mklost+found
Binary files differ
diff --git a/rootfs/sbin/mkswap b/rootfs/sbin/mkswap
new file mode 120000
index 0000000..ba95bb9
--- /dev/null
+++ b/rootfs/sbin/mkswap
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/mkswap
\ No newline at end of file
diff --git a/rootfs/sbin/modinfo b/rootfs/sbin/modinfo
new file mode 120000
index 0000000..166f56d
--- /dev/null
+++ b/rootfs/sbin/modinfo
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/modinfo
\ No newline at end of file
diff --git a/rootfs/sbin/modprobe b/rootfs/sbin/modprobe
new file mode 120000
index 0000000..38991b1
--- /dev/null
+++ b/rootfs/sbin/modprobe
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/modprobe
\ No newline at end of file
diff --git a/rootfs/sbin/mount-copybind b/rootfs/sbin/mount-copybind
new file mode 100755
index 0000000..e32e675
--- /dev/null
+++ b/rootfs/sbin/mount-copybind
@@ -0,0 +1,56 @@
+#!/bin/sh
+#
+# Perform a bind mount, copying existing files as we do so to ensure the
+# overlaid path has the necessary content.
+
+if [ $# -lt 2 ]; then
+ echo >&2 "Usage: $0 spec mountpoint [OPTIONS]"
+ exit 1
+fi
+
+# e.g. /var/volatile/lib
+spec=$1
+
+# e.g. /var/lib
+mountpoint=$2
+
+if [ $# -gt 2 ]; then
+ options=$3
+else
+ options=
+fi
+
+[ -n "$options" ] && options=",$options"
+
+mkdir -p "${spec%/*}"
+
+if [ -d "$mountpoint" ]; then
+
+ if [ -d "$spec" ]; then
+ specdir_existed=yes
+ else
+ specdir_existed=no
+ mkdir "$spec"
+ fi
+
+ # Fast version of calculating `dirname ${spec}`/.`basename ${spec}`-work
+ overlay_workdir="${spec%/*}/.${spec##*/}-work"
+ mkdir "${overlay_workdir}"
+
+ # Try to mount using overlay, which is must faster than copying files.
+ # If that fails, fall back to slower copy.
+ if ! mount -t overlay overlay -olowerdir="$mountpoint",upperdir="$spec",workdir="$overlay_workdir" "$mountpoint" > /dev/null 2>&1; then
+
+ if [ "$specdir_existed" != "yes" ]; then
+ cp -aPR "$mountpoint"/. "$spec/"
+ fi
+
+ mount -o "bind$options" "$spec" "$mountpoint"
+ fi
+elif [ -f "$mountpoint" ]; then
+ if [ ! -f "$spec" ]; then
+ cp -aP "$mountpoint" "$spec"
+ fi
+
+ mount -o "bind$options" "$spec" "$mountpoint"
+fi
diff --git a/rootfs/sbin/mount_ext4.sh b/rootfs/sbin/mount_ext4.sh
new file mode 100755
index 0000000..6cb1dc8
--- /dev/null
+++ b/rootfs/sbin/mount_ext4.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+if [ ! -b /dev/mmcblk1p2 ]; then
+ fdisk_emmc.sh
+ mkfs.ext4 /dev/mmcblk1p3
+fi
+
+#mount -o remount,rw /
+#mkdir -p /mnt/emmc2
+#mkdir -p /mnt/emmc3
+#mount -o remount,ro /
+
+mount -t ext4 -o async /dev/mmcblk1p3 /mnt/emmc2
+if [ $? -ne 0 ]; then
+ echo "ext4 mmcblk1p3 mount fail $? !"
+ mkfs.ext4 /dev/mmcblk1p3
+ mount -t ext4 /dev/mmcblk1p3 /mnt/emmc2
+fi
+
diff --git a/rootfs/sbin/nameif b/rootfs/sbin/nameif
new file mode 120000
index 0000000..459172e
--- /dev/null
+++ b/rootfs/sbin/nameif
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/nameif
\ No newline at end of file
diff --git a/rootfs/sbin/nat.sh b/rootfs/sbin/nat.sh
new file mode 100755
index 0000000..1c9b82e
--- /dev/null
+++ b/rootfs/sbin/nat.sh
@@ -0,0 +1,49 @@
+#!/bin/sh
+#
+# $Id: nat.sh,v 1.4 2009-12-09 08:45:37 steven Exp $
+#
+# usage: nat.sh
+#
+
+path_sh=`nv get path_sh`
+. $path_sh/global.sh
+echo "Info: nat.sh start " >> $test_log
+
+ZTE_FORWARD_CHAIN=port_forward
+ZTE_DMZ_CHAIN=DMZ
+ZTE_MAPPING_CHAIN=port_mapping
+
+iptables -P INPUT ACCEPT
+iptables -P OUTPUT ACCEPT
+iptables -P FORWARD ACCEPT
+
+#clear nat
+iptables -t nat -F
+iptables -t nat -X $ZTE_FORWARD_CHAIN
+iptables -t nat -X $ZTE_DMZ_CHAIN
+iptables -t nat -X $ZTE_MAPPING_CHAIN
+
+
+#Make a new chain for nat
+iptables -t nat -N $ZTE_FORWARD_CHAIN
+iptables -t nat -N $ZTE_DMZ_CHAIN
+iptables -t nat -N $ZTE_MAPPING_CHAIN
+
+iptables -t nat -I PREROUTING 1 -j $ZTE_FORWARD_CHAIN
+iptables -t nat -I PREROUTING 1 -j $ZTE_DMZ_CHAIN
+iptables -t nat -I PREROUTING 1 -j $ZTE_MAPPING_CHAIN
+
+ lan_en=`nv get LanEnable`
+ nat_en=`nv get natenable`
+ if [ "-$nat_en" != "-0" -a "-$lan_en" == "-2" ]; then
+ iptables -t nat -A POSTROUTING -o ${defwan_rel%:*} -j MASQUERADE
+ elif [ "-$nat_en" != "-0" -a "-$lan_en" != "-0" ]; then
+ iptables -t nat -A POSTROUTING -o $defwan_rel -j MASQUERADE
+ fi
+
+clat46_en=1
+ if [ "-$clat46_en" = "-1" ]; then
+ iptables -t nat -A POSTROUTING -o clat4 -j MASQUERADE
+ fi
+
+
diff --git a/rootfs/sbin/netdog_init_set.sh b/rootfs/sbin/netdog_init_set.sh
new file mode 100755
index 0000000..7087c38
--- /dev/null
+++ b/rootfs/sbin/netdog_init_set.sh
@@ -0,0 +1,43 @@
+#!/bin/sh
+#
+#
+path_conf=`nv get path_conf`
+test_log=`nv get path_log`"te.log"
+
+br_ipchange_flag=`nv get br_ipchange_flag`
+leak_set_flag=`nv get leak_set_flag`
+
+leak_full_panic=`nv get leak_full_panic`
+skb_max_panic=`nv get skb_max_panic`
+skb_max_fail=`nv get skb_max_fail`
+leak_list_max=`nv get leak_list_max`
+debug_mode=`nv get debug_mode`
+
+if [ "${leak_list_max}" != "" ]; then
+ netdog -s 'leak_list_max='${leak_list_max} &
+ echo "Info: netdog -s 'leak_list_max='${leak_list_max}" >> $test_log
+fi
+if [ "${skb_max_panic}" != "" ]; then
+ netdog -s 'skb_max_panic='${skb_max_panic} &
+ echo "Info: netdog -s 'skb_max_panic='${skb_max_panic}" >> $test_log
+fi
+if [ "${skb_max_fail}" != "" ]; then
+ netdog -s 'skb_max_fail='${skb_max_fail} &
+ echo "Info: netdog -s 'skb_max_fail='${skb_max_fail}" >> $test_log
+fi
+if [ "${leak_full_panic}" != "" ]; then
+ netdog -s 'leak_full_panic='${leak_full_panic} &
+ echo "Info: netdog -s 'leak_full_panic='${leak_full_panic}" >> $test_log
+fi
+if [ "$br_ipchange_flag" != "" ]; then
+ netdog -s 'brip='$br_ipchange_flag &
+ echo "Info: netdog -s 'brip='$br_ipchange_flag" >> $test_log
+fi
+if [ "${leak_set_flag}" != "" ]; then
+ netdog -s 'leak='${leak_set_flag} &
+ echo "Info: netdog -s 'leak='${leak_set_flag}" >> $test_log
+fi
+if [ "${debug_mode}" == "zephyr" ]; then
+ 7100_ip_proxy &
+ echo "Info: debug_mode 'debug_mode='${debug_mode}" >> $test_log
+fi
diff --git a/rootfs/sbin/nologin b/rootfs/sbin/nologin
new file mode 120000
index 0000000..04f6b9e
--- /dev/null
+++ b/rootfs/sbin/nologin
@@ -0,0 +1 @@
+/sbin/nologin.shadow
\ No newline at end of file
diff --git a/rootfs/sbin/nologin.shadow b/rootfs/sbin/nologin.shadow
new file mode 100755
index 0000000..1f1da6e
--- /dev/null
+++ b/rootfs/sbin/nologin.shadow
Binary files differ
diff --git a/rootfs/sbin/oem_zxic_verify b/rootfs/sbin/oem_zxic_verify
new file mode 100755
index 0000000..df5248c
--- /dev/null
+++ b/rootfs/sbin/oem_zxic_verify
Binary files differ
diff --git a/rootfs/sbin/oem_zxic_verify_3 b/rootfs/sbin/oem_zxic_verify_3
new file mode 100755
index 0000000..3c43ccf
--- /dev/null
+++ b/rootfs/sbin/oem_zxic_verify_3
Binary files differ
diff --git a/rootfs/sbin/pivot_root b/rootfs/sbin/pivot_root
new file mode 120000
index 0000000..961991c
--- /dev/null
+++ b/rootfs/sbin/pivot_root
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/pivot_root
\ No newline at end of file
diff --git a/rootfs/sbin/populate-extfs.sh b/rootfs/sbin/populate-extfs.sh
new file mode 100755
index 0000000..b1d3d1f
--- /dev/null
+++ b/rootfs/sbin/populate-extfs.sh
@@ -0,0 +1,105 @@
+#!/bin/sh
+#
+# This script uses debugfs command to populate the ext2/3/4 filesystem
+# from a given directory.
+#
+
+do_usage () {
+ cat << _EOF
+Usage: populate-extfs.sh <source> <device>
+Create an ext2/ext3/ext4 filesystem from a directory or file
+
+ source: The source directory or file
+ device: The target device
+
+_EOF
+ exit 1
+}
+
+[ $# -ne 2 ] && do_usage
+
+SRCDIR=${1%%/}
+DEVICE=$2
+
+# Find where is the debugfs command if not found in the env.
+if [ -z "$DEBUGFS" ]; then
+ CONTRIB_DIR=$(dirname $(readlink -f $0))
+ DEBUGFS="$CONTRIB_DIR/../debugfs/debugfs"
+fi
+
+{
+ CWD="/"
+ find $SRCDIR | while read FILE; do
+ TGT="${FILE##*/}"
+ DIR="${FILE#$SRCDIR}"
+ DIR="${DIR%$TGT}"
+
+ # Skip the root dir
+ [ ! -z "$DIR" ] || continue
+ [ ! -z "$TGT" ] || continue
+
+ if [ "$DIR" != "$CWD" ]; then
+ echo "cd $DIR"
+ CWD="$DIR"
+ fi
+
+ # Only stat once since stat is a time consuming command
+ STAT=$(stat -c "TYPE=\"%F\";DEVNO=\"0x%t 0x%T\";MODE=\"%f\";U=\"%u\";G=\"%g\"" $FILE)
+ eval $STAT
+
+ case $TYPE in
+ "directory")
+ echo "mkdir $TGT"
+ ;;
+ "regular file" | "regular empty file")
+ echo "write $FILE $TGT"
+ ;;
+ "symbolic link")
+ LINK_TGT=$(readlink $FILE)
+ echo "symlink $TGT $LINK_TGT"
+ ;;
+ "block special file")
+ echo "mknod $TGT b $DEVNO"
+ ;;
+ "character special file")
+ echo "mknod $TGT c $DEVNO"
+ ;;
+ "fifo")
+ echo "mknod $TGT p"
+ ;;
+ *)
+ echo "Unknown/unhandled file type '$TYPE' file: $FILE" 1>&2
+ ;;
+ esac
+
+ # Set the file mode
+ echo "sif $TGT mode 0x$MODE"
+
+ # Set uid and gid
+ echo "sif $TGT uid $U"
+ echo "sif $TGT gid $G"
+ done
+
+ # Handle the hard links.
+ # Save the hard links to a file, use the inode number as the filename, for example:
+ # If a and b's inode number is 6775928, save a and b to /tmp/tmp.VrCwHh5gdt/6775928.
+ INODE_DIR=`mktemp -d` || exit 1
+ for i in `find $SRCDIR -type f -links +1 -printf 'INODE=%i###FN=%p\n'`; do
+ eval `echo $i | sed 's$###$ $'`
+ echo ${FN#$SRCDIR} >>$INODE_DIR/$INODE
+ done
+ # Use the debugfs' ln and "sif links_count" to handle them.
+ for i in `ls $INODE_DIR`; do
+ # The link source
+ SRC=`head -1 $INODE_DIR/$i`
+ # Remove the files and link them again except the first one
+ for TGT in `sed -n -e '1!p' $INODE_DIR/$i`; do
+ echo "rm $TGT"
+ echo "ln $SRC $TGT"
+ done
+ LN_CNT=`cat $INODE_DIR/$i | wc -l`
+ # Set the links count
+ echo "sif $SRC links_count $LN_CNT"
+ done
+ rm -fr $INODE_DIR
+} | $DEBUGFS -w -f - $DEVICE
diff --git a/rootfs/sbin/poweroff b/rootfs/sbin/poweroff
new file mode 120000
index 0000000..ac97420
--- /dev/null
+++ b/rootfs/sbin/poweroff
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/poweroff
\ No newline at end of file
diff --git a/rootfs/sbin/ppp_updown.sh b/rootfs/sbin/ppp_updown.sh
new file mode 100755
index 0000000..7425a33
--- /dev/null
+++ b/rootfs/sbin/ppp_updown.sh
@@ -0,0 +1,484 @@
+#!/bin/sh
+
+path_sh=`nv get path_sh`
+. $path_sh/global.sh
+
+echo "Info: ppp_updown.sh $1 $2 start" >> $test_log
+
+echo 1 > /proc/sys/net/ipv4/ip_forward
+
+path_sh=`nv get path_sh`
+path_conf=`nv get path_conf`
+c_id=$2
+
+ps_if=`nv get pswan`$c_id
+eth_if=`nv get ppp_name`
+pdp_type=`nv get ppp_pdp_type`
+
+dhcp6s_conf=$path_conf/dhcp6s$c_id.conf
+radvd_conf=$path_conf/radvd$c_id.conf
+ndp_log=$path_conf/ndp$c_id.log
+radvd_pidfile=$path_tmp/radvd$c_id.pid
+
+dnsconfig=0
+
+b_dhcpv6stateEnabled=`nv get dhcpv6stateEnabled`
+b_dhcpv6statelessEnabled=`nv get dhcpv6statelessEnabled`
+
+#ipµØÖ·¸ñʽa.b.c.d
+#»ñÈ¡ip²¢ÅäÖÃps¡¢eth,´Ë´¦IPµØÖ·µÄÅäÖùæÔòΪpdp¼¤»îipµØÖ·×îºóһλµÄ×îºóÒ»¸öbitºÍµ¹ÊýµÚ¶þbit·Ö±ðÈ¡·´£¬¸Ã¹æÔòºóÐø¸ù¾øÐèÇó¿ÉÐÞ¸Ä
+ipaddr_set()
+{
+ pdp_ip=`nv get $ps_if"_ip"`
+ #´Óa.b.c.d»ñȡǰÈý×Ö½Úa.b.c
+ ps_ip_abc=${pdp_ip%.*}
+ #´Óa.b.c»ñȡǰÁ½¸ö×Ö½Úa.b
+ ps_ip_ab=${ps_ip_abc%.*}
+ #´Óa.b.c»ñÈ¡µÚÈý×Ö½Úc
+ ps_ip_c=${ps_ip_abc##*.}
+ #´Óa.b.c.d»ñÈ¡µÚËÄ×Ö½Úd
+ ps_ip_d=${pdp_ip##*.}
+
+ #pdp_ipµÚËÄλµÄ×îºó1bitÈ¡·´
+ [ "$ps_ip_c" -ge "254" ] && { ps_ip_c="250"; }
+ [ "$ps_ip_c" -le "2" ] && { ps_ip_c="10"; }
+ ps_ip_c1=`expr $ps_ip_c + 1`
+ ps_ip_c2=`expr $ps_ip_c - 1`
+
+ ps_ip=$ps_ip_ab"."$ps_ip_c1"."$ps_ip_d
+
+ ifconfig $ps_if $ps_ip up
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $ps_if $ps_ip up failed." >> $test_log
+ fi
+ echo "Info: ifconfig $ps_if $ps_ip gw $ps_ip up" >> $test_log
+
+ #pdp_ipµÚËÄλµÄµ¹ÊýµÚ2bitÈ¡·´
+ eth_ip=$ps_ip_ab"."$ps_ip_c2"."$ps_ip_d
+
+
+ nv set $eth_if"_ip"=$eth_ip
+ #ppp0Íø¿ÚÔÚpppdÖÐÒѾup£¬ÎÞÐèÔÙ´Îup
+ ifconfig $eth_if $eth_ip
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $eth_if $eth_ip up failed." >> $test_log
+ fi
+ echo "Info: ifconfig $eth_if $eth_ip up" >> $test_log
+ nv set $ps_if"_pppip"=$ps_ip
+}
+
+#·ÓɹæÔò£¬psÓëeth¼¶Áª
+route_set()
+{
+ marknum=`expr $c_id + 20`
+ iptables -t mangle -A PREROUTING -i $ps_if -j MARK --set-mark $marknum
+ rt_num=`expr $c_id + 120`
+
+ echo "Info: ip route add default dev $eth_if table $rt_num " >> $test_log
+ ip route add default dev $eth_if table $rt_num
+
+ echo "Info: ip rule add to $pdp_ip fwmark $marknum table $rt_num " >> $test_log
+ ip rule add to $pdp_ip fwmark $marknum table $rt_num
+
+ marknum=`expr $c_id + 10`
+ iptables -t mangle -A PREROUTING -i $eth_if -d ! $eth_ip/24 -j MARK --set-mark $marknum
+ rt_num=`expr $c_id + 100`
+
+ echo "Info: ip route add default dev $ps_if table $rt_num " >> $test_log
+ ip route add default dev $ps_if table $rt_num
+
+ echo "Info: ip rule add from $pdp_ip fwmark $marknum table $rt_num " >> $test_log
+ ip rule add from $pdp_ip fwmark $marknum table $rt_num
+
+ ip route flush cache
+
+ #±¾µØÍøÂçÅäÖÃ
+ iptables -t nat -I POSTROUTING -s $ps_ip -o $ps_if -j SNAT --to $pdp_ip
+
+ route_info=`route|grep default`
+
+ if [ "$route_info" == "" ];then
+ route add default dev $ps_if
+ else
+ echo "Debug: default route already exist." >> $test_log
+ fi
+}
+
+#ɾ³ý¶ÔÓ¦µÄ·ÓɹæÔò
+route_del()
+{
+ pdp_ip=`nv get $ps_if"_ip"`
+
+ eth_ip=`nv get $eth_if"_ip"`
+
+ ps_ip=`nv get $ps_if"_pppip"`
+
+ marknum=`expr $c_id + 10`
+ rt_num=`expr $c_id + 100`
+
+ iptables -t mangle -D PREROUTING -i $eth_if -d ! $eth_ip/24 -j MARK --set-mark $marknum
+ ip rule del from $pdp_ip fwmark $marknum table $rt_num
+ ip route del default dev $ps_if table $rt_num
+
+ marknum=`expr $c_id + 20`
+ rt_num=`expr $c_id + 120`
+ iptables -t mangle -D PREROUTING -i $ps_if -j MARK --set-mark $marknum
+ ip rule del to $pdp_ip fwmark $marknum table $rt_num
+ ip route del default dev $eth_if table $rt_num
+
+ iptables -t nat -D POSTROUTING -s $ps_ip -o $ps_if -j SNAT --to $pdp_ip
+
+ ifconfig $ps_if down
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $ps_if down failed." >> $test_log
+ fi
+
+ #reset nv
+ nv set ppp_cid=""
+ nv set $eth_if"_ip"=0.0.0.0
+ nv set $eth_if"_nm"=0.0.0.0
+ nv set $ps_if"_ip"=0.0.0.0
+ nv set $ps_if"_pridns"=0.0.0.0
+ nv set $ps_if"_secdns"=0.0.0.0
+ nv set $ps_if"_pppip"=0.0.0.0
+}
+
+#############linkup dhcpserver set############
+linkup_add_dns_to_dhcp6s_radvd_conf()
+{
+ #Ö±Á¬Ä£Ê½Ã»ÓÐÊÖ¶¯DNS
+ ipv6_pridns_auto=`nv get $ps_if"_ipv6_pridns_auto"`
+ ipv6_secdns_auto=`nv get $ps_if"_ipv6_secdns_auto"`
+
+ if [ -n "$ipv6_pridns_auto" ] && [ "-$ipv6_pridns_auto" != "-::" ] && [ "-$ipv6_pridns_auto" != "-::0" ];then
+ ipv6_prefer_dns=$ipv6_pridns_auto
+ fi
+
+ if [ -n "$ipv6_secdns_auto" ] && [ "-$ipv6_secdns_auto" != "-::" ] && [ "-$ipv6_secdns_auto" != "-::0" ];then
+ ipv6_standby_dns=$ipv6_secdns_auto
+ fi
+
+ if [ "-$ipv6_prefer_dns" == "-" -a "-$ipv6_standby_dns" == "-" ]; then
+ return
+ else
+ if [ -n "$1" ] && [ "-$1" == "-dhcp6s" ] ;then
+ echo -e "\toption dns_servers $ipv6_prefer_dns $ipv6_standby_dns;" >> $dhcp6s_conf
+ elif [ -n "$1" ] && [ "-$1" == "-radvd" ] ;then
+ # del last line
+ sed -i '$d' $radvd_conf
+ echo -e "\tRDNSS $ipv6_prefer_dns $ipv6_standby_dns\n\t{" >> $radvd_conf
+ echo -e "\t\tAdvRDNSSPreference 15;" >> $radvd_conf
+ echo -e "\t\tAdvRDNSSOpen on;" >> $radvd_conf
+ echo -e "\t};\n};" >> $radvd_conf
+ fi
+
+ if [ "-$dnsconfig" == "-0" ]; then
+ echo "dnsconfig $1 $ipv6_prefer_dns, $ipv6_standby_dns" >> $test_log
+ if [ "-$ipv6_prefer_dns" != "-" ]; then
+ echo "nameserver $ipv6_prefer_dns" >> /etc/resolv.conf
+ fi
+ if [ "-$ipv6_standby_dns" != "-" ]; then
+ echo "nameserver $ipv6_standby_dns" >> /etc/resolv.conf
+ fi
+ dnsconfig=1
+ fi
+ fi
+}
+
+linkup_dhcpv6_set()
+{
+ dhcpv6_start=$pdp_ip
+ dhcpv6_end=$pdp_ip
+
+ #nvÖµ·Ç¿ÕÔò±íʾÓû§ÉèÖÃÁ˾²Ì¬ip¡¢gw
+ gw=`nv get $ps_if"_ipv6_gw"`
+
+ echo -e "interface $eth_if {" > $dhcp6s_conf
+ if [ "-$b_dhcpv6stateEnabled" = "-1" ];then
+ echo -e "\tserver-preference 255;\n\trenew-time 6000;" >> $dhcp6s_conf
+ echo -e "\trebind-time 9000;\n\tprefer-life-time 1300;" >> $dhcp6s_conf
+ echo -e "\tvalid-life-time 2000;\n\tallow rapid-commit;" >> $dhcp6s_conf
+ echo -e "\tlink $eth_if {\n\t\tallow unicast;\n\t\tsend unicast;" >> $dhcp6s_conf
+ echo -e "\t\tpool {\n\t\t\trange $dhcpv6_start to $dhcpv6_end/$prefix_len;" >> $dhcp6s_conf
+ echo -e "\t\t};\n\t};" >> $dhcp6s_conf
+ linkup_add_dns_to_dhcp6s_radvd_conf dhcp6s
+ echo -e "};" >> $dhcp6s_conf
+ dhcp6s -dDf -c $dhcp6s_conf $eth_if &
+ else
+ #slaac with dhcp statelessset dns info
+ if [ "-$b_dhcpv6statelessEnabled" = "-1" ];then
+ echo -e "\tlink $eth_if {\n\t};" >> $dhcp6s_conf
+ linkup_add_dns_to_dhcp6s_radvd_conf dhcp6s
+ echo -e "};" >> $dhcp6s_conf
+ dhcp6s -dDf -c $dhcp6s_conf $eth_if &
+ if [ $? -ne 0 ];then
+ echo "Error: dhcp6s -dDf -c $dhcp6s_conf $eth_if failed." >> $test_log
+ fi
+ fi
+ fi
+}
+
+#»ñÈ¡ip²¢ÅäÖÃps¡¢eth
+ip6addr_set()
+{
+ #disable the forwarding to send RS and not set the addr when receive ra packet
+ echo 0 > /proc/sys/net/ipv6/conf/all/forwarding
+ echo 0 > /proc/sys/net/ipv6/conf/$ps_if/accept_ra
+ echo 0 > /proc/sys/net/ipv6/conf/$eth_if/accept_ra
+
+ #call the slaac program to get the prefix addr
+ ifconfig $ps_if up 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $ps_if up failed." >> $test_log
+ fi
+ prefix_info_temp=`nv get $ps_if"_ipv6_prefix_info"`
+ #Èç¹ûµ±Ç°Ã»ÓÐǰ׺£¬ÔòÖ±½ÓÆô¶¯slaac£¬Èç¹ûµ±Ç°Ç°×ºÒѾÉèÖã¬Ôò˵Ã÷ÒѾ»ñÈ¡µ½£¬Ö±½ÓÅäÖÃIPµØÖ·¼´¿É
+ if [ -n "$prefix_info_temp" -a "-$prefix_info_temp" != "-::" ]; then
+ ret_code=0
+ else
+ sleep 1
+ interface_id_temp1=`nv get $ps_if"_ipv6_interface_id"`
+ local_ipv6_addr="fe80::"$interface_id_temp1
+ local_ipv6_addr_nv="$ps_if""_local_ipv6_addr"
+ nv set $local_ipv6_addr_nv=$local_ipv6_addr
+ ip -6 addr add $local_ipv6_addr/64 dev $ps_if 2>>$test_log
+ zte_ipv6_slaac -i "$ps_if"
+ ret_code=$?
+ fi
+
+ echo "Info: zte_ipv6_slaac return: $ret_code" >> $test_log
+ echo "the program zte_ipv6_slaac return = $ret_code"
+ if [ $ret_code -eq 0 ]; then
+ echo "the zte_ipv6_slaac success"
+ interface_id_temp=`nv get $ps_if"_ipv6_interface_id"`
+ prefix_info_temp=`nv get $ps_if"_ipv6_prefix_info"`
+
+ echo "##############1##########"
+ echo "$interface_id_temp"
+ echo "$prefix_info_temp"
+ echo "##############2##########"
+
+ #pdp ¼¤»îµÄipv6µØÖ·
+ pdp_ip6=$prefix_info_temp$interface_id_temp
+ #pdp¼¤»îµØÖ·£¬ÊÊÅäÒ³ÃæÊ¹ÓÃ
+ nv set ipv6_wan_ipaddr="$pdp_ip6"
+
+ ipv6_addr_conver $pdp_ip6 "$ps_if"
+
+ #¸øeth·ÖÅ䵨ַ£¬Ê¹ÓÃipv6_addr_converÔÚµÚ15+1
+ eth_ip6=`nv get ipv6_br0_addr`
+
+ ip -6 addr add $eth_ip6/64 dev $eth_if
+ if [ $? -ne 0 ];then
+ echo "Error: ip -6 addr add $eth_ip6/64 dev $eth_if failed." >> $test_log
+ fi
+ #¸øÍâÍø¿Ú·ÖÅ䵨ַ£¬Ê¹ÓÃipv6_addr_converÔÚµÚ15+2
+ ps_ip6=`nv get $ps_if"_dhcpv6_start"`
+ nv set $ps_if"_ipv6_ip"=$ps_ip6
+ ip -6 addr add $ps_ip6/126 dev $ps_if 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ip -6 addr add $ps_ip6/126 dev $ps_if failed." >> $test_log
+ fi
+ nv set $ps_if"_ipv6_state"="working"
+
+ echo "Info: zte_ipv6_slaac pdp_ip6: $pdp_ip6" >> $test_log
+ echo "Info: zte_ipv6_slaac ps_ip6: $ps_ip6" >> $test_log
+ echo "Info: zte_ipv6_slaac eth_ip6: $eth_ip6" >> $test_log
+ else
+ echo "the zte_ipv6_slaac fail"
+ nv set $ps_if"_ipv6_state"="dead"
+ exit 1
+ fi
+}
+
+#·ÓɹæÔò£¬psÓëeth¼¶Áª
+route6_set()
+{
+ echo 0 > /proc/sys/net/ipv6/conf/all/forwarding
+
+ marknum=`expr $c_id + 60`
+ ip6tables -t mangle -A PREROUTING -i $ps_if -j MARK --set-mark $marknum
+ rt_num=`expr $c_id + 160`
+ ip -6 route add default dev $eth_if table $rt_num
+ ip -6 rule add to $pdp_ip6/64 fwmark $marknum table $rt_num
+
+ marknum=`expr $c_id + 50`
+ ip6tables -t mangle -A PREROUTING -i $eth_if -j MARK --set-mark $marknum
+ rt_num=`expr $c_id + 150`
+ ip -6 route add default dev $ps_if table $rt_num
+ ip -6 rule add from $pdp_ip6/64 fwmark $marknum table $rt_num
+
+ ip6tables -t filter -A FORWARD -p icmpv6 --icmpv6-type 135 -j DROP
+
+ ip -6 route flush cache
+
+ #Õâ¾äÉèÍ꣬ÀïÃæ¿ÉÒÔpingͨÍâÍøÁË
+ echo "Info: route6_set pdp_ip6=$pdp_ip6" >> $test_log
+
+ ip -6 route add default dev $ps_if 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ip -6 route add default dev $ps_if failed." >> $test_log
+ fi
+
+ #enable ipv6 packet forwarding
+ echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
+ echo 1 > /proc/sys/net/ipv6/conf/$ps_if/accept_ra
+ echo 1 > /proc/sys/net/ipv6/conf/$eth_if/accept_ra
+ #enable ipv6 neigh discovery proxy
+ echo 1 > /proc/sys/net/ipv6/conf/all/proxy_ndp
+
+ ndp_kill
+ zte_ndp -a -s $eth_if -d $ps_if -l $ndp_log -p &
+}
+
+#############linkup radvd set############
+linkup_radvd_set()
+{
+ echo "enter linkup_radvd_set "
+
+ prefix_len=64
+
+ rm -rf $radvd_conf
+
+ if [ "-$b_dhcpv6stateEnabled" = "-1" ];then
+ echo -e "interface $eth_if\n{\n\tAdvSendAdvert on;" > $radvd_conf
+ echo -e "\tAdvManagedFlag on;\n};" >> $radvd_conf
+ radvd_kill
+ rm -rf $radvd_pidfile
+ radvd -d 3 -C $radvd_conf -p $radvd_pidfile&
+ echo "leave linkup_radvd_set "
+ return
+ fi
+
+ echo "Info: psext_updown_ipv6.sh eth_if:$eth_if, prefix_len:$prefix_len" >> $test_log
+ echo "prefix_len:$prefix_len"
+
+ cp $path_ro/radvd_template.conf $radvd_conf
+
+ sed -i -e 's/#ipv6_wan_addr#\/64/#ipv6_wan_addr#\/#prefix_len#/g' $radvd_conf
+ sed -i -e s/br0/$eth_if/g $radvd_conf
+ sed -i -e s/#ipv6_wan_addr#/$eth_ip6/g $radvd_conf
+ sed -i -e s/#prefix_len#/$prefix_len/g $radvd_conf
+ sed -i -e s/#adv_switch#/on/g $radvd_conf
+
+ #slaac with dns info
+ if [ "-$b_dhcpv6statelessEnabled" = "-1" ];then
+ echo "use dhcpv6stateless for dns"
+ else
+ sed -i -e 's/AdvOtherConfigFlag on;/AdvOtherConfigFlag off;/g' $radvd_conf
+ linkup_add_dns_to_dhcp6s_radvd_conf radvd
+ fi
+
+ radvd_kill
+ sleep 1
+ rm -rf $radvd_pidfile
+ radvd -d 3 -C $radvd_conf -p $radvd_pidfile &
+
+ echo "leave linkup_radvd_set "
+}
+
+#Çå³ýÏàÓ¦µÄradvd½ø³Ì
+linkdown_radvd_set()
+{
+ #¸úÖÕ¶ËÁ¬½ÓµÄÍø¿ÚÖ±½Ó»ádown£¬ËùÒÔ²»ÓÃÏñufiÒ»ÑùÉèÖóÉ1sÓÐЧÆÚ
+ radvd_kill
+}
+
+#Çå³ýÏàÓ¦µÄDHCPv6½ø³Ì
+linkdown_dhcpv6_server_set()
+{
+ dhcp6s_kill
+}
+
+#ɾ³ýÏàÓ¦µÄipv6·ÓɹæÔò
+route6_del()
+{
+ eth_ip6=`nv get ipv6_br0_addr`
+ ps_ip6=`nv get $ps_if"_ipv6_ip"`
+ pdp_ip6=`nv get ipv6_wan_ipaddr`
+
+ ip6tables -t filter -D FORWARD -p icmpv6 --icmpv6-type 135 -j DROP
+
+ marknum=`expr $c_id + 50`
+ rt_num=`expr $c_id + 150`
+ ip -6 rule del from $pdp_ip6/64 fwmark $marknum table $rt_num
+ ip6tables -t mangle -D PREROUTING -i $eth_if -j MARK --set-mark $marknum
+ ip -6 route del default dev $ps_if table $rt_num
+
+ marknum=`expr $c_id + 60`
+ rt_num=`expr $c_id + 160`
+ ip -6 rule del to $pdp_ip6/64 fwmark $marknum table $rt_num
+ ip6tables -t mangle -D PREROUTING -i $ps_if -j MARK --set-mark $marknum
+ ip -6 route del default dev $eth_if table $rt_num
+
+ ip -6 addr del $eth_ip6/64 dev $eth_if
+ #if [ $? -ne 0 ];then
+ # echo "Error: ip -6 addr del $eth_ip/64 dev $eth_if failed." >> $test_log
+ #fi
+ ip -6 addr del $ps_ip6/126 dev $ps_if
+ #if [ $? -ne 0 ];then
+ # echo "Error: ip -6 addr del $ps_ip6/126 dev $ps_if failed." >> $test_log
+ #fi
+ ip -6 route del default
+ #if [ $? -ne 0 ];then
+ # echo "Error: ip -6 route del default failed." >> $test_log
+ #fi
+
+ ifconfig $eth_if down 2>>$test_log
+ #if [ $? -ne 0 ];then
+ # echo "Error: ifconfig $eth_if down failed." >> $test_log
+ #fi
+ ifconfig $ps_if down 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $ps_if down failed." >> $test_log
+ fi
+
+ echo 0 > /proc/sys/net/ipv6/conf/$ps_if/accept_ra
+
+ #reset nv
+ nv set ppp_cid=""
+ nv set $ps_if"_pppv6_ip"="::"
+ nv set $ps_if"_ipv6_ip"="::"
+ nv set $ps_if"_ipv6_pridns_auto"="::"
+ nv set $ps_if"_ipv6_secdns_auto"="::"
+ nv set $ps_if"_ipv6_gw"="::"
+ nv set $ps_if"_ipv6_interface_id"="::"
+ nv set $ps_if"_ipv6_prefix_info"="::"
+ nv set $ps_if"_dhcpv6_start"="::"
+ nv set $ps_if"_dhcpv6_end"="::"
+
+ #ÊÊÅäÒ³ÃæµÈÆäËûµØ·½Ê¹ÓÃÀÏNV
+ nv set ipv6_wan_ipaddr="::"
+ nv set $ps_if"_ipv6_state"="dead"
+
+ local_ipv6_addr_nv="$ps_if""_local_ipv6_addr"
+ nv set $local_ipv6_addr_nv="::"
+
+ ndp_kill
+}
+
+if [ "$1" == "linkup" ]; then
+ if [ "$pdp_type" != "IPV6" ]; then
+ ipaddr_set
+ route_set
+ fi
+ if [ "$pdp_type" == "IPV6" -o "$pdp_type" == "IPV4V6" ]; then
+ ip6addr_set
+ route6_set
+ linkup_dhcpv6_set
+ linkup_radvd_set
+ fi
+elif [ "$1" == "linkdown" ]; then
+ if [ "$pdp_type" != "IPV6" ]; then
+ route_del
+ fi
+ if [ "$pdp_type" == "IPV6" -o "$pdp_type" == "IPV4V6" ]; then
+ linkdown_radvd_set
+ linkdown_dhcpv6_server_set
+ route6_del
+ slaac_kill
+ echo "" > /etc/resolv.conf
+ fi
+fi
+
+echo "Info: ppp_updown.sh $1 $2 leave" >> $test_log
diff --git a/rootfs/sbin/pppd_up.sh b/rootfs/sbin/pppd_up.sh
new file mode 100755
index 0000000..db1ba09
--- /dev/null
+++ b/rootfs/sbin/pppd_up.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+#
+# $Id: lan.sh
+#
+path_sh=`nv get path_sh`
+. $path_sh/global.sh
+
+pppd_auth=`nv get pppd_auth`
+dev_name=$1
+echo "name is $1"
+aa=`echo $dev_name | sed 's/\//\\\\\//g'`
+echo "aa is $aa"
+echo "Info:start pppd!" >> $test_log
+if [ "$pppd_auth" == "auth" ]; then
+ cp $path_ro/options.auth $path_conf/options
+ cp $path_ro/pap-secrets $path_conf/pap-secrets
+ cp $path_ro/chap-secrets $path_conf/chap-secrets
+ sed -i -e "s/#dev_name#/$aa/g" $path_conf/options
+ sed -i -e "s/#dev_name#/$aa/g" $path_conf/options
+ killall -9 pppd
+ pppd &
+elif [ "$pppd_auth" == "noauth" ]; then
+ cp $path_ro/options.noauth $path_conf/options
+ sed -i -e "s/#dev_name#/$aa/g" $path_conf/options
+ sed -i -e "s/#dev_name#/$aa/g" $path_conf/options
+ killall -9 pppd
+ pppd &
+fi
diff --git a/rootfs/sbin/pppoe_dail.sh b/rootfs/sbin/pppoe_dail.sh
new file mode 100755
index 0000000..fc1269f
--- /dev/null
+++ b/rootfs/sbin/pppoe_dail.sh
@@ -0,0 +1,54 @@
+#!/bin/sh
+#
+# $Id: pppoe_dail.sh,v 1.1 2007-09-26 01:33:21 winfred Exp $
+#
+# usage: pppoe_dail.sh
+#
+# pppoe_dail.sh,v1.0 2010-09-09 10:00:00 maxiaoliang $
+#
+# usage: pppoe_dail.sh
+#
+path_sh=`nv get path_sh`
+. $path_sh/global.sh
+echo "Info: pppoe_dail.sh start " >> $test_log
+
+usage()
+{
+ echo "Usage:"
+ echo " $0 [connect | disconnect]"
+ exit 1
+}
+if [ "$1" = "" ]; then
+ echo "$0: insufficient arguments"
+ usage $0
+fi
+
+killall pppoecd
+
+eth_dial_mode=`nv get ethwan_dialmode`
+
+idle_time=`nv get idle_time`
+wan0=`nv get ethwan`
+
+ if [ "$1" = "connect" ]; then
+ pppoe_user=`nv get pppoe_username`
+ pppoe_pass=`nv get pppoe_cc`
+ if [ "-${pppoe_user}" = "-" -a "-${pppoe_pass}" = "-" ];then
+ echo "WARN: pppoe_user is ${pppoe_user}, pppoe_pass is ${pppoe_pass}, so not connect pppoecd. " >> $test_log
+ else
+ #dial mode
+ if [ "$eth_dial_mode" == "auto" ]; then
+ pppoecd $wan0 -u $pppoe_user -p $pppoe_pass -N 2 -k &
+ elif [ "$eth_dial_mode" == "ondemand" ]; then
+ pppoecd $wan0 -u $pppoe_user -p $pppoe_pass -N 2 -i $idle_time -R -k &
+ elif [ "$eth_dial_mode" == "manual" ]; then
+ pppoecd $wan0 -u $pppoe_user -p $pppoe_pass -N 2 -k &
+ fi
+ fi
+ fi
+
+ if [ "$1" = "disconnect" ]; then
+ echo "pppoe-down: pppoe is disconnected! "
+ sleep 2
+ fi
+
diff --git a/rootfs/sbin/pppoe_updown.sh b/rootfs/sbin/pppoe_updown.sh
new file mode 100755
index 0000000..fbbbb6b
--- /dev/null
+++ b/rootfs/sbin/pppoe_updown.sh
@@ -0,0 +1,54 @@
+#!/bin/sh
+
+path_sh=`nv get path_sh`
+echo "Info: pppoe_updown.sh $1 start " >> $test_log
+wan_if=`nv get ethwan`
+. $path_sh/global.sh
+
+pppoe_down()
+{
+ nv set rj45_state="idle"
+ #killall pppoecd
+ (/sbin/router_msg_proxy ipv4 pppoe_updown.sh 1>> $test_log 2>&1 || echo "Error: router_msg_proxy ipv4 pppoe_updown.sh failed." >> $test_log) &
+ if [ $? -ne 0 ];then
+ echo "Error: router_msg_proxy ipv4 failed." >> $test_log
+ fi
+}
+pppoe_up()
+{
+ udhcpc_kill
+ nv set rj45_state="working"
+ nv set eth_curmode="pppoe"
+ (/sbin/router_msg_proxy del_timer ethwan 1>> $test_log 2>&1 || echo "Error: router_msg_proxy del_timer failed." >> $test_log) &
+ if [ $? -ne 0 ];then
+ echo "Error: router_msg_proxy del_timer failed." >> $test_log
+ fi
+ (/sbin/router_msg_proxy ipv4 pppoe_updown.sh 1>> $test_log 2>&1 || echo "Error: router_msg_proxy ipv4 pppoe_updown.sh failed." >> $test_log) &
+ if [ $? -ne 0 ];then
+ echo "Error: router_msg_proxy ipv4 failed." >> $test_log
+ fi
+
+ wan_ip=`nv get $wan_if"_ip"`
+ wan_gw=`nv get $wan_if"_gw"`
+ wan_pri=`nv get ethwan_priority`
+ rt_num=`expr $wan_pri \* 10 `
+ ip rule add from $wan_ip table $rt_num 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ip rule add from $wan_ip table $rt_num failed." >> $test_log
+ fi
+ ip route add default via $wan_gw table $rt_num 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ip route add default via $wan_gw table $rt_num failed." >> $test_log
+ fi
+ ip route flush cache 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ip route flush cache failed." >> $test_log
+ fi
+}
+
+if [ "$1" == "up" ]; then
+ pppoe_up
+elif [ "$1" == "down" ]; then
+ pppoe_down
+fi
+
\ No newline at end of file
diff --git a/rootfs/sbin/print_errmsg.sh b/rootfs/sbin/print_errmsg.sh
new file mode 100755
index 0000000..4530abd
--- /dev/null
+++ b/rootfs/sbin/print_errmsg.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+echo "error:"
+grep "\<${1##0}\>" /etc_ro/errmsg.txt|sed -n "s/#define[[:blank:]]\+[a-zA-Z0-9]\+[[:blank:]]\+[0-9]\+[[:blank:]]\+\(.*\)/\1/p" |awk -F'*' '{print $2}'
diff --git a/rootfs/sbin/psext_down.sh b/rootfs/sbin/psext_down.sh
new file mode 100755
index 0000000..b9d3877
--- /dev/null
+++ b/rootfs/sbin/psext_down.sh
@@ -0,0 +1,65 @@
+#!/bin/sh
+test_log=`nv get telog_path`
+if [ "$test_log" == "" ]; then
+ test_log=`nv get path_log`"te.log"
+fi
+echo "Info: psext_down.sh $1 start" >> $test_log
+c_id=$1
+ps_if=`nv get pswan`$c_id
+eth_if=`nv get "ps_ext"$c_id`
+ext_br="br"$c_id
+
+#ɾ³ý¶ÔÓ¦µÄ·ÓɹæÔò
+route_del()
+{
+ pdp_ip=`nv get $ps_if"_pdp_ip"`
+ ps_ip=`nv get $ps_if"_ip"`
+ br_ip=`nv get $ext_br"_ip"`
+ marknum=`expr $c_id + 10`
+ rt_num=`expr $c_id + 100`
+
+ iptables -t mangle -D PREROUTING -i $ext_br -j MARK --set-mark $marknum
+ ip rule del from $pdp_ip fwmark $marknum table $rt_num
+ ip route del default dev $ps_if table $rt_num
+
+ marknum=`expr $c_id + 20`
+ rt_num=`expr $c_id + 120`
+ iptables -t mangle -D PREROUTING -i $ps_if -j MARK --set-mark $marknum
+ ip rule del to $pdp_ip fwmark $marknum table $rt_num
+ ip route del default dev $ext_br table $rt_num
+ #±¾µØÍøÂçÅäÖÃ
+ iptables -t nat -D POSTROUTING -s $ps_ip -o $ps_if -j SNAT --to $pdp_ip
+ if [ $? -ne 0 ];then
+ echo "cmd <<iptables -t nat -D POSTROUTING -s $ps_ip -o $ps_if -j SNAT --to $pdp_ip>> exec failed" >> $test_log
+ fi
+ route delete default dev $ps_if
+ if [ $? -ne 0 ];then
+ echo "cmd <<route delete default dev $ps_if>> exec failed" >> $test_log
+ fi
+
+ ifconfig $ext_br 0.0.0.0
+ ifconfig $ext_br down 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $ext_br down failed." >> $test_log
+ fi
+
+ ifconfig $ps_if 0.0.0.0
+ ifconfig $ps_if down 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $ps_if down failed." >> $test_log
+ fi
+
+ #reset nv
+ nv set $ext_br"_ip"=0.0.0.0
+ nv set $ext_br"_nm"=0.0.0.0
+ nv set $ps_if"_pdp_ip"=0.0.0.0
+ nv set $ps_if"_pridns"=0.0.0.0
+ nv set $ps_if"_secdns"=0.0.0.0
+ nv set $ps_if"_ip"=0.0.0.0
+}
+tc_tbf.sh down $c_id
+route_del
+ifconfig $eth_if down
+ifconfig $ext_br down
+brctl delif $ext_br $eth_if
+brctl delbr $ext_br
diff --git a/rootfs/sbin/psext_down_ipv6.sh b/rootfs/sbin/psext_down_ipv6.sh
new file mode 100755
index 0000000..2ce0d21
--- /dev/null
+++ b/rootfs/sbin/psext_down_ipv6.sh
@@ -0,0 +1,84 @@
+#!/bin/sh
+test_log=`nv get telog_path`
+if [ "$test_log" == "" ]; then
+ test_log=`nv get path_log`"te.log"
+fi
+echo "Info: psext_updown_ipv6.sh $ps_if $eth_if $br_if start" >> $test_log
+
+c_id=$1
+ps_if=`nv get pswan`$c_id
+eth_if=`nv get "ps_ext"$c_id`
+br_if="br"$c_id
+
+#删除相应的ipv6路由规则
+linkdown_route_set()
+{
+ br_ip=`nv get $br_if"_ipv6_ip"`
+ ps_ip=`nv get $ps_if"_ipv6_ip"`
+ pdp_ip=`nv get ipv6_wan_ipaddr`
+
+ ip6tables -t filter -D FORWARD -p icmpv6 --icmpv6-type 135 -j DROP
+
+ marknum=`expr $c_id + 50`
+ rt_num=`expr $c_id + 150`
+ ip -6 rule del from $pdp_ip/64 fwmark $marknum table $rt_num
+ ip6tables -t mangle -D PREROUTING -i $br_if -j MARK --set-mark $marknum
+ ip -6 route del default dev $ps_if table $rt_num
+
+ marknum=`expr $c_id + 60`
+ rt_num=`expr $c_id + 160`
+ ip -6 rule del to $pdp_ip/64 fwmark $marknum table $rt_num
+ ip6tables -t mangle -D PREROUTING -i $ps_if -j MARK --set-mark $marknum
+ ip -6 route del default dev $br_if table $rt_num
+
+ ip -6 addr del $br_ip/126 dev $br_if
+ #if [ $? -ne 0 ];then
+ # echo "Error: ip -6 addr del $eth_ip/126 dev $eth_if failed." >> $test_log
+ #fi
+ ip -6 addr del $ps_ip/126 dev $ps_if
+ #if [ $? -ne 0 ];then
+ # echo "Error: ip -6 addr del $ps_ip/126 dev $ps_if failed." >> $test_log
+ #fi
+ ip -6 route del default
+ #if [ $? -ne 0 ];then
+ # echo "Error: ip -6 route del default failed." >> $test_log
+ #fi
+
+ ifconfig $br_if down 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $br_if down failed." >> $test_log
+ fi
+ ifconfig $ps_if down 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $ps_if down failed." >> $test_log
+ fi
+
+ echo 0 > /proc/sys/net/ipv6/conf/$ps_if/accept_ra
+
+ #reset nv
+ nv set $br_if"_ipv6_ip"="::"
+ nv set $ps_if"_ipv6_ip"="::"
+ nv set $ps_if"_ipv6_pridns_auto"="::"
+ nv set $ps_if"_ipv6_secdns_auto"="::"
+ nv set $ps_if"_ipv6_gw"="::"
+ nv set $ps_if"_ipv6_interface_id"="::"
+ nv set $ps_if"_ipv6_prefix_info"="::"
+ nv set $ps_if"_dhcpv6_start"="::"
+ nv set $ps_if"_dhcpv6_end"="::"
+
+ #适配页面等其他地方使用老NV
+ nv set ipv6_wan_ipaddr="::"
+ nv set $ps_if"_ipv6_state"="dead"
+
+ local_ipv6_addr_nv="$ps_if""_local_ipv6_addr"
+ nv set $local_ipv6_addr_nv="::"
+
+ #ndp_kill
+}
+
+tc_tbf.sh down $c_id
+linkdown_route_set
+brctl delif $br_if $eth_if
+ifconfig $eth_if down
+#echo "" > /etc/resolv.conf
+echo "Info: psext_down_ipv6.sh leave" >> $test_log
diff --git a/rootfs/sbin/psext_up.sh b/rootfs/sbin/psext_up.sh
new file mode 100755
index 0000000..ecd67ba
--- /dev/null
+++ b/rootfs/sbin/psext_up.sh
@@ -0,0 +1,104 @@
+#!/bin/sh
+test_log=`nv get telog_path`
+if [ "$test_log" == "" ]; then
+ test_log=`nv get path_log`"te.log"
+fi
+echo "Info: psext_up.sh $1 start" >> $test_log
+path_conf=`nv get path_conf`
+
+echo 1 > /proc/sys/net/ipv4/ip_forward
+c_id=$1
+ps_if=`nv get pswan`$c_id
+eth_if=`nv get "ps_ext"$c_id`
+ext_br="br"$c_id
+pidfile=$path_conf"/udhcpd"$c_id".pid"
+confile=$path_conf"/udhcpd"$c_id".conf"
+leases=$path_conf"/udhcpd"$c_id".leases"
+
+arp_proxy_set()
+{
+ (zte_arp_proxy -i $ext_br 2>> $test_log || echo "Error: zte_arp_proxy -i $ext_br failed." >> $test_log) &
+}
+
+dhcp_set()
+{
+ mask=`nv get $ext_br"_nm"`
+ ifconfig $ext_br netmask $mask 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $eth_br netmask $mask failed." >> $test_log
+ fi
+ if [ -e ${pidfile} ]; then
+ kill `cat $pidfile`
+ rm -f $pidfile
+ fi
+ touch $leases
+ udhcpd -f $confile &
+}
+
+#»ñÈ¡ip²¢ÅäÖÃps¡¢eth
+get_ipaddr()
+{
+ 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
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $ps_if $ps_ip up failed." >> $test_log
+ fi
+ nv set default_wan_rel=$ps_if
+ nv set default_cid=$c_id
+ nv set $ext_br"_ip"=$br_ip
+ ifconfig $ext_br $br_ip 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $ext_br $br_ip up failed." >> $test_log
+ fi
+}
+#·ÓɹæÔò£¬psÓëeth¼¶Áª
+route_set()
+{
+ marknum=`expr $c_id + 20`
+ iptables -t mangle -A PREROUTING -i $ps_if -j MARK --set-mark $marknum
+ rt_num=`expr $c_id + 120`
+
+ ip route add default dev $ext_br table $rt_num
+
+ ip rule add to $pdp_ip fwmark $marknum table $rt_num
+
+ marknum=`expr $c_id + 10`
+ iptables -t mangle -A PREROUTING -i $ext_br -j MARK --set-mark $marknum
+ rt_num=`expr $c_id + 100`
+
+ ip route add default dev $ps_if table $rt_num
+ ip rule add from $pdp_ip fwmark $marknum table $rt_num
+
+ ip route flush cache
+
+ #±¾µØÍøÂçÅäÖÃ
+ iptables -t nat -I POSTROUTING -s $ps_ip -o $ps_if -j SNAT --to $pdp_ip
+
+ route_info=`route|grep default`
+
+ if [ "$route_info" == "" ];then
+ route add default dev $ps_if
+ else
+ echo "Debug: default route already exist." >> $test_log
+ fi
+}
+
+mtu=`nv get mtu`
+ifconfig $ps_if mtu $mtu
+brctl addbr $ext_br
+brctl setfd $ext_br 0.1
+brctl addif $ext_br $eth_if
+ifconfig $ext_br up
+get_ipaddr
+dhcp_set
+route_set
+arp_proxy_set
+ifconfig $eth_if up
+ismbim=`ps |grep -v grep |grep -w mbim |awk '{printf $1}'`
+if [ "-$ismbim" != "-" ]; then
+ eth_mac=`cat "/sys/class/net/"$eth_if"/address"`
+ arp -s $pdp_ip $eth_mac -i $ext_br 2>>$test_log
+fi
+tc_tbf.sh up $c_id
diff --git a/rootfs/sbin/psext_up_ipv6.sh b/rootfs/sbin/psext_up_ipv6.sh
new file mode 100755
index 0000000..07ef6dc
--- /dev/null
+++ b/rootfs/sbin/psext_up_ipv6.sh
@@ -0,0 +1,114 @@
+#!/bin/sh
+test_log=`nv get telog_path`
+if [ "$test_log" == "" ]; then
+ test_log=`nv get path_log`"te.log"
+fi
+
+c_id=$1
+path_conf=`nv get path_conf`
+path_tmp=`nv get path_tmp`
+dhcp6s_conf=$path_conf/dhcp6s$c_id.conf
+radvd_conf=$path_conf/radvd$c_id.conf
+ndp_log=$path_conf/ndp$c_id.log
+radvd_pidfile=$path_tmp/radvd$c_id.pid
+
+ps_if=`nv get pswan`$c_id
+eth_if=`nv get "ps_ext"$c_id`
+br_if="br"$c_id
+
+echo "Info: psext_updown_ipv6.sh $ps_if $eth_if $br_if start" >> $test_log
+
+prefix_len=`nv get $ps_if"_ipv6_prefix_len"`
+br_ip=`nv get $br_if"_ipv6_ip"`
+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"`
+
+#获取ip并配置ps、eth
+linkup_get_addr()
+{
+ #disable the forwarding to send RS and not set the addr when receive ra packet
+ echo 0 > /proc/sys/net/ipv6/conf/all/forwarding
+ echo 0 > /proc/sys/net/ipv6/conf/$ps_if/accept_ra
+ echo 0 > /proc/sys/net/ipv6/conf/$eth_if/accept_ra
+ echo 0 > /proc/sys/net/ipv6/conf/$br_if/accept_ra
+ #call the slaac program to get the prefix addr
+ ifconfig $ps_if up 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $ps_if up failed." >> $test_log
+ fi
+ ip -6 addr add $local_ipv6_addr/64 dev $ps_if 2>>$test_log
+ brctl addbr $br_if
+ brctl setfd $br_if 0.1
+ ifconfig $br_if up 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $br_if up failed." >> $test_log
+ fi
+ ip -6 addr add $br_ip/64 dev $br_if
+ ip -6 addr add $ps_ip/126 dev $ps_if 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ip -6 addr add $ps_ip/126 dev $ps_if failed." >> $test_log
+ fi
+ nv set $ps_if"_ipv6_state"="working"
+}
+
+#路由规则,ps与eth级联
+linkup_route_set()
+{
+ echo 0 > /proc/sys/net/ipv6/conf/all/forwarding
+
+ marknum=`expr $c_id + 60`
+ ip6tables -t mangle -A PREROUTING -i $ps_if -j MARK --set-mark $marknum
+ rt_num=`expr $c_id + 160`
+ ip -6 route add default dev $br_if table $rt_num
+ ip -6 rule add to $pdp_ip/64 fwmark $marknum table $rt_num
+
+ marknum=`expr $c_id + 50`
+ ip6tables -t mangle -A PREROUTING -i $br_if -j MARK --set-mark $marknum
+ 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
+
+ ip6tables -t filter -A FORWARD -p icmpv6 --icmpv6-type 135 -j DROP
+
+ ip -6 route flush cache
+
+ #这句设完,里面可以ping通外网了
+ echo "Info: route_set ps_ip=$ps_ip" >> $test_log
+ #ip -6 route add default via $ps_ip dev $ps_if
+ ip -6 route add default dev $ps_if 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ip -6 route add default dev $ps_if failed." >> $test_log
+ fi
+
+ #enable ipv6 packet forwarding
+ echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
+ echo 1 > /proc/sys/net/ipv6/conf/$ps_if/accept_ra
+ echo 1 > /proc/sys/net/ipv6/conf/$eth_if/accept_ra
+ 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
+
+ zte_ndp -a -s $br_if -d $ps_if -l $ndp_log -p &
+}
+
+linkup_dhcpv6_set()
+{
+ dhcp6s -dDf -c $dhcp6s_conf $br_if &
+}
+
+linkup_radvd_set()
+{
+ radvd -d 3 -C $radvd_conf -p $radvd_pidfile &
+}
+
+mtu=`nv get mtu`
+ifconfig $ps_if mtu $mtu
+linkup_get_addr
+linkup_route_set
+linkup_dhcpv6_set
+linkup_radvd_set
+brctl addif $br_if $eth_if
+ifconfig $eth_if up
+tc_tbf.sh up $c_id
+echo "Info: psext_up_ipv6.sh leave" >> $test_log
diff --git a/rootfs/sbin/psext_updown.sh b/rootfs/sbin/psext_updown.sh
new file mode 100755
index 0000000..7723f5b
--- /dev/null
+++ b/rootfs/sbin/psext_updown.sh
@@ -0,0 +1,476 @@
+#!/bin/sh
+
+path_sh=`nv get path_sh`
+. $path_sh/global.sh
+echo "Info: psext_updown.sh $1 $2 start" >> $test_log
+
+echo 1 > /proc/sys/net/ipv4/ip_forward
+c_id=$2
+ps_if=`nv get pswan`$c_id
+eth_if=`nv get "ps_ext"$c_id`
+ext_br="br"$c_id
+ps_ext_mode=`nv get need_jilian`
+#Óû§ÉèÖþ²Ì¬ip¡¢gw£¬nmÔÚ´Ë´¦¼ÆËã
+arp_proxy_kill()
+{
+ ps > ${path_tmp}/zte_arp_proxy.$ext_br.$$
+ arp_proxy_pid=`awk 'BEGIN{temp1="'"${ext_br}"'";temp2="zte_arp_proxy"}{if(index($0,temp1)>0 && index($0,temp2)>0){print $1}}' ${path_tmp}/zte_arp_proxy.$ext_br.$$`
+ rm -f ${path_tmp}/zte_arp_proxy.$ext_br.$$
+ [ -n "$arp_proxy_pid" ] && { kill $arp_proxy_pid; echo "test: kill udhcpc $arp_proxy_pid " >> $test_log ; }
+}
+
+arp_proxy_set()
+{
+ arp_proxy_kill
+ (zte_arp_proxy -i $ext_br 2>> $test_log || echo "Error: zte_arp_proxy -i $ext_br failed." >> $test_log) &
+}
+
+get_mask()
+{
+ mask=`echo ${ps_ip}"."${gw} | awk -F '.' '{
+ nm1=0;nm2=0;nm3=0
+ if($1 == $5)
+ nm1=255
+
+ if(255 == nm1 && $2 == $6)
+ nm2=255
+
+ if(255 == nm2 && $3 == $7)
+ nm3=255
+
+ printf nm1"."nm2"."nm3".0"
+ }'`
+}
+
+dhcp_set()
+{
+
+ start=$pdp_ip
+ end=$pdp_ip
+ #nvÖµ·Ç¿ÕÔò±íʾÓû§ÉèÖÃÁ˾²Ì¬ip¡¢gw
+ gw=`nv get $ps_if"_gw"`
+ if [ "-$gw" == "-" -o "-$gw" == "-0.0.0.0" ]; then
+ gw=$br_ip
+ mask=$valid_mask
+ echo psip $ps_ip br_ip $br_ip valid_mask $valid_mask $mask
+ else
+ echo "no mask"
+ get_mask
+ fi
+ nv set $ext_br"_nm"=$mask
+ ifconfig $ext_br netmask $mask 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $eth_br netmask $mask failed." >> $test_log
+ fi
+ dns=`nv get $ps_if"_pridns"`
+ dns2=`nv get $ps_if"_secdns"`
+ lease="86400"
+
+ #±¾µØÍøÂçÅäÖÃ
+ if [ "-$dns" == "-" -o "-$dns" == "-0.0.0.0" ] && [ "-$dns2" == "-" -o "-$dns2" == "-0.0.0.0" ]; then
+ echo "Error: no valid dns, use default dns." >> $test_log
+ dns="114.114.114.114"
+ dns2="8.8.8.8"
+ fi
+ rm -rf $path_conf"/udhcpd"$c_id".conf"
+ touch $path_conf"/udhcpd"$c_id".conf"
+ echo " " > $path_conf"/udhcpd"$c_id".conf"
+
+ 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
+
+ pidfile=$path_conf"/udhcpd"$c_id".pid"
+ leasesfile=$path_conf"/udhcpd"$c_id".leases"
+
+ sh $path_sh/config-udhcpd.sh $c_id -s $start
+ sh $path_sh/config-udhcpd.sh $c_id -e $end
+ sh $path_sh/config-udhcpd.sh $c_id -i $ext_br
+ sh $path_sh/config-udhcpd.sh $c_id -m $mask
+ sh $path_sh/config-udhcpd.sh $c_id -d $dns $dns2
+ if [ "-$gw" != "-" ]; then
+ sh $path_sh/config-udhcpd.sh $c_id -g $gw
+ fi
+ if [ "-$lease" != "-" ]; then
+ sh $path_sh/config-udhcpd.sh $c_id -t $lease
+ fi
+ sh $path_sh/config-udhcpd.sh $c_id -p $pidfile
+ sh $path_sh/config-udhcpd.sh $c_id -l $leasesfile
+ sh $path_sh/config-udhcpd.sh $c_id -r 1
+}
+get_validnum()
+{
+ last4=${ipaddr##*.}
+ ipaddr=${ipaddr%.*}
+ mark=`expr $last4 % 2`
+ last3=0
+ frag=`expr $frag + 1`
+ echo $ipaddr $last4 $last3
+ if [ $last4 -eq 0 ] || [ $last4 -eq 255 ];
+ then
+ last3=${ipaddr##*.}
+ fi
+ if [ $last4 -eq 0 ] && [ $last3 -eq 0 ];
+ then
+ get_validnum
+ elif [ $last4 -eq 255 ] && [ $last3 -eq 255 ];
+ then
+ get_validnum
+ else
+ return
+ fi
+}
+get_netmask_btrunk()
+{
+ pdpip=$1
+ pdp_ip4=${pdpip##*.}
+ front3=${pdpip%.*}
+
+ if [ $pdp_ip4 -eq 1 ];then
+ tmp_ip1=`expr $pdp_ip4 + 1`
+ tmp_ip2=`expr $pdp_ip4 + 2`
+ ps_ip="$front3.$tmp_ip1"
+ br_ip="$front3.$tmp_ip2"
+ elif [ $pdp_ip4 -eq 254 ];then
+ tmp_ip1=`expr $pdp_ip4 - 2`
+ tmp_ip2=`expr $pdp_ip4 - 1`
+ ps_ip="$front3.$tmp_ip1"
+ br_ip="$front3.$tmp_ip2"
+ else
+ tmp_ip1=`expr $pdp_ip4 - 1`
+ tmp_ip2=`expr $pdp_ip4 + 1`
+ ps_ip="$front3.$tmp_ip1"
+ br_ip="$front3.$tmp_ip2"
+ fi
+
+ nv set $ps_if"_ip"=$ps_ip
+ valid_mask="255.255.0.0"
+}
+
+get_netmask()
+{
+ ipaddr=$1
+ last4=0
+ last3=0
+ mark=0
+ frag=0
+
+ get_validnum
+ echo $ipaddr $last4 $last3 $mark $frag
+ #½«ÓÐЧ¶ÎÖÐÓÐЧλÖÃΪ1£¬¸Ãλ×ó±ß¶¼ÖÃΪ0
+ valid_num=0
+
+ if [ $mark -eq 1 -a $last3 -eq 0 ];then
+ valid_num=`expr $last4 + 1`
+ elif [ $mark -eq 0 -a $last3 -eq 0 ];then
+ valid_num=$last4
+ elif [ $mark -eq 1 -a $last3 -ne 0 ];then
+ valid_num=`expr $last3 + 1`
+ elif [ $mark -eq 0 -a $last3 -ne 0 ];then
+ valid_num=$last3
+ fi
+ echo $valid_num
+ #´Ó×óÏòÓÒÕÒµ½ÓÐЧ¶ÎÖеÚÒ»¸ö1µÄλÖÃ
+ place=1
+ while [ `expr $valid_num % 2` -eq 0 ]
+ do
+ place=`expr $place + 1`
+ valid_num=`expr $valid_num / 2`
+ done
+
+ if [ $last3 -eq 0 ]
+ then
+ frag=`expr $frag - 1`
+ fi
+ count=1
+
+ if [ $place -gt 8 ]
+ then
+ place=`expr $place - 8`
+ frag=`expr $frag + 1`
+ fi
+
+ tmp_place=$place
+ while [ $tmp_place -gt 0 ]
+ do
+ count=`expr $count \* 2`
+ tmp_place=`expr $tmp_place - 1`
+ done
+
+ #ÖÁÉÙÐèÒªÈý¸öÓÐЧipµØÖ·£¨ps¿Ú£¬pc£¬Íø¹Ø£©£¬ÑÚÂë×î´óΪ255.255.255.248
+ if [ $frag -eq 0 -a $place -eq 2 ]
+ then
+ count=`expr $count + 3`
+ else
+ count=`expr $count - 1`
+ fi
+
+ before=$frag
+
+ while [ $before -lt 3 ]
+ do
+ valid_mask=$valid_mask"255."
+ before=`expr $before + 1`
+ done
+ valid_mask=$valid_mask"`expr 255 - $count`"
+ while [ $frag -gt 0 ]
+ do
+ valid_mask=$valid_mask".0"
+ frag=`expr $frag - 1`
+ done
+
+ pdpip=$1
+ pdp_ip4=${pdpip##*.}
+ pdp_ip4_tmp=$pdp_ip4
+ front3=${pdpip%.*}
+
+ tmp_count=0
+ com_num=0
+ while [ $tmp_count -lt 3 ]
+ do
+ valid_count=0
+
+ if [ `expr $pdp_ip4_tmp % 2` -eq 1 ]
+ then
+ tmp_count1=$tmp_count
+ valid_count=1
+ while [ $tmp_count1 -gt 0 ]
+ do
+ valid_count=`expr $valid_count \* 2`
+ tmp_count1=`expr $tmp_count1 - 1`
+ done
+ fi
+ com_num=`expr $com_num + $valid_count`
+ tmp_count=`expr $tmp_count + 1`
+ pdp_ip4_tmp=`expr $pdp_ip4_tmp / 2`
+ done
+ echo com_num $com_num
+
+ if [ $com_num -gt 2 ]
+ then
+ tmp_ip1=`expr $pdp_ip4 - 1`
+ tmp_ip2=`expr $pdp_ip4 - 2`
+ ps_ip="$front3.$tmp_ip1"
+ br_ip="$front3.$tmp_ip2"
+ else
+ tmp_ip1=`expr $pdp_ip4 + 1`
+ tmp_ip2=`expr $pdp_ip4 + 2`
+ ps_ip="$front3.$tmp_ip1"
+ br_ip="$front3.$tmp_ip2"
+ fi
+
+ echo ps_ip $ps_ip br_ip $br_ip valid_mask $valid_mask
+ nv set $ps_if"_ip"=$ps_ip
+}
+#»ñÈ¡ip²¢ÅäÖÃps¡¢eth
+get_ipaddr()
+{
+ pdp_ip=`nv get $ps_if"_pdp_ip"`
+#ÅжÏÊÇ·ÊÇñbtrunkÐͺŻú
+ btrunk=`cat /sys/module/fast_common/parameters/btrunk_fw`
+ if [ "$btrunk" -eq "0" ];then
+ get_netmask $pdp_ip
+ else
+ get_netmask_btrunk $pdp_ip
+ fi
+
+ ifconfig $ps_if $ps_ip up 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $ps_if $ps_ip up failed." >> $test_log
+ fi
+ nv set default_wan_rel=$ps_if
+ nv set default_cid=$c_id
+ nv set $ext_br"_ip"=$br_ip
+ ifconfig $ext_br $br_ip 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $ext_br $br_ip up failed." >> $test_log
+ fi
+}
+#·ÓɹæÔò£¬psÓëeth¼¶Áª
+route_set()
+{
+ marknum=`expr $c_id + 20`
+ iptables -t mangle -A PREROUTING -i $ps_if -j MARK --set-mark $marknum
+ rt_num=`expr $c_id + 120`
+
+ ip route add default dev $ext_br table $rt_num
+
+ ip rule add to $pdp_ip fwmark $marknum table $rt_num
+
+ marknum=`expr $c_id + 10`
+ iptables -t mangle -A PREROUTING -i $ext_br -j MARK --set-mark $marknum
+ rt_num=`expr $c_id + 100`
+
+ ip route add default dev $ps_if table $rt_num
+ ip rule add from $pdp_ip fwmark $marknum table $rt_num
+
+ ip route flush cache
+
+ #±¾µØÍøÂçÅäÖÃ
+ iptables -t nat -I POSTROUTING -s $ps_ip -o $ps_if -j SNAT --to $pdp_ip
+
+ route_info=`route|grep default`
+
+ if [ "$route_info" == "" ];then
+ route add default dev $ps_if
+ else
+ echo "Debug: default route already exist." >> $test_log
+ fi
+}
+#¹¹½¨ÍøÇÅ
+br_up()
+{
+ br="br"$c_id
+ brctl addbr $br
+ brctl setfd $br 0.1
+ ifconfig $br up 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $br up failed." >> $test_log
+ fi
+
+ ifconfig $ps_if up 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $ps_if up failed." >> $test_log
+ fi
+ brctl addif $br $ps_if 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: brctl addif $br $ps_if failed." >> $test_log
+ fi
+ brctl addif $br $eth_if 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: brctl addif $br $eth_if failed." >> $test_log
+ fi
+ ifconfig $eth_if up 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $eth_if up failed." >> $test_log
+ fi
+
+}
+#ɾ³ýÍøÇÅ
+br_down()
+{
+ br="br"$c_id
+ brctl delif $br $eth_if 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: brctl delif $br $eth_if failed." >> $test_log
+ fi
+ ifconfig $eth_if down 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $eth_if down failed." >> $test_log
+ fi
+ brctl delif $br $ps_if 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: brctl delif $br $ps_if failed." >> $test_log
+ fi
+ ifconfig $ps_if down 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $ps_if down failed." >> $test_log
+ fi
+ ifconfig $br down 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $br down failed." >> $test_log
+ fi
+ brctl delbr $br 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: brctl delbr $br failed." >> $test_log
+ fi
+}
+#ɱËÀ¶ÔÓ¦µÄDHCP½ø³Ì
+dhcp_kill()
+{
+ pidfile=$path_conf"/udhcpd"$c_id".pid"
+ kill `cat $pidfile`
+}
+#ɾ³ý¶ÔÓ¦µÄ·ÓɹæÔò
+route_del()
+{
+ pdp_ip=`nv get $ps_if"_pdp_ip"`
+# ps_ip1=${pdp_ip%.*}
+# ps_ip2=${pdp_ip##*.}
+# [ "$ps_ip2" -ge "254" ] && { ps_ip2="250"; }
+# ps_ip2=`expr $ps_ip2 + 1`
+ ps_ip=`nv get $ps_if"_ip"`
+ br_ip=`nv get $ext_br"_ip"`
+ marknum=`expr $c_id + 10`
+ rt_num=`expr $c_id + 100`
+
+ iptables -t mangle -D PREROUTING -i $ext_br -j MARK --set-mark $marknum
+ ip rule del from $pdp_ip fwmark $marknum table $rt_num
+ ip route del default dev $ps_if table $rt_num
+
+ marknum=`expr $c_id + 20`
+ rt_num=`expr $c_id + 120`
+ iptables -t mangle -D PREROUTING -i $ps_if -j MARK --set-mark $marknum
+ ip rule del to $pdp_ip fwmark $marknum table $rt_num
+ ip route del default dev $ext_br table $rt_num
+ #±¾µØÍøÂçÅäÖÃ
+ iptables -t nat -D POSTROUTING -s $ps_ip -o $ps_if -j SNAT --to $pdp_ip
+ if [ $? -ne 0 ];then
+ echo "cmd <<iptables -t nat -D POSTROUTING -s $ps_ip -o $ps_if -j SNAT --to $pdp_ip>> exec failed" >> $test_log
+ fi
+ route delete default dev $ps_if
+ if [ $? -ne 0 ];then
+ echo "cmd <<route delete default dev $ps_if>> exec failed" >> $test_log
+ fi
+
+ ifconfig $ext_br 0.0.0.0
+ ifconfig $ext_br down 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $ext_br down failed." >> $test_log
+ fi
+
+ ifconfig $ps_if 0.0.0.0
+ ifconfig $ps_if down 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $ps_if down failed." >> $test_log
+ fi
+
+ #reset nv
+ nv set $ext_br"_ip"=0.0.0.0
+ nv set $ext_br"_nm"=0.0.0.0
+ nv set $ps_if"_pdp_ip"=0.0.0.0
+ nv set $ps_if"_pridns"=0.0.0.0
+ nv set $ps_if"_secdns"=0.0.0.0
+ nv set $ps_if"_ip"=0.0.0.0
+}
+
+if [ "-$1" == "-linkup" ]; then
+ mtu=`nv get mtu`
+ ifconfig $ps_if mtu $mtu
+ if [ "-$ps_ext_mode" == "-1" ]; then
+ brctl addbr $ext_br
+ brctl setfd $ext_br 0.1
+ brctl addif $ext_br $eth_if
+ ifconfig $ext_br up
+ get_ipaddr
+ dhcp_set
+ route_set
+ arp_proxy_set
+ ifconfig $eth_if up
+ ismbim=`ps |grep -v grep |grep -w mbim |awk '{printf $1}'`
+ if [ "-$ismbim" != "-" ]; then
+ eth_mac=`cat "/sys/class/net/"$eth_if"/address"`
+ arp -s $pdp_ip $eth_mac 2>>$test_log
+ fi
+ tc_tbf.sh up $c_id
+ elif [ "-$ps_ext_mode" == "-0" ]; then
+ br_up
+ fi
+elif [ "-$1" == "-linkdown" ]; then
+ if [ "-$ps_ext_mode" == "-1" ]; then
+ tc_tbf.sh down $c_id
+ arp_proxy_kill
+ dhcp_kill
+ route_del
+ ifconfig $eth_if down
+ ifconfig $ext_br down
+ brctl delif $ext_br $eth_if
+ brctl delbr $ext_br
+ echo "" > /etc/resolv.conf
+ elif [ "-$ps_ext_mode" == "-0" ]; then
+ br_down
+ fi
+fi
diff --git a/rootfs/sbin/psext_updown_ipv6.sh b/rootfs/sbin/psext_updown_ipv6.sh
new file mode 100755
index 0000000..a48bd73
--- /dev/null
+++ b/rootfs/sbin/psext_updown_ipv6.sh
@@ -0,0 +1,446 @@
+#!/bin/sh
+
+path_sh=`nv get path_sh`
+. $path_sh/global.sh
+
+#echo "Info: psext_updown_ipv6.sh $1 $2 start" >> $test_log
+
+c_id=$2
+
+dhcp6s_conf=$path_conf/dhcp6s$c_id.conf
+radvd_conf=$path_conf/radvd$c_id.conf
+ndp_log=$path_conf/ndp$c_id.log
+radvd_pidfile=$path_tmp/radvd$c_id.pid
+
+ps_if=`nv get pswan`$c_id
+eth_if=`nv get "ps_ext"$c_id`
+ps_ext_mode=`nv get need_jilian`
+br_if="br"$c_id
+dnsconfig=0
+prefix_len=64
+echo "Info: psext_updown_ipv6.sh $ps_ext_mode $ps_if $eth_if $br_if start" >> $test_log
+
+b_dhcpv6stateEnabled=`nv get dhcpv6stateEnabled`
+b_dhcpv6statelessEnabled=`nv get dhcpv6statelessEnabled`
+
+#采用PDP激活方式,没有dhcp6c进程
+
+#############linkup dhcpserver set############
+linkup_add_dns_to_dhcp6s_radvd_conf()
+{
+ #直连模式没有手动DNS
+ ipv6_pridns_auto=`nv get $ps_if"_ipv6_pridns_auto"`
+ ipv6_secdns_auto=`nv get $ps_if"_ipv6_secdns_auto"`
+
+ if [ -n "$ipv6_pridns_auto" ] && [ "-$ipv6_pridns_auto" != "-::" ] && [ "-$ipv6_pridns_auto" != "-::0" ];then
+ ipv6_prefer_dns=$ipv6_pridns_auto
+ fi
+
+ if [ -n "$ipv6_secdns_auto" ] && [ "-$ipv6_secdns_auto" != "-::" ] && [ "-$ipv6_secdns_auto" != "-::0" ];then
+ ipv6_standby_dns=$ipv6_secdns_auto
+ fi
+
+ if [ "-$ipv6_prefer_dns" == "-" -a "-$ipv6_standby_dns" == "-" ]; then
+ return
+ else
+ if [ -n "$1" ] && [ "-$1" == "-dhcp6s" ] ;then
+ echo -e "\toption dns_servers $ipv6_prefer_dns $ipv6_standby_dns;" >> $dhcp6s_conf
+ elif [ -n "$1" ] && [ "-$1" == "-radvd" ] ;then
+ # del last line
+ sed -i '$d' $radvd_conf
+ echo -e "\tRDNSS $ipv6_prefer_dns $ipv6_standby_dns\n\t{" >> $radvd_conf
+ echo -e "\t\tAdvRDNSSPreference 15;" >> $radvd_conf
+ echo -e "\t\tAdvRDNSSOpen on;" >> $radvd_conf
+ echo -e "\t};\n};" >> $radvd_conf
+ fi
+
+ if [ "-$dnsconfig" == "-0" ]; then
+ echo "dnsconfig $1 $ipv6_prefer_dns, $ipv6_standby_dns" >> $test_log
+ if [ "-$ipv6_prefer_dns" != "-" ]; then
+ echo "nameserver $ipv6_prefer_dns" >> /etc/resolv.conf
+ fi
+ if [ "-$ipv6_standby_dns" != "-" ]; then
+ echo "nameserver $ipv6_standby_dns" >> /etc/resolv.conf
+ fi
+ dnsconfig=1
+ fi
+ fi
+}
+
+linkup_dhcpv6_set()
+{
+ dhcpv6_start=$pdp_ip
+ dhcpv6_end=$pdp_ip
+
+ #nv值非空则表示用户设置了静态ip、gw
+ gw=`nv get $ps_if"_ipv6_gw"`
+
+ echo -e "interface $br_if {" > $dhcp6s_conf
+ if [ "-$b_dhcpv6stateEnabled" = "-1" ];then
+ echo -e "\tserver-preference 255;\n\trenew-time 6000;" >> $dhcp6s_conf
+ echo -e "\trebind-time 9000;\n\tprefer-life-time 1300;" >> $dhcp6s_conf
+ echo -e "\tvalid-life-time 2000;\n\tallow rapid-commit;" >> $dhcp6s_conf
+ echo -e "\tlink $br_if {\n\t\tallow unicast;\n\t\tsend unicast;" >> $dhcp6s_conf
+ echo -e "\t\tpool {\n\t\t\trange $dhcpv6_start to $dhcpv6_end/$prefix_len;" >> $dhcp6s_conf
+ echo -e "\t\t};\n\t};" >> $dhcp6s_conf
+ linkup_add_dns_to_dhcp6s_radvd_conf dhcp6s
+ echo -e "};" >> $dhcp6s_conf
+ dhcp6s -dDf -c $dhcp6s_conf $br_if &
+ else
+ #slaac with dhcp statelessset dns info
+ if [ "-$b_dhcpv6statelessEnabled" = "-1" ];then
+ echo -e "\tlink $br_if {\n\t};" >> $dhcp6s_conf
+ linkup_add_dns_to_dhcp6s_radvd_conf dhcp6s
+ echo -e "};" >> $dhcp6s_conf
+ dhcp6s -dDf -c $dhcp6s_conf $br_if &
+ if [ $? -ne 0 ];then
+ echo "Error: dhcp6s -dDf -c $dhcp6s_conf $br_if failed." >> $test_log
+ fi
+ fi
+ fi
+}
+
+#获取ip并配置ps、eth
+linkup_get_addr()
+{
+ #disable the forwarding to send RS and not set the addr when receive ra packet
+ echo 0 > /proc/sys/net/ipv6/conf/all/forwarding
+ echo 0 > /proc/sys/net/ipv6/conf/$ps_if/accept_ra
+ echo 0 > /proc/sys/net/ipv6/conf/$eth_if/accept_ra
+ echo 0 > /proc/sys/net/ipv6/conf/$br_if/accept_ra
+ #call the slaac program to get the prefix addr
+ ifconfig $ps_if up 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $ps_if up failed." >> $test_log
+ fi
+ prefix_info_temp=`nv get $ps_if"_ipv6_prefix_info"`
+ #如果当前没有前缀,则直接启动slaac,如果当前前缀已经设置,则说明已经获取到,直接配置IP地址即可
+ if [ -n "$prefix_info_temp" -a "-$prefix_info_temp" != "-::" ]; then
+ ret_code=0
+ else
+ sleep 1
+ interface_id_temp1=`nv get $ps_if"_ipv6_interface_id"`
+ local_ipv6_addr="fe80::"$interface_id_temp1
+ local_ipv6_addr_nv="$ps_if""_local_ipv6_addr"
+ nv set $local_ipv6_addr_nv=$local_ipv6_addr
+ ip -6 addr add $local_ipv6_addr/64 dev $ps_if 2>>$test_log
+ zte_ipv6_slaac -i "$ps_if"
+ ret_code=$?
+ fi
+ echo "Info: zte_ipv6_slaac return: $ret_code" >> $test_log
+ echo "the program zte_ipv6_slaac return = $ret_code"
+ if [ $ret_code -eq 0 ]; then
+ echo "the zte_ipv6_slaac success"
+ interface_id_temp=`nv get $ps_if"_ipv6_interface_id"`
+ prefix_info_temp=`nv get $ps_if"_ipv6_prefix_info"`
+ prefix_len=`nv get $ps_if"_ipv6_prefix_len"`
+ echo "##############1##########"
+ echo "$interface_id_temp"
+ echo "$prefix_info_temp $prefix_len"
+ echo "##############2##########"
+
+ #pdp 激活的ipv6地址
+ pdp_ip=$prefix_info_temp$interface_id_temp
+ #pdp激活地址,适配页面使用
+ nv set ipv6_wan_ipaddr="$pdp_ip"
+
+ ipv6_addr_conver $pdp_ip "$ps_if"
+
+ #给eth分配地址,使用ipv6_addr_conver在第15+1
+ br_ip=`nv get ipv6_br0_addr`
+ 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 [ $? -ne 0 ];then
+ echo "Error: ifconfig $br_if up failed." >> $test_log
+ fi
+ ip -6 addr add $br_ip/64 dev $br_if
+ #给外网口分配地址,使用ipv6_addr_conver在第15+2
+ ps_ip=`nv get $ps_if"_dhcpv6_start"`
+ nv set $ps_if"_ipv6_ip"=$ps_ip
+ #ifconfig $ps_if $ps_ip up
+ #if [ $? -ne 0 ];then
+ # echo "Error: ifconfig $ps_ip up failed." >> $test_log
+ #fi
+ ip -6 addr add $ps_ip/126 dev $ps_if 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ip -6 addr add $ps_ip/126 dev $ps_if failed." >> $test_log
+ fi
+ nv set $ps_if"_ipv6_state"="working"
+
+ echo "Info: zte_ipv6_slaac pdp_ip: $pdp_ip" >> $test_log
+ echo "Info: zte_ipv6_slaac ps_ip: $ps_ip" >> $test_log
+ echo "Info: zte_ipv6_slaac br_ip: $br_ip" >> $test_log
+ else
+ echo "the zte_ipv6_slaac fail"
+ nv set $ps_if"_ipv6_state"="dead"
+ exit 1
+ fi
+}
+
+#路由规则,ps与eth级联
+linkup_route_set()
+{
+ echo 0 > /proc/sys/net/ipv6/conf/all/forwarding
+
+ marknum=`expr $c_id + 60`
+ ip6tables -t mangle -A PREROUTING -i $ps_if -j MARK --set-mark $marknum
+ rt_num=`expr $c_id + 160`
+ ip -6 route add default dev $br_if table $rt_num
+ ip -6 rule add to $pdp_ip/64 fwmark $marknum table $rt_num
+
+ marknum=`expr $c_id + 50`
+ ip6tables -t mangle -A PREROUTING -i $br_if -j MARK --set-mark $marknum
+ 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
+
+ ip6tables -t filter -A FORWARD -p icmpv6 --icmpv6-type 135 -j DROP
+
+ ip -6 route flush cache
+
+ #这句设完,里面可以ping通外网了
+ echo "Info: route_set ps_ip=$ps_ip" >> $test_log
+ #ip -6 route add default via $ps_ip dev $ps_if
+ ip -6 route add default dev $ps_if 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ip -6 route add default dev $ps_if failed." >> $test_log
+ fi
+
+ #enable ipv6 packet forwarding
+ echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
+ echo 1 > /proc/sys/net/ipv6/conf/$ps_if/accept_ra
+ echo 1 > /proc/sys/net/ipv6/conf/$eth_if/accept_ra
+ 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
+
+ ndp_kill
+ zte_ndp -a -s $br_if -d $ps_if -l $ndp_log -p &
+}
+
+#############linkup radvd set############
+linkup_radvd_set()
+{
+ echo "enter linkup_radvd_set "
+
+ rm -rf $radvd_conf
+
+ if [ "-$b_dhcpv6stateEnabled" = "-1" ];then
+ echo -e "interface $br_if\n{\n\tAdvSendAdvert on;" > $radvd_conf
+ echo -e "\tAdvManagedFlag on;\n};" >> $radvd_conf
+ radvd_kill
+ rm -rf $radvd_pidfile
+ radvd -d 3 -C $radvd_conf -p $radvd_pidfile&
+ echo "leave linkup_radvd_set "
+ return
+ fi
+
+ echo "Info: psext_updown_ipv6.sh br_if:$br_if, prefix_len:$prefix_len" >> $test_log
+ echo "ipv6_br0_addr_tmp:$ipv6_br0_addr_tmp"
+ echo "prefix_len:$prefix_len"
+
+ cp $path_ro/radvd_template.conf $radvd_conf
+
+ sed -i -e 's/#ipv6_wan_addr#\/64/#ipv6_wan_addr#\/#prefix_len#/g' $radvd_conf
+ sed -i -e s/br0/$br_if/g $radvd_conf
+ sed -i -e s/#ipv6_wan_addr#/$br_ip/g $radvd_conf
+ sed -i -e s/#prefix_len#/$prefix_len/g $radvd_conf
+ sed -i -e s/#adv_switch#/on/g $radvd_conf
+
+ # TODO: replace br0's ipv6 address
+ #sed -i -e s/#ipv6_wan_addr#/$wan_addr/g $radvd_conf
+ #sed -i -e s/#adv_switch#/on/g $radvd_conf
+
+ #slaac with dns info
+ if [ "-$b_dhcpv6statelessEnabled" = "-1" ];then
+ echo "use dhcpv6stateless for dns"
+ else
+ sed -i -e 's/AdvOtherConfigFlag on;/AdvOtherConfigFlag off;/g' $radvd_conf
+ linkup_add_dns_to_dhcp6s_radvd_conf radvd
+ fi
+
+ radvd_kill
+ sleep 1
+ rm -rf $radvd_pidfile
+ radvd -d 3 -C $radvd_conf -p $radvd_pidfile &
+
+ echo "leave linkup_radvd_set "
+}
+
+#构建网桥
+br_up()
+{
+ br="br"$c_id
+ brctl addbr $br 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: brctl addbr $br failed." >> $test_log
+ fi
+ brctl setfd $br 0.1 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: brctl setfd $br 0.1 failed." >> $test_log
+ fi
+ ifconfig $br up 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $br up failed." >> $test_log
+ fi
+
+ ifconfig $ps_if up 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $ps_if up failed." >> $test_log
+ fi
+ brctl addif $br $ps_if 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: brctl addif $br $ps_if failed." >> $test_log
+ fi
+
+ brctl addif $br $eth_if 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: brctl addif $br $eth_if failed." >> $test_log
+ fi
+ ifconfig $eth_if up 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $eth_if up failed." >> $test_log
+ fi
+}
+
+#删除网桥
+br_down()
+{
+ br="br"$c_id
+ brctl delif $br $eth_if 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: brctl delif $br $eth_if failed." >> $test_log
+ fi
+ ifconfig $eth_if down 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $eth_if down failed." >> $test_log
+ fi
+ brctl delif $br $ps_if 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: brctl delif $br $ps_if failed." >> $test_log
+ fi
+ ifconfig $ps_if down 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $ps_if down failed." >> $test_log
+ fi
+ ifconfig $br down 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $br down failed." >> $test_log
+ fi
+ brctl delbr $br 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: brctl delbr $br failed." >> $test_log
+ fi
+}
+
+#清除相应的radvd进程
+linkdown_radvd_set()
+{
+ #跟终端连接的网口直接会down,所以不用像ufi一样设置成1s有效期
+ radvd_kill
+}
+
+#清除相应的DHCPv6进程
+linkdown_dhcpv6_server_set()
+{
+ dhcp6s_kill
+}
+
+#删除相应的ipv6路由规则
+linkdown_route_set()
+{
+ br_ip=`nv get $br_if"_ipv6_ip"`
+ ps_ip=`nv get $ps_if"_ipv6_ip"`
+ pdp_ip=`nv get ipv6_wan_ipaddr`
+
+ ip6tables -t filter -D FORWARD -p icmpv6 --icmpv6-type 135 -j DROP
+
+ marknum=`expr $c_id + 50`
+ rt_num=`expr $c_id + 150`
+ ip -6 rule del from $pdp_ip/64 fwmark $marknum table $rt_num
+ ip6tables -t mangle -D PREROUTING -i $br_if -j MARK --set-mark $marknum
+ ip -6 route del default dev $ps_if table $rt_num
+
+ marknum=`expr $c_id + 60`
+ rt_num=`expr $c_id + 160`
+ ip -6 rule del to $pdp_ip/64 fwmark $marknum table $rt_num
+ ip6tables -t mangle -D PREROUTING -i $ps_if -j MARK --set-mark $marknum
+ ip -6 route del default dev $br_if table $rt_num
+
+ ip -6 addr del $br_ip/126 dev $br_if
+ #if [ $? -ne 0 ];then
+ # echo "Error: ip -6 addr del $eth_ip/126 dev $eth_if failed." >> $test_log
+ #fi
+ ip -6 addr del $ps_ip/126 dev $ps_if
+ #if [ $? -ne 0 ];then
+ # echo "Error: ip -6 addr del $ps_ip/126 dev $ps_if failed." >> $test_log
+ #fi
+ ip -6 route del default
+ #if [ $? -ne 0 ];then
+ # echo "Error: ip -6 route del default failed." >> $test_log
+ #fi
+
+ ifconfig $br_if down 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $br_if down failed." >> $test_log
+ fi
+ ifconfig $ps_if down 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $ps_if down failed." >> $test_log
+ fi
+
+ echo 0 > /proc/sys/net/ipv6/conf/$ps_if/accept_ra
+
+ #reset nv
+ nv set $br_if"_ipv6_ip"="::"
+ nv set $ps_if"_ipv6_ip"="::"
+ nv set $ps_if"_ipv6_pridns_auto"="::"
+ nv set $ps_if"_ipv6_secdns_auto"="::"
+ nv set $ps_if"_ipv6_gw"="::"
+ nv set $ps_if"_ipv6_interface_id"="::"
+ nv set $ps_if"_ipv6_prefix_info"="::"
+ nv set $ps_if"_dhcpv6_start"="::"
+ nv set $ps_if"_dhcpv6_end"="::"
+
+ #适配页面等其他地方使用老NV
+ nv set ipv6_wan_ipaddr="::"
+ nv set $ps_if"_ipv6_state"="dead"
+
+ local_ipv6_addr_nv="$ps_if""_local_ipv6_addr"
+ nv set $local_ipv6_addr_nv="::"
+
+ ndp_kill
+}
+
+if [ "$1" == "linkup" ]; then
+ mtu=`nv get mtu`
+ ifconfig $ps_if mtu $mtu
+ if [ "-$ps_ext_mode" == "-1" ]; then
+ linkup_get_addr
+ linkup_route_set
+ linkup_dhcpv6_set
+ linkup_radvd_set
+ brctl addif $br_if $eth_if
+ ifconfig $eth_if up
+ tc_tbf.sh up $c_id
+ elif [ "-$ps_ext_mode" == "-0" ]; then
+ br_up
+ fi
+elif [ "$1" == "linkdown" ]; then
+ if [ "-$ps_ext_mode" == "-1" ]; then
+ tc_tbf.sh down $c_id
+ linkdown_radvd_set
+ linkdown_dhcpv6_server_set
+ linkdown_route_set
+ slaac_kill
+ brctl delif $br_if $eth_if
+ ifconfig $eth_if down
+ echo "" > /etc/resolv.conf
+ elif [ "-$ps_ext_mode" == "-0" ]; then
+ br_down
+ fi
+fi
+
+echo "Info: psext_updown_ipv6.sh leave" >> $test_log
diff --git a/rootfs/sbin/raidautorun b/rootfs/sbin/raidautorun
new file mode 120000
index 0000000..7f83d96
--- /dev/null
+++ b/rootfs/sbin/raidautorun
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/raidautorun
\ No newline at end of file
diff --git a/rootfs/sbin/reboot b/rootfs/sbin/reboot
new file mode 120000
index 0000000..1019059
--- /dev/null
+++ b/rootfs/sbin/reboot
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/reboot
\ No newline at end of file
diff --git a/rootfs/sbin/restorecon b/rootfs/sbin/restorecon
new file mode 120000
index 0000000..eea58cd
--- /dev/null
+++ b/rootfs/sbin/restorecon
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/restorecon
\ No newline at end of file
diff --git a/rootfs/sbin/restorecon_xattr b/rootfs/sbin/restorecon_xattr
new file mode 100755
index 0000000..f2b8889
--- /dev/null
+++ b/rootfs/sbin/restorecon_xattr
Binary files differ
diff --git a/rootfs/sbin/rmmod b/rootfs/sbin/rmmod
new file mode 120000
index 0000000..182ada8
--- /dev/null
+++ b/rootfs/sbin/rmmod
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/rmmod
\ No newline at end of file
diff --git a/rootfs/sbin/route b/rootfs/sbin/route
new file mode 120000
index 0000000..03d1415
--- /dev/null
+++ b/rootfs/sbin/route
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/route
\ No newline at end of file
diff --git a/rootfs/sbin/routef b/rootfs/sbin/routef
new file mode 100755
index 0000000..c251e7b
--- /dev/null
+++ b/rootfs/sbin/routef
@@ -0,0 +1,10 @@
+#! /bin/sh
+# SPDX-License-Identifier: GPL-2.0
+
+if [ -z "$*" ] ; then
+ exec ip -4 ro flush scope global type unicast
+else
+ echo "Usage: routef"
+ echo
+ echo "This script will flush the IPv4 routing table"
+fi
diff --git a/rootfs/sbin/routel b/rootfs/sbin/routel
new file mode 100755
index 0000000..7056886
--- /dev/null
+++ b/rootfs/sbin/routel
@@ -0,0 +1,72 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+
+#
+# Script created by: Stephen R. van den Berg <srb@cuci.nl>, 1999/04/18
+# Donated to the public domain.
+#
+# This script transforms the output of "ip" into more readable text.
+# "ip" is the Linux-advanced-routing configuration tool part of the
+# iproute package.
+#
+
+test "X-h" = "X$1" && echo "Usage: $0 [tablenr [raw ip args...]]" && exit 64
+
+test -z "$*" && set 0
+
+ip route list table "$@" |
+ while read network rest
+ do set xx $rest
+ shift
+ proto=""
+ via=""
+ dev=""
+ scope=""
+ src=""
+ table=""
+ case $network in
+ broadcast|local|unreachable) via=$network
+ network=$1
+ shift
+ ;;
+ esac
+ while test $# != 0
+ do
+ case "$1" in
+ proto|via|dev|scope|src|table)
+ key=$1
+ val=$2
+ eval "$key='$val'"
+ shift 2
+ ;;
+ dead|onlink|pervasive|offload|notify|linkdown|unresolved)
+ shift
+ ;;
+ *)
+ # avoid infinite loop on unknown keyword without value at line end
+ shift
+ shift
+ ;;
+ esac
+ done
+ echo "$network $via $src $proto $scope $dev $table"
+ done | awk -F ' ' '
+BEGIN {
+ format="%15s%-3s %15s %15s %8s %8s%7s %s\n";
+ printf(format,"target","","gateway","source","proto","scope","dev","tbl");
+ }
+ { network=$1;
+ mask="";
+ if(match(network,"/"))
+ { mask=" "substr(network,RSTART+1);
+ network=substr(network,0,RSTART);
+ }
+ via=$2;
+ src=$3;
+ proto=$4;
+ scope=$5;
+ dev=$6;
+ table=$7;
+ printf(format,network,mask,via,src,proto,scope,dev,table);
+ }
+'
diff --git a/rootfs/sbin/rtmon b/rootfs/sbin/rtmon
new file mode 100755
index 0000000..b8cbaf4
--- /dev/null
+++ b/rootfs/sbin/rtmon
Binary files differ
diff --git a/rootfs/sbin/rtpr b/rootfs/sbin/rtpr
new file mode 100755
index 0000000..7e48674
--- /dev/null
+++ b/rootfs/sbin/rtpr
@@ -0,0 +1,5 @@
+#! /bin/sh
+# SPDX-License-Identifier: GPL-2.0
+
+exec tr "[\\\\]" "[
+]"
diff --git a/rootfs/sbin/runlevel b/rootfs/sbin/runlevel
new file mode 120000
index 0000000..c760ed6
--- /dev/null
+++ b/rootfs/sbin/runlevel
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/runlevel
\ No newline at end of file
diff --git a/rootfs/sbin/setconsole b/rootfs/sbin/setconsole
new file mode 120000
index 0000000..9d902fa
--- /dev/null
+++ b/rootfs/sbin/setconsole
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/setconsole
\ No newline at end of file
diff --git a/rootfs/sbin/setfiles b/rootfs/sbin/setfiles
new file mode 100755
index 0000000..fd36ab7
--- /dev/null
+++ b/rootfs/sbin/setfiles
Binary files differ
diff --git a/rootfs/sbin/slattach b/rootfs/sbin/slattach
new file mode 120000
index 0000000..899936f
--- /dev/null
+++ b/rootfs/sbin/slattach
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/slattach
\ No newline at end of file
diff --git a/rootfs/sbin/start_telnetd.sh b/rootfs/sbin/start_telnetd.sh
new file mode 100755
index 0000000..9ed0fc3
--- /dev/null
+++ b/rootfs/sbin/start_telnetd.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+flag=`nv get telnetd_enable`
+
+if [ "$flag" == "y" ]; then
+ echo "Starting telnetd......!"
+ /usr/sbin/telnetd -p 4719 &
+fi
+
+
diff --git a/rootfs/sbin/start_update_app.sh b/rootfs/sbin/start_update_app.sh
new file mode 100755
index 0000000..aec2890
--- /dev/null
+++ b/rootfs/sbin/start_update_app.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+#
+# $Id: lan.sh
+#
+
+update_type=`nv get update_type`
+fota_dm_vendor=`nv get fota_dm_vendor`
+if [ "$update_type" == "mifi_local" ]; then
+ echo "update_type: mifi_local"
+fi
+
+if [ "$update_type" == "mifi_fota" ]; then
+ echo "update_type: mifi_fota"
+ if [ "$fota_dm_vendor" == "zx" ]; then
+ fota_dm_zx &
+ else
+ fota_dm_gs &
+ fi
+fi
+
+if [ "$update_type" == "mdl_local" ]; then
+ echo "update_type: mdl_local"
+ localUpdate &
+fi
+
+if [ "$update_type" == "mdl_fota" ]; then
+ echo "update_type: mdl_fota"
+ if [ "$fota_dm_vendor" == "zx" ]; then
+ fota_dm_zx &
+ else
+ fota_dm_gs &
+ fi
+fi
+
+if [ "$update_type" == "none" ]; then
+ echo "update_type: none"
+fi
\ No newline at end of file
diff --git a/rootfs/sbin/sulogin b/rootfs/sbin/sulogin
new file mode 120000
index 0000000..dd593d6
--- /dev/null
+++ b/rootfs/sbin/sulogin
@@ -0,0 +1 @@
+/sbin/sulogin.util-linux
\ No newline at end of file
diff --git a/rootfs/sbin/sulogin.util-linux b/rootfs/sbin/sulogin.util-linux
new file mode 100755
index 0000000..86b9d8e
--- /dev/null
+++ b/rootfs/sbin/sulogin.util-linux
Binary files differ
diff --git a/rootfs/sbin/swapoff b/rootfs/sbin/swapoff
new file mode 120000
index 0000000..c3305c8
--- /dev/null
+++ b/rootfs/sbin/swapoff
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/swapoff
\ No newline at end of file
diff --git a/rootfs/sbin/swapon b/rootfs/sbin/swapon
new file mode 120000
index 0000000..0e58d41
--- /dev/null
+++ b/rootfs/sbin/swapon
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/swapon
\ No newline at end of file
diff --git a/rootfs/sbin/switch_root b/rootfs/sbin/switch_root
new file mode 120000
index 0000000..422da3a
--- /dev/null
+++ b/rootfs/sbin/switch_root
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/switch_root
\ No newline at end of file
diff --git a/rootfs/sbin/sysctl b/rootfs/sbin/sysctl
new file mode 120000
index 0000000..8763d2b
--- /dev/null
+++ b/rootfs/sbin/sysctl
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/sysctl
\ No newline at end of file
diff --git a/rootfs/sbin/syslogd b/rootfs/sbin/syslogd
new file mode 120000
index 0000000..981b26b
--- /dev/null
+++ b/rootfs/sbin/syslogd
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/syslogd
\ No newline at end of file
diff --git a/rootfs/sbin/tc_tbf.sh b/rootfs/sbin/tc_tbf.sh
new file mode 100755
index 0000000..a893cba
--- /dev/null
+++ b/rootfs/sbin/tc_tbf.sh
@@ -0,0 +1,126 @@
+#!/bin/sh
+# ===========================================================
+# usage: tc_control.sh
+# traffic control by tc_uplink and tc_downlink
+
+path_sh=`nv get path_sh`
+. $path_sh/global.sh
+
+echo "Info: tc_tbf $1 $2 start "
+echo "Info: tc_tbf $1 $2 start" >> $test_log
+
+#Á÷¿ØÉÏÏÂÐз§Öµ£¬Îª¿Õ»òΪ0±íʾ²»½øÐÐÁ÷¿Ø£¬ÔÝʱֻʵÏÖÉÏÐеÄtc£¬ÏÂÐн«À´¸ù¾Ýʵ¼ÊÐèÒªÔÙÀ©Õ¹ÊµÏÖ
+UPLINK=`nv get tc_uplink`
+DOWNLINK=`nv get tc_downlink`
+def_cid=`nv get default_cid`
+tc_enable=`nv get tc_enable`
+
+#tc_enable=0£¬Á÷Á¿¿ØÖƹ¦Äܹرգ¬Ö±½ÓÍ˳ö
+if [ "$tc_enable" == "0" ]; then
+ echo "tc_enable=0"
+ echo "tc_enable=0" >> $test_log
+ exit 0
+fi
+
+#ÉÏÏÂÐеijö¿ÚdevÐèÒª¸ù¾Ýʵ¼ÊÇé¿öÑ¡Ôñ
+need_jilian=`nv get need_jilian`
+lanEnable=`nv get LanEnable`
+if [ "$need_jilian" == "1" ]; then
+ if [ "$lanEnable" == "1" ]; then
+ IN=`nv get lan_name`
+ elif [ "$lanEnable" == "0" ]; then
+ IN=`nv get "ps_ext"$def_cid`
+ fi
+elif [ "$need_jilian" == "0" ]; then
+ IN=`nv get lan_name`
+fi
+
+#˫ջʱ£¬ipv4ºÍipv6µÄĬÈÏÍâÍø¿Ú¿ÉÄܲ»Ò»Ö£¬ËäÈ»¶ÌÆÚÄÚ¶¼²»»áÓÐʵ¼Ê³¡¾°
+OUT4=$defwan_rel
+OUT6=$defwan6_rel
+
+if [ "$lanEnable" == "1" ]; then
+ GATEWAY=`nv get lan_ipaddr`
+fi
+
+echo "IN=$IN, OUT4=$OUT4, OUT6=$OUT6, GATEWAY=$GATEWAY, DOWNLINK=$DOWNLINK, UPLINK=$UPLINK"
+echo "IN=$IN, OUT4=$OUT4, OUT6=$OUT6, GATEWAY=$GATEWAY, DOWNLINK=$DOWNLINK, UPLINK=$UPLINK" >> $test_log
+
+#Çå¿ÕÔÏȵÄÁ÷³Ì¹æÔò
+tc qdisc del dev $IN root
+if [ "$OUT4" != "" ]; then
+ tc qdisc del dev $OUT4 root
+fi
+if [ "$OUT6" != "" -a "$OUT6" != "$OUT4" ]; then
+ echo "clear tc for $OUT6"
+ tc qdisc del dev $OUT6 root
+fi
+
+#¸øÄں˻ָ´¿ìËÙת·¢¼¶±ð
+fastnat_level=`nv get fastnat_level`
+echo "Info: fastnat_level restore to£º$fastnat_level" >> $test_log
+echo $fastnat_level > /proc/net/fastnat_level
+
+ifconfig $IN txqueuelen 10
+if [ "$OUT4" != "" ]; then
+ ifconfig $OUT4 txqueuelen 10
+fi
+if [ "$OUT6" != "" -a "$OUT6" != "$OUT4" ]; then
+ ifconfig $OUT6 txqueuelen 10
+fi
+
+#ÊÊÅä֮ǰµÄ¿Í»§£ºÈç¹û$1²»µÈÓÚdown/DOWN£¬¾Í°´up/UP´¦Àí
+if [ "$1" == "down" -o "$1" == "DOWN" ]; then
+ echo "traffic control down"
+ echo "traffic control down" >> $test_log
+ exit 0
+fi
+
+if [ "$DOWNLINK" == "" -o "$DOWNLINK" == "0" ] && [ "$UPLINK" == "" -o "$UPLINK" == "0" ]; then
+ echo "no need to traffic control"
+ echo "no need to traffic control" >> $test_log
+ exit 0
+fi
+
+#Ôݶ¨uc/v2¶¼ÐèÒª¹Ø±Õ¿ìËÙת·¢
+
+echo 0 > /proc/net/fastnat_level
+
+if [ "$DOWNLINK" != "0" -a "$DOWNLINK" != "" ]; then
+ echo "traffic control for down"
+ echo "traffic control for down" >> $test_log
+
+ LOCAL=`nv get tc_local`
+ SUM=`expr ${DOWNLINK} + ${LOCAL}`
+ echo "LOCAL=$LOCAL, SUM=$SUM"
+ echo "LOCAL=$LOCAL, SUM=$SUM" >> $test_log
+
+ ifconfig $IN txqueuelen 1000
+
+ #ÏÞËٵĴóСµ¥Î»ËäÈ»ÊÇbps£¬µ«Êµ¼ÊÊÇ×Ö½Ú
+ tc qdisc add dev $IN root handle 1: htb default 20
+ tc class add dev $IN parent 1: classid 1:1 htb rate ${SUM}bps
+ tc class add dev $IN parent 1:1 classid 1:20 htb rate ${DOWNLINK}bps
+ tc class add dev $IN parent 1:1 classid 1:10 htb rate ${LOCAL}bps
+ tc qdisc add dev $IN parent 1:10 handle 10: sfq perturb 10
+ tc qdisc add dev $IN parent 1:20 handle 20: sfq perturb 10
+ tc filter add dev $IN protocol ip parent 1:0 prio 1 u32 match ip src ${GATEWAY}/32 match ip sport 80 0xffff flowid 1:10
+fi
+
+if [ "$UPLINK" != "0" -a "$UPLINK" != "" ]; then
+ if [ "$OUT4" != "" ]; then
+ echo "traffic control for up - ipv4"
+ echo "traffic control for up - ipv4" >> $test_log
+ ifconfig $OUT4 txqueuelen 1000
+ tc qdisc add dev $OUT4 root handle 1: htb default 1
+ tc class add dev $OUT4 parent 1: classid 1:1 htb rate ${UPLINK}bps
+ fi
+
+ if [ "$OUT6" != "" -a "$OUT6" != "$OUT4" ]; then
+ echo "traffic control for up - ipv6"
+ echo "traffic control for up - ipv6" >> $test_log
+ ifconfig $OUT6 txqueuelen 1000
+ tc qdisc add dev $OUT6 root handle 1: htb default 1
+ tc class add dev $OUT6 parent 1: classid 1:1 htb rate ${UPLINK}bps
+ fi
+fi
\ No newline at end of file
diff --git a/rootfs/sbin/to_mnt_ubifs.sh b/rootfs/sbin/to_mnt_ubifs.sh
new file mode 100755
index 0000000..abaa4a9
--- /dev/null
+++ b/rootfs/sbin/to_mnt_ubifs.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+#
+#Author: comlee
+#
+
+#外部传参
+# 参数1: mount点
+# 参数2: 分区名
+RECVFS_MTD_NUM=`cat /proc/mtd | grep "$2\"" | awk '{print $1}'| cut -b 4- |sed 's/://g'`
+ubiattach /dev/ubi_ctrl -m ${RECVFS_MTD_NUM}
+echo "attach $2 $1"
+
+if [ $? != 0 ];then
+ echo "fail to attach $2"
+ exit 1
+fi
+
+UBIDEV_NUM=`ls /sys/devices/virtual/ubi|wc -l`
+MYTMP=0
+
+if [ ! -e $1 ]; then
+ mkdir -p $1
+fi
+
+while :
+do
+ if [ -e /sys/devices/virtual/ubi/ubi${MYTMP} ]; then
+ TMPDEV=`cat /sys/devices/virtual/ubi/ubi${MYTMP}/mtd_num`
+ if [ $TMPDEV -eq ${RECVFS_MTD_NUM} ]; then
+# umount $1
+ mount -t ubifs -o rw,sync,noatime ubi${MYTMP}_0 $1
+ exit 0
+ fi
+ else
+ if [ ${MYTMP} -ge ${UBIDEV_NUM} ]; then
+ exit 1
+ fi
+ fi
+ MYTMP=`expr $MYTMP + 1`
+done
+
+
diff --git a/rootfs/sbin/tunctl b/rootfs/sbin/tunctl
new file mode 120000
index 0000000..7730038
--- /dev/null
+++ b/rootfs/sbin/tunctl
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/tunctl
\ No newline at end of file
diff --git a/rootfs/sbin/ubi_mount.sh b/rootfs/sbin/ubi_mount.sh
new file mode 100755
index 0000000..9e79e6a
--- /dev/null
+++ b/rootfs/sbin/ubi_mount.sh
@@ -0,0 +1,135 @@
+#!/bin/sh
+#
+#Author: zhouguopo
+#
+
+#外部传参
+# 参数1: mount点
+# 参数2: 分区名
+# 参数3: vol_name
+# 参数4: type 默认ubifs,可以是squashfs
+mount_point=$1
+mtd_name=$2
+vol_name=$3
+if [ $# -lt 4 ]; then
+ fs_type=ubifs
+else
+ fs_type=$4
+fi
+
+secboot=$(cat /proc/cmdline | grep "pubkeyhash=")
+sestatus=$(sestatus | grep "SELinux status" | awk '{print $NF}')
+
+if [ x"$UBI_MNT_OPT" = x"" ]; then
+ UBI_MNT_OPT=rw,noatime
+fi
+if [ x"$fs_type" = x"squashfs" ]; then
+ if [ x"$sestatus" = x"enabled" ]; then
+ UBI_MNT_OPT=ro,defcontext=system_u:object_r:default_t:s0
+ else
+ UBI_MNT_OPT=ro
+ fi
+fi
+echo "mount_point:$mount_point"
+echo "mtd_name:$mtd_name"
+echo "vol_name:$vol_name"
+echo "fs_type:$fs_type"
+echo "UBI_MNT_OPT:$UBI_MNT_OPT"
+#exit -1
+
+g_ubi_dev="ubi0_0"
+g_ubiblock_dev="ubiblock0_0"
+# check_vol_is_attached vol_name
+# 1 is attached, 0 not attached
+function check_vol_is_attached()
+{
+ ret=0
+ vol_name=$1
+ found=0
+ #declare -g g_ubi_dev
+ while read -r f; do
+ vol_name_tmp=$(cat "$f")
+ if [ x"$vol_name_tmp" = x"$vol_name" ]; then
+ g_ubi_dev=$(echo "$f" | awk -F'/' '{print $7}')
+ echo "$vol_name already attached $g_ubi_dev"
+ found=1
+ break
+ fi
+ done <<EOF
+$(find /sys/devices/virtual/ubi -name "name")
+EOF
+ if [ "$found" -eq 1 ]; then
+ ret=1
+ fi
+ return "$ret"
+}
+
+function mtd_do_attach()
+{
+ mtd_name_temp=$1
+ #not attached and do attach
+ MTD_NUM=`cat /proc/mtd | grep "$mtd_name\"" | awk '{print $1}'| cut -b 4- |sed 's/://g'`
+ echo "attach $mtd_name mtd$MTD_NUM"
+ ubiattach /dev/ubi_ctrl -m ${MTD_NUM}
+ if [ $? != 0 ];then
+ echo "fail to attach $2"
+ return 1
+ fi
+ return 0
+}
+
+check_vol_is_attached $vol_name
+if [ $? = 0 ];then
+ mtd_do_attach $mtd_name #not attached and do attach
+ if [ $? = 1 ]; then
+ exit -1 #attach fail and exit error
+ else
+ #check again,fill g_ubi_dev
+ check_vol_is_attached $vol_name
+ if [ $? = 0 ];then
+ echo "check ubi vol attached again and fail"
+ exit -2
+ fi
+ fi
+fi
+
+if [ $fs_type = "squashfs" ]; then
+ g_ubiblock_dev=`echo $g_ubi_dev | sed 's/ubi/ubiblock/'`
+ echo "g_ubiblock_dev:$g_ubiblock_dev"
+ if [ ! -b "/dev/$g_ubiblock_dev" ]; then
+ echo "g_ubiblock_dev:$g_ubiblock_dev not exist and create"
+ ubiblock -c /dev/$g_ubi_dev
+ fi
+fi
+
+if [ $fs_type = "squashfs" ]; then
+ if [[ "$secboot" != "" ]]; then
+ zxic_parse_squashfs_verity /dev/$g_ubiblock_dev /tmp/sign /tmp/raw_table /tmp/hash_tree_offset
+ #openssl dgst -sha256 -verify /etc_ro/dm-verity-pub.pem -signature /tmp/sign /tmp/raw_table
+ if [ -f /usr/lib/libcrypto.so.3 ]; then
+ oem_zxic_verify_3 -s /tmp/sign -f /tmp/raw_table
+ else
+ oem_zxic_verify -s /tmp/sign -f /tmp/raw_table
+ fi
+ if [ $? -ne 0 ]; then
+ echo "dm-verity sign verify fail"
+ exit 1
+ fi
+
+ root_hash=` sed -n '/Root hash/p' /tmp/raw_table | awk '{print $3}' `
+ salt=` sed -n '/Salt/p' /tmp/raw_table | awk '{print $2}' `
+ hash_offset=` cat /tmp/hash_tree_offset `
+ veritysetup --restart-on-corruption open /dev/$g_ubiblock_dev $mtd_name /dev/$g_ubiblock_dev --hash-offset=$hash_offset $root_hash -s $salt
+ if [ $? -ne 0 ]; then
+ echo "dm-verity veritysetup open fail"
+ exit 1
+ fi
+ rm /tmp/sign /tmp/raw_table /tmp/hash_tree_offset
+ mount -t $fs_type -o $UBI_MNT_OPT /dev/mapper/$mtd_name $mount_point
+ else
+ mount -t $fs_type -o $UBI_MNT_OPT /dev/$g_ubiblock_dev $mount_point
+ fi
+else
+ mount -t $fs_type -o $UBI_MNT_OPT $g_ubi_dev $mount_point
+fi
+
diff --git a/rootfs/sbin/udhcpc b/rootfs/sbin/udhcpc
new file mode 120000
index 0000000..83be1a7
--- /dev/null
+++ b/rootfs/sbin/udhcpc
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/udhcpc
\ No newline at end of file
diff --git a/rootfs/sbin/udhcpc.sh b/rootfs/sbin/udhcpc.sh
new file mode 100755
index 0000000..1cdeae0
--- /dev/null
+++ b/rootfs/sbin/udhcpc.sh
@@ -0,0 +1,155 @@
+#!/bin/sh
+# udhcpc script edited by Tim Riker <Tim@Rikers.org>
+
+path_sh=`nv get path_sh`
+. $path_sh/global.sh
+
+echo "Info: udhcpc.sh $1 $2 start" >> $test_log
+
+[ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1
+
+RESOLV_CONF=$path_conf"/resolv.conf"
+#broadcast´æÔÚʱºò£¬ÉèÖÃBROADCAST
+[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
+#subnet´æÔÚʱºò£¬ÉèÖÃNETMASK
+[ -n "$subnet" ] && NETMASK="netmask $subnet"
+
+deconfig_wan()
+{
+ nv set $1"_ip"=0.0.0.0
+ nv set $1"_nm"=0.0.0.0
+ nv set $1"_gw"=0.0.0.0
+ nv set $1"_pridns"=0.0.0.0
+ nv set $1"_secdns"=0.0.0.0
+}
+
+get_wan_name()
+{
+ c_id="0"
+ ps_name=`nv get pswan`
+ rj45_name=`nv get ethwan`
+ wifi_name=`nv get wifiwan`
+ case "$1" in
+ $ps_name"1")
+ wanname="pswan"
+ c_id="1" ;;
+ $ps_name"2")
+ wanname="pswan"
+ c_id="2" ;;
+ $ps_name"3")
+ wanname="pswan"
+ c_id="3" ;;
+ $ps_name"4")
+ wanname="pswan"
+ c_id="4" ;;
+ $rj45_name)
+ wanname="ethwan" ;;
+ $wifi_name)
+ wanname="wifiwan" ;;
+ esac
+}
+
+
+case "$1" in
+ deconfig)
+ echo "case deconfig "
+ ifconfig $interface 0.0.0.0 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $interface 0.0.0.0 failed." >> $test_log
+ fi
+ deconfig_wan $interface 2>>$test_log
+ (router_msg_proxy ipv4 udhcpc.sh >> $test_log 2>&1 || echo "Error: router_msg_proxy ipv4 udhcpc.sh failed." >> $test_log) &
+ echo "case deconfig over"
+
+ step=`nvram_get 2860 step_tmp`
+ if [ "-$step" = "-" ];then
+ step=0
+ fi
+
+ echo "step=$step"
+
+ step=`expr $step + 1`
+ nv set step_tmp=$step
+
+ if [ "-$step" = "-3" ];then
+ nv set step_tmp=0
+ fi
+
+ ;;
+
+ renew|bound)
+ echo "case renew bound"
+
+ get_wan_name $interface
+ if [ "-$wanname" == "-ethwan" -o "-$wanname" == "-wifiwan" ]; then
+ (router_msg_proxy del_timer $wanname >> $test_log 2>&1 || echo "Error: router_msg_proxy del_timer failed." >> $test_log) &
+ fi
+
+ #µ÷Óøýű¾Æðudhcpʱºò£¬ÅжÏinterfaceÊÇ·ñºÍethwanÆ¥Å䣬ƥÅäÔòÆðethwan,·ñÔòÓÃÔinterface
+ ethwan_tmp=`nv get ethwan`
+ sw0_flag=`echo $ethwan_tmp | grep $interface`
+ if [ "-${sw0_flag}" != "-" ];then
+ interface=${ethwan_tmp}
+ fi
+ ifconfig $interface $ip $BROADCAST $NETMASK 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $interface $ip $BROADCAST $NETMASK failed." >> $test_log
+ fi
+ if [ "-$wanname" == "-wifiwan" ]; then
+ nv set wifi_state="working"
+ elif [ "-$wanname" == "-ethwan" ]; then
+ #×ÔÊÊÓ¦£¬dhcp»ñÈ¡ip³É¹¦ÔòɱËÀpppoe½ø³Ì
+ pppoe_pid=`ps | grep -v grep | grep $interface | grep pppoecd | awk '{print $1}'`
+ kill $pppoe_pid
+ nv set rj45_state="working"
+ nv set eth_curmode="dhcp"
+ fi
+
+ echo "interface:$interface, ip:$ip, NETMASK:$subnet"
+ echo "router:$router"
+ echo "dns:$dns"
+
+ #set new value to ip, netmask, gateway and dns in nv
+ nv set $interface"_ip"=$ip
+ nv set $interface"_nm"=$subnet
+ nv set $interface"_gw"=$router
+ #set dns to nv
+ for i in $dns ; do
+ [ -n "$pspridns" ] || { nv set $interface"_pridns"=$i; pspridns="pspridns"; }
+ nv set $interface"_secdns"=$i
+ done
+
+ #c_id=0ÔòÊÇrj45»òWiFi£¬c_id=defaultÔòΪÓÃÓÚÍâÍøµÄps¿Ú
+ def_cid=`nv get default_cid`
+ if [ "-$c_id" == "-0" -o "-$c_id" == "-$def_cid" ]; then
+ (router_msg_proxy ipv4 udhcpc.sh >> $test_log 2>&1 || echo "Error: router_msg_proxy ipv4 udhcpc.sh failed." >> $test_log) &
+ else
+ #policy router
+ wan_pri=`nv get $wanname"_priority"`
+ rt_num=`expr $wan_pri \* 10 + $c_id`
+ ip rule add from $ip table $rt_num 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ip rule add from $ip table $rt_num failed." >> $test_log
+ fi
+ ip route add default via $router table $rt_num 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ip route add default via $router table $rt_num failed." >> $test_log
+ fi
+ ip route flush cache 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ip route flush cache failed." >> $test_log
+ fi
+ fi
+
+ # notify goahead when the WAN IP has been acquired. --yy
+ echo "case renew bound over"
+
+ #nv set ppp_status=ppp_connected
+ nv set step_tmp=0
+ ;;
+esac
+
+
+
+exit 0
+
diff --git a/rootfs/sbin/uevent b/rootfs/sbin/uevent
new file mode 120000
index 0000000..0511f03
--- /dev/null
+++ b/rootfs/sbin/uevent
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/uevent
\ No newline at end of file
diff --git a/rootfs/sbin/upnp.sh b/rootfs/sbin/upnp.sh
new file mode 100755
index 0000000..732e0a6
--- /dev/null
+++ b/rootfs/sbin/upnp.sh
@@ -0,0 +1,47 @@
+#!/bin/sh
+#
+# $Id: upnp.sh,v 1.22.6.1 2008-10-02 12:57:42 winfred Exp $
+#
+# usage: upnp.sh
+#
+path_sh=`nv get path_sh`
+. $path_sh/global.sh
+echo "Info: upnp.sh start " >> $test_log
+
+
+# stop all
+killall -9 miniupnpd
+sh $path_sh/upnp_ipt_remove.sh
+
+# upnp
+upnp=`nv get upnpEnabled`
+if [ "$upnp" = "1" ]; then
+ if [ -f $path_conf/pidfile/miniupnp.pid ]
+ then
+ rm -f $path_conf/pidfile/miniupnpd.pid
+ fi
+
+ if [ -f /var/run/miniupnpd.pid ]
+ then
+ rm -f /var/run/miniupnpd.pid
+ fi
+
+ if [ -f $path_conf/miniupnpd.conf ]
+ then
+ echo "$path_conf/miniupnpd.conf already exist!"
+ rm $path_conf/miniupnpd.conf
+ fi
+
+ cp $path_ro/miniupnpd_temp.conf $path_conf/miniupnpd.conf
+
+ gw=`nv get lan_ipaddr`
+ . $path_sh/upnp_set_listenip.sh $gw/16
+
+ route del -net 239.0.0.0 netmask 255.0.0.0 dev $lan_if
+ route add -net 239.0.0.0 netmask 255.0.0.0 dev $lan_if 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: route add -net 239.0.0.0 netmask 255.0.0.0 dev $lan_if failed." >> $test_log
+ fi
+ . $path_sh/upnp_ipt_init.sh
+ miniupnpd -f $path_conf/miniupnpd.conf &
+fi
diff --git a/rootfs/sbin/upnp_ipt_init.sh b/rootfs/sbin/upnp_ipt_init.sh
new file mode 100755
index 0000000..e942b8c
--- /dev/null
+++ b/rootfs/sbin/upnp_ipt_init.sh
@@ -0,0 +1,22 @@
+#! /bin/sh
+# $Id: iptables_init.sh,v 1.1 2008-09-15 12:28:53 winfred Exp $
+
+path_sh=`nv get path_sh`
+. $path_sh/global.sh
+
+echo "Info: upnp_ipt_init.sh start" >> $test_log
+IPTABLES=iptables
+
+#change this parameters :
+EXTIF=$defwan_rel
+
+#adding the MINIUPNPD chain for nat
+$IPTABLES -t nat -N MINIUPNPD
+#adding the rule to MINIUPNPD
+#$IPTABLES -t nat -A PREROUTING -d $EXTIP -i $EXTIF -j MINIUPNPD
+$IPTABLES -t nat -I PREROUTING -i $EXTIF -j MINIUPNPD
+
+#adding the MINIUPNPD chain for filter
+$IPTABLES -t filter -N MINIUPNPD
+#adding the rule to MINIUPNPD
+$IPTABLES -t filter -I FORWARD -i $EXTIF -o ! $EXTIF -j MINIUPNPD
diff --git a/rootfs/sbin/upnp_ipt_remove.sh b/rootfs/sbin/upnp_ipt_remove.sh
new file mode 100755
index 0000000..4cbcb1d
--- /dev/null
+++ b/rootfs/sbin/upnp_ipt_remove.sh
@@ -0,0 +1,25 @@
+#! /bin/sh
+# $Id: iptables_removeall.sh,v 1.1 2008-09-15 12:28:53 winfred Exp $
+
+path_sh=`nv get path_sh`
+. $path_sh/global.sh
+
+echo "Info: upnp_ipt_remove.sh start" >> $test_log
+
+IPTABLES=iptables
+
+#change this parameters :
+EXTIF="$defwan_rel"
+
+#removing the MINIUPNPD chain for nat
+$IPTABLES -t nat -F MINIUPNPD
+#removing the rule to MINIUPNPD
+#$IPTABLES -t nat -D PREROUTING -d $EXTIP -i $EXTIF -j MINIUPNPD
+$IPTABLES -t nat -D PREROUTING -i $EXTIF -j MINIUPNPD
+$IPTABLES -t nat -X MINIUPNPD
+
+#removing the MINIUPNPD chain for filter
+$IPTABLES -t filter -F MINIUPNPD
+#adding the rule to MINIUPNPD
+$IPTABLES -t filter -D FORWARD -i $EXTIF -o ! $EXTIF -j MINIUPNPD
+$IPTABLES -t filter -X MINIUPNPD
diff --git a/rootfs/sbin/upnp_set_listenip.sh b/rootfs/sbin/upnp_set_listenip.sh
new file mode 100755
index 0000000..dcfbc4f
--- /dev/null
+++ b/rootfs/sbin/upnp_set_listenip.sh
@@ -0,0 +1,21 @@
+#! /bin/sh
+
+path_sh=`nv get path_sh`
+. $path_sh/global.sh
+
+echo "Info: upnp_set_listenip.sh start" >> $test_log
+
+if [ -f $path_conf/miniupnpd.conf ]
+ then
+ echo "$path_conf/miniupnpd.conf already exist!"
+fi
+
+conf_file=$path_conf/miniupnpd.conf
+
+listening_ip=$(grep listening_ip= $conf_file)
+aim="listening_ip=$1"
+sed -i "s:$listening_ip:$aim:g" $conf_file
+ip=`nv get lan_ipaddr`
+sed -i -e "s/#allow_ip#/$ip/g" $conf_file
+name=`nv get device_name`
+sed -i -e "s/#device_name#/$name/g" $conf_file
diff --git a/rootfs/sbin/user-config-udhcpd.sh b/rootfs/sbin/user-config-udhcpd.sh
new file mode 100755
index 0000000..dd03b71
--- /dev/null
+++ b/rootfs/sbin/user-config-udhcpd.sh
@@ -0,0 +1,71 @@
+#!/bin/sh
+
+path_sh=`nv get path_sh`
+. $path_sh/global.sh
+echo "Info: user-config-udhcpd.sh start" >> $test_log
+
+lan_enable=`nv get LanEnable`
+if [ "-$lan_enable" == "-0" ]; then
+ exit 0
+fi
+
+static_ip_init()
+{
+ mac_ip_list=`nv get mac_ip_list`
+ num_any=`echo $mac_ip_list| grep -c ";"`
+ num_one=`echo $mac_ip_list| grep -c "+"`
+
+ if [ "$num_any" -eq "0" ]; then
+ if [ "$num_one" -eq "1" ]; then
+ mac=`echo $mac_ip_list| awk -F '+' '{print $2}'`
+ ip=`echo $mac_ip_list| awk -F '+' '{print $3}'`
+ sh $path_sh/config-udhcpd.sh "lan" -S $mac $ip
+ else
+ echo "the mac_ip_list is null"
+
+ fi
+ else
+ var=`echo $mac_ip_list | sed "s/;/ /g"`
+ for list in $var
+ do
+ mac=`echo $list| awk -F '+' '{print $2}'`
+ ip=`echo $list| awk -F '+' '{print $3}'`
+ sh $path_sh/config-udhcpd.sh "lan" -S $mac $ip
+ done
+
+ fi
+}
+
+start=`nv get dhcpStart`
+end=`nv get dhcpEnd`
+dns=`nv get dhcpDns`
+mask=`nv get lan_netmask`
+gw=`nv get lan_ipaddr`
+lease=`nv get dhcpLease_hour`
+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
+sh $path_sh/config-udhcpd.sh "lan" -i $lan_if
+sh $path_sh/config-udhcpd.sh "lan" -m $mask
+sh $path_sh/config-udhcpd.sh "lan" -d $dns
+echo "Info: config-udhcpd.sh lan -d $dns" >> $test_log
+if [ "-$gw" != "-" ]; then
+ sh $path_sh/config-udhcpd.sh "lan" -g $gw
+ echo "Info: config-udhcpd.sh lan -g $gw" >> $test_log
+fi
+if [ "-$lease" != "-" ]; then
+ sh $path_sh/config-udhcpd.sh "lan" -t $lease
+fi
+
+static_ip_init
+
+sh $path_sh/config-udhcpd.sh "lan" -p $pidfile
+sh $path_sh/config-udhcpd.sh "lan" -l $leasesfile
\ No newline at end of file
diff --git a/rootfs/sbin/vconfig b/rootfs/sbin/vconfig
new file mode 120000
index 0000000..79b6d92
--- /dev/null
+++ b/rootfs/sbin/vconfig
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/vconfig
\ No newline at end of file
diff --git a/rootfs/sbin/vigr b/rootfs/sbin/vigr
new file mode 120000
index 0000000..145d605
--- /dev/null
+++ b/rootfs/sbin/vigr
@@ -0,0 +1 @@
+/sbin/vigr.shadow
\ No newline at end of file
diff --git a/rootfs/sbin/vigr.shadow b/rootfs/sbin/vigr.shadow
new file mode 120000
index 0000000..6d63393
--- /dev/null
+++ b/rootfs/sbin/vigr.shadow
@@ -0,0 +1 @@
+vipw.shadow
\ No newline at end of file
diff --git a/rootfs/sbin/vipw b/rootfs/sbin/vipw
new file mode 120000
index 0000000..dae12e1
--- /dev/null
+++ b/rootfs/sbin/vipw
@@ -0,0 +1 @@
+/sbin/vipw.shadow
\ No newline at end of file
diff --git a/rootfs/sbin/vipw.shadow b/rootfs/sbin/vipw.shadow
new file mode 100755
index 0000000..e7f02da
--- /dev/null
+++ b/rootfs/sbin/vipw.shadow
Binary files differ
diff --git a/rootfs/sbin/wan_ipv4.sh b/rootfs/sbin/wan_ipv4.sh
new file mode 100755
index 0000000..e5f7446
--- /dev/null
+++ b/rootfs/sbin/wan_ipv4.sh
@@ -0,0 +1,295 @@
+#!/bin/sh
+#usg: wan_ipv4 linkup pswan
+
+path_sh=`nv get path_sh`
+. $path_sh/global.sh
+
+#Èë²ÎÖÐÓÐc_idÔòÉèÖã¬Ã»ÓÐÔòÖÃÁ㣬ÓÃÓÚÉèÖòßÂÔ·ÓɱíºÅ
+if [ "-$3" == "-" ]; then
+ c_id="0"
+else
+ c_id=$3
+fi
+def_cid=`nv get default_cid`
+
+#»ñÈ¡ÍøÂçÉ豸Ãû
+get_wan_if()
+{
+ case $1 in
+ "pswan")
+ wan_if="$pswan_name"$2 ;;
+ "ethwan")
+ wan_if=$ethwan_if ;;
+ "wifiwan")
+ wan_if=$wifiwan_if ;;
+ esac
+
+ mtu=`nv get mtu`
+ ifconfig $wan_if mtu $mtu
+}
+#ÉèÖù¤×÷״̬ ÕýÔÚÁ¬½Ó£ºconnect ÒÑÁ¬½Ó£ºworking ÒѶϿª£ºdead
+state_set()
+{
+ if [ "-$wan_name" == "-wifiwan" ]; then
+ nv set wifi_state="working"
+ elif [ "-$wan_name" == "-ethwan" ]; then
+ nv set rj45_state="working"
+ fi
+}
+#¸ù¾ÝÍø¿ÚÊÇ·ñÓÃÓÚÆÕͨÉÏÍâÍø£¬È·¶¨ÊÇ·ñÐèÒª·¢ÏûÏ¢¸øzte_router
+msg_zte_router()
+{
+ if [ "-$c_id" == "-0" -o "-$c_id" == "-$def_cid" ]; then
+ (router_msg_proxy ipv4 wan_ipv4.sh >> $test_log 2>&1 || echo "Error: router_msg_proxy ipv4 wan_ipv4.sh failed." >> $test_log) &
+ fi
+}
+
+linkup()
+{
+ #$1 :pswan / usbwan / ethwan / wifiwan
+ wan_name=$1
+ wan_mode=`nv get $wan_name"_mode"`
+
+ #»ñÈ¡wan_if±äÁ¿
+ get_wan_if $1 $2
+
+ if [ "-$wan_mode" == "-static" ]; then
+ wan_ip=`nv get "static_"$wan_name"_ip"`
+ wan_gw=`nv get "static_"$wan_name"_gw"`
+ wan_pridns=`nv get "static_"$wan_name"_pridns"`
+ wan_secdns=`nv get "static_"$wan_name"_secdns"`
+ wan_nm=`nv get "static_"$wan_name"_nm"`
+ if [ "-$wan_name" != "-wifiwan" ]; then
+ ifconfig $wan_if down 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $wan_if down failed." >> $test_log
+ fi
+ ifconfig $wan_if $wan_ip up 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $wan_if $wan_ip up failed." >> $test_log
+ fi
+ fi
+ if [ "-$wan_name" == "-ethwan" ]; then
+ nv set eth_curmode="static"
+ #rj45¾²Ì¬Á¬½Ó£¬¹Ø±Õ³¬Ê±¼ÆÊ±Æ÷
+ (router_msg_proxy del_timer ethwan >> $test_log 2>&1 || echo "Error: router_msg_proxy del_timer failed." >> $test_log) &
+ fi
+
+ #ÉèÖÃÍøÂçÉ豸״̬±ê־Ϊworking
+ state_set
+ #set ip¡¢gw¡¢dns to nv
+ nv set $wan_if"_ip"=$wan_ip
+ nv set $wan_if"_gw"=$wan_gw
+ nv set $wan_if"_pridns"=$wan_pridns
+ nv set $wan_if"_secdns"=$wan_secdns
+
+ wan_pri=`nv get $1"_priority"`
+ rt_num=`expr $wan_pri \* 10 + $c_id`
+ ip rule add from $wan_ip table $rt_num 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ip rule add from $wan_ip table $rt_num failed." >> $test_log
+ fi
+ ip route add default via $wan_gw table $rt_num 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ip route add default via $wan_gw table $rt_num failed." >> $test_log
+ fi
+ ip route flush cache 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ip route flush cache failed." >> $test_log
+ fi
+
+ #in this proxy ,we send msg to zte_mainctrl
+ msg_zte_router
+
+ # pswan PDP
+ elif [ "-$wan_mode" == "-pdp" ]; then
+ pswan_ip=`nv get $wan_if"_ip"`
+ pswan_gw=`nv get $wan_if"_gw"`
+ pswan_pridns=`nv get $wan_if"_pridns"`
+ 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 $pswan_ip up 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $wan_if $pswan_ip up failed." >> $test_log
+ fi
+
+ pswan_pri=`nv get pswan_priority`
+ rt_num=`expr $pswan_pri \* 10 + $c_id`
+ ip rule add from $pswan_ip table $rt_num 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ip rule add from $pswan_ip table $rt_num failed." >> $test_log
+ fi
+ ip route add default via $pswan_gw table $rt_num 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ip route add default via $pswan_gw table $rt_num failed." >> $test_log
+ fi
+ ip route flush cache 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ip route flush cache failed." >> $test_log
+ fi
+
+ msg_zte_router
+
+ elif [ "-$wan_mode" == "-auto" ]; then
+ pppoe_user=`nv get pppoe_username`
+ pppoe_pass=`nv get pppoe_cc`
+ udhcpc_kill
+ pppoe_kill
+
+ if [ "-$wan_name" == "-ethwan" ]; then
+ nv set eth_curmode=""
+ fi
+ if [ "-$wan_name" != "-wifiwan" ]; then
+ ifconfig $wan_if down 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $wan_if down failed." >> $test_log
+ fi
+ ifconfig $wan_if up 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $wan_if up failed." >> $test_log
+ fi
+ fi
+
+ if [ "-${pppoe_user}" = "-" -a "-${pppoe_pass}" = "-" ];then
+ echo "auto wan_mode: pppoe_user is ${pppoe_user}, pppoe_pass is ${pppoe_pass}, so start dhcp client. " >> $test_log
+ udhcpc -i $wan_if -s $path_sh/udhcpc.sh &
+ else
+ sh $path_sh/pppoe_dail.sh connect
+ fi
+
+ elif [ "-$wan_mode" == "-dhcp" ]; then
+ udhcpc_kill
+ pppoe_kill
+
+ if [ "-$wan_name" == "-pswan" ]; then
+ ifconfig $wan_if arp 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $wan_if arp failed." >> $test_log
+ fi
+ fi
+
+ if [ "-$wan_name" == "-ethwan" ]; then
+ nv set eth_curmode="dhcp"
+ fi
+
+ if [ "-$wan_name" != "-wifiwan" ]; then
+ ifconfig $wan_if down 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $wan_if down failed." >> $test_log
+ fi
+ ifconfig $wan_if up 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $wan_if up failed." >> $test_log
+ fi
+ fi
+ udhcpc -i $wan_if -s $path_sh/udhcpc.sh &
+
+ elif [ "-$wan_mode" == "-pppoe" ]; then
+ udhcpc_kill
+ pppoe_kill
+
+ if [ "-$wan_name" == "-ethwan" ]; then
+ nv set eth_curmode="pppoe"
+ fi
+
+ if [ "-$wan_name" != "-wifiwan" ]; then
+ ifconfig $wan_if down 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $wan_if down failed." >> $test_log
+ fi
+ ifconfig $wan_if up 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $wan_if up failed." >> $test_log
+ fi
+ fi
+ sh $path_sh/pppoe_dail.sh connect
+ fi
+
+}
+
+del_default_wan()
+{
+ default_wan_name=`nv get default_wan_name`
+ if [ "$1" == "$default_wan_name" ]; then
+ nv set default_wan_name=""
+ nv set default_wan_rel=""
+ fi
+}
+
+linkdown()
+{
+ wan_name=$1
+ get_wan_if $1 $2
+
+ udhcpc_kill
+ pppoe_kill
+
+ if [ "-$c_id" == "-0" -o "-$c_id" == "-$def_cid" ]; then
+ echo 0 > /proc/sys/net/ipv4/ip_forward
+ fi
+
+ ifconfig $wan_if 0.0.0.0 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $wan_if 0.0.0.0 failed." >> $test_log
+ fi
+ if [ "$wan_name" == "wifiwan" ]; then
+ echo $wan_if > /proc/net/dev_down
+ else
+ ifconfig $wan_if down 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $wan_if down failed." >> $test_log
+ fi
+ fi
+ wan_ip=`nv get $wan_if"_ip"`
+ wan_gw=`nv get $wan_if"_gw"`
+
+ route del default gw $wan_gw dev $wan_if
+ #if [ $? -ne 0 ];then
+ # echo "Error: route del default gw $wan_gw dev $wan_if failed." >> $test_log
+ #fi
+
+ #del policy router
+ wan_pri=`nv get $1"_priority"`
+ rt_num=`expr $wan_pri \* 10 + $c_id`
+ ip rule del from $wan_ip table $rt_num
+ #if [ $? -ne 0 ];then
+ # echo "Error: ip rule del from $wan_ip table $rt_num failed." >> $test_log
+ #fi
+ ip route del default via $wan_gw table $rt_num
+ #if [ $? -ne 0 ];then
+ # echo "Error: ip route del default via $wan_gw table $rt_num failed." >> $test_log
+ #fi
+
+ #wan_ipaddÐèÒªÊÊÅä
+ if [ "$wan_if" == "$defwan_if" ]; then
+ nv set wan_ipaddr=""
+ fi
+ nv set $wan_if"_ip"=0.0.0.0
+ nv set $wan_if"_nm"=0.0.0.0
+ nv set $wan_if"_gw"=0.0.0.0
+ nv set $wan_if"_pridns"=0.0.0.0
+ nv set $wan_if"_secdns"=0.0.0.0
+ pdp_type=`nv get "pdp_act_type"$def_cid`
+ if [ "$2" == "$def_cid" -a "-$pdp_type" != "-IPv4v6" ]; then
+ nv set default_cid=""
+ fi
+ del_default_wan $wan_if
+ msg_zte_router
+
+}
+
+echo "Info: wan_ipv4.sh $1 $2 $3 start" >> $test_log
+if [ "$1" == "linkup" ]; then
+ linkup $2 $3
+
+elif [ "$1" == "linkdown" ]; then
+ if [ "-$2" == "-pswan" ]; then
+ tc_tbf.sh down $def_cid
+ fi
+ linkdown $2 $3
+fi
\ No newline at end of file
diff --git a/rootfs/sbin/wan_ipv6.sh b/rootfs/sbin/wan_ipv6.sh
new file mode 100755
index 0000000..f761399
--- /dev/null
+++ b/rootfs/sbin/wan_ipv6.sh
@@ -0,0 +1,416 @@
+#!/bin/sh
+
+path_sh=`nv get path_sh`
+. $path_sh/global.sh
+
+
+echo "input param is $1 $2 $3"
+echo "Info: wan_ipv6 $1 $2 $3 start" >> $test_log
+
+#Èë²ÎÖÐÓÐc_idÔòÉèÖã¬Ã»ÓÐÔòÖÃÁ㣬ÓÃÓÚÉèÖòßÂÔ·ÓɱíºÅ
+if [ "$3" == "" ]; then
+ c_id="0"
+else
+ c_id=$3
+fi
+def_cid=`nv get default_cid`
+
+is_chinamobile_pd_diff=`nv get pd_chinamobile_enable`
+pd_chinamobile=`nv get pd_chinamobile`
+prefix_len=`nv get pd_len_chinamobile`
+
+b_dhcpv6stateEnabled=`nv get dhcpv6stateEnabled`
+b_dhcpv6statelessEnabled=`nv get dhcpv6statelessEnabled`
+
+############# »ñȡָ¶¨Íø¿ÚµÄÈ«¾Ö±äÁ¿ ############
+get_wan_info()
+{
+ echo "wan_name_info = $1"
+
+ #»ñÈ¡¶ÔÓ¦wan¿ÚµÄip mode
+ wan_mode=`nv get $1"_mode"`
+
+ #»ñÈ¡¶ÔÓ¦µÄÍø¿ÚÃû
+ case $1 in
+ "pswan")
+ wan_if=$pswan_name$2 ;;
+ "usbwan")
+ wan_if=$usbwan_if ;;
+ "ethwan")
+ wan_if=$ethwan_if ;;
+ "wifiwan")
+ wan_if=$wifiwan_if ;;
+ esac
+ mtu=`nv get mtu`
+ ifconfig $wan_if mtu $mtu
+
+ #ÐèÒªÓõ½Ïà¹ØÅäÖÃÎļþ
+ dhcp6s_conf=$path_conf/dhcp6s_$wan_if.conf
+ radvd_conf=$path_conf/radvd_$wan_if.conf
+ radvd_pidfile=$path_tmp/radvd_$wan_if.pid
+ #resolv_conf=$path_conf/resolv_$wan_if.conf
+ ndp_log=$path_conf/ndp_$wan_if.log
+
+ #·ÀdosÏà¹ØÅäÖÃ
+ dosenable=`nv get dosenable`
+ if [ "x$dosenable" != "x0" ]; then
+ if [ "$1" == "pswan" ]; then
+ wan6_prefix=$1$2"_prefix"
+ else
+ wan6_prefix=$1"_prefix"
+ fi
+ echo 1 > /sys/module/fast_common/parameters/lan_dos_enable
+ echo "wan6_prefix_name = $wan6_prefix"
+ fi
+
+ echo "wan_if_info = $wan_if"
+}
+
+#Çå³ýÏàÓ¦µÄslaac½ø³Ì
+slaac_kill()
+{
+ ps > ${path_tmp}/zte_ipv6_slaac.${wan_if}.$$
+ slaac_pid=`awk 'BEGIN{temp1="'"${wan_if}"'";temp2="zte_ipv6_slaac"}{if(index($0,temp1)>0 && index($0,temp2)>0){print $1}}' ${path_tmp}/zte_ipv6_slaac.${wan_if}.$$`
+ rm -f ${path_tmp}/zte_ipv6_slaac.${wan_if}.$$
+ [ -n "$slaac_pid" ] && { kill $slaac_pid; echo "Info: kill slaac $slaac_pid " >> $test_log ; }
+}
+
+linkup_get_wan_addr()
+{
+ echo "wan_name_info = $wan_if"
+
+ #disable the forwarding to send RS and not set the addr when receive ra packet
+ #echo 0 > /proc/sys/net/ipv6/conf/all/forwarding
+ echo 0 > /proc/sys/net/ipv6/conf/$wan_if/accept_ra
+
+ # IPv6ÔÝʱ²»¿¼ÂÇstaticģʽ£¬È罫À´ÓÐÐèÇ󣬲ο¼ipv4ÅäÖÃ
+ # µ±wan_modeΪDHCP£¬»òÕßusbwan¡¢ethwanΪPPP¡¢PPPOEʱ£¬Æô¶¯dhcp6c
+ if [ "$1" == "pswan" ]; then
+
+ if [ "-$wan_mode" == "-dhcp" ]; then
+ ifconfig $wan_if arp 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $wan_if arp failed." >> $test_log
+ fi
+ fi
+ #call the slaac program to get the prefix addr
+ ifconfig $wan_if up 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $wan_if up failed." >> $test_log
+ fi
+ prefix_info_temp=`nv get $wan_if"_ipv6_prefix_info"`
+ #Èç¹ûµ±Ç°Ã»ÓÐǰ׺£¬ÔòÖ±½ÓÆô¶¯slaac£¬Èç¹ûµ±Ç°Ç°×ºÒѾÉèÖã¬Ôò˵Ã÷ÒѾ»ñÈ¡µ½£¬Ö±½ÓÅäÖÃIPµØÖ·¼´¿É
+ if [ -n "$prefix_info_temp" -a "-$prefix_info_temp" != "-::" ]; then
+ ret_code=0
+ else
+ sleep 1
+ interface_id_temp1=`nv get $wan_if"_ipv6_interface_id"`
+ local_ipv6_addr="fe80::"$interface_id_temp1
+ local_ipv6_addr_nv="$wan_if""_local_ipv6_addr"
+ nv set $local_ipv6_addr_nv=$local_ipv6_addr
+ ip -6 addr add $local_ipv6_addr/64 dev $wan_if 2>>$test_log
+ zte_ipv6_slaac -i "$wan_if"
+ ret_code=$?
+ fi
+
+ echo "the program zte_ipv6_slaac return = $ret_code"
+ if [ $ret_code -eq 0 ]; then
+ echo "the zte_ipv6_slaac success"
+ interface_id_temp=`nv get $wan_if"_ipv6_interface_id"`
+ prefix_info_temp=`nv get $wan_if"_ipv6_prefix_info"`
+
+ echo "##############1##########"
+ echo "$interface_id_temp"
+ echo "$prefix_info_temp"
+ echo "##############2##########"
+
+ if [ "x$dosenable" != "x0" ]; then
+ ip6_prefix=`echo "$prefix_info_temp" | awk -F ':' '{printf "0x"$1",0x"$2",0x"$3",0x"$4}'`
+ echo "ip6_prefix1=$ip6_prefix"
+ echo $ip6_prefix > /sys/module/fast_common/parameters/$wan6_prefix
+ fi
+
+
+ wan_addr=$prefix_info_temp$interface_id_temp
+ wan_addr_nv=$wan_if"_ipv6_ip"
+ nv set $wan_addr_nv="$wan_addr"
+ echo "wan_addr = $wan_addr"
+
+ ip -6 addr add $wan_addr/126 dev $wan_if 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ip -6 addr add $wan_addr/126 dev $wan_if failed." >> $test_log
+ fi
+
+ killall -9 clatd
+ clatd -i $wan_if -p 1:1:1:123:: &
+
+ if [ "-$c_id" != "-$def_cid" ]; then
+ wan_pri=`nv get $1"_priority"`
+ rt_num=`expr $wan_pri \* 10 + $c_id`
+ default_gw_addr_temp=`nv get $wan_if"_ipv6_gw"`
+ echo "ipv6_wan_default_gw = $default_gw_addr_temp"
+ ip -6 rule add from $wan_addr table $rt_num 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ip -6 rule add from $wan_addr table $rt_num failed." >> $test_log
+ fi
+ if [ -n "$default_gw_addr_temp" -a "-$default_gw_addr_temp" != "-::" ] ; then
+ ip -6 route add default via $default_gw_addr_temp dev $wan_if table $rt_num 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ip -6 route add default via $default_gw_addr_temp dev $wan_if table $rt_num failed." >> $test_log
+ fi
+ else
+ ip -6 route add default dev $wan_if table $rt_num 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ip -6 route add default dev $wan_if table $rt_num failed." >> $test_log
+ fi
+ fi
+ ip -6 route flush cache 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ip -6 route flush cache failed." >> $test_log
+ fi
+ #sleep 1
+ fi
+ nv set $wan_if"_ipv6_state"="working"
+ else
+ echo "the zte_ipv6_slaac fail"
+ nv set $wan_if"_ipv6_state"="dead"
+ #exit 1
+ fi
+ else
+ #if [ "-$wan_mode" == "-DHCP" -o "-$wan_mode" == "-PPP" -o "-$wan_mode" == "-PPPOE" ]; then
+ #dhcp6c -dDf -z $wan_if &
+ # ²ÉÓÃPDP¼¤»î·ÖÅäµÄipv6µØÖ·
+ #else
+ #call the slaac program to get the prefix addr
+ ifconfig $wan_if up 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $wan_if up failed." >> $test_log
+ fi
+ #sleep 1
+ #interface_id_temp1=`nv get $wan_if"_ipv6_interface_id"`
+ interface_id_temp1="0001:0002:0003:0004"
+ nv set $wan_if"_ipv6_interface_id"=$interface_id_temp1
+ local_ipv6_addr="fe80::"$interface_id_temp1
+ local_ipv6_addr_nv="$wan_if""_local_ipv6_addr"
+ nv set $local_ipv6_addr_nv=$local_ipv6_addr
+ ip -6 addr add $local_ipv6_addr/64 dev $wan_if 2>>$test_log
+
+ zte_ipv6_slaac -i "$wan_if"
+ ret_code=$?
+
+ echo "the program zte_ipv6_slaac return = $ret_code"
+ if [ $ret_code -eq 0 ]; then
+ echo "the zte_ipv6_slaac success"
+ #ifconfig $wan_if up 2>>$test_log
+ dhcp6c -dDf -z $wan_if &
+ interface_id_temp=`nv get $wan_if"_ipv6_interface_id"`
+ prefix_info_temp=`nv get $wan_if"_ipv6_prefix_info"`
+ if [ "-$prefix_info_temp" == "-" -o "-$prefix_info_temp" == "-::" ]; then
+ echo "wait dhcp6c get ipv6_prefix"
+ sleep 2
+ prefix_info_temp=`nv get $wan_if"_ipv6_prefix_info"`
+ fi
+
+ echo "##############1##########"
+ echo "$interface_id_temp"
+ echo "$prefix_info_temp"
+ echo "##############2##########"
+ if [ "-$prefix_info_temp" == "-" -o "-$prefix_info_temp" == "-::" ]; then
+ echo "get ipv6_prefix fail"
+ nv set $wan_if"_ipv6_state"="dead"
+ exit 1
+ fi
+ if [ "x$dosenable" != "x0" ]; then
+ ip6_prefix=`echo "$prefix_info_temp" | awk -F ':' '{printf "0x"$1",0x"$2",0x"$3",0x"$4}'`
+ echo "ip6_prefix2=$ip6_prefix"
+ echo $ip6_prefix > /sys/module/fast_common/parameters/$wan6_prefix
+ fi
+
+ wan_addr=$prefix_info_temp$interface_id_temp
+ wan_addr_nv=$wan_if"_ipv6_ip"
+ nv set $wan_addr_nv="$wan_addr"
+ echo "wan_addr = $wan_addr"
+
+ ip -6 addr add $wan_addr/126 dev $wan_if 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ip -6 addr add $wan_addr/126 dev $wan_if failed." >> $test_log
+ fi
+
+ killall -9 clatd
+ clatd -i $wan_if -p 1:1:1:123:: &
+ else
+ echo "the zte_ipv6_slaac fail"
+ nv set $wan_if"_ipv6_state"="dead"
+ exit 1
+ fi
+ #fi
+ fi
+}
+
+#############linkdown radvd set############
+linkdown_radvd_set()
+{
+ if [ "-$b_dhcpv6stateEnabled" = "-1" ];then
+ radvd_kill
+ return
+ else
+ sed -i -e s/AdvValidLifetime.*/'AdvValidLifetime 30;'/g $radvd_conf
+ sed -i -e s/AdvPreferredLifetime.*/'AdvPreferredLifetime 1;'/g $radvd_conf
+ fi
+
+ if [ "-$is_chinamobile_pd_diff" = "-1" ] ; then
+ if [ "-$pd_chinamobile" == "-" ] ; then
+ echo "no pd info get"
+ else
+ radvd_kill
+ rm -rf $radvd_pidfile
+ radvd -d 3 -C $radvd_conf -s -p $radvd_pidfile &
+ nv set pd_chinamobile=""
+ nv set pd_len_chinamobile=""
+ radvd_kill
+ fi
+ fi
+
+ radvd_kill
+ rm -rf $radvd_pidfile
+ radvd -d 3 -C $radvd_conf -s -p $radvd_pidfile &
+}
+
+#############linkdown wanaddr route set############
+linkdown_route_set()
+{
+ echo "wan_name_info = $wan_if"
+
+ wan_addr=`nv get $wan_if"_ipv6_ip"`
+ ip -6 addr del $wan_addr/126 dev $wan_if
+
+ local_ipv6_addr_nv="$wan_if""_local_ipv6_addr"
+ local_ipv6_addr=`nv get $local_ipv6_addr_nv`
+ ip -6 addr del $local_ipv6_addr/64 dev $wan_if 2>>$test_log
+ #if [ $? -ne 0 ];then
+ # echo "Error: ip -6 addr del $wan_addr/126 dev $wan_if failed." >> $test_log
+ #fi
+
+ killall clatd
+ sh $path_sh/clat_config.sh down $wan_if
+
+ if [ "-$c_id" == "-0" -o "-$c_id" == "-$def_cid" ]; then
+ echo 0 > /proc/sys/net/ipv6/conf/all/forwarding
+ ip -6 route del default
+ #if [ $? -ne 0 ];then
+ #echo "Error: ip -6 route del default failed." >> $test_log
+ #fi
+
+ nv set ipv6_br0_addr="::"
+ ipv6_addr_conver $wan_addr "$wan_if"
+ ipv6_br0_addr_tmp=`nv get ipv6_br0_addr`
+ ip -6 addr del $ipv6_br0_addr_tmp/64 dev br0
+ #if [ $? -ne 0 ];then
+ #echo "Error: ip -6 addr del $ipv6_br0_addr_tmp/64 dev br0 failed." >> $test_log
+ #fi
+
+ #ÊÊÅäÒ³ÃæµÈÆäËûµØ·½Ê¹ÓÃÀÏNV
+ nv set ipv6_wan_ipaddr="::"
+
+ def_cid=`nv get default_cid`
+ if [ "-$c_id" == "-$def_cid" ]; then
+ nv set default_cid=""
+ nv set $wan_if"_ipv6_state"="dead"
+ fi
+ else
+ wan_pri=`nv get $1"_priority"`
+ rt_num=`expr $wan_pri \* 10 + $c_id`
+
+ default_gw_addr_temp=`nv get $wan_if"_ipv6_gw"`
+ echo "ipv6_wan_default_gw = $default_gw_addr_temp"
+
+ ip -6 rule del from $wan_addr table $rt_num
+ #if [ $? -ne 0 ];then
+ #echo "Error: ip -6 rule del from $wan_addr table $rt_num failed." >> $test_log
+ #fi
+ if [ -n "$default_gw_addr_temp" ] ; then
+ ip -6 route del default via $default_gw_addr_temp dev $wan_if table $rt_num
+ #if [ $? -ne 0 ];then
+ #echo "Error: ip -6 route del default via $default_gw_addr_temp dev $wan_if table $rt_num failed." >> $test_log
+ #fi
+ else
+ ip -6 route del default dev $wan_if table $rt_num
+ #if [ $? -ne 0 ];then
+ #echo "Error: ip -6 route del default dev $wan_if table $rt_num failed." >> $test_log
+ #fi
+ fi
+ ip -6 route flush cache 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ip -6 route flush cache failed." >> $test_log
+ fi
+
+ nv set $wan_if"_ipv6_state"="dead"
+
+ fi
+
+ echo 0 > /proc/sys/net/ipv6/conf/$wan_if/accept_ra
+
+ #reset wan'nv
+ nv set $wan_if"_ipv6_ip"="::"
+ nv set $wan_if"_ipv6_pridns_auto"="::"
+ nv set $wan_if"_ipv6_secdns_auto"="::"
+ nv set $wan_if"_ipv6_gw"="::"
+ nv set $wan_if"_ipv6_interface_id"="::"
+ nv set $wan_if"_ipv6_prefix_info"="::"
+ nv set $wan_if"_dhcpv6_start"="::"
+ nv set $wan_if"_dhcpv6_end"="::"
+ nv set $wan_if"_radvd_ipv6_dns_servers"="::"
+
+ if [ "x$dosenable" != "x0" ]; then
+ echo 0,0,0,0 > /sys/module/fast_common/parameters/$wan6_prefix
+ fi
+ if [ "$1" == "pswan" ]; then
+ ifconfig $wan_if down 2>>$test_log
+ if [ $? -ne 0 ];then
+ echo "Error: ifconfig $wan_if down failed." >> $test_log
+ fi
+ fi
+}
+
+#Çå³ýÏàÓ¦µÄDHCPv6½ø³Ì
+linkdown_dhcpv6_server_set()
+{
+ dhcp6c_kill
+ dhcp6s_kill
+}
+
+del_default_wan6()
+{
+ default_wan6_name=`nv get default_wan6_name`
+ if [ "-$1" == "-$default_wan6_name" ]; then
+ nv set default_wan6_name=""
+ nv set default_wan6_rel=""
+ fi
+}
+############ipv6 shell entry#################
+get_wan_info $2 $3
+
+case $1 in
+ "linkup")
+ linkup_get_wan_addr $2 $3
+
+ ;;
+
+ "linkdown")
+ #if [ "-$2" == "-pswan" ]; then
+ # tc_tbf.sh down $def_cid
+ #fi
+ linkdown_radvd_set
+ linkdown_dhcpv6_server_set
+ #linkdown_route_set $2
+ #slaac_kill
+ #ndp_kill
+ #del_default_wan6 $wan_if
+ ;;
+
+esac
+
+
+#if [ "-$c_id" == "-0" -o "-$c_id" == "-$def_cid" ]; then
+ #(router_msg_proxy ipv6 wan_ipv6.sh >> $test_log 2>&1 || echo "Error: router_msg_proxy ipv6 wan_ipv6.sh failed." >> $test_log) &
+#fi
diff --git a/rootfs/sbin/wan_ipv6_config.sh b/rootfs/sbin/wan_ipv6_config.sh
new file mode 100755
index 0000000..99cec0e
--- /dev/null
+++ b/rootfs/sbin/wan_ipv6_config.sh
@@ -0,0 +1,276 @@
+#!/bin/sh
+
+path_sh=`nv get path_sh`
+. $path_sh/global.sh
+
+echo "input param is $1"
+echo "Info: wan_ipv6_config.sh $1 start" >> $test_log
+
+wan_addr_temp=`nv get $wan_if"ipv6_wan_ipaddr"`
+wan_addr=`echo $wan_addr_temp | sed 's/\/64//'`
+
+is_chinamobile_pd_diff=`nv get pd_chinamobile_enable`
+pd_chinamobile=`nv get pd_chinamobile`
+#prefix_len=`nv get pd_len_chinamobile`
+prefix_len=`nv get $wan_if"_ipv6_prefix_len"`
+
+b_dhcpv6stateEnabled=`nv get dhcpv6stateEnabled`
+b_dhcpv6statelessEnabled=`nv get dhcpv6statelessEnabled`
+b_dhcpv6statePdEnabled=`nv get dhcpv6statePdEnabled`
+
+############# »ñȡĬÈÏÍø¿ÚÃûÏà¹ØÐÅÏ¢ ############
+get_default_wan_info()
+{
+ wan_if_name=$1
+ wan_if=$defwan6_if
+ wan_addr=`nv get $wan_if"_ipv6_ip"`
+ def_cid=`nv get default_cid`
+
+ if [ "$1" == "pswan" ]; then
+ ipaddr_type=`nv get "pdp_act_type"$def_cid`
+ elif [ "$1" == "ethwan" ]; then
+ ipaddr_type=`nv get eth_act_type`
+ elif [ "$1" == "wifiwan" ]; then
+ ipaddr_type=`nv get wifi_act_type`
+ fi
+
+ #ÐèÒªÓõ½Ïà¹ØÅäÖÃÎļþ
+ dhcp6s_conf=$path_conf/dhcp6s_$wan_if.conf
+ radvd_conf=$path_conf/radvd_$wan_if.conf
+ radvd_pidfile=$path_tmp/radvd_$wan_if.pid
+ ndp_log=$path_conf/ndp_$wan_if.log
+
+ echo "test: default_wan_if_info = $wan_if, wan_addr:$wan_addr"
+}
+
+#############linkup dhcpserver set############
+linkup_add_dns_to_dhcp6s_radvd_conf()
+{
+ # ipv6 dns set
+ ipv6_dns_mode=`nv get $wan_if_name"_ipv6_dns_mode"`
+ echo "ipv6_dns_mode:$ipv6_dns_mode"
+ echo "the input param is $1"
+
+ ipv6_prefer_dns=""
+ ipv6_standby_dns=""
+ if [ "-$ipv6_dns_mode" = "-auto" ];then
+
+ ipv6_pridns_auto=`nv get $wan_if"_ipv6_pridns_auto"`
+ ipv6_secdns_auto=`nv get $wan_if"_ipv6_secdns_auto"`
+
+ if [ -n "$ipv6_pridns_auto" ] && [ "-$ipv6_pridns_auto" != "-::" ] && [ "-$ipv6_pridns_auto" != "-::0" ];then
+ ipv6_prefer_dns=$ipv6_pridns_auto
+ fi
+
+ if [ -n "$ipv6_secdns_auto" ] && [ "-$ipv6_secdns_auto" != "-::" ] && [ "-$ipv6_secdns_auto" != "-::0" ];then
+ ipv6_standby_dns=$ipv6_secdns_auto
+ fi
+
+ elif [ "-$ipv6_dns_mode" = "-manual" ];then
+ #¶ÔÓÚÊÖ¶¯DNS£¬Ò³ÃæÖ»ÄÜÉèÖõ½pswan¿Ú£¬ËùÒÔ¶ÔÓÚÊÖ¶¯dns£¬²»¹ÜºÎÖÖģʽ£¬ÔÝʱ¶¼È¡ÓÃpswanµÄÊÖ¶¯dnsµØÖ·
+ ipv6_pridns_manual=`nv get $pswan_if_name"_ipv6_pridns_manual"`
+ ipv6_secdns_manual=`nv get $pswan_if_name"_ipv6_secdns_manual"`
+
+ if [ -n "$ipv6_pridns_manual" ] && [ "-$ipv6_pridns_manual" != "-::" ] && [ "-$ipv6_pridns_manual" != "-::0" ];then
+ ipv6_prefer_dns=$ipv6_pridns_manual
+ fi
+
+ if [ -n "$ipv6_secdns_manual" ] && [ "-$ipv6_secdns_manual" != "-::" ] && [ "-$ipv6_secdns_manual" != "-::0" ];then
+ ipv6_standby_dns=$ipv6_secdns_manual
+ fi
+
+ fi
+
+ if [ "-$ipv6_prefer_dns" == "-" -a "-$ipv6_standby_dns" == "-" ]; then
+ return
+ else
+ if [ -n "$1" ] && [ "$1" == "dhcp6s" ] ;then
+ echo -e "\toption dns_servers $ipv6_prefer_dns $ipv6_standby_dns;" >> $dhcp6s_conf
+ elif [ -n "$1" ] && [ "$1" == "radvd" ] ;then
+ # del last line
+ sed -i '$d' $radvd_conf
+ echo -e "\tRDNSS $ipv6_prefer_dns $ipv6_standby_dns\n\t{" >> $radvd_conf
+ echo -e "\t\tAdvRDNSSPreference 15;" >> $radvd_conf
+ echo -e "\t\tAdvRDNSSOpen on;" >> $radvd_conf
+ echo -e "\t};\n};" >> $radvd_conf
+ fi
+ fi
+}
+
+linkup_dhcpv6_server_set()
+{
+ dhcp6s_kill
+ rm -fr $dhcp6s_conf
+
+ if [ "-$is_chinamobile_pd_diff" = "-1" ] ; then
+ nv set pd_chinamobile=""
+ nv set pd_len_chinamobile=""
+ dhcp6c -dDf -z $wan_if &
+ for i in a b c d e; do
+ #sleep 1;
+ pd_chinamobile=`nv get pd_chinamobile`
+ if [ "-$pd_chinamobile" == "-" ]; then
+ echo "no pd get";
+ else
+ echo "pd get";
+ break;
+ fi
+ done
+ pd_chinamobile=`nv get pd_chinamobile`
+ prefix_len=`nv get pd_len_chinamobile`
+ if [ "-$pd_chinamobile" == "-" ]; then
+ dhcp6c_kill
+ prefix_len="64"
+ else
+ wan_addr=$pd_chinamobile
+ # here br0 is bind by dhcp6c, need to kill then run dhcp6s£¬need to fix
+ dhcp6c_kill
+ #sleep 1
+ fi
+ else
+ if [ "-$prefix_len" == "-" ]; then
+ prefix_len=64
+ fi
+ echo "not chinamobile"
+ fi
+
+ ipv6_addr_conver "$wan_addr" "$wan_if"
+ dhcpv6_start=`nv get $wan_if"_dhcpv6_start"`
+ dhcpv6_end=`nv get $wan_if"_dhcpv6_end"`
+ prefix_info_temp=`nv get $wan_if"_ipv6_prefix_info"`
+ echo -e "interface br0 {" > $dhcp6s_conf
+ #dhcpv6 pd
+ if [ "-$b_dhcpv6statePdEnabled" = "-1" ];then
+ echo -e "\tserver-preference 255;\n\trenew-time 6000;" >> $dhcp6s_conf
+ echo -e "\trebind-time 9000;\n\tprefer-life-time 1300;" >> $dhcp6s_conf
+ echo -e "\tvalid-life-time 2000;\n\tallow rapid-commit;" >> $dhcp6s_conf
+ echo -e "\tlink br0 {\n\t\tallow unicast;\n\t\tsend unicast;" >> $dhcp6s_conf
+ echo -e "\t\tprefix $prefix_info_temp:/$prefix_len;\n\t};" >> $dhcp6s_conf
+ linkup_add_dns_to_dhcp6s_radvd_conf dhcp6s
+ echo -e "};" >> $dhcp6s_conf
+ dhcp6s -dDf -c $dhcp6s_conf $lan_if &
+ return
+ fi
+ #set up dhcpv6 addr pool
+ if [ "-$b_dhcpv6stateEnabled" = "-1" ];then
+ echo -e "\tserver-preference 255;\n\trenew-time 6000;" >> $dhcp6s_conf
+ echo -e "\trebind-time 9000;\n\tprefer-life-time 1300;" >> $dhcp6s_conf
+ echo -e "\tvalid-life-time 2000;\n\tallow rapid-commit;" >> $dhcp6s_conf
+ echo -e "\tlink br0 {\n\t\tallow unicast;\n\t\tsend unicast;" >> $dhcp6s_conf
+ echo -e "\t\tpool {\n\t\t\trange $dhcpv6_start to $dhcpv6_end/$prefix_len;" >> $dhcp6s_conf
+ echo -e "\t\t};\n\t};" >> $dhcp6s_conf
+ linkup_add_dns_to_dhcp6s_radvd_conf dhcp6s
+ echo -e "};" >> $dhcp6s_conf
+ dhcp6s -dDf -c $dhcp6s_conf $lan_if &
+ else
+ #slaac with dhcp statelessset dns info
+ if [ "-$b_dhcpv6statelessEnabled" = "-1" ];then
+ echo -e "\tlink br0 {\n\t};" >> $dhcp6s_conf
+ linkup_add_dns_to_dhcp6s_radvd_conf dhcp6s
+ echo -e "};" >> $dhcp6s_conf
+ dhcp6s -dDf -c $dhcp6s_conf $lan_if &
+ fi
+ fi
+}
+
+#############linkup radvd set############
+linkup_radvd_set()
+{
+ echo "enter linkup_radvd_set "
+
+ if [ "-$is_chinamobile_pd_diff" = "-1" ] ; then
+ pd_chinamobile=`nv get pd_chinamobile`
+ prefix_len=`nv get pd_len_chinamobile`
+ if [ "-$pd_chinamobile" == "-" ]; then
+ prefix_len="64"
+ else
+ wan_addr=$pd_chinamobile
+ fi
+ else
+ if [ "-$prefix_len" == "-" ]; then
+ prefix_len=64
+ fi
+ echo "not chinamobile"
+ fi
+
+ rm -rf $radvd_conf
+ #wangming delete
+ if [ "-$b_dhcpv6stateEnabled" = "-1" -o "-$b_dhcpv6statePdEnabled" = "-1"];then
+ echo -e "interface br0\n{\n\tAdvSendAdvert on;" > $radvd_conf
+ echo -e "\tAdvManagedFlag on;\n};" >> $radvd_conf
+ radvd_kill
+ rm -rf $radvd_pidfile
+ radvd -d 3 -C $radvd_conf -p $radvd_pidfile &
+ echo "leave linkup_radvd_set "
+ return
+ fi
+
+ cp $path_ro/radvd_template.conf $radvd_conf
+
+ sed -i -e 's/#ipv6_wan_addr#\/64/#ipv6_wan_addr#\/#prefix_len#/g' $radvd_conf
+ sed -i -e s/#ipv6_wan_addr#/$wan_addr/g $radvd_conf
+ sed -i -e s/#prefix_len#/$prefix_len/g $radvd_conf
+ sed -i -e s/#adv_switch#/on/g $radvd_conf
+
+ echo "copy radvd_template.conf"
+ echo "wan_addr:$wan_addr"
+ echo "prefix_len:$prefix_len"
+
+#slaac with dns info
+ if [ "-$b_dhcpv6statelessEnabled" = "-1" ];then
+ echo "use dhcpv6stateless for dns"
+ else
+ sed -i -e 's/AdvOtherConfigFlag on;/AdvOtherConfigFlag off;/g' $radvd_conf
+ linkup_add_dns_to_dhcp6s_radvd_conf radvd
+ fi
+
+ radvd_kill
+ #sleep 1
+ rm -rf $radvd_pidfile
+ radvd -d 3 -C $radvd_conf -p $radvd_pidfile &
+
+ echo "leave linkup_radvd_set "
+}
+
+#############linkup resolve config set############
+linkup_route_set()
+{
+ default_gw_addr_temp=`nv get $wan_if"_ipv6_gw"`
+ echo "ipv6_wan_default_gw = $default_gw_addr_temp"
+
+ echo 0 > /proc/sys/net/ipv6/conf/all/forwarding
+
+ if [ -n "$default_gw_addr_temp" -a "-$default_gw_addr_temp" != "-::" ] ; then
+ ip -6 route add default via $default_gw_addr_temp dev $defwan6_rel
+ else
+ ip -6 route add default dev $defwan6_rel
+ fi
+
+ nv set ipv6_br0_addr="::"
+
+ ipv6_addr_conver "$wan_addr" "$wan_if"
+
+ ipv6_br0_addr_tmp=`nv get ipv6_br0_addr`
+ echo "ipv6_br0_addr_tmp = $ipv6_br0_addr_tmp"
+
+ ip -6 addr add $ipv6_br0_addr_tmp/64 dev br0
+
+ #enable ipv6 packet forwarding
+ #sleep 3
+ echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
+
+ #enable ipv6 neigh discovery proxy
+ echo 1 > /proc/sys/net/ipv6/conf/all/proxy_ndp
+
+ ndp_kill
+ zte_ndp -a -s br0 -d "$wan_if" -l $ndp_log &
+
+}
+
+############ipv6 shell entry#################
+get_default_wan_info $1
+#linkup_route_set
+linkup_dhcpv6_server_set
+linkup_radvd_set
+#linkup_resolve_config_set #ÓÉzte_router¶ÔIPv4£¬IPv6ͳ¼Æ½øÐÐdnsµÄÏà¹Ø²Ù×÷
+
diff --git a/rootfs/sbin/watchdog b/rootfs/sbin/watchdog
new file mode 120000
index 0000000..3cfb6d5
--- /dev/null
+++ b/rootfs/sbin/watchdog
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/watchdog
\ No newline at end of file
diff --git a/rootfs/sbin/zcip b/rootfs/sbin/zcip
new file mode 120000
index 0000000..e8af737
--- /dev/null
+++ b/rootfs/sbin/zcip
@@ -0,0 +1 @@
+/usr/lib/busybox/sbin/zcip
\ No newline at end of file
diff --git a/rootfs/sbin/zte_watch_devid_qrcode.sh b/rootfs/sbin/zte_watch_devid_qrcode.sh
new file mode 100755
index 0000000..781c4c5
--- /dev/null
+++ b/rootfs/sbin/zte_watch_devid_qrcode.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+##
+# $Id: zte_qrcode_create.sh,v 0.0.0.1 2013.05.06 liuweipeng Exp $
+#
+# usage: zte_qrcode_create.sh
+#
+
+#wifi_ssid_qrcode_name='/usr/zte_web/web/img/qrcode_ssid_wifikey.png'
+#wifi_ssid_qrcode_name_bmp='/usr/zte/zte_conf/mmi/mmi_image/ssid_wifikey.bmp'
+
+#multi_wifi_ssid_qrcode_name='/usr/zte_web/web/img/qrcode_multi_ssid_wifikey.png'
+#multi_wifi_ssid_qrcode_name_bmp='/usr/zte/zte_conf/mmi/mmi_image/multi_ssid_wifikey.bmp'
+
+#local_domain_qrcode_name='/usr/zte_web/web/img/qrcode_local_domaind.png'
+#local_domain_qrcode_name_bmp='/usr/zte/zte_conf/mmi/mmi_image/local_domaind.bmp'
+
+reg_id_text=`nv get reg_id`
+dl_url_text=`nv get app_dl_url`
+
+device_qrcode_name="/etc_rw/zcore/system/qrcode_devid.png"
+appdl_qrcode_name="/etc_rw/zcore/system/qrcode_appdl.png"
+
+
+echo "device_qrcode_name=$device_qrcode_name"
+
+echo "enter the device id qrcode create"
+
+
+rm -rf $device_qrcode_name
+rm -rf $appdl_qrcode_name
+
+qrencode -o $appdl_qrcode_name -m 1 -s 7 "$dl_url_text"
+qrencode -o $device_qrcode_name -m 1 -s 7 "$reg_id_text"
+
+
diff --git a/rootfs/sbin/zxic_parse_squashfs_verity b/rootfs/sbin/zxic_parse_squashfs_verity
new file mode 100755
index 0000000..30ac4e0
--- /dev/null
+++ b/rootfs/sbin/zxic_parse_squashfs_verity
Binary files differ
diff --git a/rootfs/sbin/zxic_qrcode_create.sh b/rootfs/sbin/zxic_qrcode_create.sh
new file mode 100755
index 0000000..879c76b
--- /dev/null
+++ b/rootfs/sbin/zxic_qrcode_create.sh
@@ -0,0 +1,213 @@
+#!/bin/sh
+##
+# $Id: zxic_qrcode_create.sh,v 0.0.0.1 2013.05.06 liuweipeng Exp $
+#
+# usage: zxic_qrcode_create.sh
+#
+
+#wifi_ssid_qrcode_name='/usr/zte_web/web/img/qrcode_ssid_wifikey.png'
+#wifi_ssid_qrcode_name_bmp='/usr/zte/zte_conf/mmi/mmi_image/ssid_wifikey.bmp'
+
+#multi_wifi_ssid_qrcode_name='/usr/zte_web/web/img/qrcode_multi_ssid_wifikey.png'
+#multi_wifi_ssid_qrcode_name_bmp='/usr/zte/zte_conf/mmi/mmi_image/multi_ssid_wifikey.bmp'
+
+#local_domain_qrcode_name='/usr/zte_web/web/img/qrcode_local_domaind.png'
+#local_domain_qrcode_name_bmp='/usr/zte/zte_conf/mmi/mmi_image/local_domaind.bmp'
+
+ROOT=`nv get wifi_root_dir`
+
+wifi_ssid_qrcode_name="$ROOT/wifi/qrcode_ssid_wifikey.png"
+wifi_ssid_qrcode_name_bmp="$ROOT/wifi/ssid_wifikey.bmp"
+
+wifi_5g_ssid_qrcode_name="$ROOT/wifi/qrcode_ssid_wifikey_5g.png"
+wifi_5g_ssid_qrcode_name_bmp="$ROOT/wifi/ssid_wifikey_5g.bmp"
+
+multi_wifi_ssid_qrcode_name="$ROOT/wifi/qrcode_multi_ssid_wifikey.png"
+multi_wifi_ssid_qrcode_name_bmp="$ROOT/wifi/multi_ssid_wifikey.bmp"
+
+local_domain_qrcode_name="$ROOT/wifi/qrcode_local_domaind.png"
+local_domain_qrcode_name_bmp="$ROOT/wifi/local_domaind.bmp"
+
+#for luci
+target_web_dir="/www/luci-static/resources/icons/"
+#for vue
+target_vue_web_dir="/etc_ro/web/icons/"
+
+
+echo "wifi_ssid_qrcode_name=$wifi_ssid_qrcode_name"
+echo "wifi_ssid_qrcode_name_bmp=$wifi_ssid_qrcode_name_bmp"
+############zte qrcode create shell entry#################
+
+case $1 in
+ "wifi_create")
+
+ echo "enter the wifi_create function"
+
+ rm -rf $wifi_ssid_qrcode_name
+ rm -rf $wifi_ssid_qrcode_name_bmp
+
+ #wifi_ssid_name=`zte_nvc_apps read SSID1` # wifi ssid
+ #wifi_auth_mode=`zte_nvc_apps read AuthMode` # wifi auth mode
+ #wifi_encry_type=`zte_nvc_apps read EncrypType` #wifi encry type
+ #wifi_password=`zte_nvc_apps read WPAPSK1` #wifi password
+ wifi_ssid_name=`nv get SSID1` # wifi ssid
+ wifi_auth_mode=`nv get AuthMode` # wifi auth mode
+ wifi_encry_type=`nv get EncrypType` # wifi encry type
+ auth_wpa=`echo $wifi_auth_mode | sed -n '/WPA/p'`
+ auth_wpa_1=`echo $wifi_auth_mode | sed -n '/WPA3/p'`
+ if [ -n "$auth_wpa" ];then # wpa
+ wifi_password=`nv get WPAPSK1` # wifi password
+ if [ -n "$auth_wpa_1" ];then
+ wifi_T="SAE"
+ else
+ wifi_T="WPA"
+ fi
+ qrcode_text='WIFI:T:'$wifi_T';S:'$wifi_ssid_name';P:'$wifi_password';'
+ echo "qrcode_text = $qrcode_text"
+ elif [ "$wifi_encry_type" = "WEP" -o "$wifi_auth_mode" = "SHARED" -o "$wifi_auth_mode" = "WEPAUTO" ];then
+ defaultKeyID=`nv get DefaultKeyID`
+ if [ "$defaultKeyID" = "0" ];then
+ wifi_password=`nv get Key1Str1`
+ elif [ "$defaultKeyID" = "1" ];then
+ wifi_password=`nv get Key2Str1`
+ elif [ "$defaultKeyID" = "2" ];then
+ wifi_password=`nv get Key3Str1`
+ elif [ "$defaultKeyID" = "3" ];then
+ wifi_password=`nv get Key4Str1`
+ else
+ wifi_password=`nv get Key1Str1`
+ fi
+ qrcode_text='WIFI:T:WEP;S:'$wifi_ssid_name';P:'$wifi_password';'
+ echo "qrcode_text = $qrcode_text"
+ elif [ "$wifi_encry_type" = "NONE" ];then
+ qrcode_text='WIFI:S:'$wifi_ssid_name';'
+ echo "qrcode_text = $qrcode_text"
+ fi
+
+ qrencode -o $wifi_ssid_qrcode_name -m 10 -s 2 "$qrcode_text"
+ png2bmp -O $wifi_ssid_qrcode_name_bmp $wifi_ssid_qrcode_name
+
+ cp $wifi_ssid_qrcode_name $target_web_dir
+ cp $wifi_ssid_qrcode_name $target_vue_web_dir
+
+#5g
+ rm -rf $wifi_5g_ssid_qrcode_name
+ rm -rf $wifi_5g_ssid_qrcode_name_bmp
+
+ #wifi_ssid_name=`zte_nvc_apps read SSID1` # wifi ssid
+ #wifi_auth_mode=`zte_nvc_apps read AuthMode` # wifi auth mode
+ #wifi_encry_type=`zte_nvc_apps read EncrypType` #wifi encry type
+ #wifi_password=`zte_nvc_apps read WPAPSK1` #wifi password
+ wifi_ssid_name=`nv get SSID1_5g` # wifi ssid
+ wifi_auth_mode=`nv get AuthMode_5g` # wifi auth mode
+ wifi_encry_type=`nv get EncrypType_5g` # wifi encry type
+ auth_wpa=`echo $wifi_auth_mode | sed -n '/WPA/p'`
+ auth_wpa_1=`echo $wifi_auth_mode | sed -n '/WPA3/p'`
+ if [ -n "$auth_wpa" ];then # wpa
+ wifi_password=`nv get WPAPSK1_5g` # wifi password
+ if [ -n "$auth_wpa_1" ];then
+ wifi_T="SAE"
+ else
+ wifi_T="WPA"
+ fi
+ qrcode_text='WIFI:T:'$wifi_T';S:'$wifi_ssid_name';P:'$wifi_password';'
+ echo "qrcode_text = $qrcode_text"
+ elif [ "$wifi_encry_type" = "WEP" -o "$wifi_auth_mode" = "SHARED" -o "$wifi_auth_mode" = "WEPAUTO" ];then
+ defaultKeyID=`nv get DefaultKeyID_5g`
+ if [ "$defaultKeyID" = "0" ];then
+ wifi_password=`nv get Key1Str1_5g`
+ elif [ "$defaultKeyID" = "1" ];then
+ wifi_password=`nv get Key2Str1_5g`
+ elif [ "$defaultKeyID" = "2" ];then
+ wifi_password=`nv get Key3Str1_5g`
+ elif [ "$defaultKeyID" = "3" ];then
+ wifi_password=`nv get Key4Str1_5g`
+ else
+ wifi_password=`nv get Key1Str1_5g`
+ fi
+ qrcode_text='WIFI:T:WEP;S:'$wifi_ssid_name';P:'$wifi_password';'
+ echo "qrcode_text = $qrcode_text"
+ elif [ "$wifi_encry_type" = "NONE" ];then
+ qrcode_text='WIFI:S:'$wifi_ssid_name';'
+ echo "qrcode_text = $qrcode_text"
+ fi
+
+ qrencode -o $wifi_5g_ssid_qrcode_name -m 10 -s 2 "$qrcode_text"
+ png2bmp -O $wifi_5g_ssid_qrcode_name_bmp $wifi_5g_ssid_qrcode_name
+
+ cp $wifi_5g_ssid_qrcode_name $target_web_dir
+ cp $wifi_5g_ssid_qrcode_name $target_vue_web_dir
+
+ ;;
+
+ "multi_wifi_create")
+ echo "enter the multi_wifi_create function"
+
+ rm -rf $multi_wifi_ssid_qrcode_name_bmp
+ rm -rf $multi_wifi_ssid_qrcode_name
+
+ #multi_wifi_ssid_name=`zte_nvc_apps read m_SSID` # multi wifi ssid
+ #multi_wifi_auth_mode=`zte_nvc_apps read m_AuthMode` #multi wifi auth mode
+ #multi_wifi_encry_type=`zte_nvc_apps read m_EncrypType` #multi wifi encry type
+ #multi_wifi_password=`zte_nvc_apps read m_WPAPSK1` #multi wifi password
+ multi_wifi_ssid_name=`nv get m_SSID` # wifi ssid
+ multi_wifi_auth_mode=`nv get m_AuthMode` # wifi auth mode
+ multi_wifi_encry_type=`nv get m_EncrypType` # wifi encry type
+ multi_wifi_password=`nv get m_WPAPSK1` # wifi password
+ auth_wpa=`echo $multi_wifi_auth_mode | sed -n '/WPA/p'`
+ auth_wpa_1=`echo $multi_wifi_auth_mode | sed -n '/WPA3/p'`
+ if [ -n "$auth_wpa" ];then # wpa
+ if [ -n "$auth_wpa_1" ];then
+ wifi_T="SAE"
+ else
+ wifi_T="WPA"
+ fi
+ qrcode_text='WIFI:T:'$wifi_T';S:'$multi_wifi_ssid_name';P:'$multi_wifi_password';'
+ echo "qrcode_text = $qrcode_text"
+ ##elif [ "$multi_wifi_encry_type" = "WEP" ];then
+ elif [ "$multi_wifi_encry_type" = "WEP" -o "$multi_wifi_auth_mode" = "SHARED" -o "$multi_wifi_auth_mode" = "WEPAUTO" ];then
+ multi_defaultKeyID=`nv get m_DefaultKeyID`
+ if [ "$multi_defaultKeyID" = "0" ];then
+ multi_wifi_password=`nv get m_Key1Str1`
+ elif [ "$multi_defaultKeyID" = "1" ];then
+ multi_wifi_password=`nv get m_Key2Str1`
+ elif [ "$multi_defaultKeyID" = "2" ];then
+ multi_wifi_password=`nv get m_Key3Str1`
+ elif [ "$multi_defaultKeyID" = "3" ];then
+ multi_wifi_password=`nv get m_Key4Str1`
+ else
+ multi_wifi_password=`nv get m_Key1Str1`
+ fi
+ qrcode_text='WIFI:T:WEP;S:'$multi_wifi_ssid_name';P:'$multi_wifi_password';'
+ echo "qrcode_text = $qrcode_text"
+ elif [ "$multi_wifi_encry_type" = "NONE" ];then
+ qrcode_text='WIFI:S:'$multi_wifi_ssid_name';'
+ echo "qrcode_text = $qrcode_text"
+ fi
+
+ qrencode -o $multi_wifi_ssid_qrcode_name -m 10 -s 2 "$qrcode_text"
+ png2bmp -O $multi_wifi_ssid_qrcode_name_bmp $multi_wifi_ssid_qrcode_name
+
+ cp $multi_wifi_ssid_qrcode_name $target_web_dir
+ cp $multi_wifi_ssid_qrcode_name $target_vue_web_dir
+ ;;
+
+ "local_domain_create")
+ echo "enter the local_url_create function"
+
+ rm -rf $local_domain_qrcode_name_bmp
+
+ local_domain_url=`zte_nvc_apps read LocalDomain` #local domain name
+ local_domain_username=`zte_nvc_apps read admin_user` #local domain username
+ local_domain_passwd=`zte_nvc_apps read admin_Password` #local domain password
+
+ qrcode_text='http://'$local_domain_url
+ echo "qrcode_text = $qrcode_text"
+
+ qrencode -o $local_domain_qrcode_name -m 10 -s 2 "$qrcode_text"
+ png2bmp -O $local_domain_qrcode_name_bmp $local_domain_qrcode_name
+
+ local_domain_qrcode_name
+
+ ;;
+esac
\ No newline at end of file