[T106][ZXW-22]7520V3SCV2.01.01.02P42U09_VEC_V0.8_AP_VEC origin source commit

Change-Id: Ic6e05d89ecd62fc34f82b23dcf306c93764aec4b
diff --git a/ap/app/Script/Makefile b/ap/app/Script/Makefile
new file mode 100755
index 0000000..2065e63
--- /dev/null
+++ b/ap/app/Script/Makefile
@@ -0,0 +1,66 @@
+

+############################################################################

+#

+# Makefile --  Build for rootfs makefile.

+#

+# Copyright (c) 2001-2004, SnapGear (www.snapgear.com)

+# Copyright (c) 2001, Lineo

+#

+# Add by zhouwei 2010-08-06 for freescale imx28 platform

+# 

+############################################################################

+CP        = cp

+ROMFS_DIR = $(ROMFSDIR)

+$(warning  CONFIG_WIFI_MODULE=$(CONFIG_WIFI_MODULE))

+.PHONY: romfs wifi

+

+ifneq ($(CONFIG_WIFI_MODULE), )

+CPWIFI=wifi

+endif

+

+$(warning  CPWIFI=$(CPWIFI))

+all:

+

+romfs: $(CPWIFI)

+	chmod +x ./scripts/*.sh

+	$(CP) -f ./scripts/*.sh $(ROMFS_DIR)/sbin/

+	#$(CP) -f ./scripts/*.txt $(ROMFS_DIR)/sbin/

+	mkdir -p $(ROMFS_DIR)/etc_ro/ 

+	$(CP) -f ./etc/*.conf $(ROMFS_DIR)/etc_ro/

+	$(CP) -f ./etc/options.auth $(ROMFS_DIR)/etc_ro/

+	$(CP) -f ./etc/options.noauth $(ROMFS_DIR)/etc_ro/

+	$(CP) -f ./etc/initchat $(ROMFS_DIR)/etc_ro/

+ifneq ($(CONFIG_USE_WEBUI_SECURITY),yes)

+	$(CP) -f ./etc/pap-secrets $(ROMFS_DIR)/etc_ro/

+	$(CP) -f ./etc/chap-secrets $(ROMFS_DIR)/etc_ro/

+endif

+ifeq ($(USE_FOTA),yes)

+	mkdir -p $(ROMFS_DIR)/recovery/sbin

+	$(CP) -f ./scripts/to_mnt_ubifs.sh $(ROMFS_DIR)/recovery/sbin/

+endif

+wifi:

+	@echo "copying wifi script"

+	

+ifeq ($(CONFIG_WIFI_MODULE), realtek)

+	@echo "copying wifi realtek script"

+	mkdir -p $(ROMFS_DIR)/etc_ro/ 

+	$(CP) -rf ./wifi/*  $(ROMFS_DIR)/etc_ro/

+ifeq ($(CONFIG_WIFI_RTL_WPA2),yes)

+	chmod +x  ./wifi_script/realtek_wpa2/*

+	$(CP) -rf ./wifi_script/realtek_wpa2/*  $(ROMFS_DIR)/sbin/

+else

+	chmod +x  ./wifi_script/realtek/*

+	$(CP) -rf ./wifi_script/realtek/*  $(ROMFS_DIR)/sbin/

+endif

+else

+	chmod +x  ./wifi_script/realtek/*

+ifeq ($(CONFIG_MIN_8M_VERSION), n)

+	$(CP) -rf ./wifi_script/realtek/zte_qrcode_create.sh  $(ROMFS_DIR)/sbin/

+else

+ifeq ($(CONFIG_MMI_LCD),yes)

+	$(CP) -rf ./wifi_script/realtek/zte_qrcode_create.sh  $(ROMFS_DIR)/sbin/

+endif

+endif

+endif

+

+

diff --git a/ap/app/Script/etc/chap-secrets b/ap/app/Script/etc/chap-secrets
new file mode 100644
index 0000000..cd2fb9b
--- /dev/null
+++ b/ap/app/Script/etc/chap-secrets
@@ -0,0 +1,3 @@
+# Secrets for authentication using CHAP
+# client	server	secret			IP addresses
+hello		*		hello			*
diff --git a/ap/app/Script/etc/initchat b/ap/app/Script/etc/initchat
new file mode 100644
index 0000000..f00a425
--- /dev/null
+++ b/ap/app/Script/etc/initchat
@@ -0,0 +1,8 @@
+AT OK
+ATE0V1 OK
+AT OK
+ATS0=0 OK
+AT OK
+ATE0V1 OK
+AT OK
+ATDT CONNECT
diff --git a/ap/app/Script/etc/miniupnpd_temp.conf b/ap/app/Script/etc/miniupnpd_temp.conf
new file mode 100644
index 0000000..f12e4f7
--- /dev/null
+++ b/ap/app/Script/etc/miniupnpd_temp.conf
@@ -0,0 +1,101 @@
+# WAN network interface
+#ext_ifname=eth0
+ext_ifname=wan0
+# if the WAN interface has several IP addresses, you
+# can specify the one to use below
+#ext_ip=
+
+# LAN network interfaces IPs / networks
+# there can be multiple listening ips for SSDP traffic.
+# should be under the form nnn.nnn.nnn.nnn/nn
+# HTTP is available on all interfaces
+# When MULTIPLE_EXTERNAL_IP is enabled, the external ip
+# address associated with the subnet follows. for example :
+listening_ip=192.168.0.1
+# port for HTTP (descriptions and SOAP) traffic. set 0 for autoselect.
+port=5000
+
+# path to the unix socket used to communicate with MiniSSDPd
+# If running, MiniSSDPd will manage M-SEARCH answering.
+# default is /var/run/minissdpd.sock
+#minissdpdsocket=/var/run/minissdpd.sock
+
+# enable NAT-PMP support (default is no)
+#enable_natpmp=yes
+
+# enable UPNP support (default is yes)
+enable_upnp=yes
+
+# chain names for netfilter (not used for pf or ipf).
+# default is MINIUPNPD for both
+#upnp_forward_chain=forwardUPnP
+#upnp_nat_chain=UPnP
+
+# lease file location
+lease_file=/etc_rw/upnp.leases
+
+# bitrates reported by daemon in bits per second
+bitrate_up=1000000
+bitrate_down=10000000
+
+# "secure" mode : when enabled, UPnP client are allowed to add mappings only
+# to their IP.
+secure_mode=yes
+#secure_mode=no
+
+# default presentation url is http address on port 80
+# If set to an empty string, no presentationURL element will appear
+# in the XML description of the device, which prevents MS Windows
+# from displaying an icon in the "Network Connections" panel.
+#presentation_url=http://www.mylan/index.php
+
+# report system uptime instead of daemon uptime
+system_uptime=yes
+
+# notify interval in seconds. default is 30 seconds.
+#notify_interval=240
+notify_interval=30
+
+# unused rules cleaning.
+# never remove any rule before this threshold for the number
+# of redirections is exceeded. default to 20
+#clean_ruleset_threshold=10
+# clean process work interval in seconds. default to 0 (disabled).
+# a 600 seconds (10 minutes) interval makes sense
+clean_ruleset_interval=600
+
+# log packets in pf
+#packet_log=no
+
+# ALTQ queue in pf
+# filter rules must be used for this to be used.
+# compile with PF_ENABLE_FILTER_RULES (see config.h file)
+#queue=queue_name1
+
+# tag name in pf
+#tag=tag_name1
+
+# make filter rules in pf quick or not. default is yes
+# active when compiled with PF_ENABLE_FILTER_RULES (see config.h file)
+#quickrules=no
+
+# uuid : generate your own with "make genuuid"
+uuid=8c45af75-17c3-461c-8198-cfa836f4bc17
+
+# serial and model number the daemon will report to clients
+# in its XML description
+serial=12345678
+model_number=#device_name#
+
+# UPnP permission rules
+# (allow|deny) (external port range) ip/mask (internal port range)
+# A port range is <min port>-<max port> or <port> if there is only
+# one port in the range.
+# ip/mask format must be nn.nn.nn.nn/nn
+# it is advised to only allow redirection of port above 1024
+# and to finish the rule set with "deny 0-65535 0.0.0.0/0 0-65535"
+allow 1024-65535 #allow_ip#/24 1024-65535
+allow 1024-65535 192.168.0.0/23 22
+allow 12345 192.168.7.113/32 54321
+deny 0-65535 0.0.0.0/0 0-65535
+
diff --git a/ap/app/Script/etc/options b/ap/app/Script/etc/options
new file mode 100644
index 0000000..7ce2c46
--- /dev/null
+++ b/ap/app/Script/etc/options
@@ -0,0 +1,16 @@
+ttyS2

+init '/sbin/chat -v -S -t 8 -d /dev/ttyS2 -f /etc_ro/initchat'

+debug

+local 192.168.2.1:192.168.2.100

+ms-dns 114.114.114.114

+nodetach

+noaccomp

+nobsdcomp

+nodeflate

+nopcomp

+novj

+novjccomp

+default-asyncmap

+auth

+persist

+ipcp-accept-local

diff --git a/ap/app/Script/etc/options.auth b/ap/app/Script/etc/options.auth
new file mode 100755
index 0000000..db0cc5a
--- /dev/null
+++ b/ap/app/Script/etc/options.auth
@@ -0,0 +1,18 @@
+#dev_name#

+logfile /var/log/pppd.log

+debug

+local 192.168.2.1:192.168.2.100

+ms-dns 114.114.114.114

+nodetach

+noaccomp

+nobsdcomp

+nodeflate

+nopcomp

+novj

+novjccomp

+default-asyncmap

+auth

+persist

+ipcp-accept-local

+ipv6 ,

+ipv6cp-restart 30

diff --git a/ap/app/Script/etc/options.noauth b/ap/app/Script/etc/options.noauth
new file mode 100755
index 0000000..e00b17f
--- /dev/null
+++ b/ap/app/Script/etc/options.noauth
@@ -0,0 +1,18 @@
+#dev_name#

+logfile /var/log/pppd.log

+debug

+local 192.168.2.1:192.168.2.100

+ms-dns 114.114.114.114

+nodetach

+noaccomp

+nobsdcomp

+nodeflate

+nopcomp

+novj

+novjccomp

+default-asyncmap

+noauth

+persist

+ipcp-accept-local

+ipv6 ,

+ipv6cp-restart 30

diff --git a/ap/app/Script/etc/pap-secrets b/ap/app/Script/etc/pap-secrets
new file mode 100644
index 0000000..ad10560
--- /dev/null
+++ b/ap/app/Script/etc/pap-secrets
@@ -0,0 +1,3 @@
+# Secrets for authentication using PAP
+# client	server	secret			IP addresses
+hello		*		hello			*
diff --git a/ap/app/Script/etc/radvd.conf b/ap/app/Script/etc/radvd.conf
new file mode 100644
index 0000000..9f602f9
--- /dev/null
+++ b/ap/app/Script/etc/radvd.conf
@@ -0,0 +1,32 @@
+interface br0
+{
+	AdvSendAdvert on;
+
+# This may be needed on some interfaces which are not active when
+# radvd starts, but becomoe available later on; see man page for details.
+
+	# IgnoreIfMissing on;
+
+#
+# These settings cause advertisements to be sent every 3-10 seconds.  This
+# range is good for 6to4 with a dynamic IPv4 address, but can be greatly
+# increased when not using 6to4 prefixes.
+#
+
+	MinRtrAdvInterval 3;
+	MaxRtrAdvInterval 10;
+
+	AdvHomeAgentFlag off;
+
+	prefix #ipv6_wan_addr#/64
+	{
+		AdvOnLink on;
+		AdvAutonomous #adv_switch#;
+		AdvRouterAddr off;
+
+		AdvValidLifetime 300;
+		AdvPreferredLifetime 120;
+	};
+
+};
+
diff --git a/ap/app/Script/etc/radvd_temp_bridge.conf b/ap/app/Script/etc/radvd_temp_bridge.conf
new file mode 100644
index 0000000..8db151d
--- /dev/null
+++ b/ap/app/Script/etc/radvd_temp_bridge.conf
@@ -0,0 +1,27 @@
+
+interface br0
+{
+	AdvSendAdvert on;
+	AdvOtherConfigFlag on;
+	MinRtrAdvInterval 30;
+	MaxRtrAdvInterval 100;
+
+	prefix #ipv6_wan_addr#/64
+	{
+		AdvOnLink on;
+		AdvAutonomous  #adv_switch#;
+		AdvRouterAddr off;
+
+		AdvValidLifetime 300;
+		AdvPreferredLifetime 120;
+	};
+	prefix #ipv6_bridge_ipaddr#/64
+	{
+		AdvOnLink on;
+		AdvAutonomous  #adv_switch#;
+		AdvRouterAddr off;
+
+		AdvValidLifetime 300;
+		AdvPreferredLifetime 120;
+	};
+};
diff --git a/ap/app/Script/etc/radvd_template.conf b/ap/app/Script/etc/radvd_template.conf
new file mode 100644
index 0000000..de8973a
--- /dev/null
+++ b/ap/app/Script/etc/radvd_template.conf
@@ -0,0 +1,18 @@
+
+interface br0
+{
+	AdvSendAdvert on;
+	AdvOtherConfigFlag on;
+	MinRtrAdvInterval 30;
+	MaxRtrAdvInterval 100;
+
+	prefix #ipv6_wan_addr#/64
+	{
+		AdvOnLink on;
+		AdvAutonomous  #adv_switch#;
+		AdvRouterAddr off;
+
+		AdvValidLifetime 300;
+		AdvPreferredLifetime 120;
+	};
+};
diff --git a/ap/app/Script/etc/udhcpd.conf b/ap/app/Script/etc/udhcpd.conf
new file mode 100644
index 0000000..1d8f42d
--- /dev/null
+++ b/ap/app/Script/etc/udhcpd.conf
@@ -0,0 +1,8 @@
+start 192.168.1.100
+end 192.168.1.200
+interface br0
+option subnet 255.255.255.0
+option dns 192.168.1.1
+option router 192.168.1.1
+option lease 86400
+lease_file /mnt/jffs2/etc/udhcpd.leases
diff --git a/ap/app/Script/etc/udhcpd.leases b/ap/app/Script/etc/udhcpd.leases
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/ap/app/Script/etc/udhcpd.leases
diff --git a/ap/app/Script/scripts/auto_dial.sh b/ap/app/Script/scripts/auto_dial.sh
new file mode 100644
index 0000000..f6508cc
--- /dev/null
+++ b/ap/app/Script/scripts/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/ap/app/Script/scripts/clat_config.sh b/ap/app/Script/scripts/clat_config.sh
new file mode 100644
index 0000000..c1a9b2b
--- /dev/null
+++ b/ap/app/Script/scripts/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/ap/app/Script/scripts/config-dns.sh b/ap/app/Script/scripts/config-dns.sh
new file mode 100644
index 0000000..5237ca3
--- /dev/null
+++ b/ap/app/Script/scripts/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/ap/app/Script/scripts/config-hostname.sh b/ap/app/Script/scripts/config-hostname.sh
new file mode 100644
index 0000000..bf4c5cc
--- /dev/null
+++ b/ap/app/Script/scripts/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/ap/app/Script/scripts/config-igmpproxy.sh b/ap/app/Script/scripts/config-igmpproxy.sh
new file mode 100644
index 0000000..353970e
--- /dev/null
+++ b/ap/app/Script/scripts/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/ap/app/Script/scripts/config-parents.sh b/ap/app/Script/scripts/config-parents.sh
new file mode 100644
index 0000000..b38ff67
--- /dev/null
+++ b/ap/app/Script/scripts/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/ap/app/Script/scripts/config-udhcpd.sh b/ap/app/Script/scripts/config-udhcpd.sh
new file mode 100644
index 0000000..dfbd2c1
--- /dev/null
+++ b/ap/app/Script/scripts/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/ap/app/Script/scripts/customer_type.sh b/ap/app/Script/scripts/customer_type.sh
new file mode 100644
index 0000000..aa3a7d4
--- /dev/null
+++ b/ap/app/Script/scripts/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/ap/app/Script/scripts/ddns.sh b/ap/app/Script/scripts/ddns.sh
new file mode 100644
index 0000000..baac6c0
--- /dev/null
+++ b/ap/app/Script/scripts/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/ap/app/Script/scripts/defwan_set.sh b/ap/app/Script/scripts/defwan_set.sh
new file mode 100644
index 0000000..bac6f8f
--- /dev/null
+++ b/ap/app/Script/scripts/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/ap/app/Script/scripts/firewall_init.sh b/ap/app/Script/scripts/firewall_init.sh
new file mode 100644
index 0000000..b28f885
--- /dev/null
+++ b/ap/app/Script/scripts/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/ap/app/Script/scripts/fota_release_space.sh b/ap/app/Script/scripts/fota_release_space.sh
new file mode 100755
index 0000000..dfe8908
--- /dev/null
+++ b/ap/app/Script/scripts/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 /var/log
+
+#EC 616000558980
+killall zte_mifi
+killall zte_cpe
+echo 7 >/proc/sys/vm/drop_caches
+
+#¿ÉÄÜ»¹ÒªÉ¾³ýijЩռÄÚ´æµÄÏß³Ì
+
diff --git a/ap/app/Script/scripts/gateway_send_arp.sh b/ap/app/Script/scripts/gateway_send_arp.sh
new file mode 100644
index 0000000..6a8664a
--- /dev/null
+++ b/ap/app/Script/scripts/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/ap/app/Script/scripts/get_errinfo.sh b/ap/app/Script/scripts/get_errinfo.sh
new file mode 100644
index 0000000..5ac323d
--- /dev/null
+++ b/ap/app/Script/scripts/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/ap/app/Script/scripts/getpid.sh b/ap/app/Script/scripts/getpid.sh
new file mode 100644
index 0000000..bb28f3f
--- /dev/null
+++ b/ap/app/Script/scripts/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/ap/app/Script/scripts/global.sh b/ap/app/Script/scripts/global.sh
new file mode 100755
index 0000000..f39ba94
--- /dev/null
+++ b/ap/app/Script/scripts/global.sh
@@ -0,0 +1,87 @@
+#!/bin/sh
+
+#
+#¸Ã½Å±¾ÓÃÓÚ»ñȡһЩͨÓõÄnv±äÁ¿¼°¶¨Ò幫¹²º¯ÊýʹÓÃ
+#
+
+####»ñȡͨÓÃ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
+path_tmp=`nv get path_tmp`
+path_ro=`nv get path_ro`
+
+##getLanIfName
+lan_if=`nv get lan_name`
+#echo "LanIfName=$lan_if"
+
+##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`
+
+#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/ap/app/Script/scripts/internet.sh b/ap/app/Script/scripts/internet.sh
new file mode 100755
index 0000000..b9ff044
--- /dev/null
+++ b/ap/app/Script/scripts/internet.sh
@@ -0,0 +1,116 @@
+#!/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
+
+genSysFiles()
+{
+	login=`nv get Login`
+	pass=`nv get Password`
+	echo "$login::0:0:Adminstrator:/:/bin/sh" > /etc/passwd
+	echo "$login:x:0:$login" > /etc/group
+	echo "$login:$pass" > /tmp/tmpchpw
+	chpasswd < /tmp/tmpchpw
+	rm -f /tmp/tmpchpw
+}
+user_login=`cat /etc/passwd | grep admin`
+#user_login²»´æÔÚ»òΪ¿ÕʱºòÖ´Ðк¯ÊýgenSysFiles
+[ -n "$user_login" ] || { genSysFiles;}
+
+safe_run()
+{
+    ps_tmp=`nv get path_log`"ps.tmp"
+    ps > ${ps_tmp}
+	flag=`grep -w "$1" ${ps_tmp}`
+	if [ "-${flag}" = "-" ];then
+		$1 &
+	fi
+	rm -rf ${ps_tmp}
+}
+
+#¶¯Ì¬nvÖÿÕ
+#. $path_sh/cfgnv_init.sh
+pswan=`nv get pswan`
+ethwan=`nv get ethwan`
+wifiwan=`nv get wifiwan`
+echo 0 > /proc/sys/net/ipv6/conf/$pswan"1"/accept_ra
+echo 0 > /proc/sys/net/ipv6/conf/$pswan"2"/accept_ra
+echo 0 > /proc/sys/net/ipv6/conf/$pswan"3"/accept_ra
+echo 0 > /proc/sys/net/ipv6/conf/$pswan"4"/accept_ra
+echo 0 > /proc/sys/net/ipv6/conf/$pswan"5"/accept_ra
+echo 0 > /proc/sys/net/ipv6/conf/$pswan"6"/accept_ra
+echo 0 > /proc/sys/net/ipv6/conf/$pswan"7"/accept_ra
+echo 0 > /proc/sys/net/ipv6/conf/$pswan"8"/accept_ra
+if [ "-$ethwan" != "-" ]; then
+    echo 0 > /proc/sys/net/ipv6/conf/$ethwan/accept_ra
+fi
+if [ "-$wifiwan" != "-" ]; then
+    echo 0 > /proc/sys/net/ipv6/conf/$wifiwan/accept_ra
+fi
+
+#°²È«ÒªÇó
+echo 0 > /proc/sys/net/ipv4/conf/all/send_redirects
+echo 0 > /proc/sys/net/ipv4/conf/default/send_redirects
+echo 0 > /proc/sys/net/ipv4/conf/all/accept_redirects
+echo 0 > /proc/sys/net/ipv4/conf/default/accept_redirects
+echo 0 > /proc/sys/net/ipv6/conf/all/accept_redirects
+echo 0 > /proc/sys/net/ipv6/conf/default/accept_redirects
+echo 0 > /proc/sys/net/ipv4/conf/all/secure_redirects
+echo 0 > /proc/sys/net/ipv4/conf/default/secure_redirects
+
+#EC ÉèÖÃÁ¬½Ó¸ú×Ù×î´óÖµ,·Åµ½rcÀïÃæÅäÖÃ
+#echo 2000 > /proc/sys/net/nf_conntrack_max
+echo 7200 > /proc/sys/net/netfilter/nf_conntrack_tcp_timeout_established
+
+#zte_mainctrl &
+
+#½«br_name,usblan_name´«¸øÄÚºËʵÏÖÆ½Ì¨»¯
+fast_usb=`nv get fast_usb`
+lan_enable=`nv get LanEnable`
+
+#LanEnableΪ2ʱºòûÓÐbr£¬²»ÐèҪдbr_name
+if [ "$lan_enable" != "2" ]; then
+    echo $lan_if > /proc/net/br_name
+fi
+
+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
+
+#½«²»Ö§³Ö¿ìËÙת·¢µÄЭÒé¶Ë¿ÚºÅ´«¸øÄÚºË
+nofast_port=`nv get nofast_port`
+echo "Info: set nofast_port£º$nofast_port" >> $test_log
+echo $nofast_port > /proc/net/nofast_port
+
+#SKB debug¿ª¹Ø
+skb_debug=`nv get skb_debug`
+echo "Info: set skb_debug£º$skb_debug" >> $test_log
+if [ "-$skb_debug" != "-1" ]; then
+    echo 0 > /proc/net/skb_debug_off
+fi
+
+killall -9 miniupnpd
+rm -rf $path_conf/inadyn.status
+
+#¼Ç¼½ø³Ì±»ºÎÖÖÐźÅkilledµô
+netdog -s exitsig=1
+
+#¼à¿ØÄÚºËskbÏà¹ØÐÅÏ¢µÄ×î´óÖµ
+#safe_run netmonitor
+
+#¼à¿ØÄں˵Änetlinkʼþ´æÎļþ£¬Ö§³ÖÄÚºË×Ô¶¨Òåʼþ£¬Òò»áдflash°æ±¾Ä¬ÈϹرÕ
+#safe_run event_proc
diff --git a/ap/app/Script/scripts/lan.sh b/ap/app/Script/scripts/lan.sh
new file mode 100755
index 0000000..407c47b
--- /dev/null
+++ b/ap/app/Script/scripts/lan.sh
@@ -0,0 +1,145 @@
+#!/bin/sh
+#
+# $Id: lan.sh
+#
+path_sh=`nv get path_sh`
+. $path_sh/global.sh
+
+br_set()
+{
+    br_name=$lan_if
+
+    #ÉèÖÃÍøÇÅ
+    killall -9 udhcpd
+    echo "ifconfig $br_name down...................."
+    ifconfig $br_name down
+
+    echo "brctl delbr $br_name......................"
+    brctl delbr $br_name
+
+    echo "brctl addbr $br_name......................"
+    brctl addbr $br_name 2>>$test_log
+    if [ $? -ne 0 ];then
+        echo "Error: brctl addbr $br_name failed." >> $test_log
+    fi
+    echo "brctl setfd $br_name 0.1.................."
+    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
+    echo "ifconfig lo up......................."
+    ifconfig lo up 2>>$test_log
+    if [ $? -ne 0 ];then
+        echo "Error: ifconfig lo up failed." >> $test_log
+    fi
+    echo "ifconfig $br_name up......................"
+    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
+    
+    br_node=`nv get br_node`
+
+    #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`
+    nm=`nv get lan_netmask`
+    ifconfig $lan_if $ip netmask $nm 2>>$test_log
+    if [ $? -ne 0 ];then
+        echo "Error: ifconfig $lan_if $ip netmask $nm failed." >> $test_log
+    fi
+
+    webv6_enable=`nv get webv6_enable`
+    ipv6=`nv get lan_ipv6addr`
+    if [ "x$webv6_enable" == "x1" ]; then
+        ifconfig $lan_if $ipv6
+    if [ $? -ne 0 ];then
+        echo "Error: ifconfig $lan_if $ipv6 failed." >> $test_log
+    fi
+    fi
+}
+
+#½âÎöÄÚÍøµØÖ·¡¢Íø¹ØµØÖ·Í¨¹ýproc»úÖÆ¶¯Ì¬´«µÝ¸øÄںˣ¬ÒÔ±ãÄÚºËʵÏÖ·ÀÖ¹ÄÚÍøµØÖ·Ð¹Â¶¹¦ÄÜ
+lanip_proc()
+{
+    #ipµØÖ·»»Ëã³É4×Ö½ÚÕûÐÍÊÇÍøÂç×Ö½ÚÐò£¬Òªµßµ¹ÏÂ
+    #uclinux²»Ö§³Ö×óÒÆ×Ö·û
+	ip_value=`echo "$ip" | awk -F '.' '{printf $1 + 256* $2 + 256*256* $3 + 256*256*256* $4}'`
+	nm_value=`echo "$nm" | awk -F '.' '{printf $1 + 256* $2 + 256*256* $3 + 256*256*256* $4}'`
+
+    echo $ip_value > /sys/module/lanip_filter_ipv4/parameters/lan_ipaddr
+    echo $nm_value > /sys/module/lanip_filter_ipv4/parameters/lan_netmask
+}
+
+main()
+{
+    lan_enable=`nv get LanEnable`
+    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" != "x" ]; then
+        lan_set
+    fi
+    
+    #vlanÅäÖã¬ÔÝʱ·ÅÓÚ´Ë´¦£¬1 ¿ª»úµÄʱºò²»ÐèÒª½«sw¼ÓÈëµ½ÍøÇÅÏ 
+    #2 ´Ë´¦±ØÐ뽫sw upÆðÀ´£¬Èç¹û²»upµÄ»°½«²»»áÓÐrj45ÈȲå°Îʼþ
+    sw_name=`nv get swvlan`
+    ifconfig $sw_name up
+    natenable=`nv get natenable`
+    dosenable=`nv get dosenable`
+    if [[ "x$natenable" != "x0" || "x$dosenable" != "x0" ]]; then
+        lanip_proc
+    fi
+    if [ "x$dosenable" != "x0" ]; then
+        echo 1 > /sys/module/fast_common/parameters/lan_dos_enable
+    fi
+
+
+
+
+    echo "" > $path_conf/udhcpd.leases
+
+    . $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
+
+    dnsmasq -i $lan_if -r $path_conf/resolv.conf &
+    . $path_sh/upnp.sh
+    
+	#»ñÈ¡br0µÄipv6µØÖ·
+    ipv6lanipaddrcmd="ifconfig $br_name | grep Scope:Link | sed 's/^.*addr: //g' | sed 's/\/.*$//g'"
+    ipv6lanipaddr=`eval $ipv6lanipaddrcmd`
+    nv set ipv6_lan_ipaddr=$ipv6lanipaddr
+}
+
+main
diff --git a/ap/app/Script/scripts/landev_updown.sh b/ap/app/Script/scripts/landev_updown.sh
new file mode 100644
index 0000000..8bf322e
--- /dev/null
+++ b/ap/app/Script/scripts/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/ap/app/Script/scripts/nat.sh b/ap/app/Script/scripts/nat.sh
new file mode 100644
index 0000000..1c9b82e
--- /dev/null
+++ b/ap/app/Script/scripts/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/ap/app/Script/scripts/netdog_init_set.sh b/ap/app/Script/scripts/netdog_init_set.sh
new file mode 100644
index 0000000..7087c38
--- /dev/null
+++ b/ap/app/Script/scripts/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/ap/app/Script/scripts/ppp_updown.sh b/ap/app/Script/scripts/ppp_updown.sh
new file mode 100755
index 0000000..7425a33
--- /dev/null
+++ b/ap/app/Script/scripts/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/ap/app/Script/scripts/pppd_up.sh b/ap/app/Script/scripts/pppd_up.sh
new file mode 100755
index 0000000..db1ba09
--- /dev/null
+++ b/ap/app/Script/scripts/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/ap/app/Script/scripts/pppoe_dail.sh b/ap/app/Script/scripts/pppoe_dail.sh
new file mode 100755
index 0000000..fc1269f
--- /dev/null
+++ b/ap/app/Script/scripts/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/ap/app/Script/scripts/pppoe_updown.sh b/ap/app/Script/scripts/pppoe_updown.sh
new file mode 100644
index 0000000..fbbbb6b
--- /dev/null
+++ b/ap/app/Script/scripts/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/ap/app/Script/scripts/print_errmsg.sh b/ap/app/Script/scripts/print_errmsg.sh
new file mode 100644
index 0000000..4530abd
--- /dev/null
+++ b/ap/app/Script/scripts/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/ap/app/Script/scripts/psext_down.sh b/ap/app/Script/scripts/psext_down.sh
new file mode 100755
index 0000000..b9d3877
--- /dev/null
+++ b/ap/app/Script/scripts/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/ap/app/Script/scripts/psext_down_ipv6.sh b/ap/app/Script/scripts/psext_down_ipv6.sh
new file mode 100755
index 0000000..2ce0d21
--- /dev/null
+++ b/ap/app/Script/scripts/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/ap/app/Script/scripts/psext_up.sh b/ap/app/Script/scripts/psext_up.sh
new file mode 100755
index 0000000..ecd67ba
--- /dev/null
+++ b/ap/app/Script/scripts/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/ap/app/Script/scripts/psext_up_ipv6.sh b/ap/app/Script/scripts/psext_up_ipv6.sh
new file mode 100755
index 0000000..07ef6dc
--- /dev/null
+++ b/ap/app/Script/scripts/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/ap/app/Script/scripts/psext_updown.sh b/ap/app/Script/scripts/psext_updown.sh
new file mode 100755
index 0000000..7723f5b
--- /dev/null
+++ b/ap/app/Script/scripts/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/ap/app/Script/scripts/psext_updown_ipv6.sh b/ap/app/Script/scripts/psext_updown_ipv6.sh
new file mode 100755
index 0000000..a48bd73
--- /dev/null
+++ b/ap/app/Script/scripts/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/ap/app/Script/scripts/start_telnetd.sh b/ap/app/Script/scripts/start_telnetd.sh
new file mode 100644
index 0000000..9ed0fc3
--- /dev/null
+++ b/ap/app/Script/scripts/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/ap/app/Script/scripts/start_update_app.sh b/ap/app/Script/scripts/start_update_app.sh
new file mode 100644
index 0000000..aec2890
--- /dev/null
+++ b/ap/app/Script/scripts/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/ap/app/Script/scripts/tc_tbf.sh b/ap/app/Script/scripts/tc_tbf.sh
new file mode 100644
index 0000000..a893cba
--- /dev/null
+++ b/ap/app/Script/scripts/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/ap/app/Script/scripts/to_mnt_ubifs.sh b/ap/app/Script/scripts/to_mnt_ubifs.sh
new file mode 100644
index 0000000..abaa4a9
--- /dev/null
+++ b/ap/app/Script/scripts/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/ap/app/Script/scripts/udhcpc.sh b/ap/app/Script/scripts/udhcpc.sh
new file mode 100644
index 0000000..1cdeae0
--- /dev/null
+++ b/ap/app/Script/scripts/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/ap/app/Script/scripts/upnp.sh b/ap/app/Script/scripts/upnp.sh
new file mode 100644
index 0000000..732e0a6
--- /dev/null
+++ b/ap/app/Script/scripts/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/ap/app/Script/scripts/upnp_ipt_init.sh b/ap/app/Script/scripts/upnp_ipt_init.sh
new file mode 100644
index 0000000..e942b8c
--- /dev/null
+++ b/ap/app/Script/scripts/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/ap/app/Script/scripts/upnp_ipt_remove.sh b/ap/app/Script/scripts/upnp_ipt_remove.sh
new file mode 100644
index 0000000..4cbcb1d
--- /dev/null
+++ b/ap/app/Script/scripts/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/ap/app/Script/scripts/upnp_set_listenip.sh b/ap/app/Script/scripts/upnp_set_listenip.sh
new file mode 100644
index 0000000..dcfbc4f
--- /dev/null
+++ b/ap/app/Script/scripts/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/ap/app/Script/scripts/user-config-udhcpd.sh b/ap/app/Script/scripts/user-config-udhcpd.sh
new file mode 100644
index 0000000..62eefd7
--- /dev/null
+++ b/ap/app/Script/scripts/user-config-udhcpd.sh
@@ -0,0 +1,66 @@
+#!/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"
+
+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/ap/app/Script/scripts/wan_ipv4.sh b/ap/app/Script/scripts/wan_ipv4.sh
new file mode 100755
index 0000000..e5f7446
--- /dev/null
+++ b/ap/app/Script/scripts/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/ap/app/Script/scripts/wan_ipv6.sh b/ap/app/Script/scripts/wan_ipv6.sh
new file mode 100755
index 0000000..d7045caa
--- /dev/null
+++ b/ap/app/Script/scripts/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/ap/app/Script/scripts/wan_ipv6_config.sh b/ap/app/Script/scripts/wan_ipv6_config.sh
new file mode 100755
index 0000000..1c1e278
--- /dev/null
+++ b/ap/app/Script/scripts/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/ap/app/Script/scripts/zte_watch_devid_qrcode.sh b/ap/app/Script/scripts/zte_watch_devid_qrcode.sh
new file mode 100755
index 0000000..781c4c5
--- /dev/null
+++ b/ap/app/Script/scripts/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/ap/app/Script/wifi/realtek/ath/simplecfgservice.xml b/ap/app/Script/wifi/realtek/ath/simplecfgservice.xml
new file mode 100644
index 0000000..a0ed6aa
--- /dev/null
+++ b/ap/app/Script/wifi/realtek/ath/simplecfgservice.xml
Binary files differ
diff --git a/ap/app/Script/wifi/realtek/ath/wscd.conf b/ap/app/Script/wifi/realtek/ath/wscd.conf
new file mode 100644
index 0000000..4402f39
--- /dev/null
+++ b/ap/app/Script/wifi/realtek/ath/wscd.conf
@@ -0,0 +1,75 @@
+#detail please reference config_file_README.txt

+wlan_fifo0 ="/etc_rw/wifi/realtek/wscd-wlan0.fifo"

+wlan_fifo1 ="/etc_rw/wifi/realtek/wscd-wlan1.fifo"

+

+SSID_prefix = "Reaktek_AP_"

+

+use_ie = 1

+

+# AUTH_OPEN=1, AUTH_WPAPSK=2, AUTH_SHARED=4, AUTH_WPA=8, AUTH_WPA2=0x10, AUTH_WPA2PSK=0x20

+auth_type_flags = 39

+

+# ENCRYPT_NONE=1, ENCRYPT_WEP=2, ENCRYPT_TKIP=4, ENCRYPT_AES=8

+encrypt_type_flags = 15

+

+uuid = 63041253101920061228aabbccddeeff

+device_name = "RTK_AP"

+manufacturer = "Realtek"

+manufacturerURL = "http://www.realtek.com/"

+modelURL = "http://www.realtek.com/"

+model_name = "RTL8xxx"

+model_num = "EV-2010-09-20"

+serial_num = "123456789012347"

+modelDescription = "WLAN Access Point"

+device_attrib_id = 1

+device_oui = 0050f204

+device_category_id = 6

+device_sub_category_id = 1

+

+# PASS_ID_DEFAULT=0, PASS_ID_USER=1, PASS_ID_MACHINE=2, PASS_ID_REKEY=3,

+# PASS_ID_PB=4, PASS_ID_REG=5, PASS_ID_RESERVED=6

+device_password_id = 0

+

+tx_timeout = 5

+resent_limit = 2

+reg_timeout = 120

+block_timeout = 60

+

+WPS_START_LED_GPIO_number = 2

+WPS_END_LED_unconfig_GPIO_number = 0

+WPS_END_LED_config_GPIO_number = 0

+WPS_PBC_overlapping_GPIO_number = 1

+PBC_overlapping_LED_time_out = 30

+

+

+No_ifname_for_flash_set = 0

+

+#disable_disconnect = 1

+#disable_auto_gen_ssid = 1

+#manual_key_type = 2

+#manual_key = 1234567890

+#random_key_len = 64

+#PSK_LEN = 64

+

+disable_hidden_ap = 1

+

+#SSID_prefix = "RTKAP_"

+

+button_hold_time = 1

+

+# for WPS2;if wps1.0 don't define

+# 0x2008|0x480|0x680(CONFIG_METHOD_VIRTUAL_PIN | CONFIG_METHOD_PHYSICAL_PBC | CONFIG_METHOD_VIRTUAL_PBC )

+

+config_method =  9864

+#if AP mode config by EAP-base ER or auto-generate

+#but want not apply to both band then preset the paramater to 1

+#ProfileDontBothApply = 1

+

+# value=2:deny whatever config or unconfig state.

+# value=1:deny under configured state, allow when unconfig state.

+#disable_configured_by_exReg = 1

+

+#when PIN failed number >= MaxPinFailThresHold AP will indefinitely auto-lock-down 

+#until user intervenes to unlock ; vaild value 1~10

+#MaxPinFailThresHold = 10

+

diff --git a/ap/app/Script/wifi_script/realtek/bridge.sh b/ap/app/Script/wifi_script/realtek/bridge.sh
new file mode 100644
index 0000000..3fecf65
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek/bridge.sh
@@ -0,0 +1,173 @@
+#!/bin/sh
+#
+# script file to start bridge
+#
+# Usage: bridge.sh br_interface lan1_interface wlan_interface[1]..wlan_interface[N]
+#
+
+## error code
+ERROR_SUCCESS=0
+ERROR_INVALID_PARAMETERS=1
+ERROR_NO_SUCH_DEVICE=2
+ERROR_NO_CONFIG_FILE=3
+ERROR_NO_SUCH_FILE=4
+ERROR_NO_SUCH_DIRECTORY=5
+ERROR_NULL_FILE=6
+ERROR_NET_IF_UP_FAIL=7
+ERROR_ADD_BR_FAIL=8
+ERROR_ADD_IF_FAIL=9
+
+
+if [ $# -lt 2 ]; then
+	echo "Usage: $0 br_interface lan1_interface wlan_interface ..."  >> $LOG
+	exit $ERROR_INVALID_PARAMETERS;
+fi
+
+
+ROOT=`nv get wifi_root_dir`
+LOG=$ROOT/wifi/realtek/slog
+#CUR_PATH=`pwd`
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+
+if [ -z "$WLAN_PREFIX" ]; then
+	WLAN_PREFIX=wlan
+fi
+
+LAN_PREFIX=eth
+BR_UTIL=brctl
+IFCONFIG=ifconfig
+SLEEP=sleep
+## test for to RESTART_BR be 1
+RESTART_BR=0
+RESTART_LAN=0
+RESTART_WLAN=1
+
+#set PARA for $i can't pass to function
+BR_INTF=$1
+PARA2=$2
+PARA3=$3
+PARA_ALL=$*
+
+BR_NOT_EXIST=0
+
+rtl_shutdown_net_if() {
+	if [ $BR_NOT_EXIST != 0 ]; then
+		return;
+	fi
+	
+	# shutdown network interface (ethernet, wlan)
+	for ARG in $PARA_ALL ; do
+		case $ARG in
+		$LAN_PREFIX*)
+			if [ $RESTART_LAN != 0 ]; then
+				$IFCONFIG $ARG down	
+				$BR_UTIL delif $BR_INTF $ARG 2> /dev/null
+			fi
+			;;
+		$WLAN_PREFIX*)
+			if [ $RESTART_WLAN != 0 ]; then
+				$IFCONFIG $ARG down	
+				$BR_UTIL delif $BR_INTF $ARG 2> /dev/null
+			fi
+			;;
+		*)
+			;;
+		esac
+	done
+}
+
+rtl_enable_net_if() {
+	# Enable network interface (Ethernet, wlan, WDS, bridge)
+	if [ $RESTART_BR != 0 ]; then
+		echo 'Setup bridge...'  >> $LOG
+		if [ $BR_NOT_EXIST != 0 ]; then
+			$BR_UTIL addbr $BR_INTF
+			if [ $? != 0 ]; then
+				echo "Failed: $BR_UTIL addbr $BR_INTF"
+				exit $ERROR_ADD_BR_FAIL;
+			fi
+		fi
+		#$BR_UTIL setfd $BR_INTF 0
+		#$BR_UTIL stp $BR_INTF 0
+	fi
+	#IP_ADDR=`cat $CONFIG_ROOT_DIR/ip_addr`
+	#SUBNET_MASK=`cat $CONFIG_ROOT_DIR/net_mask`
+	#$IFCONFIG $BR_INTF $IP_ADDR netmask $SUBNET_MASK
+	
+	#Add lan port to bridge interface
+	if [ $RESTART_LAN != 0 ]; then
+		for ARG in $PARA_ALL ; do
+			case $ARG in
+			$LAN_PREFIX*)
+				$BR_UTIL addif $BR_INTF $ARG 2> /dev/null
+				$IFCONFIG $ARG  0.0.0.0
+				;;
+			*)
+				;;
+			esac
+		done
+	fi
+	
+	if [ $RESTART_WLAN != 0 ]; then
+		for ARG in $PARA_ALL ; do
+			case $ARG in
+			$WLAN_PREFIX*)
+				CONFIG_DIR=$CONFIG_ROOT_DIR/$ARG
+				WLAN_DISABLED_VALUE=`cat $CONFIG_DIR/wlan_disabled`
+				echo "$CONFIG_DIR/wlan_disabled = $WLAN_DISABLED_VALUE " >> $LOG
+				
+				ISUP=`$IFCONFIG $ARG | grep UP`
+				if [ "$WLAN_DISABLED_VALUE" = 0  -a  "$ISUP" = "" ]; then
+				
+					echo "$IFCONFIG $ARG up"  >> $LOG
+					$IFCONFIG $ARG up					
+					if [ $? != 0 ]; then
+						echo "$IFCONFIG $ARG up failed "  >> $LOG
+						exit $ERROR_NET_IF_UP_FAIL;
+					fi
+				
+				
+					if [ "$ARG" != "wlan0" -a "$ARG" != "wlan0-vxd" ]; then
+						HAS_BEEN_ADDED=`$BR_UTIL show | grep $ARG`
+						if [ ! -z "$HAS_BEEN_ADDED" ]; then
+							echo "$ARG  has been added to $BR_UTIL :: $HAS_BEEN_ADDED"  >> $LOG
+						else
+							echo "$ARG  has not been added to $BR_UTIL :: $HAS_BEEN_ADDED"  >> $LOG
+							echo "$BR_UTIL addif $BR_INTF $ARG" >> $LOG
+							$BR_UTIL addif $BR_INTF $ARG 2> /dev/null
+							
+							if [ $? != 0 ]; then
+								echo "Failed: $BR_UTIL addif $BR_INTF $ARG"  >> $LOG
+								exit $ERROR_ADD_IF_FAIL;
+							fi
+					
+						fi
+						
+
+						#IP_ADDR=`cat $CONFIG_DIR/ip_addr`
+						#$IFCONFIG $ARG $IP_ADDR
+						$IFCONFIG $ARG 0.0.0.0
+					fi
+
+					#$SLEEP 1
+				fi
+				;;
+			*)
+				;;
+			esac
+		done
+	fi
+}
+#end of rtl_enable_net_if
+
+rtl_bridge() {
+	BR_NOT_EXIST=`$IFCONFIG $BR_INTF > /dev/null 2>&1; echo $?`
+	if [ "$PARA3" != "null" ]; then
+		#rtl_shutdown_net_if
+		rtl_enable_net_if
+	fi
+}
+
+
+rtl_bridge
+
diff --git a/ap/app/Script/wifi_script/realtek/bridge1.sh b/ap/app/Script/wifi_script/realtek/bridge1.sh
new file mode 100644
index 0000000..0167595
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek/bridge1.sh
@@ -0,0 +1,157 @@
+#!/bin/sh
+#
+# script file to start bridge
+#
+# Usage: bridge.sh br_interface lan1_interface wlan_interface[1]..wlan_interface[N]
+#
+
+## error code
+ERROR_SUCCESS=0
+ERROR_INVALID_PARAMETERS=1
+ERROR_NO_SUCH_DEVICE=2
+ERROR_NO_CONFIG_FILE=3
+ERROR_NO_SUCH_FILE=4
+ERROR_NO_SUCH_DIRECTORY=5
+ERROR_NULL_FILE=6
+ERROR_NET_IF_UP_FAIL=7
+ERROR_ADD_BR_FAIL=8
+ERROR_ADD_IF_FAIL=9
+
+
+if [ $# -lt 2 ]; then
+	echo "Usage: $0 br_interface lan1_interface wlan_interface ..."  >> $LOG
+	exit $ERROR_INVALID_PARAMETERS;
+fi
+
+
+ROOT=`nv get wifi_root_dir`
+LOG=$ROOT/wifi/realtek/slog
+#CUR_PATH=`pwd`
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+
+if [ -z "$WLAN_PREFIX" ]; then
+	WLAN_PREFIX=wlan
+fi
+
+LAN_PREFIX=eth
+BR_UTIL=brctl
+IFCONFIG=ifconfig
+SLEEP=sleep
+## test for to RESTART_BR be 1
+RESTART_BR=0
+RESTART_LAN=0
+RESTART_WLAN=1
+
+#set PARA for $i can't pass to function
+BR_INTF=$1
+PARA2=$2
+PARA3=$3
+PARA_ALL=$*
+
+BR_NOT_EXIST=0
+
+rtl_shutdown_net_if() {
+	if [ $BR_NOT_EXIST != 0 ]; then
+		return;
+	fi
+	
+	# shutdown network interface (ethernet, wlan)
+	for ARG in $PARA_ALL ; do
+		case $ARG in
+		$LAN_PREFIX*)
+			if [ $RESTART_LAN != 0 ]; then
+				$IFCONFIG $ARG down	
+				$BR_UTIL delif $BR_INTF $ARG 2> /dev/null
+			fi
+			;;
+		$WLAN_PREFIX*)
+			if [ $RESTART_WLAN != 0 ]; then
+				$IFCONFIG $ARG down	
+				$BR_UTIL delif $BR_INTF $ARG 2> /dev/null
+			fi
+			;;
+		*)
+			;;
+		esac
+	done
+}
+
+rtl_enable_net_if() {
+	# Enable network interface (Ethernet, wlan, WDS, bridge)
+	if [ $RESTART_BR != 0 ]; then
+		echo 'Setup bridge...'  >> $LOG
+		if [ $BR_NOT_EXIST != 0 ]; then
+			$BR_UTIL addbr $BR_INTF
+			if [ $? != 0 ]; then
+				echo "Failed: $BR_UTIL addbr $BR_INTF"
+				exit $ERROR_ADD_BR_FAIL;
+			fi
+		fi
+		#$BR_UTIL setfd $BR_INTF 0
+		#$BR_UTIL stp $BR_INTF 0
+	fi
+	#IP_ADDR=`cat $CONFIG_ROOT_DIR/ip_addr`
+	#SUBNET_MASK=`cat $CONFIG_ROOT_DIR/net_mask`
+	#$IFCONFIG $BR_INTF $IP_ADDR netmask $SUBNET_MASK
+	
+	#Add lan port to bridge interface
+	if [ $RESTART_LAN != 0 ]; then
+		for ARG in $PARA_ALL ; do
+			case $ARG in
+			$LAN_PREFIX*)
+				$BR_UTIL addif $BR_INTF $ARG 2> /dev/null
+				$IFCONFIG $ARG  0.0.0.0
+				;;
+			*)
+				;;
+			esac
+		done
+	fi
+	
+	if [ $RESTART_WLAN != 0 ]; then
+		for ARG in $PARA_ALL ; do
+			case $ARG in
+			$WLAN_PREFIX*)
+				CONFIG_DIR=$CONFIG_ROOT_DIR/$ARG
+				WLAN_DISABLED_VALUE=`cat $CONFIG_DIR/wlan_disabled`
+				if [ "$WLAN_DISABLED_VALUE" = 0 ]; then
+				
+				
+					echo "$IFCONFIG $ARG up"  >> $LOG
+					$IFCONFIG $ARG up
+					if [ $? != 0 ]; then
+						echo "Failed: $IFCONFIG $ARG up" >> $LOG
+						exit $ERROR_NET_IF_UP_FAIL;
+					fi
+				
+					echo "$BR_UTIL addif $BR_INTF $ARG" >> $LOG
+					$BR_UTIL addif $BR_INTF $ARG 2> /dev/null
+					if [ $? != 0 ]; then
+						echo "Failed: $BR_UTIL addif $BR_INTF $ARG" >> $LOG
+						exit $ERROR_ADD_IF_FAIL;
+					fi
+				#	IP_ADDR=`cat $CONFIG_DIR/ip_addr`
+				#	$IFCONFIG $ARG $IP_ADDR
+
+					#$SLEEP 1
+				fi
+				;;
+			*)
+				;;
+			esac
+		done
+	fi
+}
+#end of rtl_enable_net_if
+
+rtl_bridge() {
+	BR_NOT_EXIST=`$IFCONFIG $BR_INTF > /dev/null 2>&1; echo $?`
+	if [ "$PARA3" != "null" ]; then
+		#rtl_shutdown_net_if
+		rtl_enable_net_if
+	fi
+}
+
+
+rtl_bridge
+
diff --git a/ap/app/Script/wifi_script/realtek/default_setting.sh b/ap/app/Script/wifi_script/realtek/default_setting.sh
new file mode 100755
index 0000000..75f5fa7
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek/default_setting.sh
@@ -0,0 +1,205 @@
+#!/bin/sh
+
+## error code
+
+
+ERROR_SUCCESS=0
+ERROR_INVALID_PARAMETERS=1
+
+if [ $# -lt 1 ]; then echo "Usage: $0 iface"; exit 1; fi
+ROOT=`nv get wifi_root_dir`
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+CONFIG_DIR=$CONFIG_ROOT_DIR/$1
+
+if [ ! -d "$CONFIG_ROOT_DIR" ]; then
+    mkdir -p $CONFIG_ROOT_DIR
+fi
+
+if [ ! -d "$CONFIG_DIR" ]; then
+    mkdir -p $CONFIG_DIR
+fi
+
+if [ ! -f "$CONFIG_ROOT_DIR/wifi_script_dir" ]; then
+	echo "/sbin" > $CONFIG_ROOT_DIR/wifi_script_dir
+fi
+if [ ! -f "$CONFIG_ROOT_DIR/wifi_bin_dir" ]; then
+	echo "/bin" > $CONFIG_ROOT_DIR/wifi_bin_dir
+fi
+
+WLAN_PREFIX=wlan
+
+case $1 in
+$WLAN_PREFIX[0-9]*)
+	EXT=${1#$WLAN_PREFIX[0-9]}
+	echo $EXT
+	;;
+*)
+	echo "invalid WLAN interface!($1)"
+	exit $ERROR_INVALID_PARAMETERS
+	;;
+esac
+
+echo "1" > $CONFIG_DIR/board_ver
+echo "00017301FA10" > $CONFIG_DIR/nic0_addr
+echo "00017301FA19" > $CONFIG_DIR/nic1_addr
+echo "00017301FA10" > $CONFIG_DIR/wlan0_addr
+echo "00017301FA11" > $CONFIG_DIR/wlan1_addr
+echo "00017301FA12" > $CONFIG_DIR/wlan2_addr
+echo "00017301FA13" > $CONFIG_DIR/wlan3_addr
+echo "00017301FA14" > $CONFIG_DIR/wlan4_addr
+echo "00017301FA15" > $CONFIG_DIR/wlan5_addr
+echo "00017301FA16" > $CONFIG_DIR/wlan6_addr
+echo "00017301FA17" > $CONFIG_DIR/wlan7_addr
+
+echo "0000000000000000000000000000" > $CONFIG_DIR/tx_power_cck_a
+echo "0000000000000000000000000000" > $CONFIG_DIR/tx_power_cck_b
+echo "0000000000000000000000000000" > $CONFIG_DIR/tx_power_ht40_1s_a
+echo "0000000000000000000000000000" > $CONFIG_DIR/tx_power_ht40_1s_b
+echo "0000000000000000000000000000" > $CONFIG_DIR/tx_power_diff_ht40_2s
+echo "0000000000000000000000000000" > $CONFIG_DIR/tx_power_diff_ht20
+echo "0000000000000000000000000000" > $CONFIG_DIR/tx_power_diff_ofdm
+echo "3" > $CONFIG_DIR/reg_domain
+echo "0" > $CONFIG_DIR/11n_xcap
+echo "0" > $CONFIG_DIR/led_type
+echo "0" > $CONFIG_DIR/tssi_1
+echo "0" > $CONFIG_DIR/tssi_2
+echo "0" > $CONFIG_DIR/11n_ther
+echo "0" > $CONFIG_DIR/trswitch
+
+#wlan_mode: 0: AP, 1: Clienr(network_type=0)/AD-Hoc(network_type=1) 
+echo "0" >  $CONFIG_DIR/wlan_mode
+echo "0" >  $CONFIG_DIR/wlan_disabled
+echo "family-test$EXT" > $CONFIG_DIR/ssid
+echo "3" > $CONFIG_DIR/MIMO_TR_mode
+
+#channel: default channel
+echo "1" > $CONFIG_DIR/channel
+#ch_hi: Available highest channel
+echo "0" > $CONFIG_DIR/ch_hi
+#ch_low: Available lowest channel
+echo "0" > $CONFIG_DIR/ch_low
+#band: 64: 11AC, 8: 11N, 4: 11A, 2: 11G, 1: 11B; ex. 11 = 8 + 2 + 1 => BGN mode
+echo "11" > $CONFIG_DIR/band
+#basic_rate: 15=0x0f -> bit0-bit11 as 1,2,5.5,11,6,9,12,18,24,36,48,54
+echo "15" > $CONFIG_DIR/basic_rates
+echo "4095" > $CONFIG_DIR/supported_rate
+echo "1" > $CONFIG_DIR/rate_adaptive_enabled
+echo "0" > $CONFIG_DIR/fix_rate
+echo "2347" > $CONFIG_DIR/rts_threshold
+echo "2346" > $CONFIG_DIR/frag_threshold
+echo "30000" >  $CONFIG_DIR/inactivity_time	#unit:10ms
+echo "100" > $CONFIG_DIR/beacon_interval
+echo "1" > $CONFIG_DIR/dtim_period
+echo "0" > $CONFIG_DIR/preamble_type
+echo "0" > $CONFIG_DIR/hidden_ssid
+echo "0" > $CONFIG_DIR/supported_sta_num
+echo "1" > $CONFIG_DIR/protection_disabled
+echo "0" > $CONFIG_DIR/macclone_enable
+echo "0" > $CONFIG_DIR/iapp_enable
+echo "2" > $CONFIG_DIR/wifi_specific
+echo "0" > $CONFIG_DIR/vap_enable
+echo "0" > $CONFIG_DIR/group_id
+echo "0" > $CONFIG_DIR/block_relay
+echo "1" > $CONFIG_DIR/wmm_enabled
+echo "0" > $CONFIG_DIR/guest_access
+
+echo "0" > $CONFIG_DIR/wds_enable
+echo "0" > $CONFIG_DIR/wds_pure
+
+echo "0" > $CONFIG_DIR/macac_enabled
+echo "0" > $CONFIG_DIR/macac_num
+#echo "001122334455" > $CONFIG_DIR/macac_addr1
+#echo "001234567890" > $CONFIG_DIR/macac_addr2
+
+echo "0" > $CONFIG_DIR/countrycode_enable
+echo "US" > $CONFIG_DIR/countrycode
+
+echo "0" > $CONFIG_DIR/wapiType
+echo "1234567890" > $CONFIG_DIR/wapiPsk
+echo "a" > $CONFIG_DIR/wapiPsklen
+echo "2" > $CONFIG_DIR/auth_type
+echo "0" > $CONFIG_DIR/encrypt
+echo "2" > $CONFIG_DIR/wpa_auth
+echo "87654321" > $CONFIG_DIR/wpa_psk
+echo "2" > $CONFIG_DIR/wpa_cipher
+echo "2" > $CONFIG_DIR/wpa2_cipher
+echo "0" > $CONFIG_DIR/psk_enable
+echo "86400" > $CONFIG_DIR/gk_rekey
+echo "0" > $CONFIG_DIR/psk_format
+
+echo "0" >  $CONFIG_DIR/wpa11w
+echo "0" >  $CONFIG_DIR/wpa2EnableSHA256
+
+echo "0" > $CONFIG_DIR/wep
+echo "0" > $CONFIG_DIR/wep_default_key
+echo "1" > $CONFIG_DIR/wep_key_type
+echo "0987654321" > $CONFIG_DIR/wepkey1_64_hex
+echo "0987654321" > $CONFIG_DIR/wepkey2_64_hex
+echo "0987654321" > $CONFIG_DIR/wepkey3_64_hex
+echo "0987654321" > $CONFIG_DIR/wepkey4_64_hex
+echo "3534333231" > $CONFIG_DIR/wepkey1_64_asc
+echo "3534333231" > $CONFIG_DIR/wepkey2_64_asc
+echo "3534333231" > $CONFIG_DIR/wepkey3_64_asc
+echo "3534333231" > $CONFIG_DIR/wepkey4_64_asc
+echo "12345678901234567890123456" > $CONFIG_DIR/wepkey1_128_hex
+echo "12345678901234567890123456" > $CONFIG_DIR/wepkey2_128_hex
+echo "12345678901234567890123456" > $CONFIG_DIR/wepkey3_128_hex
+echo "12345678901234567890123456" > $CONFIG_DIR/wepkey4_128_hex
+echo "31323334353637383930313233" > $CONFIG_DIR/wepkey1_128_asc
+echo "31323334353637383930313233" > $CONFIG_DIR/wepkey2_128_asc
+echo "31323334353637383930313233" > $CONFIG_DIR/wepkey3_128_asc
+echo "31323334353637383930313233" > $CONFIG_DIR/wepkey4_128_asc
+#network_type: 0 - Client mode, 1 - AD-Hoc mode
+echo "0" > $CONFIG_DIR/network_type
+echo "" > $CONFIG_DIR/default_ssid
+echo "0" > $CONFIG_DIR/power_scale
+
+# channel_bonding: BW: 0 - 20M mode, 1 - 40M, 2 - 80M mode
+echo "0" > $CONFIG_DIR/channel_bonding
+#control_sideband: BW: 0 - lower 2nd channel offset , 1 - higher 2nd channel offset
+echo "0" > $CONFIG_DIR/control_sideband
+echo "1" > $CONFIG_DIR/aggregation
+echo "1" > $CONFIG_DIR/short_gi
+echo "0" > $CONFIG_DIR/stbc_enabled
+echo "0" > $CONFIG_DIR/coexist_enabled
+
+echo "0" > $CONFIG_DIR/enable_1x
+echo "0.0.0.0" > $CONFIG_DIR/rs_ip
+echo "1812" > $CONFIG_DIR/rs_port
+echo "" > $CONFIG_DIR/rs_password
+echo "3" > $CONFIG_DIR/rs_maxretry
+echo "5" > $CONFIG_DIR/rs_interval_time
+echo "0" > $CONFIG_DIR/mac_auth_enabled
+echo "0" > $CONFIG_DIR/enable_supp_nonwpa
+echo "0" > $CONFIG_DIR/supp_nonwpa
+echo "0" > $CONFIG_DIR/wpa2_pre_auth
+
+echo "0" > $CONFIG_DIR/account_rs_enabled
+echo "0.0.0.0" > $CONFIG_DIR/account_rs_ip
+echo "0" > $CONFIG_DIR/account_rs_port
+echo "" > $CONFIG_DIR/account_rs_password
+echo "0" > $CONFIG_DIR/account_rs_update_enabled
+echo "0" > $CONFIG_DIR/account_rs_update_delay
+echo "0" > $CONFIG_DIR/account_rs_maxretry
+echo "0" > $CONFIG_DIR/account_rs_interval_time
+
+echo "0" > $CONFIG_DIR/wsc_disabled
+echo "3" > $CONFIG_DIR/wsc_method
+echo "0" > $CONFIG_DIR/wsc_configured
+echo "1" > $CONFIG_DIR/wsc_auth
+echo "1" > $CONFIG_DIR/wsc_enc
+echo "0" > $CONFIG_DIR/wsc_manual_enabled
+echo "1" > $CONFIG_DIR/wsc_upnp_enabled
+echo "1" > $CONFIG_DIR/wsc_registrar_enabled
+echo "" > $CONFIG_DIR/wsc_ssid
+echo "" > $CONFIG_DIR/wsc_psk
+echo "0" > $CONFIG_DIR/wsc_configbyextreg
+echo "27006672" > $CONFIG_DIR/wsc_pin
+
+echo "0.0.0.0" > $CONFIG_DIR/ip_addr
+echo "255.255.255.0" > $CONFIG_DIR/net_mask
+
+echo "192.168.1.250" > $CONFIG_ROOT_DIR/ip_addr
+echo "255.255.255.0" > $CONFIG_ROOT_DIR/net_mask
+echo "RTL8192CD" > $CONFIG_ROOT_DIR/device_name
+echo "0" > $CONFIG_ROOT_DIR/band2g5g_select
diff --git a/ap/app/Script/wifi_script/realtek/init.sh b/ap/app/Script/wifi_script/realtek/init.sh
new file mode 100644
index 0000000..8ac898a
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek/init.sh
@@ -0,0 +1,318 @@
+#!/bin/sh
+#
+# script file to start network
+#
+# Usage: init.sh {gw | ap} {all | bridge | wan}
+#
+
+##if [ $# -lt 2 ]; then echo "Usage: $0 {gw | ap} {all | bridge | wan}"; exit 1 ; fi
+
+
+
+## error code
+ERROR_SUCCESS=0
+ERROR_INVALID_PARAMETERS=1
+ERROR_NO_SUCH_DEVICE=2
+ERROR_NO_CONFIG_FILE=3
+ERROR_NO_SUCH_FILE=4
+ERROR_NO_SUCH_DIRECTORY=5
+ERROR_NULL_FILE=6
+ERROR_NET_IF_UP_FAIL=7
+#CUR_PATH=`pwd`
+
+
+ROOT=`nv get wifi_root_dir`
+LOG=$ROOT/wifi/realtek/slog
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+
+LOG1=$ROOT/wifi/realtek/slog1
+LOG_LIMIT=128 #128K 
+#if [ -e "$LOG"]; then
+	LOG_SIZE=`du $LOG | cut -f1`
+	if [ $LOG_SIZE -ge $LOG_LIMIT ]; then    
+		mv $LOG $LOG1
+	fi
+#else
+#	touch $LOG
+#fi
+
+SCRIPT_DIR=`cat $CONFIG_ROOT_DIR/wifi_script_dir`
+BIN_DIR=`cat $CONFIG_ROOT_DIR/wifi_bin_dir`
+
+if [ -z "$SCRIPT_DIR" ] || [ -z "$BIN_DIR" ]; then
+	wifi_startup_fail_nvset
+	exit $ERROR_NULL_FILE;
+fi
+if [ ! -d "$SCRIPT_DIR" ]; then
+	echo "ERROR: $SCRIPT_DIR specify the path NOT exist." >> $LOG
+	wifi_startup_fail_nvset
+	exit $ERROR_NO_SUCH_DIRECTORY;
+fi
+if [ ! -d "$BIN_DIR" ]; then
+	echo "ERROR: $BIN_DIR specify the path NOT exist." >> $LOG
+	wifi_startup_fail_nvset
+	exit $ERROR_NO_SUCH_DIRECTORY;
+fi
+
+#PATH=$PATH:$BIN_DIR
+#export PATH
+
+START_BRIDGE=$SCRIPT_DIR/bridge.sh
+#START_WLAN_APP=$SCRIPT_DIR/wlanapp_8192c.sh
+START_WLAN=$SCRIPT_DIR/wlan_8192c.sh
+
+WLAN_PREFIX=wlan
+
+# the following fields must manually set depends on system configuration. Not support auto config.
+ROOT_WLAN=wlan0
+ROOT_CONFIG_DIR=$CONFIG_ROOT_DIR/$ROOT_WLAN
+WLAN_INTERFACE=$ROOT_WLAN
+NUM_INTERFACE=0
+#VIRTUAL_WLAN_INTERFACE="$ROOT_WLAN-va0 $ROOT_WLAN-va1 $ROOT_WLAN-va2 $ROOT_WLAN-va3"
+#VIRTUAL_WLAN_INTERFACE="$ROOT_WLAN-vxd"
+VIRTUAL_WLAN_INTERFACE="$ROOT_WLAN-va0 $ROOT_WLAN-va1 $ROOT_WLAN-vxd"
+NUM_VIRTUAL_INTERFACE=0
+VXD_INTERFACE="$ROOT_WLAN-vxd"
+#VXD_INTERFACE=""
+ALL_WLAN_INTERFACE="$WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE $VXD_INTERFACE"
+
+BR_UTIL=brctl
+IFCONFIG=ifconfig
+IWPRIV=iwpriv
+FLASH_PROG=flash
+
+export SCRIPT_DIR
+export BIN_DIR
+export WLAN_PREFIX
+export ROOT_WLAN
+export BR_UTIL
+
+
+wifi_startup_fail_nvset() {
+	date +[%H:%M:%S]init.shenddddddddddddddddddd >> $LOG
+	echo "wlan0 start failed "  >> $LOG
+	echo " "  >> $LOG
+}
+rtl_get_available_wlan() {
+	NUM=0
+	VALID_WLAN_INTERFACE=""
+	for WLAN in $WLAN_INTERFACE ; do
+		NOT_EXIST=`$IFCONFIG $WLAN > /dev/null 2>&1; echo $?`
+		if [ $NOT_EXIST = 0 ]; then
+			CONFIG_DIR=$CONFIG_ROOT_DIR/$WLAN
+			if [ ! -d "$CONFIG_DIR" ]; then
+				echo "$CONFIG_DIR: No such directory"  >> $LOG
+				wifi_startup_fail_nvset
+				exit $ERROR_NO_CONFIG_FILE
+			fi
+			
+			if [ -z "$VALID_WLAN_INTERFACE" ]; then
+				VALID_WLAN_INTERFACE="$WLAN"
+			else
+				VALID_WLAN_INTERFACE="$VALID_WLAN_INTERFACE $WLAN"
+			fi
+			NUM=`expr $NUM + 1`
+		fi
+	done
+	
+	if [ "$NUM" = "0" ]; then
+		echo "$WLAN_INTERFACE: No such device"  >> $LOG
+		wifi_startup_fail_nvset
+		exit $ERROR_NO_SUCH_DEVICE;
+	fi
+	WLAN_INTERFACE=$VALID_WLAN_INTERFACE
+	NUM_INTERFACE=$NUM
+	
+	NUM=0
+	VALID_WLAN_INTERFACE=""
+	for WLAN in $VIRTUAL_WLAN_INTERFACE ; do
+		NOT_EXIST=`$IFCONFIG $WLAN > /dev/null 2>&1; echo $?`
+		if [ $NOT_EXIST = 0 ]; then
+			CONFIG_DIR=$CONFIG_ROOT_DIR/$WLAN
+			if [ ! -d "$CONFIG_DIR" ]; then
+				echo "$CONFIG_DIR: No such directory"  >> $LOG
+				wifi_startup_fail_nvset
+				exit $ERROR_NO_CONFIG_FILE
+			fi
+			
+			if [ -z "$VALID_WLAN_INTERFACE" ]; then
+				VALID_WLAN_INTERFACE="$WLAN"
+			else
+				VALID_WLAN_INTERFACE="$VALID_WLAN_INTERFACE $WLAN"
+			fi
+			NUM=`expr $NUM + 1`
+		fi
+	done
+	VIRTUAL_WLAN_INTERFACE=$VALID_WLAN_INTERFACE
+	NUM_VIRTUAL_INTERFACE=$NUM
+	
+	
+
+	ALL_WLAN_INTERFACE="$WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE"
+}
+
+BR_INTERFACE=br0
+BR_LAN1_INTERFACE=eth0
+
+ENABLE_BR=1
+
+
+# Generate WPS PIN number
+rtl_generate_wps_pin() {
+	for WLAN in $WLAN_INTERFACE ; do
+		CONFIG_DIR=$CONFIG_ROOT_DIR/$WLAN
+		GET_VALUE=`cat $CONFIG_DIR/wsc_pin`
+		if [ "$GET_VALUE" = "00000000" ]; then
+			##echo "27006672" > $CONFIG_DIR/wsc_pin
+			$BIN_DIR/$FLASH_PROG gen-pin $WLAN
+			$BIN_DIR/$FLASH_PROG gen-pin $WLAN-vxd
+		fi
+	done
+}
+
+rtl_set_mac_addr() {
+	# Set Ethernet 0 MAC address
+	GET_VALUE=`cat $ROOT_CONFIG_DIR/nic0_addr`
+	ELAN_MAC_ADDR=$GET_VALUE
+	$IFCONFIG $BR_LAN1_INTERFACE down
+	$IFCONFIG $BR_LAN1_INTERFACE hw ether $ELAN_MAC_ADDR
+}
+
+# Usage: rtl_has_enable_vap wlan_interface
+rtl_has_enable_vap() {
+	for INTF in $VIRTUAL_WLAN_INTERFACE ; do
+		case $INTF in
+		$1-va[0-9])
+			CONFIG_DIR=$CONFIG_ROOT_DIR/$INTF
+			WLAN_DISABLED_VALUE=`cat $CONFIG_DIR/wlan_disabled`
+			if [ "$WLAN_DISABLED_VALUE" = "0" ]; then
+				return 1
+			fi
+			;;
+		*)
+			;;
+		esac
+	done
+	
+	return 0
+}
+
+# Start WLAN interface
+rtl_start_wlan_if() {
+	for WLAN in $ALL_WLAN_INTERFACE ; do
+		echo "Initialize $WLAN interface" >> $LOG
+#		$IFCONFIG $WLAN down
+		
+		case $WLAN in
+		$WLAN_PREFIX[0-9])		#ROOT_INTERFACE
+			NO_VAP=`$IFCONFIG $WLAN-va0 > /dev/null 2>&1; echo $?`
+			if [ $NO_VAP = 0 ]; then
+				rtl_has_enable_vap $WLAN
+				HAS_VAP=`echo $?`
+				$IWPRIV $WLAN set_mib vap_enable=$HAS_VAP
+				echo "$IWPRIV $WLAN set_mib vap_enable=$HAS_VAP" >> $LOG
+			fi
+			;;
+		$WLAN_PREFIX[0-9]-vxd) ## station interface
+#			echo "$IWPRIV $WLAN copy_mib" >> $LOG
+#			$IWPRIV $WLAN copy_mib
+#			WPA_SUPPLICAT=`ps | grep wpa_supplicant | grep -v grep`
+#			echo "SUPPLICAT=$WPA_SUPPLICAT"  >> $LOG
+			;;
+		*)
+			;;
+		esac
+		
+		CONFIG_DIR=$CONFIG_ROOT_DIR/$WLAN
+		WLAN_DISABLED_VALUE=`cat $CONFIG_DIR/wlan_disabled`
+#		ISUP=`$IFCONFIG $WLAN >> $LOG | grep UP`
+		
+#		if [ "$WLAN_DISABLED_VALUE" = 0  -a  "$ISUP" = "" ]; then
+			echo "<<<${START_WLAN##*/} $WLAN>>>" >> $LOG
+			$START_WLAN $WLAN
+			ERR=`echo $?`
+			if [ $ERR != 0 ]; then
+				echo "$START_WLAN $WLAN  failed"  >> $LOG
+				wifi_startup_fail_nvset
+				exit $ERR;
+			fi
+#		else
+#			echo "$WLAN WLAN_DISABLED_VALUE=$WLAN_DISABLED_VALUE, ISUP=$ISUP" >> $LOG
+#		fi
+	done
+}
+
+# Enable WLAN interface
+rtl_enable_wlan_if() {
+	for WLAN in $ALL_WLAN_INTERFACE ; do
+		CONFIG_DIR=$CONFIG_ROOT_DIR/$WLAN
+		WLAN_DISABLED_VALUE=`cat $CONFIG_DIR/wlan_disabled`
+		if [ "$WLAN_DISABLED_VALUE" = 0 ]; then
+			echo "<<<ENABLE $WLAN>>>"
+			IP_ADDR=`cat $CONFIG_DIR/ip_addr`
+			$IFCONFIG $WLAN $IP_ADDR
+			$IFCONFIG $WLAN up
+			if [ $? != 0 ]; then
+				wifi_startup_fail_nvset
+				echo "ERROR ifconfig $WLAN up fail" >> $LOG
+ 				exit $ERROR_NET_IF_UP_FAIL;
+			fi
+		fi
+	done
+}
+
+rtl_start_no_gw() {
+	echo "<<<${START_BRIDGE##*/} $BR_INTERFACE $BR_LAN1_INTERFACE $WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE>>>"  >> $LOG
+	$START_BRIDGE $BR_INTERFACE  $WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE
+	ERR=`echo $?`
+	if [ $ERR != 0 ]; then
+		wifi_startup_fail_nvset
+		exit $ERR;
+	fi
+	#CONFIG_DIR=$CONFIG_ROOT_DIR/$WLAN
+	#GET_WPA_PSK=`cat $CONFIG_DIR/wpa_psk`
+	#echo "222 GET_WPA_PSK is "$GET_WPA_PSK
+	#echo "<<<${START_WLAN_APP##*/} start $WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE $BR_INTERFACE>>>"
+	#$START_WLAN_APP start $WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE $BR_INTERFACE
+	#ERR=`echo $?`
+	#if [ $ERR != 0 ]; then
+	#	exit $ERR;
+	#fi
+}
+
+
+rtl_init() {
+	date +[%H:%M:%S]init.shstarttttttttttttttttt >> $LOG
+	killall webs 2> /dev/null
+	$BIN_DIR/webs -x
+	
+	echo "realtek rtl_get_available_wlan" >> $LOG
+	rtl_get_available_wlan
+##	rtl_set_mac_addr
+
+
+
+	echo "realtek rtl_start_wlan_if" >> $LOG
+	rtl_start_wlan_if
+	
+#NO_EXIST=1
+	NO_EXIST=`$BR_UTIL > /dev/null 2>&1; echo $?`
+	if [ "$NO_EXIST" = "127" ]; then
+		echo "$BR_UTIL: NOT exist."  >> $LOG
+		rtl_enable_wlan_if
+	else
+		#rtl_generate_wps_pin
+		echo "realtek rtl_start_no_gw"  >> $LOG
+		rtl_start_no_gw
+	fi
+	
+    #iwpriv wlan0 stopps 1
+    #iwpriv wlan0 set_mib ps_level=0	
+	
+	  
+	date +[%H:%M:%S]init.shenddddddddddddddddddd >> $LOG
+	echo "wlan0 start success"  >> $LOG
+	echo " "  >> $LOG
+}
+
+rtl_init
diff --git a/ap/app/Script/wifi_script/realtek/init1.sh b/ap/app/Script/wifi_script/realtek/init1.sh
new file mode 100644
index 0000000..91e37fc
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek/init1.sh
@@ -0,0 +1,290 @@
+#!/bin/sh
+#
+# script file to start network
+#
+# Usage: init.sh {gw | ap} {all | bridge | wan}
+#
+
+##if [ $# -lt 2 ]; then echo "Usage: $0 {gw | ap} {all | bridge | wan}"; exit 1 ; fi
+
+
+
+## error code
+ERROR_SUCCESS=0
+ERROR_INVALID_PARAMETERS=1
+ERROR_NO_SUCH_DEVICE=2
+ERROR_NO_CONFIG_FILE=3
+ERROR_NO_SUCH_FILE=4
+ERROR_NO_SUCH_DIRECTORY=5
+ERROR_NULL_FILE=6
+ERROR_NET_IF_UP_FAIL=7
+#CUR_PATH=`pwd`
+
+
+ROOT=`nv get wifi_root_dir`
+LOG=$ROOT/wifi/realtek/slog
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+
+LOG1=$ROOT/wifi/realtek/slog1
+LOG_LIMIT=128 #128K 
+#if [ -e "$LOG"]; then
+	LOG_SIZE=`du $LOG | cut -f1`
+	if [ $LOG_SIZE -ge $LOG_LIMIT ]; then    
+		mv $LOG $LOG1
+	fi
+#else
+#	touch $LOG
+#fi
+
+SCRIPT_DIR=`cat $CONFIG_ROOT_DIR/wifi_script_dir`
+BIN_DIR=`cat $CONFIG_ROOT_DIR/wifi_bin_dir`
+
+if [ -z "$SCRIPT_DIR" ] || [ -z "$BIN_DIR" ]; then
+	wifi_startup_fail_nvset
+	exit $ERROR_NULL_FILE;
+fi
+if [ ! -d "$SCRIPT_DIR" ]; then
+	echo "ERROR: $SCRIPT_DIR specify the path NOT exist." >> $LOG
+	wifi_startup_fail_nvset
+	exit $ERROR_NO_SUCH_DIRECTORY;
+fi
+if [ ! -d "$BIN_DIR" ]; then
+	echo "ERROR: $BIN_DIR specify the path NOT exist." >> $LOG
+	wifi_startup_fail_nvset
+	exit $ERROR_NO_SUCH_DIRECTORY;
+fi
+
+#PATH=$PATH:$BIN_DIR
+#export PATH
+
+START_BRIDGE=$SCRIPT_DIR/bridge1.sh
+#START_WLAN_APP=$SCRIPT_DIR/wlanapp_8192c.sh
+START_WLAN=$SCRIPT_DIR/wlan_8192c1.sh
+
+WLAN_PREFIX=wlan
+
+# the following fields must manually set depends on system configuration. Not support auto config.
+ROOT_WLAN=wlan0
+ROOT_CONFIG_DIR=$CONFIG_ROOT_DIR/$ROOT_WLAN
+WLAN_INTERFACE=$ROOT_WLAN
+NUM_INTERFACE=0
+#VIRTUAL_WLAN_INTERFACE="$ROOT_WLAN-va0 $ROOT_WLAN-va1 $ROOT_WLAN-va2 $ROOT_WLAN-va3"
+VIRTUAL_WLAN_INTERFACE=""
+NUM_VIRTUAL_INTERFACE=0
+VXD_INTERFACE=""
+ALL_WLAN_INTERFACE="$WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE $VXD_INTERFACE"
+
+BR_UTIL=brctl
+IFCONFIG=ifconfig
+IWPRIV=iwpriv
+FLASH_PROG=flash
+
+export SCRIPT_DIR
+export BIN_DIR
+export WLAN_PREFIX
+export ROOT_WLAN
+export BR_UTIL
+
+
+wifi_startup_fail_nvset() {
+	date +[%H:%M:%S]init1.shenddddddddddddddddddd >> $LOG
+	echo "wlan0 start failed "  >> $LOG
+	echo " "  >> $LOG
+}
+rtl_get_available_wlan() {
+	NUM=0
+	VALID_WLAN_INTERFACE=""
+	for WLAN in $WLAN_INTERFACE ; do
+		NOT_EXIST=`$IFCONFIG $WLAN > /dev/null 2>&1; echo $?`
+		if [ $NOT_EXIST = 0 ]; then
+			CONFIG_DIR=$CONFIG_ROOT_DIR/$WLAN
+			if [ ! -d "$CONFIG_DIR" ]; then
+				echo "$CONFIG_DIR: No such directory"  >> $LOG
+				wifi_startup_fail_nvset
+				exit $ERROR_NO_CONFIG_FILE
+			fi
+			
+			if [ -z "$VALID_WLAN_INTERFACE" ]; then
+				VALID_WLAN_INTERFACE="$WLAN"
+			else
+				VALID_WLAN_INTERFACE="$VALID_WLAN_INTERFACE $WLAN"
+			fi
+			NUM=`expr $NUM + 1`
+		fi
+	done
+	
+	if [ "$NUM" = "0" ]; then
+		echo "$WLAN_INTERFACE: No such device"  >> $LOG
+		wifi_startup_fail_nvset
+		exit $ERROR_NO_SUCH_DEVICE;
+	fi
+	WLAN_INTERFACE=$VALID_WLAN_INTERFACE
+	NUM_INTERFACE=$NUM
+	
+	ALL_WLAN_INTERFACE="$WLAN_INTERFACE"
+}
+
+BR_INTERFACE=br0
+BR_LAN1_INTERFACE=eth0
+
+ENABLE_BR=1
+
+
+# Generate WPS PIN number
+rtl_generate_wps_pin() {
+	for WLAN in $WLAN_INTERFACE ; do
+		CONFIG_DIR=$CONFIG_ROOT_DIR/$WLAN
+		GET_VALUE=`cat $CONFIG_DIR/wsc_pin`
+		if [ "$GET_VALUE" = "00000000" ]; then
+			##echo "27006672" > $CONFIG_DIR/wsc_pin
+			$BIN_DIR/$FLASH_PROG gen-pin $WLAN
+			$BIN_DIR/$FLASH_PROG gen-pin $WLAN-vxd
+		fi
+	done
+}
+
+rtl_set_mac_addr() {
+	# Set Ethernet 0 MAC address
+	GET_VALUE=`cat $ROOT_CONFIG_DIR/nic0_addr`
+	ELAN_MAC_ADDR=$GET_VALUE
+	$IFCONFIG $BR_LAN1_INTERFACE down
+	$IFCONFIG $BR_LAN1_INTERFACE hw ether $ELAN_MAC_ADDR
+}
+
+# Usage: rtl_has_enable_vap wlan_interface
+rtl_has_enable_vap() {
+	for INTF in $VIRTUAL_WLAN_INTERFACE ; do
+		case $INTF in
+		$1-va[0-9])
+			CONFIG_DIR=$CONFIG_ROOT_DIR/$INTF
+			WLAN_DISABLED_VALUE=`cat $CONFIG_DIR/wlan_disabled`
+			if [ "$WLAN_DISABLED_VALUE" = "0" ]; then
+				return 1
+			fi
+			;;
+		*)
+			;;
+		esac
+	done
+	
+	return 0
+}
+
+# Start WLAN interface
+rtl_start_wlan_if() {
+	for WLAN in $ALL_WLAN_INTERFACE ; do
+		echo "Initialize $WLAN interface" >> $LOG
+		$IFCONFIG $WLAN down
+		
+		case $WLAN in
+		$WLAN_PREFIX[0-9])		#ROOT_INTERFACE
+			NO_VAP=`$IFCONFIG $WLAN-va0 > /dev/null 2>&1; echo $?`
+			if [ $NO_VAP = 0 ]; then
+				rtl_has_enable_vap $WLAN
+				HAS_VAP=`echo $?`
+				$IWPRIV $WLAN set_mib vap_enable=$HAS_VAP
+				echo "$IWPRIV $WLAN set_mib vap_enable=$HAS_VAP" >> $LOG
+			fi
+			;;
+		$WLAN_PREFIX[0-9]-vxd) ## station interface
+#			echo "$IWPRIV $WLAN copy_mib" >> $LOG
+#			$IWPRIV $WLAN copy_mib
+#			WPA_SUPPLICAT=`ps | grep wpa_supplicant | grep -v grep`
+#			echo "SUPPLICAT=$WPA_SUPPLICAT"  >> $LOG
+			;;
+		*)
+			;;
+		esac
+		
+		CONFIG_DIR=$CONFIG_ROOT_DIR/$WLAN
+		WLAN_DISABLED_VALUE=`cat $CONFIG_DIR/wlan_disabled`
+
+		if [ "$WLAN_DISABLED_VALUE" = 0 ]; then
+			echo "<<<${START_WLAN##*/} $WLAN>>>" >> $LOG
+			$START_WLAN $WLAN
+			ERR=`echo $?`
+			if [ $ERR != 0 ]; then
+				echo "$START_WLAN $WLAN  failed"  >> $LOG
+				wifi_startup_fail_nvset
+				exit $ERR;
+			fi
+		else
+			echo "$WLAN WLAN_DISABLED_VALUE=$WLAN_DISABLED_VALUE" >> $LOG
+		fi
+	done
+}
+
+# Enable WLAN interface
+rtl_enable_wlan_if() {
+	for WLAN in $ALL_WLAN_INTERFACE ; do
+		CONFIG_DIR=$CONFIG_ROOT_DIR/$WLAN
+		WLAN_DISABLED_VALUE=`cat $CONFIG_DIR/wlan_disabled`
+		if [ "$WLAN_DISABLED_VALUE" = 0 ]; then
+			echo "<<<ENABLE $WLAN>>>"
+			IP_ADDR=`cat $CONFIG_DIR/ip_addr`
+			$IFCONFIG $WLAN $IP_ADDR
+			$IFCONFIG $WLAN up
+			if [ $? != 0 ]; then
+				wifi_startup_fail_nvset
+				echo "ERROR ifconfig $WLAN up fail" >> $LOG
+ 				exit $ERROR_NET_IF_UP_FAIL;
+			fi
+		fi
+	done
+}
+
+rtl_start_no_gw() {
+	echo "<<<${START_BRIDGE##*/} $BR_INTERFACE $BR_LAN1_INTERFACE $WLAN_INTERFACE>>>"  >> $LOG
+	$START_BRIDGE $BR_INTERFACE  $WLAN_INTERFACE
+	ERR=`echo $?`
+	if [ $ERR != 0 ]; then
+		wifi_startup_fail_nvset
+		exit $ERR;
+	fi
+	#CONFIG_DIR=$CONFIG_ROOT_DIR/$WLAN
+	#GET_WPA_PSK=`cat $CONFIG_DIR/wpa_psk`
+	#echo "222 GET_WPA_PSK is "$GET_WPA_PSK
+	#echo "<<<${START_WLAN_APP##*/} start $WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE $BR_INTERFACE>>>"
+	#$START_WLAN_APP start $WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE $BR_INTERFACE
+	#ERR=`echo $?`
+	#if [ $ERR != 0 ]; then
+	#	exit $ERR;
+	#fi
+}
+
+
+rtl_init() {
+	date +[%H:%M:%S]init1.shstarttttttttttttttttt >> $LOG
+	killall webs 2> /dev/null
+	$BIN_DIR/webs -x
+	
+	echo "realtek rtl_get_available_wlan" >> $LOG
+	rtl_get_available_wlan
+##	rtl_set_mac_addr
+
+
+
+	echo "realtek rtl_start_wlan_if" >> $LOG
+	rtl_start_wlan_if
+	
+#NO_EXIST=1
+	NO_EXIST=`$BR_UTIL > /dev/null 2>&1; echo $?`
+	if [ "$NO_EXIST" = "127" ]; then
+		echo "$BR_UTIL: NOT exist."  >> $LOG
+		rtl_enable_wlan_if
+	else
+		#rtl_generate_wps_pin
+		echo "realtek rtl_start_no_gw"  >> $LOG
+		rtl_start_no_gw
+	fi
+	
+    #iwpriv wlan0 stopps 1
+    #iwpriv wlan0 set_mib ps_level=0	
+	
+	  
+	date +[%H:%M:%S]init1.shenddddddddddddddddddd >> $LOG
+	echo " "  >> $LOG
+	echo " "  >> $LOG
+}
+
+rtl_init
diff --git a/ap/app/Script/wifi_script/realtek/kill_wps.sh b/ap/app/Script/wifi_script/realtek/kill_wps.sh
new file mode 100644
index 0000000..13c7e4b
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek/kill_wps.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+#
+# script file to start network
+#
+# Usage: kill_wps.sh {pbc | pin} {PINNUM}
+#
+
+##if [ $# -lt 2 ]; then echo "Usage: $0 {gw | ap} {all | bridge | wan}"; exit 1 ; fi
+ROOT=`nv get wifi_root_dir`
+
+LOG=$ROOT/wifi/realtek/slog
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0
+
+ID=`nv get wifi_wps_index`
+echo "enter kill_wps.sh wifi_wps_index=$ID >>>>>>>>" >> $LOG
+ID=`expr $ID - 1`
+echo "enter kill_wps.sh ID=$ID >>>>>>>>" >> $LOG
+
+if [ "$ID" = "0" ];then
+#CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0
+#WLAN_INTERFACE="wlan0"
+CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0-va$ID
+WLAN_INTERFACE="wlan0-va$ID"
+else
+CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0-va$ID
+WLAN_INTERFACE="wlan0-va$ID"
+fi
+
+
+if [ -z "$SCRIPT_DIR" ]; then
+	SCRIPT_DIR=`cat $CONFIG_ROOT_DIR/wifi_script_dir`
+fi
+START_WLAN_APP=$SCRIPT_DIR/wlanapp_8192c.sh
+
+BR_INTERFACE="br0"
+echo "<<<${START_WLAN_APP##*/} start $WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE $BR_INTERFACE>>>" >> $LOG
+$START_WLAN_APP kill $WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE $BR_INTERFACE 
+ERR=`echo $?`
+if [ $ERR != 0 ]; then
+	exit $ERR;
+fi
diff --git a/ap/app/Script/wifi_script/realtek/kill_wps1.sh b/ap/app/Script/wifi_script/realtek/kill_wps1.sh
new file mode 100644
index 0000000..485b63f
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek/kill_wps1.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+#
+# script file to start network
+#
+# Usage: kill_wps.sh {pbc | pin} {PINNUM}
+#
+
+##if [ $# -lt 2 ]; then echo "Usage: $0 {gw | ap} {all | bridge | wan}"; exit 1 ; fi
+
+ROOT=`nv get wifi_root_dir`
+
+LOG=$ROOT/wifi/realtek/slog
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0
+
+ID=`nv get wifi_wps_index`
+echo "enter kill_wps1.sh wifi_wps_index=$ID >>>>>>>>" >> $LOG
+
+
+CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0
+WLAN_INTERFACE="wlan0"
+
+
+if [ -z "$SCRIPT_DIR" ]; then
+	SCRIPT_DIR=`cat $CONFIG_ROOT_DIR/wifi_script_dir`
+fi
+START_WLAN_APP=$SCRIPT_DIR/wlanapp_8192c.sh
+
+BR_INTERFACE="br0"
+echo "<<<${START_WLAN_APP##*/} start $WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE $BR_INTERFACE>>>" >> $LOG
+$START_WLAN_APP kill $WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE $BR_INTERFACE 
+ERR=`echo $?`
+if [ $ERR != 0 ]; then
+	exit $ERR;
+fi
diff --git a/ap/app/Script/wifi_script/realtek/para_set.sh b/ap/app/Script/wifi_script/realtek/para_set.sh
new file mode 100755
index 0000000..9b5efa2
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek/para_set.sh
@@ -0,0 +1,378 @@
+#!/bin/sh
+#
+# script file to start WLAN
+#
+
+
+## error code
+ERROR_SUCCESS=0
+ERROR_INVALID_PARAMETERS=1
+ERROR_NO_SUCH_DEVICE=2
+ERROR_NO_CONFIG_FILE=3
+ERROR_NO_SUCH_FILE=4
+ERROR_NO_SUCH_DIRECTORY=5
+ERROR_NULL_FILE=6
+ERROR_NET_IF_UP_FAIL=7
+
+ROOT=`nv get wifi_root_dir`
+LOG=$ROOT/wifi/realtek/slog
+
+IWPRIV=iwpriv
+wifi_lte_intr=`nv get wifi_lte_intr`
+
+if [ $# -lt 1 ]; then
+	echo "Usage: $0 wlan_interface" >> $LOG
+	exit $ERROR_INVALID_PARAMETERS;
+fi
+
+date +[%H:%M:%S]paraset_$1_start >> $LOG
+
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+CONFIG_DIR=$CONFIG_ROOT_DIR/$1
+
+if [ ! -d "$CONFIG_DIR" ]; then
+	echo "$CONFIG_DIR: No such directory" >> $LOG
+	exit $ERROR_NO_CONFIG_FILE
+fi
+
+if [ -z "$WLAN_PREFIX" ]; then
+	WLAN_PREFIX=wlan
+fi
+
+if [ -z "$ROOT_WLAN" ]; then
+#	ROOT_WLAN=${1:0:$WLAN_NAME_LEN}
+### delete -va0 get wlan0
+	ROOT_WLAN=${1%%-*}  
+fi
+ROOT_CONFIG_DIR=$CONFIG_ROOT_DIR/$ROOT_WLAN
+
+IS_ROOT_WLAN=0
+if [ "$1" = "$ROOT_WLAN" ]; then
+	IS_ROOT_WLAN=1
+fi
+echo "IS_ROOT_WLAN is " $IS_ROOT_WLAN
+SET_WLAN="iwpriv $1"
+SET_WLAN_PARAM="$SET_WLAN set_mib"
+IFCONFIG=ifconfig
+SET_VA0="iwpriv wlan0-va0"
+SET_VA1="iwpriv wlan0-va1"
+
+if [ $IS_ROOT_WLAN = 1 ]; then
+	$IFCONFIG $1-va0 down
+	if [ $? != 0 ]; then
+		exit $ERROR_NO_SUCH_DEVICE
+	fi
+	
+	$IFCONFIG $1-va1 down
+	if [ $? != 0 ]; then
+		exit $ERROR_NO_SUCH_DEVICE
+	fi
+	
+	$IFCONFIG $1-vxd down
+	if [ $? != 0 ]; then
+		exit $ERROR_NO_SUCH_DEVICE
+	fi
+fi
+$IFCONFIG $1 down
+if [ $? != 0 ]; then
+	exit $ERROR_NO_SUCH_DEVICE
+fi
+
+
+
+# set RF parameters
+if [ $IS_ROOT_WLAN = 1 ]; then
+echo "set RF parameters" >> $LOG
+# set channel
+	GET_VALUE=`cat $CONFIG_DIR/channel`
+	$SET_WLAN set_mib channel=$GET_VALUE
+
+##autochannel can use wifi_lte_intr
+	if [ "$wifi_lte_intr" = "1" -a "$GET_VALUE" = "0" ];then
+		echo "wifi_lte_intr=$wifi_lte_intr  $SET_WLAN set_mib ch_low=5" >> $LOG	
+#		$SET_WLAN set_mib ch_low=5
+		$SET_WLAN set_mib disable_acs_ch=15
+	else
+		GET_VALUE=`cat $CONFIG_DIR/ch_low`
+		$SET_WLAN set_mib ch_low=$GET_VALUE
+	fi
+
+# set wifi coverage	
+	GET_TX_POWER_PERCENT=`cat $CONFIG_DIR/tx_power_percet`
+	#echo "GET_TX_POWER_PERCENT is "$GET_TX_POWER_PERCENT
+	$SET_WLAN set_mib powerpercent=$GET_TX_POWER_PERCENT
+	
+# for country code
+	COUNTRY_CODE_ENABLE=`$SET_WLAN get_mib countrycode 2> /dev/null`
+	if [ ! -z "$COUNTRY_CODE_ENABLE" ]; then
+		GET_VALUE=`cat $ROOT_CONFIG_DIR/countrycode_enable`
+		$SET_WLAN set_mib countrycode=$GET_VALUE
+
+		GET_VALUE=`cat $ROOT_CONFIG_DIR/countrycode`
+		$SET_WLAN set_mib countrystr=$GET_VALUE
+	fi
+	
+	
+#set band	  bgn
+	GET_BAND=`cat $ROOT_CONFIG_DIR/band`
+	GET_WIFI_SPECIFIC=`cat $ROOT_CONFIG_DIR/wifi_specific`
+	if [ "$GET_VALUE_WLAN_MODE" != '1' ] && [ "$GET_WIFI_SPECIFIC" = 1 ] &&  [ "$GET_BAND" = '2' ] ; then
+		GET_BAND=3
+	fi
+	if [ "$GET_BAND" = '8' ]; then
+		GET_BAND=11
+		$SET_WLAN set_mib deny_legacy=3
+		$SET_VA0 set_mib deny_legacy=3
+		$SET_VA1 set_mib deny_legacy=3			
+	elif [ "$GET_BAND" = '2' ]; then
+		GET_BAND=3
+		$SET_WLAN set_mib deny_legacy=1
+		$SET_VA0 set_mib deny_legacy=1
+		$SET_VA1 set_mib deny_legacy=1		
+	elif [ "$GET_BAND" = '10' ]; then
+		GET_BAND=11
+		$SET_WLAN set_mib deny_legacy=1
+		$SET_VA0 set_mib deny_legacy=1
+		$SET_VA1 set_mib deny_legacy=1			
+	elif [ "$GET_BAND" = '64' ]; then
+		GET_BAND=76
+		$SET_WLAN set_mib deny_legacy=12
+		$SET_VA0 set_mib deny_legacy=12
+		$SET_VA1 set_mib deny_legacy=12			
+	elif [ "$GET_BAND" = '72' ]; then
+		GET_BAND=76
+		$SET_WLAN set_mib deny_legacy=4
+		$SET_VA0 set_mib deny_legacy=4
+		$SET_VA1 set_mib deny_legacy=4		
+	else
+		$SET_WLAN set_mib deny_legacy=0
+		$SET_VA0 set_mib deny_legacy=0
+		$SET_VA1 set_mib deny_legacy=0
+	fi
+	$SET_WLAN set_mib band=$GET_BAND
+	$SET_VA0 set_mib band=$GET_BAND
+	$SET_VA1 set_mib band=$GET_BAND
+
+
+###Set 11n parameter
+		if [ $GET_BAND = 10 ] || [ $GET_BAND = 11 ] || [ $GET_BAND = 76 ]; then
+			if [ $IS_ROOT_WLAN = 1 ]; then
+				GET_CHANNEL_BONDING=`cat $CONFIG_DIR/channel_bonding`
+				$SET_WLAN set_mib use40M=$GET_CHANNEL_BONDING
+
+				GET_CONTROL_SIDEBAND=`cat $CONFIG_DIR/control_sideband`
+
+				if [ "$GET_CHANNEL_BONDING" = 0 ]; then
+					$SET_WLAN set_mib 2ndchoffset=0
+				else
+					if [ "$GET_CONTROL_SIDEBAND" = 0 ]; then
+						 $SET_WLAN set_mib 2ndchoffset=1
+					fi
+					if [ "$GET_CONTROL_SIDEBAND" = 1 ]; then
+						 $SET_WLAN set_mib 2ndchoffset=2
+					fi
+				fi
+			fi # [ $IS_ROOT_WLAN = 1 ]
+
+		GET_COEXIST_ENABLED=`cat $CONFIG_DIR/coexist_enabled`
+		$SET_WLAN set_mib coexist=$GET_COEXIST_ENABLED
+		fi # [ $GET_BAND = 10 ] || [ $GET_BAND = 11 ]
+##########
+	
+else
+## for va0 va1 set ssid 
+echo "set basic ap parameters" >> $LOG
+	GET_VALUE=`cat $CONFIG_DIR/ssid`
+	$SET_WLAN set_mib ssid="$GET_VALUE"
+	
+	GET_VALUE=`cat $CONFIG_DIR/hidden_ssid`
+	$SET_WLAN set_mib hiddenAP=$GET_VALUE
+
+	GET_VALUE=`cat $CONFIG_DIR/supported_sta_num`
+	$SET_WLAN set_mib stanum=$GET_VALUE
+
+	# for ap isolation 
+	# need to confirm which is for ap isolation
+	#GET_VALUE=`cat $CONFIG_DIR/group_id`
+	#$SET_WLAN set_mib groupID=$GET_VALUE
+
+	# set block relay
+	GET_VALUE=`cat $CONFIG_DIR/block_relay`
+	$SET_WLAN set_mib block_relay=$GET_VALUE
+
+
+	GET_WLAN_AUTH_TYPE=`cat $CONFIG_DIR/auth_type`
+	AUTH_TYPE=$GET_WLAN_AUTH_TYPE
+	GET_WLAN_ENCRYPT=`cat $CONFIG_DIR/encrypt`
+	if [ "$GET_WLAN_AUTH_TYPE" = '1' ] && [ "$GET_WLAN_ENCRYPT" != '1' ]; then
+		# shared-key and not WEP enabled, force to open-system
+		AUTH_TYPE=0
+	fi
+	$SET_WLAN set_mib authtype=$AUTH_TYPE
+	if [ "$GET_WLAN_ENCRYPT" = '0' ]; then
+		$SET_WLAN set_mib encmode=0
+	elif [ "$GET_WLAN_ENCRYPT" = '1' ]; then
+		### WEP mode ##
+		GET_WEP=`cat $CONFIG_DIR/wep`
+		GET_WEP_KEY_TYPE=`cat $CONFIG_DIR/wep_key_type`
+		GET_WEP_KEY_ID=`cat $CONFIG_DIR/wep_default_key`
+		
+		if [ "$GET_WEP" = '1' ]; then
+			if [ "$GET_WEP_KEY_TYPE" = '0' ]; then
+				GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_64_asc`
+				GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_64_asc`
+				GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_64_asc`
+				GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_64_asc`
+			else
+				GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_64_hex`
+				GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_64_hex`
+				GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_64_hex`
+				GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_64_hex`
+			fi
+		
+			$SET_WLAN set_mib encmode=1
+			$SET_WLAN set_mib wepkey1=$GET_WEP_KEY_1
+			$SET_WLAN set_mib wepkey2=$GET_WEP_KEY_2
+			$SET_WLAN set_mib wepkey3=$GET_WEP_KEY_3
+			$SET_WLAN set_mib wepkey4=$GET_WEP_KEY_4
+			$SET_WLAN set_mib wepdkeyid=$GET_WEP_KEY_ID
+		else
+			if [ "$GET_WEP_KEY_TYPE" = '0' ]; then
+				GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_128_asc`
+				GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_128_asc`
+				GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_128_asc`
+				GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_128_asc`
+			else
+				GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_128_hex`
+				GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_128_hex`
+				GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_128_hex`
+				GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_128_hex`
+			fi
+			$SET_WLAN set_mib encmode=5
+			$SET_WLAN set_mib wepkey1=$GET_WEP_KEY_1
+			$SET_WLAN set_mib wepkey2=$GET_WEP_KEY_2
+			$SET_WLAN set_mib wepkey3=$GET_WEP_KEY_3
+			$SET_WLAN set_mib wepkey4=$GET_WEP_KEY_4
+			$SET_WLAN set_mib wepdkeyid=$GET_WEP_KEY_ID
+		fi
+	else
+			## WPA mode ##
+		$SET_WLAN set_mib encmode=2
+	fi
+
+
+	## Set 802.1x flag ##
+	_ENABLE_1X=0
+	if [ $GET_WLAN_ENCRYPT -lt 2 ]; then
+		GET_ENABLE_1X=`cat $CONFIG_DIR/enable_1x`
+		GET_MAC_AUTH_ENABLED=`cat $CONFIG_DIR/mac_auth_enabled`
+		if [ "$GET_ENABLE_1X" != 0 ] || [ "$GET_MAC_AUTH_ENABLED" != 0 ]; then
+			_ENABLE_1X=1
+		fi
+	else
+		_ENABLE_1X=1
+	fi
+	$SET_WLAN set_mib 802_1x=$_ENABLE_1X
+	
+
+	echo "wpa relative settings"  >> $LOG
+#
+# following settings is used when driver WPA module is included
+#
+
+	GET_WPA_AUTH=`cat $CONFIG_DIR/wpa_auth`
+	#if [ $GET_VALUE_WLAN_MODE != 1 ] && [ $GET_WLAN_ENCRYPT -ge 2 ]  && [ $GET_WLAN_ENCRYPT -lt 7 ] && [ $GET_WPA_AUTH = 2 ]; then
+	if [ $GET_WLAN_ENCRYPT -ge 2 ]  && [ $GET_WLAN_ENCRYPT -lt 11 ]; then
+		if [ $GET_WPA_AUTH = 2 ]; then
+			if [ $GET_WLAN_ENCRYPT = 2 ]; then
+				ENABLE=1
+			elif [ $GET_WLAN_ENCRYPT = 4 ]; then
+				ENABLE=2
+			elif [ $GET_WLAN_ENCRYPT = 6 ]; then
+				ENABLE=3
+		        elif [ $GET_WLAN_ENCRYPT = 8 ]; then
+			        ENABLE=8
+		        elif [ $GET_WLAN_ENCRYPT = 10 ]; then
+			       ENABLE=10
+			else
+				echo "invalid ENCRYPT value!($GET_WLAN_ENCRYPT)" >> $LOG
+				exit $ERROR_INVALID_PARAMETERS;
+			fi
+			$SET_WLAN set_mib psk_enable=$ENABLE
+		else
+			$SET_WLAN set_mib psk_enable=0
+		fi
+
+		if [ $GET_WLAN_ENCRYPT = 2 ] || [ $GET_WLAN_ENCRYPT = 6 ]; then
+			GET_WPA_CIPHER_SUITE=`cat $CONFIG_DIR/wpa_cipher`
+			if [ $GET_WPA_CIPHER_SUITE = 1 ]; then
+				CIPHER=2
+			elif [ $GET_WPA_CIPHER_SUITE = 2 ]; then
+				CIPHER=8
+			elif [ $GET_WPA_CIPHER_SUITE = 3 ]; then
+				CIPHER=10
+			else
+				echo "invalid WPA_CIPHER_SUITE value!($GET_WPA_CIPHER_SUITE)" >> $LOG
+				exit $ERROR_INVALID_PARAMETERS;
+			fi
+		fi
+		$SET_WLAN set_mib wpa_cipher=$CIPHER
+
+		if [ $GET_WLAN_ENCRYPT = 4 ] || [ $GET_WLAN_ENCRYPT = 6 ] || [ $GET_WLAN_ENCRYPT = 8 ] || [ $GET_WLAN_ENCRYPT = 10 ]; then
+			GET_WPA2_CIPHER_SUITE=`cat $CONFIG_DIR/wpa2_cipher`
+			if [ $GET_WPA2_CIPHER_SUITE = 1 ]; then
+				CIPHER=2
+			elif [ $GET_WPA2_CIPHER_SUITE = 2 ]; then
+				CIPHER=8
+			elif [ $GET_WPA2_CIPHER_SUITE = 3 ]; then
+				CIPHER=10
+			else
+				echo "invalid WPA2_CIPHER_SUITE value!($GET_WPA2_CIPHER_SUITE)" >> $LOG
+				exit $ERROR_INVALID_PARAMETERS;
+			fi
+		fi
+		$SET_WLAN set_mib wpa2_cipher=$CIPHER
+
+		GET_WPA_PSK=`cat $CONFIG_DIR/wpa_psk`
+		$SET_WLAN set_mib passphrase="$GET_WPA_PSK"
+
+	fi
+
+	if [ $GET_WLAN_ENCRYPT = 8 ] || [ $GET_WLAN_ENCRYPT = 10 ]; then
+		GET_WPA2_11W=`cat $CONFIG_DIR/wpa11w`
+		GET_WPA2_SHA256=`cat $CONFIG_DIR/wpa2EnableSHA256`
+		$SET_WLAN set_mib dot11IEEE80211W=$GET_WPA2_11W
+		$SET_WLAN set_mib enableSHA256=$GET_WPA2_SHA256
+	else
+		echo "Only WPA3 need PMF" >> $LOG
+		$SET_WLAN set_mib dot11IEEE80211W=0
+		$SET_WLAN set_mib enableSHA256=0
+	fi
+	
+fi # [ $IS_ROOT_WLAN = 1 ]
+
+
+
+$IFCONFIG $1 up
+if [ $? != 0 ]; then
+	exit $ERROR_NO_SUCH_DEVICE
+fi
+
+if [ $IS_ROOT_WLAN = 1 ]; then
+	$IFCONFIG $1-va0 up
+	if [ $? != 0 ]; then
+		exit $ERROR_NO_SUCH_DEVICE
+	fi
+
+	MSSID=`nv get m_ssid_enable`	
+
+	if [ $MSSID = 1 ]; then
+		$IFCONFIG $1-va1 up
+		if [ $? != 0 ]; then
+			exit $ERROR_NO_SUCH_DEVICE
+		fi
+	fi
+fi
+
+date +[%H:%M:%S]paraset_$1_end >> $LOG
+exit $ERROR_SUCCESS
\ No newline at end of file
diff --git a/ap/app/Script/wifi_script/realtek/para_set1.sh b/ap/app/Script/wifi_script/realtek/para_set1.sh
new file mode 100755
index 0000000..acdc164
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek/para_set1.sh
@@ -0,0 +1,328 @@
+#!/bin/sh
+#
+# script file to start WLAN
+#
+
+
+## error code
+ERROR_SUCCESS=0
+ERROR_INVALID_PARAMETERS=1
+ERROR_NO_SUCH_DEVICE=2
+ERROR_NO_CONFIG_FILE=3
+ERROR_NO_SUCH_FILE=4
+ERROR_NO_SUCH_DIRECTORY=5
+ERROR_NULL_FILE=6
+ERROR_NET_IF_UP_FAIL=7
+
+ROOT=`nv get wifi_root_dir`
+LOG=$ROOT/wifi/realtek/slog
+
+IWPRIV=iwpriv
+wifi_lte_intr=`nv get wifi_lte_intr`
+
+if [ $# -lt 1 ]; then
+	echo "Usage: $0 wlan_interface" >> $LOG
+	exit $ERROR_INVALID_PARAMETERS;
+fi
+
+date +[%H:%M:%S]paraset_$1_start >> $LOG
+
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+CONFIG_DIR=$CONFIG_ROOT_DIR/$1
+
+if [ ! -d "$CONFIG_DIR" ]; then
+	echo "$CONFIG_DIR: No such directory" >> $LOG
+	exit $ERROR_NO_CONFIG_FILE
+fi
+
+if [ -z "$WLAN_PREFIX" ]; then
+	WLAN_PREFIX=wlan
+fi
+
+if [ -z "$ROOT_WLAN" ]; then
+#	ROOT_WLAN=${1:0:$WLAN_NAME_LEN}
+### delete -va0 get wlan0
+	ROOT_WLAN=${1%%-*}  
+fi
+ROOT_CONFIG_DIR=$CONFIG_ROOT_DIR/$ROOT_WLAN
+
+IS_ROOT_WLAN=0
+if [ "$1" = "$ROOT_WLAN" ]; then
+	IS_ROOT_WLAN=1
+fi
+echo "IS_ROOT_WLAN is " $IS_ROOT_WLAN
+SET_WLAN="iwpriv $1"
+SET_WLAN_PARAM="$SET_WLAN set_mib"
+IFCONFIG=ifconfig
+
+
+$IFCONFIG $1 down
+if [ $? != 0 ]; then
+	exit $ERROR_NO_SUCH_DEVICE
+fi
+
+
+echo "set RF parameters" >> $LOG
+# set RF parameters
+
+
+# set channel
+	GET_VALUE=`cat $CONFIG_DIR/channel`
+	$SET_WLAN set_mib channel=$GET_VALUE
+
+##autochannel can use wifi_lte_intr
+	if [ "$wifi_lte_intr" = "1" -a "$GET_VALUE" = "0" ];then
+		echo "wifi_lte_intr=$wifi_lte_intr  $SET_WLAN set_mib ch_low=5" >> $LOG	
+#		$SET_WLAN set_mib ch_low=5
+		$SET_WLAN set_mib disable_acs_ch=15
+	else
+		GET_VALUE=`cat $CONFIG_DIR/ch_low`
+		$SET_WLAN set_mib ch_low=$GET_VALUE
+	fi
+
+# set wifi coverage	
+	GET_TX_POWER_PERCENT=`cat $CONFIG_DIR/tx_power_percet`
+	#echo "GET_TX_POWER_PERCENT is "$GET_TX_POWER_PERCENT
+	$SET_WLAN set_mib powerpercent=$GET_TX_POWER_PERCENT
+	
+# for country code
+	COUNTRY_CODE_ENABLE=`$SET_WLAN get_mib countrycode 2> /dev/null`
+	if [ ! -z "$COUNTRY_CODE_ENABLE" ]; then
+		GET_VALUE=`cat $ROOT_CONFIG_DIR/countrycode_enable`
+		$SET_WLAN set_mib countrycode=$GET_VALUE
+
+		GET_VALUE=`cat $ROOT_CONFIG_DIR/countrycode`
+		$SET_WLAN set_mib countrystr=$GET_VALUE
+	fi
+	
+	
+#set band	  bgn
+	GET_BAND=`cat $ROOT_CONFIG_DIR/band`
+	GET_WIFI_SPECIFIC=`cat $ROOT_CONFIG_DIR/wifi_specific`
+	if [ "$GET_VALUE_WLAN_MODE" != '1' ] && [ "$GET_WIFI_SPECIFIC" = 1 ] &&  [ "$GET_BAND" = '2' ] ; then
+		GET_BAND=3
+	fi
+	if [ "$GET_BAND" = '8' ]; then
+		GET_BAND=11
+		$SET_WLAN set_mib deny_legacy=3
+	elif [ "$GET_BAND" = '2' ]; then
+		GET_BAND=3
+		$SET_WLAN set_mib deny_legacy=1
+	elif [ "$GET_BAND" = '10' ]; then
+		GET_BAND=11
+		$SET_WLAN set_mib deny_legacy=1
+	elif [ "$GET_BAND" = '64' ]; then
+		GET_BAND=76
+		$SET_WLAN set_mib deny_legacy=12
+	elif [ "$GET_BAND" = '72' ]; then
+		GET_BAND=76
+		$SET_WLAN set_mib deny_legacy=4
+	else
+		$SET_WLAN set_mib deny_legacy=0
+	fi
+	
+	$SET_WLAN set_mib band=$GET_BAND	
+
+
+###Set 11n parameter
+		if [ $GET_BAND = 10 ] || [ $GET_BAND = 11 ] || [ $GET_BAND = 76 ]; then
+			if [ $IS_ROOT_WLAN = 1 ]; then
+				GET_CHANNEL_BONDING=`cat $CONFIG_DIR/channel_bonding`
+				$SET_WLAN set_mib use40M=$GET_CHANNEL_BONDING
+
+				GET_CONTROL_SIDEBAND=`cat $CONFIG_DIR/control_sideband`
+
+				if [ "$GET_CHANNEL_BONDING" = 0 ]; then
+					$SET_WLAN set_mib 2ndchoffset=0
+				else
+					if [ "$GET_CONTROL_SIDEBAND" = 0 ]; then
+						 $SET_WLAN set_mib 2ndchoffset=1
+					fi
+					if [ "$GET_CONTROL_SIDEBAND" = 1 ]; then
+						 $SET_WLAN set_mib 2ndchoffset=2
+					fi
+				fi
+			fi # [ $IS_ROOT_WLAN = 1 ]
+
+		GET_COEXIST_ENABLED=`cat $CONFIG_DIR/coexist_enabled`
+		$SET_WLAN set_mib coexist=$GET_COEXIST_ENABLED
+		fi # [ $GET_BAND = 10 ] || [ $GET_BAND = 11 ]
+##########
+	
+
+## for wlan0 set ssid 
+echo "set basic ap parameters" >> $LOG
+	GET_VALUE=`cat $CONFIG_DIR/ssid`
+	$SET_WLAN set_mib ssid="$GET_VALUE"
+	
+	GET_VALUE=`cat $CONFIG_DIR/hidden_ssid`
+	$SET_WLAN set_mib hiddenAP=$GET_VALUE
+
+	GET_VALUE=`cat $CONFIG_DIR/supported_sta_num`
+	$SET_WLAN set_mib stanum=$GET_VALUE
+
+	# for ap isolation 
+	# need to confirm which is for ap isolation
+	#GET_VALUE=`cat $CONFIG_DIR/group_id`
+	#$SET_WLAN set_mib groupID=$GET_VALUE
+
+	# set block relay
+	GET_VALUE=`cat $CONFIG_DIR/block_relay`
+	$SET_WLAN set_mib block_relay=$GET_VALUE
+
+
+	GET_WLAN_AUTH_TYPE=`cat $CONFIG_DIR/auth_type`
+	AUTH_TYPE=$GET_WLAN_AUTH_TYPE
+	GET_WLAN_ENCRYPT=`cat $CONFIG_DIR/encrypt`
+	if [ "$GET_WLAN_AUTH_TYPE" = '1' ] && [ "$GET_WLAN_ENCRYPT" != '1' ]; then
+		# shared-key and not WEP enabled, force to open-system
+		AUTH_TYPE=0
+	fi
+	$SET_WLAN set_mib authtype=$AUTH_TYPE
+	if [ "$GET_WLAN_ENCRYPT" = '0' ]; then
+		$SET_WLAN set_mib encmode=0
+	elif [ "$GET_WLAN_ENCRYPT" = '1' ]; then
+		### WEP mode ##
+		GET_WEP=`cat $CONFIG_DIR/wep`
+		GET_WEP_KEY_TYPE=`cat $CONFIG_DIR/wep_key_type`
+		GET_WEP_KEY_ID=`cat $CONFIG_DIR/wep_default_key`
+		
+		if [ "$GET_WEP" = '1' ]; then
+			if [ "$GET_WEP_KEY_TYPE" = '0' ]; then
+				GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_64_asc`
+				GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_64_asc`
+				GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_64_asc`
+				GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_64_asc`
+			else
+				GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_64_hex`
+				GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_64_hex`
+				GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_64_hex`
+				GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_64_hex`
+			fi
+		
+			$SET_WLAN set_mib encmode=1
+			$SET_WLAN set_mib wepkey1=$GET_WEP_KEY_1
+			$SET_WLAN set_mib wepkey2=$GET_WEP_KEY_2
+			$SET_WLAN set_mib wepkey3=$GET_WEP_KEY_3
+			$SET_WLAN set_mib wepkey4=$GET_WEP_KEY_4
+			$SET_WLAN set_mib wepdkeyid=$GET_WEP_KEY_ID
+		else
+			if [ "$GET_WEP_KEY_TYPE" = '0' ]; then
+				GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_128_asc`
+				GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_128_asc`
+				GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_128_asc`
+				GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_128_asc`
+			else
+				GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_128_hex`
+				GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_128_hex`
+				GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_128_hex`
+				GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_128_hex`
+			fi
+			$SET_WLAN set_mib encmode=5
+			$SET_WLAN set_mib wepkey1=$GET_WEP_KEY_1
+			$SET_WLAN set_mib wepkey2=$GET_WEP_KEY_2
+			$SET_WLAN set_mib wepkey3=$GET_WEP_KEY_3
+			$SET_WLAN set_mib wepkey4=$GET_WEP_KEY_4
+			$SET_WLAN set_mib wepdkeyid=$GET_WEP_KEY_ID
+		fi
+	else
+			## WPA mode ##
+		$SET_WLAN set_mib encmode=2
+	fi
+
+
+	## Set 802.1x flag ##
+	_ENABLE_1X=0
+	if [ $GET_WLAN_ENCRYPT -lt 2 ]; then
+		GET_ENABLE_1X=`cat $CONFIG_DIR/enable_1x`
+		GET_MAC_AUTH_ENABLED=`cat $CONFIG_DIR/mac_auth_enabled`
+		if [ "$GET_ENABLE_1X" != 0 ] || [ "$GET_MAC_AUTH_ENABLED" != 0 ]; then
+			_ENABLE_1X=1
+		fi
+	else
+		_ENABLE_1X=1
+	fi
+	$SET_WLAN set_mib 802_1x=$_ENABLE_1X
+	
+
+	echo "wpa relative settings"  >> $LOG
+#
+# following settings is used when driver WPA module is included
+#
+
+	GET_WPA_AUTH=`cat $CONFIG_DIR/wpa_auth`
+	#if [ $GET_VALUE_WLAN_MODE != 1 ] && [ $GET_WLAN_ENCRYPT -ge 2 ]  && [ $GET_WLAN_ENCRYPT -lt 7 ] && [ $GET_WPA_AUTH = 2 ]; then
+	if [ $GET_WLAN_ENCRYPT -ge 2 ]  && [ $GET_WLAN_ENCRYPT -lt 11 ]; then
+		if [ $GET_WPA_AUTH = 2 ]; then
+			if [ $GET_WLAN_ENCRYPT = 2 ]; then
+				ENABLE=1
+			elif [ $GET_WLAN_ENCRYPT = 4 ]; then
+				ENABLE=2
+			elif [ $GET_WLAN_ENCRYPT = 6 ]; then
+				ENABLE=3
+		        elif [ $GET_WLAN_ENCRYPT = 8 ]; then
+			        ENABLE=8
+		        elif [ $GET_WLAN_ENCRYPT = 10 ]; then
+			       ENABLE=10
+			else
+				echo "invalid ENCRYPT value!($GET_WLAN_ENCRYPT)" >> $LOG
+				exit $ERROR_INVALID_PARAMETERS;
+			fi
+			$SET_WLAN set_mib psk_enable=$ENABLE
+		else
+			$SET_WLAN set_mib psk_enable=0
+		fi
+
+		if [ $GET_WLAN_ENCRYPT = 2 ] || [ $GET_WLAN_ENCRYPT = 6 ]; then
+			GET_WPA_CIPHER_SUITE=`cat $CONFIG_DIR/wpa_cipher`
+			if [ $GET_WPA_CIPHER_SUITE = 1 ]; then
+				CIPHER=2
+			elif [ $GET_WPA_CIPHER_SUITE = 2 ]; then
+				CIPHER=8
+			elif [ $GET_WPA_CIPHER_SUITE = 3 ]; then
+				CIPHER=10
+			else
+				echo "invalid WPA_CIPHER_SUITE value!($GET_WPA_CIPHER_SUITE)" >> $LOG
+				exit $ERROR_INVALID_PARAMETERS;
+			fi
+		fi
+		$SET_WLAN set_mib wpa_cipher=$CIPHER
+
+		if [ $GET_WLAN_ENCRYPT = 4 ] || [ $GET_WLAN_ENCRYPT = 6 ] || [ $GET_WLAN_ENCRYPT = 8 ] || [ $GET_WLAN_ENCRYPT = 10 ]; then
+			GET_WPA2_CIPHER_SUITE=`cat $CONFIG_DIR/wpa2_cipher`
+			if [ $GET_WPA2_CIPHER_SUITE = 1 ]; then
+				CIPHER=2
+			elif [ $GET_WPA2_CIPHER_SUITE = 2 ]; then
+				CIPHER=8
+			elif [ $GET_WPA2_CIPHER_SUITE = 3 ]; then
+				CIPHER=10
+			else
+				echo "invalid WPA2_CIPHER_SUITE value!($GET_WPA2_CIPHER_SUITE)" >> $LOG
+				exit $ERROR_INVALID_PARAMETERS;
+			fi
+		fi
+		$SET_WLAN set_mib wpa2_cipher=$CIPHER
+
+		GET_WPA_PSK=`cat $CONFIG_DIR/wpa_psk`
+		$SET_WLAN set_mib passphrase="$GET_WPA_PSK"
+
+	fi
+
+	if [ $GET_WLAN_ENCRYPT = 8 ] || [ $GET_WLAN_ENCRYPT = 10 ]; then
+		GET_WPA2_11W=`cat $CONFIG_DIR/wpa11w`
+		GET_WPA2_SHA256=`cat $CONFIG_DIR/wpa2EnableSHA256`
+		$SET_WLAN set_mib dot11IEEE80211W=$GET_WPA2_11W
+		$SET_WLAN set_mib enableSHA256=$GET_WPA2_SHA256
+	else
+		echo "Only WPA3 need PMF" >> $LOG
+		$SET_WLAN set_mib dot11IEEE80211W=0
+		$SET_WLAN set_mib enableSHA256=0
+	fi
+
+$IFCONFIG $1 up
+if [ $? != 0 ]; then
+	exit $ERROR_NO_SUCH_DEVICE
+fi
+
+
+exit $ERROR_SUCCESS
\ No newline at end of file
diff --git a/ap/app/Script/wifi_script/realtek/trigger_wps.sh b/ap/app/Script/wifi_script/realtek/trigger_wps.sh
new file mode 100644
index 0000000..d42f57c
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek/trigger_wps.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+#
+# script file to start network
+#
+# Usage: trigger_wps.sh 
+#
+
+##if [ $# -lt 2 ]; then echo "Usage: $0 {gw | ap} {all | bridge | wan}"; exit 1 ; fi
+
+ROOT=`nv get wifi_root_dir`
+
+LOG=$ROOT/wifi/realtek/slog
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0
+
+ID=`nv get wifi_wps_index`
+echo "enter trigger_wps.sh wifi_wps_index=$ID >>>>>>>>" >> $LOG
+ID=`expr $ID - 1`
+echo "enter trigger_wps.sh ID=$ID >>>>>>>>" >> $LOG
+
+if [ "$ID" = "0" ];then
+#CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0
+#WLAN_INTERFACE="wlan0"
+CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0-va$ID
+WLAN_INTERFACE="wlan0-va$ID"
+else
+CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0-va$ID
+WLAN_INTERFACE="wlan0-va$ID"
+fi
+
+
+WPS_MODE=`cat $CONFIG_DIR/wsc_method`
+if [ "$WPS_MODE" = "2" ]; then
+	echo "wscd -sig_pbc $WLAN_INTERFACE" >> $LOG
+	wscd -sig_pbc $WLAN_INTERFACE
+else
+	PIN=`cat $CONFIG_DIR/wsc_pin`
+	echo "iwpriv $WLAN_INTERFACE set_mib pin=$PIN" >> $LOG
+	iwpriv $WLAN_INTERFACE set_mib pin=$PIN
+fi
+
diff --git a/ap/app/Script/wifi_script/realtek/trigger_wps1.sh b/ap/app/Script/wifi_script/realtek/trigger_wps1.sh
new file mode 100644
index 0000000..c020f1a
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek/trigger_wps1.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+#
+# script file to start network
+#
+# Usage: trigger_wps.sh 
+#
+
+##if [ $# -lt 2 ]; then echo "Usage: $0 {gw | ap} {all | bridge | wan}"; exit 1 ; fi
+ROOT=`nv get wifi_root_dir`
+
+LOG=$ROOT/wifi/realtek/slog
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0
+
+ID=`nv get wifi_wps_index`
+echo "enter trigger_wps1.sh wifi_wps_index=$ID >>>>>>>>" >> $LOG
+
+CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0
+WLAN_INTERFACE="wlan0"
+
+
+WPS_MODE=`cat $CONFIG_DIR/wsc_method`
+
+echo "enter trigger_wps1.sh WPS_MODE=$WPS_MODE >>>>>>>>" >> $LOG
+
+if [ "$WPS_MODE" = "2" ]; then
+	echo "wscd -sig_pbc $WLAN_INTERFACE" >> $LOG
+	wscd -sig_pbc $WLAN_INTERFACE
+else
+	PIN=`cat $CONFIG_DIR/wsc_pin`
+	echo "iwpriv $WLAN_INTERFACE set_mib pin=$PIN" >> $LOG
+	iwpriv $WLAN_INTERFACE set_mib pin=$PIN
+fi
+
diff --git a/ap/app/Script/wifi_script/realtek/wlan_8192c.sh b/ap/app/Script/wifi_script/realtek/wlan_8192c.sh
new file mode 100755
index 0000000..c3362e3
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek/wlan_8192c.sh
@@ -0,0 +1,604 @@
+#!/bin/sh
+#
+# script file to start WLAN
+#
+
+
+## error code
+ERROR_SUCCESS=0
+ERROR_INVALID_PARAMETERS=1
+ERROR_NO_SUCH_DEVICE=2
+ERROR_NO_CONFIG_FILE=3
+ERROR_NO_SUCH_FILE=4
+ERROR_NO_SUCH_DIRECTORY=5
+ERROR_NULL_FILE=6
+ERROR_NET_IF_UP_FAIL=7
+
+IWPRIV=iwpriv
+wifi_lte_intr=`nv get wifi_lte_intr`
+
+if [ $# -lt 1 ]; then
+	echo "Usage: $0 wlan_interface" >> $LOG
+	exit $ERROR_INVALID_PARAMETERS;
+fi
+
+ROOT=`nv get wifi_root_dir`
+LOG=$ROOT/wifi/realtek/slog
+
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+CONFIG_DIR=$CONFIG_ROOT_DIR/$1
+echo "$1 config para" >> $LOG
+if [ ! -d "$CONFIG_DIR" ]; then
+	echo "$CONFIG_DIR: No such directory" >> $LOG
+	exit $ERROR_NO_CONFIG_FILE
+fi
+
+if [ -z "$SCRIPT_DIR" ]; then
+	SCRIPT_DIR=`cat $CONFIG_ROOT_DIR/wifi_script_dir`
+fi
+#echo $SCRIPT_DIR
+#START_WLAN_APP=$SCRIPT_DIR/wlanapp_8192c.sh
+
+if [ -z "$WLAN_PREFIX" ]; then
+	WLAN_PREFIX=wlan
+fi
+#WLAN_PREFIX_LEN=${#WLAN_PREFIX}
+#WLAN_NAME_LEN=$((WLAN_PREFIX_LEN + 1))
+
+if [ -z "$ROOT_WLAN" ]; then
+#	ROOT_WLAN=${1:0:$WLAN_NAME_LEN}
+### delete -va0 get wlan0
+	ROOT_WLAN=${1%%-*}  
+fi
+ROOT_CONFIG_DIR=$CONFIG_ROOT_DIR/$ROOT_WLAN
+
+IS_ROOT_WLAN=0
+if [ "$1" = "$ROOT_WLAN" ]; then
+	IS_ROOT_WLAN=1
+fi
+echo "IS_ROOT_WLAN is " $IS_ROOT_WLAN
+SET_WLAN="iwpriv $1"
+SET_WLAN_PARAM="$SET_WLAN set_mib"
+IFCONFIG=ifconfig
+
+## Disable WLAN MAC driver and shutdown interface first ##
+$IFCONFIG $1 down
+if [ $? != 0 ]; then
+	exit $ERROR_NO_SUCH_DEVICE
+fi
+
+GET_VALUE=
+GET_VALUE_TMP=
+GET_VALUE_WLAN_DISABLED=`cat $CONFIG_DIR/wlan_disabled`
+GET_VALUE_WLAN_MODE=`cat $CONFIG_DIR/wlan_mode`
+
+echo "$CONFIG_DIR/wlan_disabled =$GET_VALUE_WLAN_DISABLED " >> $LOG
+echo "$CONFIG_DIR/wlan_mode =$GET_VALUE_WLAN_MODE " >> $LOG
+
+
+##$SET_WLAN set_mib vap_enable=0
+$SET_WLAN set_mib wsc_enable=0
+
+## kill wlan application daemon ##
+
+##$START_WLAN_APP kill $1
+
+## Set parameters to driver ##
+
+GET_VALUE=`cat $ROOT_CONFIG_DIR/reg_domain`
+$SET_WLAN set_mib regdomain=$GET_VALUE
+
+NUM=0
+case $1 in
+$ROOT_WLAN-va*)
+	NUM=${1#$ROOT_WLAN-va}
+	#NUM=$((NUM + 1))
+	NUM=`expr $NUM + 1`	
+	;;
+esac
+
+
+## first start up, must be single ap, wlan0 used 12345678ffbb , then to apsta, or mssid
+## ap to apsta: wlan0 need reset mac
+## ap to mssid: wlan0 no need reset mac
+## apsta to mssid: wlan0 need reset mac
+## apsta to ap: wlan0 need reset mac
+## mssid to apsta: wlan0 need reset mac
+## mssid to ap: wlan0 no need reset mac
+##
+
+## if mssid wlan0 use fixded mac, if vxd up, wlan0 use wlan0_addr
+
+if [ "1" = "2" ];then
+
+	MSSID=`nv get m_ssid_enable`
+	APSTA=`nv get wifi_sta_connection`
+
+	if [ "$1" = "wlan0" ];then
+		if [ "$APSTA" = "0" -a "$MSSID" = "0" ];then
+	### single ap	
+			GET_VALUE=12345678ffbb
+	### multissid		
+		elif ["$MSSID" = "1" ];then
+			GET_VALUE=12345678ffbb
+	### apsta		
+		elif [ "$APSTA" = "1" ];then
+			GET_VALUE=`cat $ROOT_CONFIG_DIR/wlan${NUM}_addr`
+		fi
+		$IFCONFIG $1 hw ether $GET_VALUE
+	else
+		GET_VALUE=`cat $ROOT_CONFIG_DIR/wlan${NUM}_addr`
+		$IFCONFIG $1 hw ether $GET_VALUE
+	fi
+	echo "$IFCONFIG $1 hw ether $GET_VALUE NOT GO here><><>" >> $LOG
+
+else
+
+	if [ "$1" = "wlan0" ];then
+##wlan0 use fixed addr	
+		GET_VALUE=12345678ffbb
+		
+		iwpriv $1 set_mib hwaddr=$GET_VALUE
+		#$IFCONFIG $1 hw ether $GET_VALUE
+	else
+	
+		if [ "$1" = "wlan0-vxd" ];then
+			echo "$IWPRIV $1 copy_mib" >> $LOG
+			$IWPRIV $1 copy_mib
+		fi
+	
+		GET_VALUE=`cat $ROOT_CONFIG_DIR/wlan${NUM}_addr`
+		#$IFCONFIG $1 hw ether $GET_VALUE
+		iwpriv $1 set_mib hwaddr=$GET_VALUE
+	fi
+fi
+echo "iwpriv $1 set_mib hwaddr=$GET_VALUE" >> $LOG
+
+if [ "$GET_VALUE_WLAN_MODE" = '1' ]; then
+	## client mode 0: infrastructure  1:Ad-hoc
+	
+#	hwaddr=`cat /proc/wlan0-vxd/mib_all | grep hwaddr`
+	
+#	echo wlan0-vxd hwaddr=$hwaddr >> $LOG
+	
+	GET_VALUE=`cat $CONFIG_DIR/network_type`
+	if  [ "$GET_VALUE" = '0' ]; then
+		$SET_WLAN set_mib opmode=8
+	else
+		$SET_WLAN set_mib opmode=32
+		GET_VALUE_TMP=`cat $CONFIG_DIR/default_ssid`
+		$SET_WLAN set_mib defssid="$GET_VALUE_TMP"
+	fi
+	echo "wlan0-vxd do not set para, exit directly" >> $LOG
+	exit $ERROR_SUCCESS
+else
+	## AP mode
+	$SET_WLAN set_mib opmode=16
+fi
+##$IFCONFIG $1 hw ether $WLAN_MAC_ADDR
+
+##if [ "$GET_VALUE_WLAN_MODE" = '2' ]; then
+##		$SET_WLAN set_mib wds_pure=1
+##else
+##		$SET_WLAN set_mib wds_pure=0
+##fi
+
+echo "set RF parameters" >> $LOG
+# set RF parameters
+if [ $IS_ROOT_WLAN = 1 ]; then
+	GET_VALUE=`cat $CONFIG_DIR/channel`
+	$SET_WLAN set_mib channel=$GET_VALUE
+##autochannel can use wifi_lte_intr
+	if [ "$wifi_lte_intr" = "1" -a "$GET_VALUE" = "0" ];then
+		echo "wifi_lte_intr=$wifi_lte_intr  $SET_WLAN set_mib ch_low=5" >> $LOG	
+#		$SET_WLAN set_mib ch_low=5
+		$SET_WLAN set_mib disable_acs_ch=15
+	else
+		GET_VALUE=`cat $CONFIG_DIR/ch_low`
+		$SET_WLAN set_mib ch_low=$GET_VALUE
+	fi
+	
+	GET_VALUE=`cat $CONFIG_DIR/ch_hi`
+	$SET_WLAN set_mib ch_hi=$GET_VALUE
+	
+	GET_VALUE=`cat $CONFIG_DIR/led_type`
+	$SET_WLAN set_mib led_type=$GET_VALUE
+	
+	GET_VALUE=`cat $CONFIG_DIR/MIMO_TR_mode`
+	$SET_WLAN set_mib MIMO_TR_mode=$GET_VALUE
+	
+	#GET_TX_POWER_CCK_A=`cat $CONFIG_DIR/tx_power_cck_a`
+	#GET_TX_POWER_CCK_B=`cat $CONFIG_DIR/tx_power_cck_b`
+	#GET_TX_POWER_HT40_1S_A=`cat $CONFIG_DIR/tx_power_ht40_1s_a`
+	#GET_TX_POWER_HT40_1S_B=`cat $CONFIG_DIR/tx_power_ht40_1s_b`
+
+	#GET_TX_POWER_DIFF_HT40_2S=`cat $CONFIG_DIR/tx_power_diff_ht40_2s`
+	#GET_TX_POWER_DIFF_HT20=`cat $CONFIG_DIR/tx_power_diff_ht20`
+	#GET_TX_POWER_DIFF_OFDM=`cat $CONFIG_DIR/tx_power_diff_ofdm`
+
+	#$SET_WLAN set_mib pwrlevelCCK_A=$GET_TX_POWER_CCK_A
+	#$SET_WLAN set_mib pwrlevelCCK_B=$GET_TX_POWER_CCK_B
+	#$SET_WLAN set_mib pwrlevelHT40_1S_A=$GET_TX_POWER_HT40_1S_A
+	#$SET_WLAN set_mib pwrlevelHT40_1S_B=$GET_TX_POWER_HT40_1S_B
+	#$SET_WLAN set_mib pwrdiffHT40_2S=$GET_TX_POWER_DIFF_HT40_2S
+	#$SET_WLAN set_mib pwrdiffHT20=$GET_TX_POWER_DIFF_HT20
+	#$SET_WLAN set_mib pwrdiffOFDM=$GET_TX_POWER_DIFF_OFDM
+	
+	GET_TX_POWER_PERCENT=`cat $CONFIG_DIR/tx_power_percet`
+	#echo "GET_TX_POWER_PERCENT is "$GET_TX_POWER_PERCENT
+	$SET_WLAN set_mib powerpercent=$GET_TX_POWER_PERCENT
+	
+	GET_11N_TSSI1=`cat $CONFIG_DIR/tssi_1`
+	$SET_WLAN set_mib tssi1=$GET_11N_TSSI1
+	GET_11N_TSSI2=`cat $CONFIG_DIR/tssi_2`
+	$SET_WLAN set_mib tssi2=$GET_11N_TSSI2
+	
+	#GET_VALUE=`cat $CONFIG_DIR/11n_ther`
+	#$SET_WLAN set_mib ther=$GET_VALUE
+	
+	GET_VALUE=`cat $CONFIG_DIR/trswitch`
+	$SET_WLAN set_mib trswitch=$GET_VALUE
+
+	#GET_VALUE=`cat $CONFIG_DIR/11n_xcap`
+	#$SET_WLAN set_mib xcap=$GET_VALUE
+	
+	#GET_VALUE=`cat $CONFIG_DIR/rfe_type`
+	#$SET_WLAN set_mib rfe_type=$GET_VALUE
+	
+	#exit $ERROR_SUCCESS
+	
+#	iwpriv wlan0 efuse_set SD=3
+#	iwpriv wlan0 efuse_sync
+	iwpriv wlan0 set_mib func_off=1
+
+fi # [ $IS_ROOT_WLAN = 1 ]
+	
+GET_VALUE=`cat $CONFIG_DIR/basic_rates`
+$SET_WLAN set_mib basicrates=$GET_VALUE
+
+GET_VALUE=`cat $CONFIG_DIR/supported_rate`
+$SET_WLAN set_mib oprates=$GET_VALUE
+	
+GET_RATE_ADAPTIVE_VALUE=`cat $CONFIG_DIR/rate_adaptive_enabled`
+if [ "$GET_RATE_ADAPTIVE_VALUE" = '0' ]; then
+	$SET_WLAN set_mib autorate=0
+	GET_FIX_RATE_VALUE=`cat $CONFIG_DIR/fix_rate`
+	$SET_WLAN set_mib fixrate=$GET_FIX_RATE_VALUE
+else
+	$SET_WLAN set_mib autorate=1
+fi
+
+GET_VALUE=`cat $CONFIG_DIR/rts_threshold`
+$SET_WLAN set_mib rtsthres=$GET_VALUE
+
+GET_VALUE=`cat $CONFIG_DIR/frag_threshold`
+$SET_WLAN set_mib fragthres=$GET_VALUE
+	
+GET_VALUE=`cat $CONFIG_DIR/inactivity_time`
+$SET_WLAN set_mib expired_time=$GET_VALUE
+GET_VALUE=`cat $ROOT_CONFIG_DIR/beacon_interval`
+$SET_WLAN set_mib bcnint=$GET_VALUE
+
+GET_VALUE=`cat $ROOT_CONFIG_DIR/dtim_period`
+$SET_WLAN set_mib dtimperiod=$GET_VALUE
+
+GET_VALUE=`cat $CONFIG_DIR/preamble_type`
+$SET_WLAN set_mib preamble=$GET_VALUE
+GET_VALUE=`cat $CONFIG_DIR/hidden_ssid`
+$SET_WLAN set_mib hiddenAP=$GET_VALUE
+
+GET_VALUE=`cat $CONFIG_DIR/supported_sta_num`
+$SET_WLAN set_mib stanum=$GET_VALUE
+
+GET_VALUE=`cat $CONFIG_DIR/ssid`
+$SET_WLAN set_mib ssid="$GET_VALUE"
+
+GET_VALUE=`cat $CONFIG_DIR/macac_enabled`
+$SET_WLAN set_mib aclmode=$GET_VALUE
+$SET_WLAN set_mib aclnum=0
+#ACL_NUM=`cat $CONFIG_DIR/macac_num`
+#_counter=1
+#while [ $_counter -le $ACL_NUM ]; do
+#	GET_VALUE=`cat $CONFIG_DIR/macac_addr$_counter`
+	#$SET_WLAN set_mib acladdr=$GET_VALUE
+#	echo "----add_acl_table is "$GET_VALUE
+	#$SET_WLAN add_acl_table $GET_VALUE
+#	_counter=$((_counter + 1))
+#done
+
+GET_WLAN_AUTH_TYPE=`cat $CONFIG_DIR/auth_type`
+AUTH_TYPE=$GET_WLAN_AUTH_TYPE
+GET_WLAN_ENCRYPT=`cat $CONFIG_DIR/encrypt`
+if [ "$GET_WLAN_AUTH_TYPE" = '1' ] && [ "$GET_WLAN_ENCRYPT" != '1' ]; then
+	# shared-key and not WEP enabled, force to open-system
+	AUTH_TYPE=0
+fi
+$SET_WLAN set_mib authtype=$AUTH_TYPE
+if [ "$GET_WLAN_ENCRYPT" = '0' ]; then
+	$SET_WLAN set_mib encmode=0
+elif [ "$GET_WLAN_ENCRYPT" = '1' ]; then
+	### WEP mode ##
+	GET_WEP=`cat $CONFIG_DIR/wep`
+	GET_WEP_KEY_TYPE=`cat $CONFIG_DIR/wep_key_type`
+	GET_WEP_KEY_ID=`cat $CONFIG_DIR/wep_default_key`
+	
+	if [ "$GET_WEP" = '1' ]; then
+		if [ "$GET_WEP_KEY_TYPE" = '0' ]; then
+			GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_64_asc`
+			GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_64_asc`
+			GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_64_asc`
+			GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_64_asc`
+		else
+			GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_64_hex`
+			GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_64_hex`
+			GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_64_hex`
+			GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_64_hex`
+		fi
+	
+		$SET_WLAN set_mib encmode=1
+		$SET_WLAN set_mib wepkey1=$GET_WEP_KEY_1
+		$SET_WLAN set_mib wepkey2=$GET_WEP_KEY_2
+		$SET_WLAN set_mib wepkey3=$GET_WEP_KEY_3
+		$SET_WLAN set_mib wepkey4=$GET_WEP_KEY_4
+		$SET_WLAN set_mib wepdkeyid=$GET_WEP_KEY_ID
+	else
+		if [ "$GET_WEP_KEY_TYPE" = '0' ]; then
+			GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_128_asc`
+			GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_128_asc`
+			GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_128_asc`
+			GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_128_asc`
+		else
+			GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_128_hex`
+			GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_128_hex`
+			GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_128_hex`
+			GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_128_hex`
+		fi
+		$SET_WLAN set_mib encmode=5
+		$SET_WLAN set_mib wepkey1=$GET_WEP_KEY_1
+		$SET_WLAN set_mib wepkey2=$GET_WEP_KEY_2
+		$SET_WLAN set_mib wepkey3=$GET_WEP_KEY_3
+		$SET_WLAN set_mib wepkey4=$GET_WEP_KEY_4
+		$SET_WLAN set_mib wepdkeyid=$GET_WEP_KEY_ID
+	fi
+else
+        ## WPA mode ##
+	$SET_WLAN set_mib encmode=2
+fi
+##$SET_WLAN set_mib wds_enable=0
+##$SET_WLAN set_mib wds_encrypt=0
+## Set 802.1x flag ##
+_ENABLE_1X=0
+if [ $GET_WLAN_ENCRYPT -lt 2 ]; then
+	GET_ENABLE_1X=`cat $CONFIG_DIR/enable_1x`
+	GET_MAC_AUTH_ENABLED=`cat $CONFIG_DIR/mac_auth_enabled`
+	if [ "$GET_ENABLE_1X" != 0 ] || [ "$GET_MAC_AUTH_ENABLED" != 0 ]; then
+		_ENABLE_1X=1
+	fi
+else
+	_ENABLE_1X=1
+fi
+$SET_WLAN set_mib 802_1x=$_ENABLE_1X
+	#set band
+GET_BAND=`cat $ROOT_CONFIG_DIR/band`
+GET_WIFI_SPECIFIC=`cat $ROOT_CONFIG_DIR/wifi_specific`
+if [ "$GET_VALUE_WLAN_MODE" != '1' ] && [ "$GET_WIFI_SPECIFIC" = 1 ] &&  [ "$GET_BAND" = '2' ] ; then
+	GET_BAND=3
+fi
+if [ "$GET_BAND" = '8' ]; then
+	GET_BAND=11
+	$SET_WLAN set_mib deny_legacy=3
+elif [ "$GET_BAND" = '2' ]; then
+	GET_BAND=3
+	$SET_WLAN set_mib deny_legacy=1
+elif [ "$GET_BAND" = '10' ]; then
+	GET_BAND=11
+	$SET_WLAN set_mib deny_legacy=1
+elif [ "$GET_BAND" = '64' ]; then
+	GET_BAND=76
+	$SET_WLAN set_mib deny_legacy=12
+elif [ "$GET_BAND" = '72' ]; then
+	GET_BAND=76
+	$SET_WLAN set_mib deny_legacy=4
+else
+	$SET_WLAN set_mib deny_legacy=0
+fi
+$SET_WLAN set_mib band=$GET_BAND
+
+
+echo "Set 11n parameter"  >> $LOG
+###Set 11n parameter
+	if [ $GET_BAND = 10 ] || [ $GET_BAND = 11 ] || [ $GET_BAND = 76 ]; then
+	if [ $IS_ROOT_WLAN = 1 ]; then
+		GET_CHANNEL_BONDING=`cat $CONFIG_DIR/channel_bonding`
+		$SET_WLAN set_mib use40M=$GET_CHANNEL_BONDING
+
+		GET_CONTROL_SIDEBAND=`cat $CONFIG_DIR/control_sideband`
+
+		if [ "$GET_CHANNEL_BONDING" = 0 ]; then
+			$SET_WLAN set_mib 2ndchoffset=0
+		else
+			if [ "$GET_CONTROL_SIDEBAND" = 0 ]; then
+				 $SET_WLAN set_mib 2ndchoffset=1
+			fi
+			if [ "$GET_CONTROL_SIDEBAND" = 1 ]; then
+				 $SET_WLAN set_mib 2ndchoffset=2
+			fi
+		fi
+	fi # [ $IS_ROOT_WLAN = 1 ]
+
+	GET_SHORT_GI=`cat $CONFIG_DIR/short_gi`
+	$SET_WLAN set_mib shortGI20M=$GET_SHORT_GI
+	$SET_WLAN set_mib shortGI40M=$GET_SHORT_GI
+
+	GET_AGGREGATION=`cat $CONFIG_DIR/aggregation`
+
+	if [ "$GET_AGGREGATION" = 0 ]; then
+		$SET_WLAN set_mib ampdu=$GET_AGGREGATION
+		$SET_WLAN set_mib amsdu=$GET_AGGREGATION
+	elif [ "$GET_AGGREGATION" = 1 ]; then
+		$SET_WLAN set_mib ampdu=1
+		$SET_WLAN set_mib amsdu=0
+	elif [ "$GET_AGGREGATION" = 2 ]; then
+		$SET_WLAN set_mib ampdu=0
+		$SET_WLAN set_mib amsdu=1
+	elif [ "$GET_AGGREGATION" = 3 ]; then
+		$SET_WLAN set_mib ampdu=1
+		$SET_WLAN set_mib amsdu=1
+	fi
+
+	GET_STBC_ENABLED=`cat $CONFIG_DIR/stbc_enabled`
+	$SET_WLAN set_mib stbc=$GET_STBC_ENABLED
+	GET_COEXIST_ENABLED=`cat $CONFIG_DIR/coexist_enabled`
+	$SET_WLAN set_mib coexist=$GET_COEXIST_ENABLED
+	fi # [ $GET_BAND = 10 ] || [ $GET_BAND = 11 ]
+##########
+
+#set nat2.5 disable when client and mac clone is set
+GET_MACCLONE_ENABLED=`cat $CONFIG_DIR/macclone_enable`
+if [ "$GET_MACCLONE_ENABLED" = '1' -a "$GET_VALUE_WLAN_MODE" = '1' ]; then
+	$SET_WLAN set_mib nat25_disable=1
+	$SET_WLAN set_mib macclone_enable=1
+else
+	$SET_WLAN set_mib nat25_disable=0
+	$SET_WLAN set_mib macclone_enable=0
+fi
+
+# set 11g protection mode
+GET_PROTECTION_DISABLED=`cat $CONFIG_DIR/protection_disabled`
+if  [ "$GET_PROTECTION_DISABLED" = '1' ] ;then
+	$SET_WLAN set_mib disable_protection=1
+else
+	$SET_WLAN set_mib disable_protection=0
+fi
+
+# for ap isolation
+GET_VALUE=`cat $CONFIG_DIR/group_id`
+$SET_WLAN set_mib groupID=$GET_VALUE
+
+# set block relay
+GET_VALUE=`cat $CONFIG_DIR/block_relay`
+$SET_WLAN set_mib block_relay=$GET_VALUE
+	
+	
+# set WiFi specific mode
+GET_VALUE=`cat $ROOT_CONFIG_DIR/wifi_specific`
+$SET_WLAN set_mib wifi_specific=$GET_VALUE
+
+# for WMM
+GET_VALUE=`cat $CONFIG_DIR/wmm_enabled`
+$SET_WLAN set_mib qos_enable=$GET_VALUE
+
+# for guest access
+GET_VALUE=`cat $CONFIG_DIR/guest_access`
+$SET_WLAN set_mib guest_access=$GET_VALUE
+
+
+
+# for country code
+COUNTRY_CODE_ENABLE=`$SET_WLAN get_mib countrycode 2> /dev/null`
+if [ ! -z "$COUNTRY_CODE_ENABLE" ]; then
+	GET_VALUE=`cat $ROOT_CONFIG_DIR/countrycode_enable`
+	$SET_WLAN set_mib countrycode=$GET_VALUE
+
+	GET_VALUE=`cat $ROOT_CONFIG_DIR/countrycode`
+	$SET_WLAN set_mib countrystr=$GET_VALUE
+fi
+
+echo "wpa relative settings"  >> $LOG
+#
+# following settings is used when driver WPA module is included
+#
+
+GET_WPA_AUTH=`cat $CONFIG_DIR/wpa_auth`
+#if [ $GET_VALUE_WLAN_MODE != 1 ] && [ $GET_WLAN_ENCRYPT -ge 2 ]  && [ $GET_WLAN_ENCRYPT -lt 7 ] && [ $GET_WPA_AUTH = 2 ]; then
+if [ $GET_WLAN_ENCRYPT -ge 2 ]  && [ $GET_WLAN_ENCRYPT -lt 11 ]; then
+	if [ $GET_WPA_AUTH = 2 ]; then
+		if [ $GET_WLAN_ENCRYPT = 2 ]; then
+			ENABLE=1
+		elif [ $GET_WLAN_ENCRYPT = 4 ]; then
+			ENABLE=2
+		elif [ $GET_WLAN_ENCRYPT = 6 ]; then
+			ENABLE=3
+		elif [ $GET_WLAN_ENCRYPT = 8 ]; then
+			ENABLE=8
+		elif [ $GET_WLAN_ENCRYPT = 10 ]; then
+			ENABLE=10
+		else
+			echo "invalid ENCRYPT value!($GET_WLAN_ENCRYPT)" >> $LOG
+			exit $ERROR_INVALID_PARAMETERS;
+		fi
+		$SET_WLAN set_mib psk_enable=$ENABLE
+	else
+		$SET_WLAN set_mib psk_enable=0
+	fi
+
+	if [ $GET_WLAN_ENCRYPT = 2 ] || [ $GET_WLAN_ENCRYPT = 6 ]; then
+		GET_WPA_CIPHER_SUITE=`cat $CONFIG_DIR/wpa_cipher`
+		if [ $GET_WPA_CIPHER_SUITE = 1 ]; then
+			CIPHER=2
+		elif [ $GET_WPA_CIPHER_SUITE = 2 ]; then
+			CIPHER=8
+		elif [ $GET_WPA_CIPHER_SUITE = 3 ]; then
+			CIPHER=10
+		else
+			echo "invalid WPA_CIPHER_SUITE value!($GET_WPA_CIPHER_SUITE)" >> $LOG
+			exit $ERROR_INVALID_PARAMETERS;
+		fi
+	fi
+	$SET_WLAN set_mib wpa_cipher=$CIPHER
+
+	if [ $GET_WLAN_ENCRYPT = 4 ] || [ $GET_WLAN_ENCRYPT = 6 ] || [ $GET_WLAN_ENCRYPT = 8 ] || [ $GET_WLAN_ENCRYPT = 10 ]; then
+		GET_WPA2_CIPHER_SUITE=`cat $CONFIG_DIR/wpa2_cipher`
+		if [ $GET_WPA2_CIPHER_SUITE = 1 ]; then
+			CIPHER=2
+		elif [ $GET_WPA2_CIPHER_SUITE = 2 ]; then
+			CIPHER=8
+		elif [ $GET_WPA2_CIPHER_SUITE = 3 ]; then
+			CIPHER=10
+		else
+			echo "invalid WPA2_CIPHER_SUITE value!($GET_WPA2_CIPHER_SUITE)" >> $LOG
+			exit $ERROR_INVALID_PARAMETERS;
+		fi
+	fi
+	$SET_WLAN set_mib wpa2_cipher=$CIPHER
+
+	GET_WPA_PSK=`cat $CONFIG_DIR/wpa_psk`
+	$SET_WLAN set_mib passphrase="$GET_WPA_PSK"
+
+	
+	GET_WPA_GROUP_REKEY_TIME=`cat $CONFIG_DIR/gk_rekey`
+	$SET_WLAN set_mib gk_rekey=$GET_WPA_GROUP_REKEY_TIME
+fi
+# Set 11w parameter #
+#if [ $GET_WLAN_ENCRYPT = 4 ] || [ $GET_WLAN_ENCRYPT = 6 ]; then
+#	GET_WPA2_11W=`cat $CONFIG_DIR/wpa11w`
+#	GET_WPA2_SHA256=`cat $CONFIG_DIR/wpa2EnableSHA256`
+#	if [ $GET_WPA2_11W = 0 ]; then
+#		GET_WPA2_SHA256=0
+#	elif [ $GET_WPA2_11W = 1 ]; then
+#		if [ "$GET_WPA2_SHA256" != '0' ] && [ "$GET_WPA2_SHA256" != '1' ]; then
+#			GET_WPA2_SHA256=0
+#		fi
+#	elif [ $GET_WPA2_11W = 2 ]; then
+#		GET_WPA2_SHA256=1
+#	else
+#		echo "invalid GET_WPA2_11W value!($GET_WPA2_11W)";
+#		exit $ERROR_INVALID_PARAMETERS;
+#	fi
+#else
+#	GET_WPA2_11W=0
+#	GET_WPA2_SHA256=0
+#fi
+
+if [ $GET_WLAN_ENCRYPT = 8 ] || [ $GET_WLAN_ENCRYPT = 10 ]; then
+	GET_WPA2_11W=`cat $CONFIG_DIR/wpa11w`
+	GET_WPA2_SHA256=`cat $CONFIG_DIR/wpa2EnableSHA256`
+	$SET_WLAN set_mib dot11IEEE80211W=$GET_WPA2_11W
+	$SET_WLAN set_mib enableSHA256=$GET_WPA2_SHA256
+else
+	echo "Only WPA3 need PMF" >> $LOG
+	$SET_WLAN set_mib dot11IEEE80211W=0
+	$SET_WLAN set_mib enableSHA256=0
+fi
+
+##########
diff --git a/ap/app/Script/wifi_script/realtek/wlan_8192c1.sh b/ap/app/Script/wifi_script/realtek/wlan_8192c1.sh
new file mode 100755
index 0000000..89a93ef
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek/wlan_8192c1.sh
@@ -0,0 +1,556 @@
+#!/bin/sh
+#
+# script file to start WLAN
+#
+
+
+## error code
+ERROR_SUCCESS=0
+ERROR_INVALID_PARAMETERS=1
+ERROR_NO_SUCH_DEVICE=2
+ERROR_NO_CONFIG_FILE=3
+ERROR_NO_SUCH_FILE=4
+ERROR_NO_SUCH_DIRECTORY=5
+ERROR_NULL_FILE=6
+ERROR_NET_IF_UP_FAIL=7
+
+IWPRIV=iwpriv
+wifi_lte_intr=`nv get wifi_lte_intr`
+
+if [ $# -lt 1 ]; then
+	echo "Usage: $0 wlan_interface" >> $LOG
+	exit $ERROR_INVALID_PARAMETERS;
+fi
+
+ROOT=`nv get wifi_root_dir`
+
+LOG=$ROOT/wifi/realtek/slog
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+
+CONFIG_DIR=$CONFIG_ROOT_DIR/$1
+echo "$1 config para" >> $LOG
+if [ ! -d "$CONFIG_DIR" ]; then
+	echo "$CONFIG_DIR: No such directory" >> $LOG
+	exit $ERROR_NO_CONFIG_FILE
+fi
+
+if [ -z "$SCRIPT_DIR" ]; then
+	SCRIPT_DIR=`cat $CONFIG_ROOT_DIR/wifi_script_dir`
+fi
+#echo $SCRIPT_DIR
+#START_WLAN_APP=$SCRIPT_DIR/wlanapp_8192c.sh
+
+if [ -z "$WLAN_PREFIX" ]; then
+	WLAN_PREFIX=wlan
+fi
+#WLAN_PREFIX_LEN=${#WLAN_PREFIX}
+#WLAN_NAME_LEN=$((WLAN_PREFIX_LEN + 1))
+
+if [ -z "$ROOT_WLAN" ]; then
+#	ROOT_WLAN=${1:0:$WLAN_NAME_LEN}
+### delete -va0 get wlan0
+	ROOT_WLAN=${1%%-*}  
+fi
+ROOT_CONFIG_DIR=$CONFIG_ROOT_DIR/$ROOT_WLAN
+
+IS_ROOT_WLAN=0
+if [ "$1" = "$ROOT_WLAN" ]; then
+	IS_ROOT_WLAN=1
+fi
+echo "IS_ROOT_WLAN is " $IS_ROOT_WLAN
+SET_WLAN="iwpriv $1"
+SET_WLAN_PARAM="$SET_WLAN set_mib"
+IFCONFIG=ifconfig
+
+## Disable WLAN MAC driver and shutdown interface first ##
+$IFCONFIG $1 down
+if [ $? != 0 ]; then
+	exit $ERROR_NO_SUCH_DEVICE
+fi
+
+GET_VALUE=
+GET_VALUE_TMP=
+GET_VALUE_WLAN_DISABLED=`cat $CONFIG_DIR/wlan_disabled`
+GET_VALUE_WLAN_MODE=`cat $CONFIG_DIR/wlan_mode`
+
+echo "$CONFIG_DIR/wlan_disabled =$GET_VALUE_WLAN_DISABLED " >> $LOG
+echo "$CONFIG_DIR/wlan_mode =$GET_VALUE_WLAN_MODE " >> $LOG
+
+
+##$SET_WLAN set_mib vap_enable=0
+$SET_WLAN set_mib wsc_enable=0
+
+## kill wlan application daemon ##
+
+##$START_WLAN_APP kill $1
+
+## Set parameters to driver ##
+
+GET_VALUE=`cat $ROOT_CONFIG_DIR/reg_domain`
+$SET_WLAN set_mib regdomain=$GET_VALUE
+
+NUM=0
+case $1 in
+$ROOT_WLAN-va*)
+	NUM=${1#$ROOT_WLAN-va}
+	#NUM=$((NUM + 1))
+	NUM=`expr $NUM + 1`	
+	;;
+esac
+
+
+GET_VALUE=`cat $ROOT_CONFIG_DIR/wlan${NUM}_addr`
+iwpriv $1 set_mib hwaddr=$GET_VALUE
+
+echo "iwpriv $1 set_mib hwaddr=$GET_VALUE" >> $LOG
+
+if [ "$GET_VALUE_WLAN_MODE" = '1' ]; then
+	## client mode 0: infrastructure  1:Ad-hoc
+	
+	hwaddr=`cat /proc/wlan0-vxd/mib_all | grep hwaddr`
+	
+	echo wlan0-vxd hwaddr=$hwaddr >> $LOG
+	
+	GET_VALUE=`cat $CONFIG_DIR/network_type`
+	if  [ "$GET_VALUE" = '0' ]; then
+		$SET_WLAN set_mib opmode=8
+	else
+		$SET_WLAN set_mib opmode=32
+		GET_VALUE_TMP=`cat $CONFIG_DIR/default_ssid`
+		$SET_WLAN set_mib defssid="$GET_VALUE_TMP"
+	fi
+	echo "wlan0-vxd do not set para, exit directly" >> $LOG
+	exit $ERROR_SUCCESS
+else
+	## AP mode
+	$SET_WLAN set_mib opmode=16
+fi
+##$IFCONFIG $1 hw ether $WLAN_MAC_ADDR
+
+##if [ "$GET_VALUE_WLAN_MODE" = '2' ]; then
+##		$SET_WLAN set_mib wds_pure=1
+##else
+##		$SET_WLAN set_mib wds_pure=0
+##fi
+
+echo "set RF parameters" >> $LOG
+# set RF parameters
+if [ $IS_ROOT_WLAN = 1 ]; then
+	GET_VALUE=`cat $CONFIG_DIR/channel`
+	$SET_WLAN set_mib channel=$GET_VALUE
+##autochannel can use wifi_lte_intr
+	if [ "$wifi_lte_intr" = "1" -a "$GET_VALUE" = "0" ];then
+		echo "wifi_lte_intr=$wifi_lte_intr  $SET_WLAN set_mib ch_low=5" >> $LOG	
+		$SET_WLAN set_mib ch_low=5
+#		$SET_WLAN set_mib disable_acs_ch=15
+	else
+		GET_VALUE=`cat $CONFIG_DIR/ch_low`
+		$SET_WLAN set_mib ch_low=$GET_VALUE
+	fi
+	
+	GET_VALUE=`cat $CONFIG_DIR/ch_hi`
+	$SET_WLAN set_mib ch_hi=$GET_VALUE
+	
+	GET_VALUE=`cat $CONFIG_DIR/led_type`
+	$SET_WLAN set_mib led_type=$GET_VALUE
+	
+	GET_VALUE=`cat $CONFIG_DIR/MIMO_TR_mode`
+	$SET_WLAN set_mib MIMO_TR_mode=$GET_VALUE
+	
+	#GET_TX_POWER_CCK_A=`cat $CONFIG_DIR/tx_power_cck_a`
+	#GET_TX_POWER_CCK_B=`cat $CONFIG_DIR/tx_power_cck_b`
+	#GET_TX_POWER_HT40_1S_A=`cat $CONFIG_DIR/tx_power_ht40_1s_a`
+	#GET_TX_POWER_HT40_1S_B=`cat $CONFIG_DIR/tx_power_ht40_1s_b`
+
+	#GET_TX_POWER_DIFF_HT40_2S=`cat $CONFIG_DIR/tx_power_diff_ht40_2s`
+	#GET_TX_POWER_DIFF_HT20=`cat $CONFIG_DIR/tx_power_diff_ht20`
+	#GET_TX_POWER_DIFF_OFDM=`cat $CONFIG_DIR/tx_power_diff_ofdm`
+
+	#$SET_WLAN set_mib pwrlevelCCK_A=$GET_TX_POWER_CCK_A
+	#$SET_WLAN set_mib pwrlevelCCK_B=$GET_TX_POWER_CCK_B
+	#$SET_WLAN set_mib pwrlevelHT40_1S_A=$GET_TX_POWER_HT40_1S_A
+	#$SET_WLAN set_mib pwrlevelHT40_1S_B=$GET_TX_POWER_HT40_1S_B
+	#$SET_WLAN set_mib pwrdiffHT40_2S=$GET_TX_POWER_DIFF_HT40_2S
+	#$SET_WLAN set_mib pwrdiffHT20=$GET_TX_POWER_DIFF_HT20
+	#$SET_WLAN set_mib pwrdiffOFDM=$GET_TX_POWER_DIFF_OFDM
+	
+	GET_TX_POWER_PERCENT=`cat $CONFIG_DIR/tx_power_percet`
+	#echo "GET_TX_POWER_PERCENT is "$GET_TX_POWER_PERCENT
+	$SET_WLAN set_mib powerpercent=$GET_TX_POWER_PERCENT
+	
+	GET_11N_TSSI1=`cat $CONFIG_DIR/tssi_1`
+	$SET_WLAN set_mib tssi1=$GET_11N_TSSI1
+	GET_11N_TSSI2=`cat $CONFIG_DIR/tssi_2`
+	$SET_WLAN set_mib tssi2=$GET_11N_TSSI2
+	
+	#GET_VALUE=`cat $CONFIG_DIR/11n_ther`
+	#$SET_WLAN set_mib ther=$GET_VALUE
+	
+	GET_VALUE=`cat $CONFIG_DIR/trswitch`
+	$SET_WLAN set_mib trswitch=$GET_VALUE
+
+	#GET_VALUE=`cat $CONFIG_DIR/11n_xcap`
+	#$SET_WLAN set_mib xcap=$GET_VALUE
+	
+	#GET_VALUE=`cat $CONFIG_DIR/rfe_type`
+	#$SET_WLAN set_mib rfe_type=$GET_VALUE
+	
+	#exit $ERROR_SUCCESS
+	
+#	iwpriv wlan0 efuse_set SD=3
+#	iwpriv wlan0 efuse_sync
+#	iwpriv wlan0 set_mib func_off=1
+
+fi # [ $IS_ROOT_WLAN = 1 ]
+	
+GET_VALUE=`cat $CONFIG_DIR/basic_rates`
+$SET_WLAN set_mib basicrates=$GET_VALUE
+
+GET_VALUE=`cat $CONFIG_DIR/supported_rate`
+$SET_WLAN set_mib oprates=$GET_VALUE
+	
+GET_RATE_ADAPTIVE_VALUE=`cat $CONFIG_DIR/rate_adaptive_enabled`
+if [ "$GET_RATE_ADAPTIVE_VALUE" = '0' ]; then
+	$SET_WLAN set_mib autorate=0
+	GET_FIX_RATE_VALUE=`cat $CONFIG_DIR/fix_rate`
+	$SET_WLAN set_mib fixrate=$GET_FIX_RATE_VALUE
+else
+	$SET_WLAN set_mib autorate=1
+fi
+
+GET_VALUE=`cat $CONFIG_DIR/rts_threshold`
+$SET_WLAN set_mib rtsthres=$GET_VALUE
+
+GET_VALUE=`cat $CONFIG_DIR/frag_threshold`
+$SET_WLAN set_mib fragthres=$GET_VALUE
+	
+GET_VALUE=`cat $CONFIG_DIR/inactivity_time`
+$SET_WLAN set_mib expired_time=$GET_VALUE
+GET_VALUE=`cat $ROOT_CONFIG_DIR/beacon_interval`
+$SET_WLAN set_mib bcnint=$GET_VALUE
+
+GET_VALUE=`cat $ROOT_CONFIG_DIR/dtim_period`
+$SET_WLAN set_mib dtimperiod=$GET_VALUE
+
+GET_VALUE=`cat $CONFIG_DIR/preamble_type`
+$SET_WLAN set_mib preamble=$GET_VALUE
+GET_VALUE=`cat $CONFIG_DIR/hidden_ssid`
+$SET_WLAN set_mib hiddenAP=$GET_VALUE
+
+GET_VALUE=`cat $CONFIG_DIR/supported_sta_num`
+$SET_WLAN set_mib stanum=$GET_VALUE
+
+GET_VALUE=`cat $CONFIG_DIR/ssid`
+$SET_WLAN set_mib ssid="$GET_VALUE"
+
+GET_VALUE=`cat $CONFIG_DIR/macac_enabled`
+$SET_WLAN set_mib aclmode=$GET_VALUE
+$SET_WLAN set_mib aclnum=0
+#ACL_NUM=`cat $CONFIG_DIR/macac_num`
+#_counter=1
+#while [ $_counter -le $ACL_NUM ]; do
+#	GET_VALUE=`cat $CONFIG_DIR/macac_addr$_counter`
+	#$SET_WLAN set_mib acladdr=$GET_VALUE
+#	echo "----add_acl_table is "$GET_VALUE
+	#$SET_WLAN add_acl_table $GET_VALUE
+#	_counter=$((_counter + 1))
+#done
+
+GET_WLAN_AUTH_TYPE=`cat $CONFIG_DIR/auth_type`
+AUTH_TYPE=$GET_WLAN_AUTH_TYPE
+GET_WLAN_ENCRYPT=`cat $CONFIG_DIR/encrypt`
+if [ "$GET_WLAN_AUTH_TYPE" = '1' ] && [ "$GET_WLAN_ENCRYPT" != '1' ]; then
+	# shared-key and not WEP enabled, force to open-system
+	AUTH_TYPE=0
+fi
+$SET_WLAN set_mib authtype=$AUTH_TYPE
+if [ "$GET_WLAN_ENCRYPT" = '0' ]; then
+	$SET_WLAN set_mib encmode=0
+elif [ "$GET_WLAN_ENCRYPT" = '1' ]; then
+	### WEP mode ##
+	GET_WEP=`cat $CONFIG_DIR/wep`
+	GET_WEP_KEY_TYPE=`cat $CONFIG_DIR/wep_key_type`
+	GET_WEP_KEY_ID=`cat $CONFIG_DIR/wep_default_key`
+	
+	if [ "$GET_WEP" = '1' ]; then
+		if [ "$GET_WEP_KEY_TYPE" = '0' ]; then
+			GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_64_asc`
+			GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_64_asc`
+			GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_64_asc`
+			GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_64_asc`
+		else
+			GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_64_hex`
+			GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_64_hex`
+			GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_64_hex`
+			GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_64_hex`
+		fi
+	
+		$SET_WLAN set_mib encmode=1
+		$SET_WLAN set_mib wepkey1=$GET_WEP_KEY_1
+		$SET_WLAN set_mib wepkey2=$GET_WEP_KEY_2
+		$SET_WLAN set_mib wepkey3=$GET_WEP_KEY_3
+		$SET_WLAN set_mib wepkey4=$GET_WEP_KEY_4
+		$SET_WLAN set_mib wepdkeyid=$GET_WEP_KEY_ID
+	else
+		if [ "$GET_WEP_KEY_TYPE" = '0' ]; then
+			GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_128_asc`
+			GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_128_asc`
+			GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_128_asc`
+			GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_128_asc`
+		else
+			GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_128_hex`
+			GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_128_hex`
+			GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_128_hex`
+			GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_128_hex`
+		fi
+		$SET_WLAN set_mib encmode=5
+		$SET_WLAN set_mib wepkey1=$GET_WEP_KEY_1
+		$SET_WLAN set_mib wepkey2=$GET_WEP_KEY_2
+		$SET_WLAN set_mib wepkey3=$GET_WEP_KEY_3
+		$SET_WLAN set_mib wepkey4=$GET_WEP_KEY_4
+		$SET_WLAN set_mib wepdkeyid=$GET_WEP_KEY_ID
+	fi
+else
+        ## WPA mode ##
+	$SET_WLAN set_mib encmode=2
+fi
+##$SET_WLAN set_mib wds_enable=0
+##$SET_WLAN set_mib wds_encrypt=0
+## Set 802.1x flag ##
+_ENABLE_1X=0
+if [ $GET_WLAN_ENCRYPT -lt 2 ]; then
+	GET_ENABLE_1X=`cat $CONFIG_DIR/enable_1x`
+	GET_MAC_AUTH_ENABLED=`cat $CONFIG_DIR/mac_auth_enabled`
+	if [ "$GET_ENABLE_1X" != 0 ] || [ "$GET_MAC_AUTH_ENABLED" != 0 ]; then
+		_ENABLE_1X=1
+	fi
+else
+	_ENABLE_1X=1
+fi
+$SET_WLAN set_mib 802_1x=$_ENABLE_1X
+	#set band
+GET_BAND=`cat $ROOT_CONFIG_DIR/band`
+GET_WIFI_SPECIFIC=`cat $ROOT_CONFIG_DIR/wifi_specific`
+if [ "$GET_VALUE_WLAN_MODE" != '1' ] && [ "$GET_WIFI_SPECIFIC" = 1 ] &&  [ "$GET_BAND" = '2' ] ; then
+	GET_BAND=3
+fi
+if [ "$GET_BAND" = '8' ]; then
+	GET_BAND=11
+	$SET_WLAN set_mib deny_legacy=3
+elif [ "$GET_BAND" = '2' ]; then
+	GET_BAND=3
+	$SET_WLAN set_mib deny_legacy=1
+elif [ "$GET_BAND" = '10' ]; then
+	GET_BAND=11
+	$SET_WLAN set_mib deny_legacy=1
+elif [ "$GET_BAND" = '64' ]; then
+	GET_BAND=76
+	$SET_WLAN set_mib deny_legacy=12
+elif [ "$GET_BAND" = '72' ]; then
+	GET_BAND=76
+	$SET_WLAN set_mib deny_legacy=4
+else
+	$SET_WLAN set_mib deny_legacy=0
+fi
+$SET_WLAN set_mib band=$GET_BAND
+
+
+echo "Set 11n parameter"  >> $LOG
+###Set 11n parameter
+	if [ $GET_BAND = 10 ] || [ $GET_BAND = 11 ] || [ $GET_BAND = 76 ]; then
+	if [ $IS_ROOT_WLAN = 1 ]; then
+		GET_CHANNEL_BONDING=`cat $CONFIG_DIR/channel_bonding`
+		$SET_WLAN set_mib use40M=$GET_CHANNEL_BONDING
+
+		GET_CONTROL_SIDEBAND=`cat $CONFIG_DIR/control_sideband`
+
+		if [ "$GET_CHANNEL_BONDING" = 0 ]; then
+			$SET_WLAN set_mib 2ndchoffset=0
+		else
+			if [ "$GET_CONTROL_SIDEBAND" = 0 ]; then
+				 $SET_WLAN set_mib 2ndchoffset=1
+			fi
+			if [ "$GET_CONTROL_SIDEBAND" = 1 ]; then
+				 $SET_WLAN set_mib 2ndchoffset=2
+			fi
+		fi
+	fi # [ $IS_ROOT_WLAN = 1 ]
+
+	GET_SHORT_GI=`cat $CONFIG_DIR/short_gi`
+	$SET_WLAN set_mib shortGI20M=$GET_SHORT_GI
+	$SET_WLAN set_mib shortGI40M=$GET_SHORT_GI
+
+	GET_AGGREGATION=`cat $CONFIG_DIR/aggregation`
+
+	if [ "$GET_AGGREGATION" = 0 ]; then
+		$SET_WLAN set_mib ampdu=$GET_AGGREGATION
+		$SET_WLAN set_mib amsdu=$GET_AGGREGATION
+	elif [ "$GET_AGGREGATION" = 1 ]; then
+		$SET_WLAN set_mib ampdu=1
+		$SET_WLAN set_mib amsdu=0
+	elif [ "$GET_AGGREGATION" = 2 ]; then
+		$SET_WLAN set_mib ampdu=0
+		$SET_WLAN set_mib amsdu=1
+	elif [ "$GET_AGGREGATION" = 3 ]; then
+		$SET_WLAN set_mib ampdu=1
+		$SET_WLAN set_mib amsdu=1
+	fi
+
+	GET_STBC_ENABLED=`cat $CONFIG_DIR/stbc_enabled`
+	$SET_WLAN set_mib stbc=$GET_STBC_ENABLED
+	GET_COEXIST_ENABLED=`cat $CONFIG_DIR/coexist_enabled`
+	$SET_WLAN set_mib coexist=$GET_COEXIST_ENABLED
+	fi # [ $GET_BAND = 10 ] || [ $GET_BAND = 11 ]
+##########
+
+#set nat2.5 disable when client and mac clone is set
+GET_MACCLONE_ENABLED=`cat $CONFIG_DIR/macclone_enable`
+if [ "$GET_MACCLONE_ENABLED" = '1' -a "$GET_VALUE_WLAN_MODE" = '1' ]; then
+	$SET_WLAN set_mib nat25_disable=1
+	$SET_WLAN set_mib macclone_enable=1
+else
+	$SET_WLAN set_mib nat25_disable=0
+	$SET_WLAN set_mib macclone_enable=0
+fi
+
+# set 11g protection mode
+GET_PROTECTION_DISABLED=`cat $CONFIG_DIR/protection_disabled`
+if  [ "$GET_PROTECTION_DISABLED" = '1' ] ;then
+	$SET_WLAN set_mib disable_protection=1
+else
+	$SET_WLAN set_mib disable_protection=0
+fi
+
+# for ap isolation
+GET_VALUE=`cat $CONFIG_DIR/group_id`
+$SET_WLAN set_mib groupID=$GET_VALUE
+
+# set block relay
+GET_VALUE=`cat $CONFIG_DIR/block_relay`
+$SET_WLAN set_mib block_relay=$GET_VALUE
+	
+	
+# set WiFi specific mode
+GET_VALUE=`cat $ROOT_CONFIG_DIR/wifi_specific`
+$SET_WLAN set_mib wifi_specific=$GET_VALUE
+
+# for WMM
+GET_VALUE=`cat $CONFIG_DIR/wmm_enabled`
+$SET_WLAN set_mib qos_enable=$GET_VALUE
+
+# for guest access
+GET_VALUE=`cat $CONFIG_DIR/guest_access`
+$SET_WLAN set_mib guest_access=$GET_VALUE
+
+
+
+# for country code
+#COUNTRY_CODE_ENABLE=`$SET_WLAN get_mib countrycode 2> /dev/null`
+if [ ! -z "$COUNTRY_CODE_ENABLE" ]; then
+GET_VALUE=`cat $ROOT_CONFIG_DIR/countrycode_enable`
+#	$SET_WLAN set_mib countrycode=$GET_VALUE
+
+GET_VALUE=`cat $ROOT_CONFIG_DIR/countrycode`
+#	$SET_WLAN set_mib countrystr=$GET_VALUE
+
+
+fi
+
+echo "wpa relative settings"  >> $LOG
+#
+# following settings is used when driver WPA module is included
+#
+
+GET_WPA_AUTH=`cat $CONFIG_DIR/wpa_auth`
+#if [ $GET_VALUE_WLAN_MODE != 1 ] && [ $GET_WLAN_ENCRYPT -ge 2 ]  && [ $GET_WLAN_ENCRYPT -lt 7 ] && [ $GET_WPA_AUTH = 2 ]; then
+if [ $GET_WLAN_ENCRYPT -ge 2 ]  && [ $GET_WLAN_ENCRYPT -lt 11 ]; then
+	if [ $GET_WPA_AUTH = 2 ]; then
+		if [ $GET_WLAN_ENCRYPT = 2 ]; then
+			ENABLE=1
+		elif [ $GET_WLAN_ENCRYPT = 4 ]; then
+			ENABLE=2
+		elif [ $GET_WLAN_ENCRYPT = 6 ]; then
+			ENABLE=3
+		elif [ $GET_WLAN_ENCRYPT = 8 ]; then
+			ENABLE=8
+		elif [ $GET_WLAN_ENCRYPT = 10 ]; then
+			ENABLE=10
+		else
+			echo "invalid ENCRYPT value!($GET_WLAN_ENCRYPT)" >> $LOG
+			exit $ERROR_INVALID_PARAMETERS;
+		fi
+		$SET_WLAN set_mib psk_enable=$ENABLE
+	else
+		$SET_WLAN set_mib psk_enable=0
+	fi
+
+	if [ $GET_WLAN_ENCRYPT = 2 ] || [ $GET_WLAN_ENCRYPT = 6 ]; then
+		GET_WPA_CIPHER_SUITE=`cat $CONFIG_DIR/wpa_cipher`
+		if [ $GET_WPA_CIPHER_SUITE = 1 ]; then
+			CIPHER=2
+		elif [ $GET_WPA_CIPHER_SUITE = 2 ]; then
+			CIPHER=8
+		elif [ $GET_WPA_CIPHER_SUITE = 3 ]; then
+			CIPHER=10
+		else
+			echo "invalid WPA_CIPHER_SUITE value!($GET_WPA_CIPHER_SUITE)" >> $LOG
+			exit $ERROR_INVALID_PARAMETERS;
+		fi
+	fi
+	$SET_WLAN set_mib wpa_cipher=$CIPHER
+
+	if [ $GET_WLAN_ENCRYPT = 4 ] || [ $GET_WLAN_ENCRYPT = 6 ] || [ $GET_WLAN_ENCRYPT = 8 ] || [ $GET_WLAN_ENCRYPT = 10 ]; then
+		GET_WPA2_CIPHER_SUITE=`cat $CONFIG_DIR/wpa2_cipher`
+		if [ $GET_WPA2_CIPHER_SUITE = 1 ]; then
+			CIPHER=2
+		elif [ $GET_WPA2_CIPHER_SUITE = 2 ]; then
+			CIPHER=8
+		elif [ $GET_WPA2_CIPHER_SUITE = 3 ]; then
+			CIPHER=10
+		else
+			echo "invalid WPA2_CIPHER_SUITE value!($GET_WPA2_CIPHER_SUITE)" >> $LOG
+			exit $ERROR_INVALID_PARAMETERS;
+		fi
+	fi
+	$SET_WLAN set_mib wpa2_cipher=$CIPHER
+
+	GET_WPA_PSK=`cat $CONFIG_DIR/wpa_psk`
+	$SET_WLAN set_mib passphrase="$GET_WPA_PSK"
+
+	
+	GET_WPA_GROUP_REKEY_TIME=`cat $CONFIG_DIR/gk_rekey`
+	$SET_WLAN set_mib gk_rekey=$GET_WPA_GROUP_REKEY_TIME
+fi
+# Set 11w parameter #
+#if [ $GET_WLAN_ENCRYPT = 4 ] || [ $GET_WLAN_ENCRYPT = 6 ]; then
+#	GET_WPA2_11W=`cat $CONFIG_DIR/wpa11w`
+#	GET_WPA2_SHA256=`cat $CONFIG_DIR/wpa2EnableSHA256`
+#	if [ $GET_WPA2_11W = 0 ]; then
+#		GET_WPA2_SHA256=0
+#	elif [ $GET_WPA2_11W = 1 ]; then
+#		if [ "$GET_WPA2_SHA256" != '0' ] && [ "$GET_WPA2_SHA256" != '1' ]; then
+#			GET_WPA2_SHA256=0
+#		fi
+#	elif [ $GET_WPA2_11W = 2 ]; then
+#		GET_WPA2_SHA256=1
+#	else
+#		echo "invalid GET_WPA2_11W value!($GET_WPA2_11W)";
+#		exit $ERROR_INVALID_PARAMETERS;
+#	fi
+#else
+#	GET_WPA2_11W=0
+#	GET_WPA2_SHA256=0
+#fi
+
+if [ $GET_WLAN_ENCRYPT = 8 ] || [ $GET_WLAN_ENCRYPT = 10 ]; then
+	GET_WPA2_11W=`cat $CONFIG_DIR/wpa11w`
+	GET_WPA2_SHA256=`cat $CONFIG_DIR/wpa2EnableSHA256`
+	$SET_WLAN set_mib dot11IEEE80211W=$GET_WPA2_11W
+	$SET_WLAN set_mib enableSHA256=$GET_WPA2_SHA256
+else
+	echo "Only WPA3 need PMF" >> $LOG
+	$SET_WLAN set_mib dot11IEEE80211W=0
+	$SET_WLAN set_mib enableSHA256=0
+fi
+
+##########
diff --git a/ap/app/Script/wifi_script/realtek/wlan_basic_deal.sh b/ap/app/Script/wifi_script/realtek/wlan_basic_deal.sh
new file mode 100644
index 0000000..9dbff1b
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek/wlan_basic_deal.sh
@@ -0,0 +1,180 @@
+#!/bin/sh
+#
+# script file to down up WLAN quickly
+#
+
+
+## error code
+ERROR_SUCCESS=0
+ERROR_INVALID_PARAMETERS=1
+ERROR_NO_SUCH_DEVICE=2
+ERROR_NO_CONFIG_FILE=3
+ERROR_NO_SUCH_FILE=4
+ERROR_NO_SUCH_DIRECTORY=5
+ERROR_NULL_FILE=6
+ERROR_NET_IF_UP_FAIL=7
+ERROR_ADD_BR_FAIL=8
+ERROR_ADD_IF_FAIL=9
+
+
+ROOT=`nv get wifi_root_dir`
+LOG=$ROOT/wifi/realtek/slog
+
+IWPRIV=iwpriv
+BR_UTIL=brctl
+
+if [ $# -lt 1 ]; then
+	echo "Usage: $0 wlan_interface" >> $LOG
+	exit $ERROR_INVALID_PARAMETERS;
+fi
+
+SET_WLAN="iwpriv $1"
+SET_WLAN_PARAM="$SET_WLAN set_mib"
+IFCONFIG=ifconfig
+SET_VA0="iwpriv wlan0-va0"
+SET_VA1="iwpriv wlan0-va1"
+
+
+
+
+br0_add_va1()
+{
+	HAS_BEEN_ADDED=`$BR_UTIL show | grep va1`
+	if [ -z "$HAS_BEEN_ADDED" ]; then
+		echo "$BR_UTIL addif br0 wlan0-va1"  >> $LOG
+		$BR_UTIL addif br0 wlan0-va1 2> /dev/null
+		
+		if [ $? != 0 ]; then
+			echo "Failed: $BR_UTIL addif br0 wlan0-va1"  >> $LOG
+			exit $ERROR_ADD_IF_FAIL;
+		fi
+
+	fi
+}
+
+ifconfig_wlan0_up()
+{
+	ifconfig wlan0 up
+	if [ $? != 0 ]; then
+		exit $ERROR_NO_SUCH_DEVICE
+	fi
+}
+
+ifconfig_wlan0_down()
+{
+	ifconfig wlan0 down
+	if [ $? != 0 ]; then
+		exit $ERROR_NO_SUCH_DEVICE
+	fi
+}
+
+ifconfig_wlan0_va0_up()
+{
+	ifconfig wlan0-va0 up
+	if [ $? != 0 ]; then
+		exit $ERROR_NO_SUCH_DEVICE
+	fi
+}
+
+ifconfig_wlan0_va0_down()
+{
+	ifconfig wlan0-va0 down
+	if [ $? != 0 ]; then
+		exit $ERROR_NO_SUCH_DEVICE
+	fi
+}
+
+ifconfig_wlan0_va1_up()
+{
+	ifconfig wlan0-va1 up
+	if [ $? != 0 ]; then
+		exit $ERROR_NO_SUCH_DEVICE
+	fi
+}
+
+ifconfig_wlan0_va1_down()
+{
+	ifconfig wlan0-va1 down
+	if [ $? != 0 ]; then
+		exit $ERROR_NO_SUCH_DEVICE
+	fi
+}
+ifconfig_wlan0_vxd_down()
+{
+	ifconfig wlan0-vxd down
+	if [ $? != 0 ]; then
+		exit $ERROR_NO_SUCH_DEVICE
+	fi
+}
+
+basic_open_va0()
+{
+	ifconfig_wlan0_up
+	ifconfig_wlan0_va0_up
+}				
+
+basic_open_va0_va1()
+{
+	iwpriv wlan0-va0 set_mib  stanum=`nv get  MAX_Access_num`
+    iwpriv wlan0-va1  set_mib  stanum=`nv get  m_MAX_Access_num`
+	ifconfig_wlan0_up
+	ifconfig_wlan0_va0_up
+	ifconfig_wlan0_va1_up
+	br0_add_va1
+}
+
+basic_open_va1()
+{
+	ifconfig_wlan0_va0_down
+	iwpriv wlan0-va0 set_mib stanum=`nv get MAX_Access_num` 
+	iwpriv wlan0-va1 set_mib stanum=`nv get m_MAX_Access_num` 
+	ifconfig_wlan0_va0_up
+	ifconfig_wlan0_va1_up
+	br0_add_va1
+}
+
+basic_close_va1()
+{
+	iwpriv	wlan0-va1  clear_acl_table
+	ifconfig_wlan0_va1_down
+	
+	ifconfig_wlan0_va0_down	
+	iwpriv wlan0-va0 set_mib stanum=`nv get MAX_Access_num` 
+	ifconfig_wlan0_va0_up
+}
+
+basic_closesta_openmssid()
+{
+	ifconfig_wlan0_va0_down 
+	ifconfig_wlan0_vxd_down
+	iwpriv wlan0-va0 set_mib  stanum=`nv get  MAX_Access_num` 
+	iwpriv wlan0-va1 set_mib  stanum=`nv get  m_MAX_Access_num` 
+	ifconfig_wlan0_va0_up 
+	ifconfig_wlan0_va1_up
+	br0_add_va1
+}
+
+
+main()
+{
+	if [ "$1" == "open_va0" ]; then
+		basic_open_va0
+	elif  [ "$1" == "open_va1" ]; then
+		basic_open_va1
+	elif [ "$1" == "close_va1" ]; then
+		basic_close_va1
+	elif [ "$1" == "open_va0_va1"  ]; then
+		basic_open_va0_va1
+	elif  [  "$1" == "close_sta_open_va1" ] ; then
+		basic_closesta_openmssid
+	else
+		echo "$1 para wrong"  >> $LOG
+		exit $ERROR_INVALID_PARAMETERS;
+	fi
+
+}
+
+date +[%H:%M:%S]$1_start >> $LOG
+main $1
+date +[%H:%M:%S]$1_end >> $LOG
+exit $ERROR_SUCCESS
\ No newline at end of file
diff --git a/ap/app/Script/wifi_script/realtek/wlanapp_8192c.sh b/ap/app/Script/wifi_script/realtek/wlanapp_8192c.sh
new file mode 100644
index 0000000..3848dbf
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek/wlanapp_8192c.sh
@@ -0,0 +1,464 @@
+#!/bin/sh
+#
+# script file to start wlan applications (IAPP, Auth, Autoconf) daemon
+#
+# Usage: wlanapp.sh [start|kill] wlan_interface...br_interface
+#
+
+## error code
+ERROR_WSCD_START_FAIL=8
+
+if [ $# -lt 2 ] || [ $1 != 'start' -a $1 != 'kill' ] ; then 
+	echo "Usage: $0 [start|kill] wlan_interface...br_interface" >> $LOG
+	exit 1 
+fi
+#CUR_PATH=`pwd`
+#TOP_VAR_DIR="/etc_ro"
+ROOT=`nv get wifi_root_dir`
+LOG=$ROOT/wifi/realtek/slog
+
+TOP_VAR_DIR="$ROOT/wifi/realtek"
+TOP_ETC_DIR="/etc_ro/realtek/ath"
+TOP_TMP_DIR="$ROOT/tmp"
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+
+if [ ! -d "$TOP_TMP_DIR" ]; then
+    mkdir $TOP_TMP_DIR
+fi
+
+if [ -z "$BIN_DIR" ]; then
+	BIN_DIR=`cat $CONFIG_ROOT_DIR/wifi_bin_dir`
+fi
+
+if [ -z "$WLAN_PREFIX" ]; then
+	WLAN_PREFIX=wlan
+fi
+#WLAN_PREFIX_LEN=${#WLAN_PREFIX}
+#WLAN_NAME_LEN=$((WLAN_PREFIX_LEN + 1))
+
+if [ -z "$ROOT_WLAN" ]; then
+#	ROOT_WLAN=${2:0:$WLAN_NAME_LEN}
+	ROOT_WLAN=${2%%-*}
+fi
+ROOT_CONFIG_DIR=$CONFIG_ROOT_DIR/$ROOT_WLAN
+
+GET_VALUE=
+GET_VALUE_TMP=
+KILLALL=killall
+FLASH_PROG=flash
+SLEEP=sleep
+
+START=1
+PARAM_NUM=$#
+PARAM_ALL=$*
+PARAM1=$1
+PARAM_BR=
+WLAN_INTERFACE=
+
+WLAN0_MODE=
+WLAN0_DISABLED=
+WLAN0_WSC_DISABLED=
+
+WLAN1_MODE=0
+WLAN1_DISABLED=1
+WLAN1_WSC_DISABLED=1
+both_band_ap=0
+
+rtl_check_wlan_band(){
+
+	WLAN0_MODE=`cat $CONFIG_ROOT_DIR/wlan0/wlan_mode`
+	WLAN0_DISABLED=`cat $CONFIG_ROOT_DIR/wlan0/wlan_disabled`
+	WLAN0_WSC_DISABLED=`cat $CONFIG_ROOT_DIR/wlan0/wsc_disabled`
+
+	if [ -d "$CONFIG_ROOT_DIR/wlan1" ] ; then
+		WLAN1_MODE=`cat $CONFIG_ROOT_DIR/wlan1/wlan_mode`
+		WLAN1_DISABLED=`cat $CONFIG_ROOT_DIR/wlan1/wlan_disabled`
+		WLAN1_WSC_DISABLED=`cat $CONFIG_ROOT_DIR/wlan1/wsc_disabled`
+	fi
+
+	if [ "$WLAN0_MODE" = "0" -o "$WLAN0_MODE" = "3" ] && [ "$WLAN1_MODE" = "0" -o "$WLAN1_MODE" = "3" ] && [ "$WLAN0_DISABLED" = "0" ] && [ "$WLAN1_DISABLED" = "0" ] && [ "$WLAN0_WSC_DISABLED" = "0" ] && [ "$WLAN1_WSC_DISABLED" = "0" ]; then
+		both_band_ap = 1
+	fi
+}
+
+rtl_check_wlan_if() {
+
+	echo "wlanapp_8192c.sh --rtl_check_wlan_if" >> $LOG
+
+	if [ $PARAM_NUM -ge 1 ]; then
+		for ARG in $PARAM_ALL ; do
+			case $ARG in
+			$WLAN_PREFIX*)
+				if [ -z "$WLAN_INTERFACE" ]; then
+					WLAN_INTERFACE="$ARG"
+				else
+					WLAN_INTERFACE="$WLAN_INTERFACE $ARG"
+				fi
+				;;
+			*)
+				PARAM_BR=$ARG
+				;;
+			esac
+		done
+	fi
+}
+	
+DEBUG_EASYCONF=
+VXD_INTERFACE=
+
+
+## kill 802.1x, autoconf and IAPP daemon ##
+rtl_kill_iwcontrol_pid() { 
+	PIDFILE="$TOP_VAR_DIR/run/iwcontrol.pid"
+	echo "wlanapp_8192c.sh --rtl_kill_iwcontrol_pid"  >> $LOG
+	if [ -f $PIDFILE ] ; then
+		PID=`cat $PIDFILE`
+		echo "IWCONTROL_PID=$PID"  >> $LOG
+		if [ "$PID" != "0" ]; then
+			kill -9 $PID 2>/dev/null
+		fi
+		rm -f $PIDFILE
+	fi
+}
+
+
+rtl_kill_wlan_pid() {
+
+	echo "wlanapp_8192c.sh --rtl_kill_wlan_pid"  >>  $LOG
+	for WLAN in $WLAN_INTERFACE ; do
+		PIDFILE=$TOP_VAR_DIR/run/auth-$WLAN.pid
+		if [ -f $PIDFILE ] ; then
+			PID=`cat $PIDFILE`
+			echo "AUTH_PID=$PID"
+			if [ "$PID" != "0" ]; then
+				kill -9 $PID 2>/dev/null
+			fi
+			rm -f $PIDFILE
+			
+			PIDFILE=$TOP_VAR_DIR/run/auth-$WLAN-vxd.pid 
+			if [ -f $PIDFILE ] ; then		
+				PID=`cat $PIDFILE`
+				if [ "$PID" != "0" ]; then
+					kill -9 $PID 2>/dev/null
+				fi
+				rm -f $PIDFILE       		
+			fi
+		fi
+		
+		# for WPS ---------------------------------->>
+		PIDFILE=$TOP_VAR_DIR/run/wscd-$WLAN.pid
+		if [ "$both_band_ap" = "1" ]; then
+			PIDFILE=$TOP_VAR_DIR/run/wscd-wlan0-wlan1.pid
+		fi
+		
+		if [ -f $PIDFILE ] ; then
+			PID=`cat $PIDFILE`
+			echo "WSCD_PID=$PID"  >> $LOG
+			if [ "$PID" != "0" ]; then
+				kill -9 $PID 2>/dev/null
+			fi
+			rm -f $PIDFILE   
+		fi 
+	done
+	#<<----------------------------------- for WPS
+}
+
+## start 802.1x daemon ##
+DEAMON_CREATED=0
+VALID_WLAN_INTERFACE=
+
+
+rtl_start_wlan() {
+	echo "rtl_start_wlan WLAN_INTERFACE is "$WLAN_INTERFACE >> $LOG
+	for WLAN in $WLAN_INTERFACE ; do
+		CONFIG_DIR=$CONFIG_ROOT_DIR/$WLAN
+		echo "rtl_start_wlan start-1------------ CONFIG_DIR is "$CONFIG_DIR  >> $LOG
+		GET_VALUE_WLAN_DISABLED=`cat $CONFIG_DIR/wlan_disabled`
+		if [ "$GET_VALUE_WLAN_DISABLED" != 0 ]; then
+			continue
+		fi
+		
+		GET_VALUE_WLAN_MODE=`cat $CONFIG_DIR/wlan_mode`
+		GET_WLAN_WPA_AUTH_TYPE=`cat $CONFIG_DIR/wpa_auth`
+		GET_WLAN_ENCRYPT=`cat $CONFIG_DIR/encrypt`
+		
+		EXT=${WLAN#$WLAN_PREFIX[0-9]}
+		EXT=${EXT#-}
+		VAP_AUTH_ENABLE=0
+		ROOT_AUTH_ENABLE=0
+		
+		_ENABLE_1X=0
+		_USE_RS=0
+
+		if [ "$GET_WLAN_ENCRYPT" -lt 2 ]; then
+			GET_ENABLE_1X=`cat $CONFIG_DIR/enable_1x`
+			GET_MAC_AUTH_ENABLED=`cat $ROOT_CONFIG_DIR/mac_auth_enabled`
+			if [ "$GET_ENABLE_1X" != 0 ] || [ "$GET_MAC_AUTH_ENABLED" != 0 ]; then
+				_ENABLE_1X=1
+				_USE_RS=1
+			fi
+		else
+			_ENABLE_1X=1
+			if  [ "$GET_WLAN_WPA_AUTH_TYPE" = 1 ]; then
+				_USE_RS=1
+			fi		
+		fi
+
+		echo "_ENABLE_1X= $_ENABLE_1X" >> $LOG	
+		ROLE=
+		if [ "$_ENABLE_1X" != 0 ]; then	
+			echo "$BIN_DIR/$FLASH_PROG wpa $WLAN $TOP_VAR_DIR/wpa-$WLAN.conf $WLAN" >> $LOG
+			$BIN_DIR/$FLASH_PROG wpa $WLAN $TOP_VAR_DIR/wpa-$WLAN.conf $WLAN
+			if [ "$GET_VALUE_WLAN_MODE" = '1' ]; then
+				GET_VALUE=`cat $CONFIG_DIR/network_type`
+				if [ "$GET_VALUE" = '0' ]; then
+					ROLE=client-infra
+				else
+					ROLE=client-adhoc			
+				fi
+			else
+				ROLE=auth
+			fi
+
+			VAP_NOT_IN_PURE_AP_MODE=0		
+		
+			
+			if [ "$GET_VALUE_WLAN_MODE" = '0' ] && [ "$VAP_NOT_IN_PURE_AP_MODE" = '0' ]; then
+				if  [ "$GET_WLAN_WPA_AUTH_TYPE" != 2 ] || [ "$_USE_RS" != 0 ]; then
+					echo "$BIN_DIR/auth $WLAN $PARAM_BR $ROLE $TOP_VAR_DIR/wpa-$WLAN.conf" >> $LOG
+					$BIN_DIR/auth $WLAN $PARAM_BR $ROLE $TOP_VAR_DIR/wpa-$WLAN.conf
+					
+					DEAMON_CREATED=1
+					ROOT_AUTH_ENABLE=1
+				fi
+		
+			fi
+		fi
+		
+		if [ "$EXT" = "vxd" ]; then	
+			if [ "$ROLE" != "auth" ] || [ "$ROLE" = "auth" -a "$_USE_RS" != 0 ]; then
+				VXD_INTERFACE=$WLAN
+			fi
+		else
+			GET_WSC_DISABLE=`cat $CONFIG_DIR/wsc_disabled`
+			#|| [ $GET_WSC_DISABLE = 0 ]
+			if [ $ROOT_AUTH_ENABLE = 1 ] || [ $GET_WSC_DISABLE = 0 ]; then
+				if [ -z "$VALID_WLAN_INTERFACE" ]; then
+					VALID_WLAN_INTERFACE="$WLAN"
+				else
+					VALID_WLAN_INTERFACE="$VALID_WLAN_INTERFACE $WLAN"
+				fi
+			fi
+		fi
+		
+	done
+
+}
+
+#end of start wlan
+
+
+# for WPS ------------------------------------------------->>
+rtl_start_wps() {
+
+
+	if [ ! -e $BIN_DIR/wscd ]; then
+		echo "wscd not exist $BIN_DIR is " $BIN_DIR  >> $LOG
+		return;
+	fi
+	echo "rtl_start_wps  WLAN is " $WLAN >> $LOG
+	echo "VALID_WLAN_INTERFACE is " $VALID_WLAN_INTERFACE  >> $LOG
+	
+	
+	for WLAN in $VALID_WLAN_INTERFACE ; do
+		EXT=${WLAN#$WLAN_PREFIX[0-9]}
+		EXT=${EXT#-}
+		echo  "EXT=$EXT" >> $LOG
+		if [ "$EXT" = "" ] || [ "$EXT" = "va0" ] || [ "$EXT" = "va1" ] || [ "$EXT" = "vxd" ]; then
+			
+			USE_IWCONTROL=1
+			DEBUG_ON=0
+			_ENABLE_1X=0
+			WSC=1
+			CONFIG_DIR=$CONFIG_ROOT_DIR/$WLAN
+			CONF_FILE=$TOP_VAR_DIR/wsc-$WLAN.conf
+			FiFO_File=$TOP_VAR_DIR/wscd-$WLAN.fifo
+			
+			echo "rtl_start_wps  CONFIG_DIR is " $CONFIG_DIR  >> $LOG
+			
+			GET_WSC_DISABLE=`cat $CONFIG_DIR/wsc_disabled`
+			GET_VALUE_WLAN_DISABLED=`cat $CONFIG_DIR/wlan_disabled`
+			GET_VALUE_WLAN_MODE=`cat $CONFIG_DIR/wlan_mode`
+			GET_WLAN_ENCRYPT=`cat $CONFIG_DIR/encrypt`
+			GET_WLAN_WPA_AUTH_TYPE=`cat $CONFIG_DIR/wpa_auth`
+
+			if [ "$GET_WLAN_ENCRYPT" -lt 2 ]; then
+				GET_ENABLE_1X=`cat $CONFIG_DIR/enable_1x`
+				GET_MAC_AUTH_ENABLED=`cat $CONFIG_DIR/mac_auth_enabled`
+				if [ "$GET_ENABLE_1X" != 0 ] || [ "$GET_MAC_AUTH_ENABLED" != 0 ]; then
+					_ENABLE_1X=1
+				fi
+			else
+				_ENABLE_1X=1
+			fi
+			echo "_ENABLE_1X is " $_ENABLE_1X  >> $LOG
+			if [ "$EXT" = "vxd" ]; then
+				GET_VALUE_WLAN_CURR_MODE=`cat $CONFIG_DIR/wlan_mode`
+				if [ $GET_VALUE_WLAN_CURR_MODE = 1 ]; then
+					GET_WSC_DISABLE = 1
+				fi
+			fi
+			
+			if [ $GET_WSC_DISABLE != 0 ]; then
+				echo "GET_WSC_DISABLE is " $GET_WSC_DISABLE   >> $LOG
+				WSC=0
+			else
+				if  [ "$GET_VALUE_WLAN_DISABLED" != 0 ] || [ "$GET_VALUE_WLAN_MODE" = 2 ]; then
+					echo "GET_VALUE_WLAN_DISABLED is "$GET_VALUE_WLAN_DISABLED  >> $LOG
+					echo "GET_VALUE_WLAN_MODE is "$GET_VALUE_WLAN_MODE  >> $LOG
+					WSC=0
+				else  
+					if [ $GET_VALUE_WLAN_MODE = 1 ]; then	
+						GET_VALUE=`cat $CONFIG_DIR/network_type`
+						if [ "$GET_VALUE" != 0 ]; then
+							echo "network_type is "$GET_VALUE  >> $LOG
+							WSC=0
+						fi
+					fi
+					if [ $GET_VALUE_WLAN_MODE = 0 ]; then	
+						if [ $GET_WLAN_ENCRYPT -lt 2 ] && [ $_ENABLE_1X != 0 ]; then
+							echo "GET_WLAN_ENCRYPT is "$GET_WLAN_ENCRYPT  >> $LOG
+							echo "_ENABLE_1X is "$_ENABLE_1X  >> $LOG
+							WSC=0
+						fi			
+						if [ $GET_WLAN_ENCRYPT -ge 2 ] && [ $GET_WLAN_WPA_AUTH_TYPE = 1 ]; then
+							echo "GET_WLAN_ENCRYPT is "$GET_WLAN_ENCRYPT  >> $LOG
+							echo "GET_WLAN_WPA_AUTH_TYPE is "$GET_WLAN_WPA_AUTH_TYPE  >> $LOG
+							WSC=0
+						fi			
+					fi
+				fi
+			fi
+			echo "-----------------WSC is "$WSC  >> $LOG 
+			if [ $WSC = 1 ]; then
+				if [ ! -f $TOP_VAR_DIR/wps/simplecfgservice.xml ]; then
+					if [ -e $TOP_VAR_DIR/wps ]; then
+						rm $TOP_VAR_DIR/wps -rf
+					fi
+					mkdir $TOP_VAR_DIR/wps
+					#cp $TOP_ETC_DIR/simplecfg*.xml $TOP_VAR_DIR/wps
+					cat $TOP_ETC_DIR/simplecfgservice.xml > $TOP_VAR_DIR/wps/simplecfgservice.xml
+				fi
+
+				if [ $GET_VALUE_WLAN_MODE = 1 ]; then			
+					UPNP=0
+					_CMD="-mode 2"
+				else		
+					GET_WSC_UPNP_ENABLED=`cat $CONFIG_DIR/wsc_upnp_enabled`
+					UPNP=$GET_WSC_UPNP_ENABLED
+					_CMD="-start"
+				fi
+				WPS_MODE=`cat $CONFIG_DIR/wsc_method`
+				if [ "$WPS_MODE" = "1" ]; then
+					_CMD="$_CMD -method 1"
+				fi
+				echo " UPNP is " $UPNP >> $LOG
+				if [ $UPNP = 1 ]; then
+					route del -net 239.255.255.250 netmask 255.255.255.255 dev "$PARAM_BR"
+					route add -net 239.255.255.250 netmask 255.255.255.255 dev "$PARAM_BR"
+				fi
+		
+				if [ "$both_band_ap" = "1" ]; then
+					_CMD="$_CMD -both_band_ap"	
+				fi
+				echo "$BIN_DIR/$FLASH_PROG upd-wsc-conf $TOP_ETC_DIR/wscd.conf $CONF_FILE $WLAN"  >> $LOG
+				$BIN_DIR/$FLASH_PROG upd-wsc-conf $TOP_ETC_DIR/wscd.conf $CONF_FILE $WLAN
+				
+				_CMD="$_CMD -c $CONF_FILE -w $WLAN"
+		
+				if [ $DEBUG_ON = 1 ]; then
+					_CMD="$_CMD -debug"	
+				fi	
+				if [ $USE_IWCONTROL = 1 ]; then
+					_CMD="$_CMD -fi $FiFO_File"
+					DEAMON_CREATED=1
+					echo "DEAMON_CREATED=1" >> $LOG
+				fi
+		
+				if [ -f "$TOP_VAR_DIR/wps_start_pbc" ]; then		
+					_CMD="$_CMD -start_pbc"
+					rm -f $TOP_VAR_DIR/wps_start_pbc
+				fi
+
+				if [ -f "$TOP_VAR_DIR/wps_start_pin" ]; then		
+					_CMD="$_CMD -start"
+					rm -f $TOP_VAR_DIR/wps_start_pin
+				fi	
+				if [ -f "$TOP_VAR_DIR/wps_local_pin" ]; then		
+					PIN=`cat $TOP_VAR_DIR/wps_local_pin`		
+					_CMD="$_CMD -local_pin $PIN"
+					rm -f $TOP_VAR_DIR/wps_local_pin
+				fi
+				if [ -f "$TOP_VAR_DIR/wps_peer_pin" ]; then		
+					PIN=`cat $TOP_VAR_DIR/wps_peer_pin`		
+					_CMD="$_CMD -peer_pin $PIN"
+					rm -f $TOP_VAR_DIR/wps_peer_pin
+				fi				
+				WSC_CMD=$_CMD
+				echo "$BIN_DIR/wscd $WSC_CMD -daemon" >> $LOG
+				$BIN_DIR/wscd $WSC_CMD -daemon
+				echo "<<<<<<<<<<wscd >>>>>>>>>>> over" >> $LOG
+				WAIT=5
+				while [ $USE_IWCONTROL != 0 -a $WAIT != 0 ]		
+				do	
+					if [ -e $FiFO_File ]; then
+						break;
+					else
+						$SLEEP 1
+						WAIT=`expr $WAIT - 1`
+						#WAIT=$((WAIT - 1))
+					fi
+				done
+				if [ $WAIT = 0 ]; then
+					exit $ERROR_WSCD_START_FAIL;
+				fi
+			fi
+		fi
+	done
+}
+#<<--------------------------------------------------- for WPS
+
+rtl_start_iwcontrol() {
+	echo "rtl_start_iwcontrol"  >> $LOG
+	if [ $DEAMON_CREATED = 1 ]; then
+		echo "$BIN_DIR/iwcontrol $VALID_WLAN_INTERFACE $VXD_INTERFACE $POLL"  >> $LOG
+		$BIN_DIR/iwcontrol $VALID_WLAN_INTERFACE $VXD_INTERFACE $POLL
+	fi
+}
+
+rtl_wlanapp() {
+
+	echo "rtl_wlanapp"  >> $LOG
+
+	if [ $PARAM1 = 'kill' ]; then
+		START=0
+	fi
+	rtl_check_wlan_if
+	if [ -z "$WLAN_INTERFACE" ]; then
+		echo "Error in $0, no wlan interface is given!"  >> $LOG
+		exit 0
+	fi
+	rtl_kill_iwcontrol_pid
+	rtl_kill_wlan_pid
+	rm -f $TOP_VAR_DIR/*.fifo
+	if [ $START = 0 ]; then
+		return;
+	fi
+	
+#	rtl_check_wlan_band
+	rtl_start_wlan
+	rtl_start_wps
+	rtl_start_iwcontrol
+}
+
+rtl_wlanapp
diff --git a/ap/app/Script/wifi_script/realtek/wps_init.sh b/ap/app/Script/wifi_script/realtek/wps_init.sh
new file mode 100644
index 0000000..922935e
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek/wps_init.sh
@@ -0,0 +1,103 @@
+#!/bin/sh
+#
+# script file to start network
+#
+# Usage: wps_init.sh {pbc | pin} {PINNUM}
+#
+
+##if [ $# -lt 2 ]; then echo "Usage: $0 {gw | ap} {all | bridge | wan}"; exit 1 ; fi
+ROOT=`nv get wifi_root_dir`
+LOG=$ROOT/wifi/realtek/slog
+
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+
+ID=`nv get wifi_wps_index`
+echo "enter wps init.sh wifi_wps_index=$ID >>>>>>>>" >> $LOG
+ID=`expr $ID - 1`
+echo "enter wps init.sh ID=$ID >>>>>>>>" >> $LOG
+
+if [ "$ID" = "0" ];then
+#CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0
+#WLAN_INTERFACE="wlan0"
+CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0-va$ID
+WLAN_INTERFACE="wlan0-va$ID"
+else
+CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0-va$ID
+WLAN_INTERFACE="wlan0-va$ID"
+fi
+ 
+echo "enter wps init.sh $CONFIG_DIR >>>>>>>>" >> $LOG
+if [ -z "$SCRIPT_DIR" ]; then
+	SCRIPT_DIR=`cat $CONFIG_ROOT_DIR/wifi_script_dir`
+fi
+START_WLAN_APP=$SCRIPT_DIR/wlanapp_8192c.sh
+echo "0" > $CONFIG_DIR/wsc_upnp_enabled
+echo "1" > $CONFIG_DIR/wsc_configured
+echo "0" > $CONFIG_DIR/wsc_disabled
+if [ $1 = "pbc" ]; then
+	echo "2" > $CONFIG_DIR/wsc_method
+else
+	echo "1" > $CONFIG_DIR/wsc_method
+	echo $2 > $CONFIG_DIR/wsc_pin
+fi
+
+echo "<<<<<wps init $1 $2 >>>>>>>>" >> $LOG
+
+
+GET_WLAN_ENCRYPT=`cat $CONFIG_DIR/encrypt`
+if [ "$GET_WLAN_ENCRYPT" = "2" ]; then #WPAPSK
+	echo "2" > $CONFIG_DIR/wsc_auth
+	GET_WLAN_AUTH=`cat $CONFIG_DIR/wpa_cipher`
+	if [ "$GET_WLAN_AUTH" = "1" ]; then #TKIP
+		echo "4" > $CONFIG_DIR/wsc_enc
+	elif [ "$GET_WLAN_AUTH" = "2" ]; then #AES
+		echo "8" > $CONFIG_DIR/wsc_enc
+	else  #TKIPAES
+		echo "12" > $CONFIG_DIR/wsc_enc
+	fi
+	GET_PSK=`cat $CONFIG_DIR/wpa_psk`
+	echo $GET_PSK > $CONFIG_DIR/wsc_psk
+elif [ "$GET_WLAN_ENCRYPT" = "4" ]; then #WPA2PSK
+	echo "32" > $CONFIG_DIR/wsc_auth
+	if [ "$GET_WLAN_AUTH" = "1" ]; then #TKIP
+		echo "4" > $CONFIG_DIR/wsc_enc
+	elif [ "$GET_WLAN_AUTH" = "2" ]; then #AES
+		echo "8" > $CONFIG_DIR/wsc_enc
+	else             #TKIPAES
+		echo "12" > $CONFIG_DIR/wsc_enc
+	fi
+	GET_PSK=`cat $CONFIG_DIR/wpa_psk`
+	echo $GET_PSK > $CONFIG_DIR/wsc_psk
+elif [ "$GET_WLAN_ENCRYPT" = "6" ]; then #WPAPSKWPA2PSK
+	echo "34" > $CONFIG_DIR/wsc_auth
+	if [ "$GET_WLAN_AUTH" = "1" ]; then #TKIP
+		echo "4" > $CONFIG_DIR/wsc_enc
+	elif [ "$GET_WLAN_AUTH" = "2" ]; then #AES
+		echo "8" > $CONFIG_DIR/wsc_enc
+	else  #TKIPAES
+		echo "12" > $CONFIG_DIR/wsc_enc
+	fi
+	GET_PSK=`cat $CONFIG_DIR/wpa_psk`
+	echo $GET_PSK > $CONFIG_DIR/wsc_psk
+else									 #open
+	echo "1" > $CONFIG_DIR/wsc_auth
+	echo "1" > $CONFIG_DIR/wsc_enc
+fi
+
+	
+echo "0" > $CONFIG_DIR/wsc_manual_enabled
+echo "0" > $CONFIG_DIR/wsc_upnp_enabled
+echo "1" > $CONFIG_DIR/wsc_registrar_enabled
+ESSID=`cat $CONFIG_DIR/ssid`
+echo $ESSID > $CONFIG_DIR/wsc_ssid
+echo "0" > $CONFIG_DIR/wsc_configbyextreg
+
+echo -e "\n test to check if loop here\n" >> $LOG
+
+BR_INTERFACE="br0"
+echo -e "\n <<<${START_WLAN_APP##*/} start $WLAN_INTERFACE $BR_INTERFACE>>>" >> $LOG
+$START_WLAN_APP start $WLAN_INTERFACE $BR_INTERFACE 
+ERR=`echo $?`
+if [ $ERR != 0 ]; then
+	exit $ERR;
+fi
diff --git a/ap/app/Script/wifi_script/realtek/wps_init1.sh b/ap/app/Script/wifi_script/realtek/wps_init1.sh
new file mode 100644
index 0000000..8f2c8b2
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek/wps_init1.sh
@@ -0,0 +1,94 @@
+#!/bin/sh
+#
+# script file to start network
+#
+# Usage: wps_init.sh {pbc | pin} {PINNUM}
+#
+
+##if [ $# -lt 2 ]; then echo "Usage: $0 {gw | ap} {all | bridge | wan}"; exit 1 ; fi
+ROOT=`nv get wifi_root_dir`
+LOG=$ROOT/wifi/realtek/slog
+
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+
+ID=`nv get wifi_wps_index`
+echo "enter wps init1.sh wifi_wps_index=$ID >>>>>>>>" >> $LOG
+
+CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0
+WLAN_INTERFACE="wlan0"
+ 
+echo "enter wps init.sh $CONFIG_DIR >>>>>>>>" >> $LOG
+if [ -z "$SCRIPT_DIR" ]; then
+	SCRIPT_DIR=`cat $CONFIG_ROOT_DIR/wifi_script_dir`
+fi
+START_WLAN_APP=$SCRIPT_DIR/wlanapp_8192c.sh
+echo "0" > $CONFIG_DIR/wsc_upnp_enabled
+echo "1" > $CONFIG_DIR/wsc_configured
+echo "0" > $CONFIG_DIR/wsc_disabled
+if [ $1 = "pbc" ]; then
+	echo "2" > $CONFIG_DIR/wsc_method
+else
+	echo "1" > $CONFIG_DIR/wsc_method
+	echo $2 > $CONFIG_DIR/wsc_pin
+fi
+
+echo "<<<<<wps init $1 $2 >>>>>>>>" >> $LOG
+
+
+GET_WLAN_ENCRYPT=`cat $CONFIG_DIR/encrypt`
+if [ "$GET_WLAN_ENCRYPT" = "2" ]; then #WPAPSK
+	echo "2" > $CONFIG_DIR/wsc_auth
+	GET_WLAN_AUTH=`cat $CONFIG_DIR/wpa_cipher`
+	if [ "$GET_WLAN_AUTH" = "1" ]; then #TKIP
+		echo "4" > $CONFIG_DIR/wsc_enc
+	elif [ "$GET_WLAN_AUTH" = "2" ]; then #AES
+		echo "8" > $CONFIG_DIR/wsc_enc
+	else  #TKIPAES
+		echo "12" > $CONFIG_DIR/wsc_enc
+	fi
+	GET_PSK=`cat $CONFIG_DIR/wpa_psk`
+	echo $GET_PSK > $CONFIG_DIR/wsc_psk
+elif [ "$GET_WLAN_ENCRYPT" = "4" ]; then #WPA2PSK
+	echo "32" > $CONFIG_DIR/wsc_auth
+	if [ "$GET_WLAN_AUTH" = "1" ]; then #TKIP
+		echo "4" > $CONFIG_DIR/wsc_enc
+	elif [ "$GET_WLAN_AUTH" = "2" ]; then #AES
+		echo "8" > $CONFIG_DIR/wsc_enc
+	else             #TKIPAES
+		echo "12" > $CONFIG_DIR/wsc_enc
+	fi
+	GET_PSK=`cat $CONFIG_DIR/wpa_psk`
+	echo $GET_PSK > $CONFIG_DIR/wsc_psk
+elif [ "$GET_WLAN_ENCRYPT" = "6" ]; then #WPAPSKWPA2PSK
+	echo "34" > $CONFIG_DIR/wsc_auth
+	if [ "$GET_WLAN_AUTH" = "1" ]; then #TKIP
+		echo "4" > $CONFIG_DIR/wsc_enc
+	elif [ "$GET_WLAN_AUTH" = "2" ]; then #AES
+		echo "8" > $CONFIG_DIR/wsc_enc
+	else  #TKIPAES
+		echo "12" > $CONFIG_DIR/wsc_enc
+	fi
+	GET_PSK=`cat $CONFIG_DIR/wpa_psk`
+	echo $GET_PSK > $CONFIG_DIR/wsc_psk
+else									 #open
+	echo "1" > $CONFIG_DIR/wsc_auth
+	echo "1" > $CONFIG_DIR/wsc_enc
+fi
+
+	
+echo "0" > $CONFIG_DIR/wsc_manual_enabled
+echo "0" > $CONFIG_DIR/wsc_upnp_enabled
+echo "1" > $CONFIG_DIR/wsc_registrar_enabled
+ESSID=`cat $CONFIG_DIR/ssid`
+echo $ESSID > $CONFIG_DIR/wsc_ssid
+echo "0" > $CONFIG_DIR/wsc_configbyextreg
+
+echo -e "\n test to check if loop here\n" >> $LOG
+
+BR_INTERFACE="br0"
+echo -e "\n <<<${START_WLAN_APP##*/} start $WLAN_INTERFACE $BR_INTERFACE>>>" >> $LOG
+$START_WLAN_APP start $WLAN_INTERFACE $BR_INTERFACE 
+ERR=`echo $?`
+if [ $ERR != 0 ]; then
+	exit $ERR;
+fi
diff --git a/ap/app/Script/wifi_script/realtek/zte_qrcode_create.sh b/ap/app/Script/wifi_script/realtek/zte_qrcode_create.sh
new file mode 100755
index 0000000..7638d87
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek/zte_qrcode_create.sh
@@ -0,0 +1,162 @@
+#!/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'
+
+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"
+
+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"
+
+#target_web_dir="$ROOT/securefs/web/img/"
+
+#if [ "$ROOT" = "" ]; then
+#    target_web_dir="/etc_ro/web/img/"
+#else
+#    target_web_dir="$ROOT/etc/web/img/"
+#fi
+
+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
+	
+	;;
+ 
+ "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
+	;;
+	
+ "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
diff --git a/ap/app/Script/wifi_script/realtek_wpa2/bridge.sh b/ap/app/Script/wifi_script/realtek_wpa2/bridge.sh
new file mode 100755
index 0000000..3fecf65
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek_wpa2/bridge.sh
@@ -0,0 +1,173 @@
+#!/bin/sh
+#
+# script file to start bridge
+#
+# Usage: bridge.sh br_interface lan1_interface wlan_interface[1]..wlan_interface[N]
+#
+
+## error code
+ERROR_SUCCESS=0
+ERROR_INVALID_PARAMETERS=1
+ERROR_NO_SUCH_DEVICE=2
+ERROR_NO_CONFIG_FILE=3
+ERROR_NO_SUCH_FILE=4
+ERROR_NO_SUCH_DIRECTORY=5
+ERROR_NULL_FILE=6
+ERROR_NET_IF_UP_FAIL=7
+ERROR_ADD_BR_FAIL=8
+ERROR_ADD_IF_FAIL=9
+
+
+if [ $# -lt 2 ]; then
+	echo "Usage: $0 br_interface lan1_interface wlan_interface ..."  >> $LOG
+	exit $ERROR_INVALID_PARAMETERS;
+fi
+
+
+ROOT=`nv get wifi_root_dir`
+LOG=$ROOT/wifi/realtek/slog
+#CUR_PATH=`pwd`
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+
+if [ -z "$WLAN_PREFIX" ]; then
+	WLAN_PREFIX=wlan
+fi
+
+LAN_PREFIX=eth
+BR_UTIL=brctl
+IFCONFIG=ifconfig
+SLEEP=sleep
+## test for to RESTART_BR be 1
+RESTART_BR=0
+RESTART_LAN=0
+RESTART_WLAN=1
+
+#set PARA for $i can't pass to function
+BR_INTF=$1
+PARA2=$2
+PARA3=$3
+PARA_ALL=$*
+
+BR_NOT_EXIST=0
+
+rtl_shutdown_net_if() {
+	if [ $BR_NOT_EXIST != 0 ]; then
+		return;
+	fi
+	
+	# shutdown network interface (ethernet, wlan)
+	for ARG in $PARA_ALL ; do
+		case $ARG in
+		$LAN_PREFIX*)
+			if [ $RESTART_LAN != 0 ]; then
+				$IFCONFIG $ARG down	
+				$BR_UTIL delif $BR_INTF $ARG 2> /dev/null
+			fi
+			;;
+		$WLAN_PREFIX*)
+			if [ $RESTART_WLAN != 0 ]; then
+				$IFCONFIG $ARG down	
+				$BR_UTIL delif $BR_INTF $ARG 2> /dev/null
+			fi
+			;;
+		*)
+			;;
+		esac
+	done
+}
+
+rtl_enable_net_if() {
+	# Enable network interface (Ethernet, wlan, WDS, bridge)
+	if [ $RESTART_BR != 0 ]; then
+		echo 'Setup bridge...'  >> $LOG
+		if [ $BR_NOT_EXIST != 0 ]; then
+			$BR_UTIL addbr $BR_INTF
+			if [ $? != 0 ]; then
+				echo "Failed: $BR_UTIL addbr $BR_INTF"
+				exit $ERROR_ADD_BR_FAIL;
+			fi
+		fi
+		#$BR_UTIL setfd $BR_INTF 0
+		#$BR_UTIL stp $BR_INTF 0
+	fi
+	#IP_ADDR=`cat $CONFIG_ROOT_DIR/ip_addr`
+	#SUBNET_MASK=`cat $CONFIG_ROOT_DIR/net_mask`
+	#$IFCONFIG $BR_INTF $IP_ADDR netmask $SUBNET_MASK
+	
+	#Add lan port to bridge interface
+	if [ $RESTART_LAN != 0 ]; then
+		for ARG in $PARA_ALL ; do
+			case $ARG in
+			$LAN_PREFIX*)
+				$BR_UTIL addif $BR_INTF $ARG 2> /dev/null
+				$IFCONFIG $ARG  0.0.0.0
+				;;
+			*)
+				;;
+			esac
+		done
+	fi
+	
+	if [ $RESTART_WLAN != 0 ]; then
+		for ARG in $PARA_ALL ; do
+			case $ARG in
+			$WLAN_PREFIX*)
+				CONFIG_DIR=$CONFIG_ROOT_DIR/$ARG
+				WLAN_DISABLED_VALUE=`cat $CONFIG_DIR/wlan_disabled`
+				echo "$CONFIG_DIR/wlan_disabled = $WLAN_DISABLED_VALUE " >> $LOG
+				
+				ISUP=`$IFCONFIG $ARG | grep UP`
+				if [ "$WLAN_DISABLED_VALUE" = 0  -a  "$ISUP" = "" ]; then
+				
+					echo "$IFCONFIG $ARG up"  >> $LOG
+					$IFCONFIG $ARG up					
+					if [ $? != 0 ]; then
+						echo "$IFCONFIG $ARG up failed "  >> $LOG
+						exit $ERROR_NET_IF_UP_FAIL;
+					fi
+				
+				
+					if [ "$ARG" != "wlan0" -a "$ARG" != "wlan0-vxd" ]; then
+						HAS_BEEN_ADDED=`$BR_UTIL show | grep $ARG`
+						if [ ! -z "$HAS_BEEN_ADDED" ]; then
+							echo "$ARG  has been added to $BR_UTIL :: $HAS_BEEN_ADDED"  >> $LOG
+						else
+							echo "$ARG  has not been added to $BR_UTIL :: $HAS_BEEN_ADDED"  >> $LOG
+							echo "$BR_UTIL addif $BR_INTF $ARG" >> $LOG
+							$BR_UTIL addif $BR_INTF $ARG 2> /dev/null
+							
+							if [ $? != 0 ]; then
+								echo "Failed: $BR_UTIL addif $BR_INTF $ARG"  >> $LOG
+								exit $ERROR_ADD_IF_FAIL;
+							fi
+					
+						fi
+						
+
+						#IP_ADDR=`cat $CONFIG_DIR/ip_addr`
+						#$IFCONFIG $ARG $IP_ADDR
+						$IFCONFIG $ARG 0.0.0.0
+					fi
+
+					#$SLEEP 1
+				fi
+				;;
+			*)
+				;;
+			esac
+		done
+	fi
+}
+#end of rtl_enable_net_if
+
+rtl_bridge() {
+	BR_NOT_EXIST=`$IFCONFIG $BR_INTF > /dev/null 2>&1; echo $?`
+	if [ "$PARA3" != "null" ]; then
+		#rtl_shutdown_net_if
+		rtl_enable_net_if
+	fi
+}
+
+
+rtl_bridge
+
diff --git a/ap/app/Script/wifi_script/realtek_wpa2/bridge1.sh b/ap/app/Script/wifi_script/realtek_wpa2/bridge1.sh
new file mode 100755
index 0000000..0167595
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek_wpa2/bridge1.sh
@@ -0,0 +1,157 @@
+#!/bin/sh
+#
+# script file to start bridge
+#
+# Usage: bridge.sh br_interface lan1_interface wlan_interface[1]..wlan_interface[N]
+#
+
+## error code
+ERROR_SUCCESS=0
+ERROR_INVALID_PARAMETERS=1
+ERROR_NO_SUCH_DEVICE=2
+ERROR_NO_CONFIG_FILE=3
+ERROR_NO_SUCH_FILE=4
+ERROR_NO_SUCH_DIRECTORY=5
+ERROR_NULL_FILE=6
+ERROR_NET_IF_UP_FAIL=7
+ERROR_ADD_BR_FAIL=8
+ERROR_ADD_IF_FAIL=9
+
+
+if [ $# -lt 2 ]; then
+	echo "Usage: $0 br_interface lan1_interface wlan_interface ..."  >> $LOG
+	exit $ERROR_INVALID_PARAMETERS;
+fi
+
+
+ROOT=`nv get wifi_root_dir`
+LOG=$ROOT/wifi/realtek/slog
+#CUR_PATH=`pwd`
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+
+if [ -z "$WLAN_PREFIX" ]; then
+	WLAN_PREFIX=wlan
+fi
+
+LAN_PREFIX=eth
+BR_UTIL=brctl
+IFCONFIG=ifconfig
+SLEEP=sleep
+## test for to RESTART_BR be 1
+RESTART_BR=0
+RESTART_LAN=0
+RESTART_WLAN=1
+
+#set PARA for $i can't pass to function
+BR_INTF=$1
+PARA2=$2
+PARA3=$3
+PARA_ALL=$*
+
+BR_NOT_EXIST=0
+
+rtl_shutdown_net_if() {
+	if [ $BR_NOT_EXIST != 0 ]; then
+		return;
+	fi
+	
+	# shutdown network interface (ethernet, wlan)
+	for ARG in $PARA_ALL ; do
+		case $ARG in
+		$LAN_PREFIX*)
+			if [ $RESTART_LAN != 0 ]; then
+				$IFCONFIG $ARG down	
+				$BR_UTIL delif $BR_INTF $ARG 2> /dev/null
+			fi
+			;;
+		$WLAN_PREFIX*)
+			if [ $RESTART_WLAN != 0 ]; then
+				$IFCONFIG $ARG down	
+				$BR_UTIL delif $BR_INTF $ARG 2> /dev/null
+			fi
+			;;
+		*)
+			;;
+		esac
+	done
+}
+
+rtl_enable_net_if() {
+	# Enable network interface (Ethernet, wlan, WDS, bridge)
+	if [ $RESTART_BR != 0 ]; then
+		echo 'Setup bridge...'  >> $LOG
+		if [ $BR_NOT_EXIST != 0 ]; then
+			$BR_UTIL addbr $BR_INTF
+			if [ $? != 0 ]; then
+				echo "Failed: $BR_UTIL addbr $BR_INTF"
+				exit $ERROR_ADD_BR_FAIL;
+			fi
+		fi
+		#$BR_UTIL setfd $BR_INTF 0
+		#$BR_UTIL stp $BR_INTF 0
+	fi
+	#IP_ADDR=`cat $CONFIG_ROOT_DIR/ip_addr`
+	#SUBNET_MASK=`cat $CONFIG_ROOT_DIR/net_mask`
+	#$IFCONFIG $BR_INTF $IP_ADDR netmask $SUBNET_MASK
+	
+	#Add lan port to bridge interface
+	if [ $RESTART_LAN != 0 ]; then
+		for ARG in $PARA_ALL ; do
+			case $ARG in
+			$LAN_PREFIX*)
+				$BR_UTIL addif $BR_INTF $ARG 2> /dev/null
+				$IFCONFIG $ARG  0.0.0.0
+				;;
+			*)
+				;;
+			esac
+		done
+	fi
+	
+	if [ $RESTART_WLAN != 0 ]; then
+		for ARG in $PARA_ALL ; do
+			case $ARG in
+			$WLAN_PREFIX*)
+				CONFIG_DIR=$CONFIG_ROOT_DIR/$ARG
+				WLAN_DISABLED_VALUE=`cat $CONFIG_DIR/wlan_disabled`
+				if [ "$WLAN_DISABLED_VALUE" = 0 ]; then
+				
+				
+					echo "$IFCONFIG $ARG up"  >> $LOG
+					$IFCONFIG $ARG up
+					if [ $? != 0 ]; then
+						echo "Failed: $IFCONFIG $ARG up" >> $LOG
+						exit $ERROR_NET_IF_UP_FAIL;
+					fi
+				
+					echo "$BR_UTIL addif $BR_INTF $ARG" >> $LOG
+					$BR_UTIL addif $BR_INTF $ARG 2> /dev/null
+					if [ $? != 0 ]; then
+						echo "Failed: $BR_UTIL addif $BR_INTF $ARG" >> $LOG
+						exit $ERROR_ADD_IF_FAIL;
+					fi
+				#	IP_ADDR=`cat $CONFIG_DIR/ip_addr`
+				#	$IFCONFIG $ARG $IP_ADDR
+
+					#$SLEEP 1
+				fi
+				;;
+			*)
+				;;
+			esac
+		done
+	fi
+}
+#end of rtl_enable_net_if
+
+rtl_bridge() {
+	BR_NOT_EXIST=`$IFCONFIG $BR_INTF > /dev/null 2>&1; echo $?`
+	if [ "$PARA3" != "null" ]; then
+		#rtl_shutdown_net_if
+		rtl_enable_net_if
+	fi
+}
+
+
+rtl_bridge
+
diff --git a/ap/app/Script/wifi_script/realtek_wpa2/default_setting.sh b/ap/app/Script/wifi_script/realtek_wpa2/default_setting.sh
new file mode 100755
index 0000000..82049f4
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek_wpa2/default_setting.sh
@@ -0,0 +1,202 @@
+#!/bin/sh
+
+## error code
+
+
+ERROR_SUCCESS=0
+ERROR_INVALID_PARAMETERS=1
+
+if [ $# -lt 1 ]; then echo "Usage: $0 iface"; exit 1; fi
+ROOT=`nv get wifi_root_dir`
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+CONFIG_DIR=$CONFIG_ROOT_DIR/$1
+
+if [ ! -d "$CONFIG_ROOT_DIR" ]; then
+    mkdir -p $CONFIG_ROOT_DIR
+fi
+
+if [ ! -d "$CONFIG_DIR" ]; then
+    mkdir -p $CONFIG_DIR
+fi
+
+if [ ! -f "$CONFIG_ROOT_DIR/wifi_script_dir" ]; then
+	echo "/sbin" > $CONFIG_ROOT_DIR/wifi_script_dir
+fi
+if [ ! -f "$CONFIG_ROOT_DIR/wifi_bin_dir" ]; then
+	echo "/bin" > $CONFIG_ROOT_DIR/wifi_bin_dir
+fi
+
+WLAN_PREFIX=wlan
+
+case $1 in
+$WLAN_PREFIX[0-9]*)
+	EXT=${1#$WLAN_PREFIX[0-9]}
+	echo $EXT
+	;;
+*)
+	echo "invalid WLAN interface!($1)"
+	exit $ERROR_INVALID_PARAMETERS
+	;;
+esac
+
+echo "1" > $CONFIG_DIR/board_ver
+echo "00017301FA10" > $CONFIG_DIR/nic0_addr
+echo "00017301FA19" > $CONFIG_DIR/nic1_addr
+echo "00017301FA10" > $CONFIG_DIR/wlan0_addr
+echo "00017301FA11" > $CONFIG_DIR/wlan1_addr
+echo "00017301FA12" > $CONFIG_DIR/wlan2_addr
+echo "00017301FA13" > $CONFIG_DIR/wlan3_addr
+echo "00017301FA14" > $CONFIG_DIR/wlan4_addr
+echo "00017301FA15" > $CONFIG_DIR/wlan5_addr
+echo "00017301FA16" > $CONFIG_DIR/wlan6_addr
+echo "00017301FA17" > $CONFIG_DIR/wlan7_addr
+
+echo "0000000000000000000000000000" > $CONFIG_DIR/tx_power_cck_a
+echo "0000000000000000000000000000" > $CONFIG_DIR/tx_power_cck_b
+echo "0000000000000000000000000000" > $CONFIG_DIR/tx_power_ht40_1s_a
+echo "0000000000000000000000000000" > $CONFIG_DIR/tx_power_ht40_1s_b
+echo "0000000000000000000000000000" > $CONFIG_DIR/tx_power_diff_ht40_2s
+echo "0000000000000000000000000000" > $CONFIG_DIR/tx_power_diff_ht20
+echo "0000000000000000000000000000" > $CONFIG_DIR/tx_power_diff_ofdm
+echo "3" > $CONFIG_DIR/reg_domain
+echo "0" > $CONFIG_DIR/11n_xcap
+echo "0" > $CONFIG_DIR/led_type
+echo "0" > $CONFIG_DIR/tssi_1
+echo "0" > $CONFIG_DIR/tssi_2
+echo "0" > $CONFIG_DIR/11n_ther
+echo "0" > $CONFIG_DIR/trswitch
+
+#wlan_mode: 0: AP, 1: Clienr(network_type=0)/AD-Hoc(network_type=1) 
+echo "0" >  $CONFIG_DIR/wlan_mode
+echo "0" >  $CONFIG_DIR/wlan_disabled
+echo "family-test$EXT" > $CONFIG_DIR/ssid
+echo "3" > $CONFIG_DIR/MIMO_TR_mode
+
+#channel: default channel
+echo "1" > $CONFIG_DIR/channel
+#ch_hi: Available highest channel
+echo "0" > $CONFIG_DIR/ch_hi
+#ch_low: Available lowest channel
+echo "0" > $CONFIG_DIR/ch_low
+#band: 64: 11AC, 8: 11N, 4: 11A, 2: 11G, 1: 11B; ex. 11 = 8 + 2 + 1 => BGN mode
+echo "11" > $CONFIG_DIR/band
+#basic_rate: 15=0x0f -> bit0-bit11 as 1,2,5.5,11,6,9,12,18,24,36,48,54
+echo "15" > $CONFIG_DIR/basic_rates
+echo "4095" > $CONFIG_DIR/supported_rate
+echo "1" > $CONFIG_DIR/rate_adaptive_enabled
+echo "0" > $CONFIG_DIR/fix_rate
+echo "2347" > $CONFIG_DIR/rts_threshold
+echo "2346" > $CONFIG_DIR/frag_threshold
+echo "30000" >  $CONFIG_DIR/inactivity_time	#unit:10ms
+echo "100" > $CONFIG_DIR/beacon_interval
+echo "1" > $CONFIG_DIR/dtim_period
+echo "0" > $CONFIG_DIR/preamble_type
+echo "0" > $CONFIG_DIR/hidden_ssid
+echo "0" > $CONFIG_DIR/supported_sta_num
+echo "1" > $CONFIG_DIR/protection_disabled
+echo "0" > $CONFIG_DIR/macclone_enable
+echo "0" > $CONFIG_DIR/iapp_enable
+echo "2" > $CONFIG_DIR/wifi_specific
+echo "0" > $CONFIG_DIR/vap_enable
+echo "0" > $CONFIG_DIR/group_id
+echo "0" > $CONFIG_DIR/block_relay
+echo "1" > $CONFIG_DIR/wmm_enabled
+echo "0" > $CONFIG_DIR/guest_access
+
+echo "0" > $CONFIG_DIR/wds_enable
+echo "0" > $CONFIG_DIR/wds_pure
+
+echo "0" > $CONFIG_DIR/macac_enabled
+echo "0" > $CONFIG_DIR/macac_num
+#echo "001122334455" > $CONFIG_DIR/macac_addr1
+#echo "001234567890" > $CONFIG_DIR/macac_addr2
+
+echo "0" > $CONFIG_DIR/countrycode_enable
+echo "US" > $CONFIG_DIR/countrycode
+
+echo "0" > $CONFIG_DIR/wapiType
+echo "1234567890" > $CONFIG_DIR/wapiPsk
+echo "a" > $CONFIG_DIR/wapiPsklen
+echo "2" > $CONFIG_DIR/auth_type
+echo "0" > $CONFIG_DIR/encrypt
+echo "2" > $CONFIG_DIR/wpa_auth
+echo "87654321" > $CONFIG_DIR/wpa_psk
+echo "2" > $CONFIG_DIR/wpa_cipher
+echo "2" > $CONFIG_DIR/wpa2_cipher
+echo "0" > $CONFIG_DIR/psk_enable
+echo "86400" > $CONFIG_DIR/gk_rekey
+echo "0" > $CONFIG_DIR/psk_format
+
+echo "0" > $CONFIG_DIR/wep
+echo "0" > $CONFIG_DIR/wep_default_key
+echo "1" > $CONFIG_DIR/wep_key_type
+echo "0987654321" > $CONFIG_DIR/wepkey1_64_hex
+echo "0987654321" > $CONFIG_DIR/wepkey2_64_hex
+echo "0987654321" > $CONFIG_DIR/wepkey3_64_hex
+echo "0987654321" > $CONFIG_DIR/wepkey4_64_hex
+echo "3534333231" > $CONFIG_DIR/wepkey1_64_asc
+echo "3534333231" > $CONFIG_DIR/wepkey2_64_asc
+echo "3534333231" > $CONFIG_DIR/wepkey3_64_asc
+echo "3534333231" > $CONFIG_DIR/wepkey4_64_asc
+echo "12345678901234567890123456" > $CONFIG_DIR/wepkey1_128_hex
+echo "12345678901234567890123456" > $CONFIG_DIR/wepkey2_128_hex
+echo "12345678901234567890123456" > $CONFIG_DIR/wepkey3_128_hex
+echo "12345678901234567890123456" > $CONFIG_DIR/wepkey4_128_hex
+echo "31323334353637383930313233" > $CONFIG_DIR/wepkey1_128_asc
+echo "31323334353637383930313233" > $CONFIG_DIR/wepkey2_128_asc
+echo "31323334353637383930313233" > $CONFIG_DIR/wepkey3_128_asc
+echo "31323334353637383930313233" > $CONFIG_DIR/wepkey4_128_asc
+#network_type: 0 - Client mode, 1 - AD-Hoc mode
+echo "0" > $CONFIG_DIR/network_type
+echo "" > $CONFIG_DIR/default_ssid
+echo "0" > $CONFIG_DIR/power_scale
+
+# channel_bonding: BW: 0 - 20M mode, 1 - 40M, 2 - 80M mode
+echo "0" > $CONFIG_DIR/channel_bonding
+#control_sideband: BW: 0 - lower 2nd channel offset , 1 - higher 2nd channel offset
+echo "0" > $CONFIG_DIR/control_sideband
+echo "1" > $CONFIG_DIR/aggregation
+echo "1" > $CONFIG_DIR/short_gi
+echo "0" > $CONFIG_DIR/stbc_enabled
+echo "0" > $CONFIG_DIR/coexist_enabled
+
+echo "0" > $CONFIG_DIR/enable_1x
+echo "0.0.0.0" > $CONFIG_DIR/rs_ip
+echo "1812" > $CONFIG_DIR/rs_port
+echo "" > $CONFIG_DIR/rs_password
+echo "3" > $CONFIG_DIR/rs_maxretry
+echo "5" > $CONFIG_DIR/rs_interval_time
+echo "0" > $CONFIG_DIR/mac_auth_enabled
+echo "0" > $CONFIG_DIR/enable_supp_nonwpa
+echo "0" > $CONFIG_DIR/supp_nonwpa
+echo "0" > $CONFIG_DIR/wpa2_pre_auth
+
+echo "0" > $CONFIG_DIR/account_rs_enabled
+echo "0.0.0.0" > $CONFIG_DIR/account_rs_ip
+echo "0" > $CONFIG_DIR/account_rs_port
+echo "" > $CONFIG_DIR/account_rs_password
+echo "0" > $CONFIG_DIR/account_rs_update_enabled
+echo "0" > $CONFIG_DIR/account_rs_update_delay
+echo "0" > $CONFIG_DIR/account_rs_maxretry
+echo "0" > $CONFIG_DIR/account_rs_interval_time
+
+echo "0" > $CONFIG_DIR/wsc_disabled
+echo "3" > $CONFIG_DIR/wsc_method
+echo "0" > $CONFIG_DIR/wsc_configured
+echo "1" > $CONFIG_DIR/wsc_auth
+echo "1" > $CONFIG_DIR/wsc_enc
+echo "0" > $CONFIG_DIR/wsc_manual_enabled
+echo "1" > $CONFIG_DIR/wsc_upnp_enabled
+echo "1" > $CONFIG_DIR/wsc_registrar_enabled
+echo "" > $CONFIG_DIR/wsc_ssid
+echo "" > $CONFIG_DIR/wsc_psk
+echo "0" > $CONFIG_DIR/wsc_configbyextreg
+echo "27006672" > $CONFIG_DIR/wsc_pin
+
+echo "0.0.0.0" > $CONFIG_DIR/ip_addr
+echo "255.255.255.0" > $CONFIG_DIR/net_mask
+
+echo "192.168.1.250" > $CONFIG_ROOT_DIR/ip_addr
+echo "255.255.255.0" > $CONFIG_ROOT_DIR/net_mask
+echo "RTL8192CD" > $CONFIG_ROOT_DIR/device_name
+echo "0" > $CONFIG_ROOT_DIR/band2g5g_select
diff --git a/ap/app/Script/wifi_script/realtek_wpa2/init.sh b/ap/app/Script/wifi_script/realtek_wpa2/init.sh
new file mode 100755
index 0000000..8ac898a
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek_wpa2/init.sh
@@ -0,0 +1,318 @@
+#!/bin/sh
+#
+# script file to start network
+#
+# Usage: init.sh {gw | ap} {all | bridge | wan}
+#
+
+##if [ $# -lt 2 ]; then echo "Usage: $0 {gw | ap} {all | bridge | wan}"; exit 1 ; fi
+
+
+
+## error code
+ERROR_SUCCESS=0
+ERROR_INVALID_PARAMETERS=1
+ERROR_NO_SUCH_DEVICE=2
+ERROR_NO_CONFIG_FILE=3
+ERROR_NO_SUCH_FILE=4
+ERROR_NO_SUCH_DIRECTORY=5
+ERROR_NULL_FILE=6
+ERROR_NET_IF_UP_FAIL=7
+#CUR_PATH=`pwd`
+
+
+ROOT=`nv get wifi_root_dir`
+LOG=$ROOT/wifi/realtek/slog
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+
+LOG1=$ROOT/wifi/realtek/slog1
+LOG_LIMIT=128 #128K 
+#if [ -e "$LOG"]; then
+	LOG_SIZE=`du $LOG | cut -f1`
+	if [ $LOG_SIZE -ge $LOG_LIMIT ]; then    
+		mv $LOG $LOG1
+	fi
+#else
+#	touch $LOG
+#fi
+
+SCRIPT_DIR=`cat $CONFIG_ROOT_DIR/wifi_script_dir`
+BIN_DIR=`cat $CONFIG_ROOT_DIR/wifi_bin_dir`
+
+if [ -z "$SCRIPT_DIR" ] || [ -z "$BIN_DIR" ]; then
+	wifi_startup_fail_nvset
+	exit $ERROR_NULL_FILE;
+fi
+if [ ! -d "$SCRIPT_DIR" ]; then
+	echo "ERROR: $SCRIPT_DIR specify the path NOT exist." >> $LOG
+	wifi_startup_fail_nvset
+	exit $ERROR_NO_SUCH_DIRECTORY;
+fi
+if [ ! -d "$BIN_DIR" ]; then
+	echo "ERROR: $BIN_DIR specify the path NOT exist." >> $LOG
+	wifi_startup_fail_nvset
+	exit $ERROR_NO_SUCH_DIRECTORY;
+fi
+
+#PATH=$PATH:$BIN_DIR
+#export PATH
+
+START_BRIDGE=$SCRIPT_DIR/bridge.sh
+#START_WLAN_APP=$SCRIPT_DIR/wlanapp_8192c.sh
+START_WLAN=$SCRIPT_DIR/wlan_8192c.sh
+
+WLAN_PREFIX=wlan
+
+# the following fields must manually set depends on system configuration. Not support auto config.
+ROOT_WLAN=wlan0
+ROOT_CONFIG_DIR=$CONFIG_ROOT_DIR/$ROOT_WLAN
+WLAN_INTERFACE=$ROOT_WLAN
+NUM_INTERFACE=0
+#VIRTUAL_WLAN_INTERFACE="$ROOT_WLAN-va0 $ROOT_WLAN-va1 $ROOT_WLAN-va2 $ROOT_WLAN-va3"
+#VIRTUAL_WLAN_INTERFACE="$ROOT_WLAN-vxd"
+VIRTUAL_WLAN_INTERFACE="$ROOT_WLAN-va0 $ROOT_WLAN-va1 $ROOT_WLAN-vxd"
+NUM_VIRTUAL_INTERFACE=0
+VXD_INTERFACE="$ROOT_WLAN-vxd"
+#VXD_INTERFACE=""
+ALL_WLAN_INTERFACE="$WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE $VXD_INTERFACE"
+
+BR_UTIL=brctl
+IFCONFIG=ifconfig
+IWPRIV=iwpriv
+FLASH_PROG=flash
+
+export SCRIPT_DIR
+export BIN_DIR
+export WLAN_PREFIX
+export ROOT_WLAN
+export BR_UTIL
+
+
+wifi_startup_fail_nvset() {
+	date +[%H:%M:%S]init.shenddddddddddddddddddd >> $LOG
+	echo "wlan0 start failed "  >> $LOG
+	echo " "  >> $LOG
+}
+rtl_get_available_wlan() {
+	NUM=0
+	VALID_WLAN_INTERFACE=""
+	for WLAN in $WLAN_INTERFACE ; do
+		NOT_EXIST=`$IFCONFIG $WLAN > /dev/null 2>&1; echo $?`
+		if [ $NOT_EXIST = 0 ]; then
+			CONFIG_DIR=$CONFIG_ROOT_DIR/$WLAN
+			if [ ! -d "$CONFIG_DIR" ]; then
+				echo "$CONFIG_DIR: No such directory"  >> $LOG
+				wifi_startup_fail_nvset
+				exit $ERROR_NO_CONFIG_FILE
+			fi
+			
+			if [ -z "$VALID_WLAN_INTERFACE" ]; then
+				VALID_WLAN_INTERFACE="$WLAN"
+			else
+				VALID_WLAN_INTERFACE="$VALID_WLAN_INTERFACE $WLAN"
+			fi
+			NUM=`expr $NUM + 1`
+		fi
+	done
+	
+	if [ "$NUM" = "0" ]; then
+		echo "$WLAN_INTERFACE: No such device"  >> $LOG
+		wifi_startup_fail_nvset
+		exit $ERROR_NO_SUCH_DEVICE;
+	fi
+	WLAN_INTERFACE=$VALID_WLAN_INTERFACE
+	NUM_INTERFACE=$NUM
+	
+	NUM=0
+	VALID_WLAN_INTERFACE=""
+	for WLAN in $VIRTUAL_WLAN_INTERFACE ; do
+		NOT_EXIST=`$IFCONFIG $WLAN > /dev/null 2>&1; echo $?`
+		if [ $NOT_EXIST = 0 ]; then
+			CONFIG_DIR=$CONFIG_ROOT_DIR/$WLAN
+			if [ ! -d "$CONFIG_DIR" ]; then
+				echo "$CONFIG_DIR: No such directory"  >> $LOG
+				wifi_startup_fail_nvset
+				exit $ERROR_NO_CONFIG_FILE
+			fi
+			
+			if [ -z "$VALID_WLAN_INTERFACE" ]; then
+				VALID_WLAN_INTERFACE="$WLAN"
+			else
+				VALID_WLAN_INTERFACE="$VALID_WLAN_INTERFACE $WLAN"
+			fi
+			NUM=`expr $NUM + 1`
+		fi
+	done
+	VIRTUAL_WLAN_INTERFACE=$VALID_WLAN_INTERFACE
+	NUM_VIRTUAL_INTERFACE=$NUM
+	
+	
+
+	ALL_WLAN_INTERFACE="$WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE"
+}
+
+BR_INTERFACE=br0
+BR_LAN1_INTERFACE=eth0
+
+ENABLE_BR=1
+
+
+# Generate WPS PIN number
+rtl_generate_wps_pin() {
+	for WLAN in $WLAN_INTERFACE ; do
+		CONFIG_DIR=$CONFIG_ROOT_DIR/$WLAN
+		GET_VALUE=`cat $CONFIG_DIR/wsc_pin`
+		if [ "$GET_VALUE" = "00000000" ]; then
+			##echo "27006672" > $CONFIG_DIR/wsc_pin
+			$BIN_DIR/$FLASH_PROG gen-pin $WLAN
+			$BIN_DIR/$FLASH_PROG gen-pin $WLAN-vxd
+		fi
+	done
+}
+
+rtl_set_mac_addr() {
+	# Set Ethernet 0 MAC address
+	GET_VALUE=`cat $ROOT_CONFIG_DIR/nic0_addr`
+	ELAN_MAC_ADDR=$GET_VALUE
+	$IFCONFIG $BR_LAN1_INTERFACE down
+	$IFCONFIG $BR_LAN1_INTERFACE hw ether $ELAN_MAC_ADDR
+}
+
+# Usage: rtl_has_enable_vap wlan_interface
+rtl_has_enable_vap() {
+	for INTF in $VIRTUAL_WLAN_INTERFACE ; do
+		case $INTF in
+		$1-va[0-9])
+			CONFIG_DIR=$CONFIG_ROOT_DIR/$INTF
+			WLAN_DISABLED_VALUE=`cat $CONFIG_DIR/wlan_disabled`
+			if [ "$WLAN_DISABLED_VALUE" = "0" ]; then
+				return 1
+			fi
+			;;
+		*)
+			;;
+		esac
+	done
+	
+	return 0
+}
+
+# Start WLAN interface
+rtl_start_wlan_if() {
+	for WLAN in $ALL_WLAN_INTERFACE ; do
+		echo "Initialize $WLAN interface" >> $LOG
+#		$IFCONFIG $WLAN down
+		
+		case $WLAN in
+		$WLAN_PREFIX[0-9])		#ROOT_INTERFACE
+			NO_VAP=`$IFCONFIG $WLAN-va0 > /dev/null 2>&1; echo $?`
+			if [ $NO_VAP = 0 ]; then
+				rtl_has_enable_vap $WLAN
+				HAS_VAP=`echo $?`
+				$IWPRIV $WLAN set_mib vap_enable=$HAS_VAP
+				echo "$IWPRIV $WLAN set_mib vap_enable=$HAS_VAP" >> $LOG
+			fi
+			;;
+		$WLAN_PREFIX[0-9]-vxd) ## station interface
+#			echo "$IWPRIV $WLAN copy_mib" >> $LOG
+#			$IWPRIV $WLAN copy_mib
+#			WPA_SUPPLICAT=`ps | grep wpa_supplicant | grep -v grep`
+#			echo "SUPPLICAT=$WPA_SUPPLICAT"  >> $LOG
+			;;
+		*)
+			;;
+		esac
+		
+		CONFIG_DIR=$CONFIG_ROOT_DIR/$WLAN
+		WLAN_DISABLED_VALUE=`cat $CONFIG_DIR/wlan_disabled`
+#		ISUP=`$IFCONFIG $WLAN >> $LOG | grep UP`
+		
+#		if [ "$WLAN_DISABLED_VALUE" = 0  -a  "$ISUP" = "" ]; then
+			echo "<<<${START_WLAN##*/} $WLAN>>>" >> $LOG
+			$START_WLAN $WLAN
+			ERR=`echo $?`
+			if [ $ERR != 0 ]; then
+				echo "$START_WLAN $WLAN  failed"  >> $LOG
+				wifi_startup_fail_nvset
+				exit $ERR;
+			fi
+#		else
+#			echo "$WLAN WLAN_DISABLED_VALUE=$WLAN_DISABLED_VALUE, ISUP=$ISUP" >> $LOG
+#		fi
+	done
+}
+
+# Enable WLAN interface
+rtl_enable_wlan_if() {
+	for WLAN in $ALL_WLAN_INTERFACE ; do
+		CONFIG_DIR=$CONFIG_ROOT_DIR/$WLAN
+		WLAN_DISABLED_VALUE=`cat $CONFIG_DIR/wlan_disabled`
+		if [ "$WLAN_DISABLED_VALUE" = 0 ]; then
+			echo "<<<ENABLE $WLAN>>>"
+			IP_ADDR=`cat $CONFIG_DIR/ip_addr`
+			$IFCONFIG $WLAN $IP_ADDR
+			$IFCONFIG $WLAN up
+			if [ $? != 0 ]; then
+				wifi_startup_fail_nvset
+				echo "ERROR ifconfig $WLAN up fail" >> $LOG
+ 				exit $ERROR_NET_IF_UP_FAIL;
+			fi
+		fi
+	done
+}
+
+rtl_start_no_gw() {
+	echo "<<<${START_BRIDGE##*/} $BR_INTERFACE $BR_LAN1_INTERFACE $WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE>>>"  >> $LOG
+	$START_BRIDGE $BR_INTERFACE  $WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE
+	ERR=`echo $?`
+	if [ $ERR != 0 ]; then
+		wifi_startup_fail_nvset
+		exit $ERR;
+	fi
+	#CONFIG_DIR=$CONFIG_ROOT_DIR/$WLAN
+	#GET_WPA_PSK=`cat $CONFIG_DIR/wpa_psk`
+	#echo "222 GET_WPA_PSK is "$GET_WPA_PSK
+	#echo "<<<${START_WLAN_APP##*/} start $WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE $BR_INTERFACE>>>"
+	#$START_WLAN_APP start $WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE $BR_INTERFACE
+	#ERR=`echo $?`
+	#if [ $ERR != 0 ]; then
+	#	exit $ERR;
+	#fi
+}
+
+
+rtl_init() {
+	date +[%H:%M:%S]init.shstarttttttttttttttttt >> $LOG
+	killall webs 2> /dev/null
+	$BIN_DIR/webs -x
+	
+	echo "realtek rtl_get_available_wlan" >> $LOG
+	rtl_get_available_wlan
+##	rtl_set_mac_addr
+
+
+
+	echo "realtek rtl_start_wlan_if" >> $LOG
+	rtl_start_wlan_if
+	
+#NO_EXIST=1
+	NO_EXIST=`$BR_UTIL > /dev/null 2>&1; echo $?`
+	if [ "$NO_EXIST" = "127" ]; then
+		echo "$BR_UTIL: NOT exist."  >> $LOG
+		rtl_enable_wlan_if
+	else
+		#rtl_generate_wps_pin
+		echo "realtek rtl_start_no_gw"  >> $LOG
+		rtl_start_no_gw
+	fi
+	
+    #iwpriv wlan0 stopps 1
+    #iwpriv wlan0 set_mib ps_level=0	
+	
+	  
+	date +[%H:%M:%S]init.shenddddddddddddddddddd >> $LOG
+	echo "wlan0 start success"  >> $LOG
+	echo " "  >> $LOG
+}
+
+rtl_init
diff --git a/ap/app/Script/wifi_script/realtek_wpa2/init1.sh b/ap/app/Script/wifi_script/realtek_wpa2/init1.sh
new file mode 100755
index 0000000..91e37fc
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek_wpa2/init1.sh
@@ -0,0 +1,290 @@
+#!/bin/sh
+#
+# script file to start network
+#
+# Usage: init.sh {gw | ap} {all | bridge | wan}
+#
+
+##if [ $# -lt 2 ]; then echo "Usage: $0 {gw | ap} {all | bridge | wan}"; exit 1 ; fi
+
+
+
+## error code
+ERROR_SUCCESS=0
+ERROR_INVALID_PARAMETERS=1
+ERROR_NO_SUCH_DEVICE=2
+ERROR_NO_CONFIG_FILE=3
+ERROR_NO_SUCH_FILE=4
+ERROR_NO_SUCH_DIRECTORY=5
+ERROR_NULL_FILE=6
+ERROR_NET_IF_UP_FAIL=7
+#CUR_PATH=`pwd`
+
+
+ROOT=`nv get wifi_root_dir`
+LOG=$ROOT/wifi/realtek/slog
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+
+LOG1=$ROOT/wifi/realtek/slog1
+LOG_LIMIT=128 #128K 
+#if [ -e "$LOG"]; then
+	LOG_SIZE=`du $LOG | cut -f1`
+	if [ $LOG_SIZE -ge $LOG_LIMIT ]; then    
+		mv $LOG $LOG1
+	fi
+#else
+#	touch $LOG
+#fi
+
+SCRIPT_DIR=`cat $CONFIG_ROOT_DIR/wifi_script_dir`
+BIN_DIR=`cat $CONFIG_ROOT_DIR/wifi_bin_dir`
+
+if [ -z "$SCRIPT_DIR" ] || [ -z "$BIN_DIR" ]; then
+	wifi_startup_fail_nvset
+	exit $ERROR_NULL_FILE;
+fi
+if [ ! -d "$SCRIPT_DIR" ]; then
+	echo "ERROR: $SCRIPT_DIR specify the path NOT exist." >> $LOG
+	wifi_startup_fail_nvset
+	exit $ERROR_NO_SUCH_DIRECTORY;
+fi
+if [ ! -d "$BIN_DIR" ]; then
+	echo "ERROR: $BIN_DIR specify the path NOT exist." >> $LOG
+	wifi_startup_fail_nvset
+	exit $ERROR_NO_SUCH_DIRECTORY;
+fi
+
+#PATH=$PATH:$BIN_DIR
+#export PATH
+
+START_BRIDGE=$SCRIPT_DIR/bridge1.sh
+#START_WLAN_APP=$SCRIPT_DIR/wlanapp_8192c.sh
+START_WLAN=$SCRIPT_DIR/wlan_8192c1.sh
+
+WLAN_PREFIX=wlan
+
+# the following fields must manually set depends on system configuration. Not support auto config.
+ROOT_WLAN=wlan0
+ROOT_CONFIG_DIR=$CONFIG_ROOT_DIR/$ROOT_WLAN
+WLAN_INTERFACE=$ROOT_WLAN
+NUM_INTERFACE=0
+#VIRTUAL_WLAN_INTERFACE="$ROOT_WLAN-va0 $ROOT_WLAN-va1 $ROOT_WLAN-va2 $ROOT_WLAN-va3"
+VIRTUAL_WLAN_INTERFACE=""
+NUM_VIRTUAL_INTERFACE=0
+VXD_INTERFACE=""
+ALL_WLAN_INTERFACE="$WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE $VXD_INTERFACE"
+
+BR_UTIL=brctl
+IFCONFIG=ifconfig
+IWPRIV=iwpriv
+FLASH_PROG=flash
+
+export SCRIPT_DIR
+export BIN_DIR
+export WLAN_PREFIX
+export ROOT_WLAN
+export BR_UTIL
+
+
+wifi_startup_fail_nvset() {
+	date +[%H:%M:%S]init1.shenddddddddddddddddddd >> $LOG
+	echo "wlan0 start failed "  >> $LOG
+	echo " "  >> $LOG
+}
+rtl_get_available_wlan() {
+	NUM=0
+	VALID_WLAN_INTERFACE=""
+	for WLAN in $WLAN_INTERFACE ; do
+		NOT_EXIST=`$IFCONFIG $WLAN > /dev/null 2>&1; echo $?`
+		if [ $NOT_EXIST = 0 ]; then
+			CONFIG_DIR=$CONFIG_ROOT_DIR/$WLAN
+			if [ ! -d "$CONFIG_DIR" ]; then
+				echo "$CONFIG_DIR: No such directory"  >> $LOG
+				wifi_startup_fail_nvset
+				exit $ERROR_NO_CONFIG_FILE
+			fi
+			
+			if [ -z "$VALID_WLAN_INTERFACE" ]; then
+				VALID_WLAN_INTERFACE="$WLAN"
+			else
+				VALID_WLAN_INTERFACE="$VALID_WLAN_INTERFACE $WLAN"
+			fi
+			NUM=`expr $NUM + 1`
+		fi
+	done
+	
+	if [ "$NUM" = "0" ]; then
+		echo "$WLAN_INTERFACE: No such device"  >> $LOG
+		wifi_startup_fail_nvset
+		exit $ERROR_NO_SUCH_DEVICE;
+	fi
+	WLAN_INTERFACE=$VALID_WLAN_INTERFACE
+	NUM_INTERFACE=$NUM
+	
+	ALL_WLAN_INTERFACE="$WLAN_INTERFACE"
+}
+
+BR_INTERFACE=br0
+BR_LAN1_INTERFACE=eth0
+
+ENABLE_BR=1
+
+
+# Generate WPS PIN number
+rtl_generate_wps_pin() {
+	for WLAN in $WLAN_INTERFACE ; do
+		CONFIG_DIR=$CONFIG_ROOT_DIR/$WLAN
+		GET_VALUE=`cat $CONFIG_DIR/wsc_pin`
+		if [ "$GET_VALUE" = "00000000" ]; then
+			##echo "27006672" > $CONFIG_DIR/wsc_pin
+			$BIN_DIR/$FLASH_PROG gen-pin $WLAN
+			$BIN_DIR/$FLASH_PROG gen-pin $WLAN-vxd
+		fi
+	done
+}
+
+rtl_set_mac_addr() {
+	# Set Ethernet 0 MAC address
+	GET_VALUE=`cat $ROOT_CONFIG_DIR/nic0_addr`
+	ELAN_MAC_ADDR=$GET_VALUE
+	$IFCONFIG $BR_LAN1_INTERFACE down
+	$IFCONFIG $BR_LAN1_INTERFACE hw ether $ELAN_MAC_ADDR
+}
+
+# Usage: rtl_has_enable_vap wlan_interface
+rtl_has_enable_vap() {
+	for INTF in $VIRTUAL_WLAN_INTERFACE ; do
+		case $INTF in
+		$1-va[0-9])
+			CONFIG_DIR=$CONFIG_ROOT_DIR/$INTF
+			WLAN_DISABLED_VALUE=`cat $CONFIG_DIR/wlan_disabled`
+			if [ "$WLAN_DISABLED_VALUE" = "0" ]; then
+				return 1
+			fi
+			;;
+		*)
+			;;
+		esac
+	done
+	
+	return 0
+}
+
+# Start WLAN interface
+rtl_start_wlan_if() {
+	for WLAN in $ALL_WLAN_INTERFACE ; do
+		echo "Initialize $WLAN interface" >> $LOG
+		$IFCONFIG $WLAN down
+		
+		case $WLAN in
+		$WLAN_PREFIX[0-9])		#ROOT_INTERFACE
+			NO_VAP=`$IFCONFIG $WLAN-va0 > /dev/null 2>&1; echo $?`
+			if [ $NO_VAP = 0 ]; then
+				rtl_has_enable_vap $WLAN
+				HAS_VAP=`echo $?`
+				$IWPRIV $WLAN set_mib vap_enable=$HAS_VAP
+				echo "$IWPRIV $WLAN set_mib vap_enable=$HAS_VAP" >> $LOG
+			fi
+			;;
+		$WLAN_PREFIX[0-9]-vxd) ## station interface
+#			echo "$IWPRIV $WLAN copy_mib" >> $LOG
+#			$IWPRIV $WLAN copy_mib
+#			WPA_SUPPLICAT=`ps | grep wpa_supplicant | grep -v grep`
+#			echo "SUPPLICAT=$WPA_SUPPLICAT"  >> $LOG
+			;;
+		*)
+			;;
+		esac
+		
+		CONFIG_DIR=$CONFIG_ROOT_DIR/$WLAN
+		WLAN_DISABLED_VALUE=`cat $CONFIG_DIR/wlan_disabled`
+
+		if [ "$WLAN_DISABLED_VALUE" = 0 ]; then
+			echo "<<<${START_WLAN##*/} $WLAN>>>" >> $LOG
+			$START_WLAN $WLAN
+			ERR=`echo $?`
+			if [ $ERR != 0 ]; then
+				echo "$START_WLAN $WLAN  failed"  >> $LOG
+				wifi_startup_fail_nvset
+				exit $ERR;
+			fi
+		else
+			echo "$WLAN WLAN_DISABLED_VALUE=$WLAN_DISABLED_VALUE" >> $LOG
+		fi
+	done
+}
+
+# Enable WLAN interface
+rtl_enable_wlan_if() {
+	for WLAN in $ALL_WLAN_INTERFACE ; do
+		CONFIG_DIR=$CONFIG_ROOT_DIR/$WLAN
+		WLAN_DISABLED_VALUE=`cat $CONFIG_DIR/wlan_disabled`
+		if [ "$WLAN_DISABLED_VALUE" = 0 ]; then
+			echo "<<<ENABLE $WLAN>>>"
+			IP_ADDR=`cat $CONFIG_DIR/ip_addr`
+			$IFCONFIG $WLAN $IP_ADDR
+			$IFCONFIG $WLAN up
+			if [ $? != 0 ]; then
+				wifi_startup_fail_nvset
+				echo "ERROR ifconfig $WLAN up fail" >> $LOG
+ 				exit $ERROR_NET_IF_UP_FAIL;
+			fi
+		fi
+	done
+}
+
+rtl_start_no_gw() {
+	echo "<<<${START_BRIDGE##*/} $BR_INTERFACE $BR_LAN1_INTERFACE $WLAN_INTERFACE>>>"  >> $LOG
+	$START_BRIDGE $BR_INTERFACE  $WLAN_INTERFACE
+	ERR=`echo $?`
+	if [ $ERR != 0 ]; then
+		wifi_startup_fail_nvset
+		exit $ERR;
+	fi
+	#CONFIG_DIR=$CONFIG_ROOT_DIR/$WLAN
+	#GET_WPA_PSK=`cat $CONFIG_DIR/wpa_psk`
+	#echo "222 GET_WPA_PSK is "$GET_WPA_PSK
+	#echo "<<<${START_WLAN_APP##*/} start $WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE $BR_INTERFACE>>>"
+	#$START_WLAN_APP start $WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE $BR_INTERFACE
+	#ERR=`echo $?`
+	#if [ $ERR != 0 ]; then
+	#	exit $ERR;
+	#fi
+}
+
+
+rtl_init() {
+	date +[%H:%M:%S]init1.shstarttttttttttttttttt >> $LOG
+	killall webs 2> /dev/null
+	$BIN_DIR/webs -x
+	
+	echo "realtek rtl_get_available_wlan" >> $LOG
+	rtl_get_available_wlan
+##	rtl_set_mac_addr
+
+
+
+	echo "realtek rtl_start_wlan_if" >> $LOG
+	rtl_start_wlan_if
+	
+#NO_EXIST=1
+	NO_EXIST=`$BR_UTIL > /dev/null 2>&1; echo $?`
+	if [ "$NO_EXIST" = "127" ]; then
+		echo "$BR_UTIL: NOT exist."  >> $LOG
+		rtl_enable_wlan_if
+	else
+		#rtl_generate_wps_pin
+		echo "realtek rtl_start_no_gw"  >> $LOG
+		rtl_start_no_gw
+	fi
+	
+    #iwpriv wlan0 stopps 1
+    #iwpriv wlan0 set_mib ps_level=0	
+	
+	  
+	date +[%H:%M:%S]init1.shenddddddddddddddddddd >> $LOG
+	echo " "  >> $LOG
+	echo " "  >> $LOG
+}
+
+rtl_init
diff --git a/ap/app/Script/wifi_script/realtek_wpa2/kill_wps.sh b/ap/app/Script/wifi_script/realtek_wpa2/kill_wps.sh
new file mode 100755
index 0000000..13c7e4b
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek_wpa2/kill_wps.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+#
+# script file to start network
+#
+# Usage: kill_wps.sh {pbc | pin} {PINNUM}
+#
+
+##if [ $# -lt 2 ]; then echo "Usage: $0 {gw | ap} {all | bridge | wan}"; exit 1 ; fi
+ROOT=`nv get wifi_root_dir`
+
+LOG=$ROOT/wifi/realtek/slog
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0
+
+ID=`nv get wifi_wps_index`
+echo "enter kill_wps.sh wifi_wps_index=$ID >>>>>>>>" >> $LOG
+ID=`expr $ID - 1`
+echo "enter kill_wps.sh ID=$ID >>>>>>>>" >> $LOG
+
+if [ "$ID" = "0" ];then
+#CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0
+#WLAN_INTERFACE="wlan0"
+CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0-va$ID
+WLAN_INTERFACE="wlan0-va$ID"
+else
+CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0-va$ID
+WLAN_INTERFACE="wlan0-va$ID"
+fi
+
+
+if [ -z "$SCRIPT_DIR" ]; then
+	SCRIPT_DIR=`cat $CONFIG_ROOT_DIR/wifi_script_dir`
+fi
+START_WLAN_APP=$SCRIPT_DIR/wlanapp_8192c.sh
+
+BR_INTERFACE="br0"
+echo "<<<${START_WLAN_APP##*/} start $WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE $BR_INTERFACE>>>" >> $LOG
+$START_WLAN_APP kill $WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE $BR_INTERFACE 
+ERR=`echo $?`
+if [ $ERR != 0 ]; then
+	exit $ERR;
+fi
diff --git a/ap/app/Script/wifi_script/realtek_wpa2/kill_wps1.sh b/ap/app/Script/wifi_script/realtek_wpa2/kill_wps1.sh
new file mode 100755
index 0000000..485b63f
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek_wpa2/kill_wps1.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+#
+# script file to start network
+#
+# Usage: kill_wps.sh {pbc | pin} {PINNUM}
+#
+
+##if [ $# -lt 2 ]; then echo "Usage: $0 {gw | ap} {all | bridge | wan}"; exit 1 ; fi
+
+ROOT=`nv get wifi_root_dir`
+
+LOG=$ROOT/wifi/realtek/slog
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0
+
+ID=`nv get wifi_wps_index`
+echo "enter kill_wps1.sh wifi_wps_index=$ID >>>>>>>>" >> $LOG
+
+
+CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0
+WLAN_INTERFACE="wlan0"
+
+
+if [ -z "$SCRIPT_DIR" ]; then
+	SCRIPT_DIR=`cat $CONFIG_ROOT_DIR/wifi_script_dir`
+fi
+START_WLAN_APP=$SCRIPT_DIR/wlanapp_8192c.sh
+
+BR_INTERFACE="br0"
+echo "<<<${START_WLAN_APP##*/} start $WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE $BR_INTERFACE>>>" >> $LOG
+$START_WLAN_APP kill $WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE $BR_INTERFACE 
+ERR=`echo $?`
+if [ $ERR != 0 ]; then
+	exit $ERR;
+fi
diff --git a/ap/app/Script/wifi_script/realtek_wpa2/para_set.sh b/ap/app/Script/wifi_script/realtek_wpa2/para_set.sh
new file mode 100755
index 0000000..dbe02cf
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek_wpa2/para_set.sh
@@ -0,0 +1,363 @@
+#!/bin/sh
+#
+# script file to start WLAN
+#
+
+
+## error code
+ERROR_SUCCESS=0
+ERROR_INVALID_PARAMETERS=1
+ERROR_NO_SUCH_DEVICE=2
+ERROR_NO_CONFIG_FILE=3
+ERROR_NO_SUCH_FILE=4
+ERROR_NO_SUCH_DIRECTORY=5
+ERROR_NULL_FILE=6
+ERROR_NET_IF_UP_FAIL=7
+
+ROOT=`nv get wifi_root_dir`
+LOG=$ROOT/wifi/realtek/slog
+
+IWPRIV=iwpriv
+wifi_lte_intr=`nv get wifi_lte_intr`
+
+if [ $# -lt 1 ]; then
+	echo "Usage: $0 wlan_interface" >> $LOG
+	exit $ERROR_INVALID_PARAMETERS;
+fi
+
+date +[%H:%M:%S]paraset_$1_start >> $LOG
+
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+CONFIG_DIR=$CONFIG_ROOT_DIR/$1
+
+if [ ! -d "$CONFIG_DIR" ]; then
+	echo "$CONFIG_DIR: No such directory" >> $LOG
+	exit $ERROR_NO_CONFIG_FILE
+fi
+
+if [ -z "$WLAN_PREFIX" ]; then
+	WLAN_PREFIX=wlan
+fi
+
+if [ -z "$ROOT_WLAN" ]; then
+#	ROOT_WLAN=${1:0:$WLAN_NAME_LEN}
+### delete -va0 get wlan0
+	ROOT_WLAN=${1%%-*}  
+fi
+ROOT_CONFIG_DIR=$CONFIG_ROOT_DIR/$ROOT_WLAN
+
+IS_ROOT_WLAN=0
+if [ "$1" = "$ROOT_WLAN" ]; then
+	IS_ROOT_WLAN=1
+fi
+echo "IS_ROOT_WLAN is " $IS_ROOT_WLAN
+SET_WLAN="iwpriv $1"
+SET_WLAN_PARAM="$SET_WLAN set_mib"
+IFCONFIG=ifconfig
+SET_VA0="iwpriv wlan0-va0"
+SET_VA1="iwpriv wlan0-va1"
+
+if [ $IS_ROOT_WLAN = 1 ]; then
+	$IFCONFIG $1-va0 down
+	if [ $? != 0 ]; then
+		exit $ERROR_NO_SUCH_DEVICE
+	fi
+	
+	$IFCONFIG $1-va1 down
+	if [ $? != 0 ]; then
+		exit $ERROR_NO_SUCH_DEVICE
+	fi
+	
+	$IFCONFIG $1-vxd down
+	if [ $? != 0 ]; then
+		exit $ERROR_NO_SUCH_DEVICE
+	fi
+fi
+$IFCONFIG $1 down
+if [ $? != 0 ]; then
+	exit $ERROR_NO_SUCH_DEVICE
+fi
+
+
+
+# set RF parameters
+if [ $IS_ROOT_WLAN = 1 ]; then
+echo "set RF parameters" >> $LOG
+# set channel
+	GET_VALUE=`cat $CONFIG_DIR/channel`
+	$SET_WLAN set_mib channel=$GET_VALUE
+
+##autochannel can use wifi_lte_intr
+	if [ "$wifi_lte_intr" = "1" -a "$GET_VALUE" = "0" ];then
+		echo "wifi_lte_intr=$wifi_lte_intr  $SET_WLAN set_mib ch_low=5" >> $LOG	
+#		$SET_WLAN set_mib ch_low=5
+		$SET_WLAN set_mib disable_acs_ch=15
+	else
+		GET_VALUE=`cat $CONFIG_DIR/ch_low`
+		$SET_WLAN set_mib ch_low=$GET_VALUE
+	fi
+
+# set wifi coverage	
+	GET_TX_POWER_PERCENT=`cat $CONFIG_DIR/tx_power_percet`
+	#echo "GET_TX_POWER_PERCENT is "$GET_TX_POWER_PERCENT
+	$SET_WLAN set_mib powerpercent=$GET_TX_POWER_PERCENT
+	
+# for country code
+	COUNTRY_CODE_ENABLE=`$SET_WLAN get_mib countrycode 2> /dev/null`
+	if [ ! -z "$COUNTRY_CODE_ENABLE" ]; then
+		GET_VALUE=`cat $ROOT_CONFIG_DIR/countrycode_enable`
+		$SET_WLAN set_mib countrycode=$GET_VALUE
+
+		GET_VALUE=`cat $ROOT_CONFIG_DIR/countrycode`
+		$SET_WLAN set_mib countrystr=$GET_VALUE
+	fi
+	
+	
+#set band	  bgn
+	GET_BAND=`cat $ROOT_CONFIG_DIR/band`
+	GET_WIFI_SPECIFIC=`cat $ROOT_CONFIG_DIR/wifi_specific`
+	if [ "$GET_VALUE_WLAN_MODE" != '1' ] && [ "$GET_WIFI_SPECIFIC" = 1 ] &&  [ "$GET_BAND" = '2' ] ; then
+		GET_BAND=3
+	fi
+	if [ "$GET_BAND" = '8' ]; then
+		GET_BAND=11
+		$SET_WLAN set_mib deny_legacy=3
+		$SET_VA0 set_mib deny_legacy=3
+		$SET_VA1 set_mib deny_legacy=3			
+	elif [ "$GET_BAND" = '2' ]; then
+		GET_BAND=3
+		$SET_WLAN set_mib deny_legacy=1
+		$SET_VA0 set_mib deny_legacy=1
+		$SET_VA1 set_mib deny_legacy=1		
+	elif [ "$GET_BAND" = '10' ]; then
+		GET_BAND=11
+		$SET_WLAN set_mib deny_legacy=1
+		$SET_VA0 set_mib deny_legacy=1
+		$SET_VA1 set_mib deny_legacy=1			
+	elif [ "$GET_BAND" = '64' ]; then
+		GET_BAND=76
+		$SET_WLAN set_mib deny_legacy=12
+		$SET_VA0 set_mib deny_legacy=12
+		$SET_VA1 set_mib deny_legacy=12			
+	elif [ "$GET_BAND" = '72' ]; then
+		GET_BAND=76
+		$SET_WLAN set_mib deny_legacy=4
+		$SET_VA0 set_mib deny_legacy=4
+		$SET_VA1 set_mib deny_legacy=4		
+	else
+		$SET_WLAN set_mib deny_legacy=0
+		$SET_VA0 set_mib deny_legacy=0
+		$SET_VA1 set_mib deny_legacy=0
+	fi
+	$SET_WLAN set_mib band=$GET_BAND
+	$SET_VA0 set_mib band=$GET_BAND
+	$SET_VA1 set_mib band=$GET_BAND
+
+
+###Set 11n parameter
+		if [ $GET_BAND = 10 ] || [ $GET_BAND = 11 ] || [ $GET_BAND = 76 ]; then
+			if [ $IS_ROOT_WLAN = 1 ]; then
+				GET_CHANNEL_BONDING=`cat $CONFIG_DIR/channel_bonding`
+				$SET_WLAN set_mib use40M=$GET_CHANNEL_BONDING
+
+				GET_CONTROL_SIDEBAND=`cat $CONFIG_DIR/control_sideband`
+
+				if [ "$GET_CHANNEL_BONDING" = 0 ]; then
+					$SET_WLAN set_mib 2ndchoffset=0
+				else
+					if [ "$GET_CONTROL_SIDEBAND" = 0 ]; then
+						 $SET_WLAN set_mib 2ndchoffset=1
+					fi
+					if [ "$GET_CONTROL_SIDEBAND" = 1 ]; then
+						 $SET_WLAN set_mib 2ndchoffset=2
+					fi
+				fi
+			fi # [ $IS_ROOT_WLAN = 1 ]
+
+		GET_COEXIST_ENABLED=`cat $CONFIG_DIR/coexist_enabled`
+		$SET_WLAN set_mib coexist=$GET_COEXIST_ENABLED
+		fi # [ $GET_BAND = 10 ] || [ $GET_BAND = 11 ]
+##########
+	
+else
+## for va0 va1 set ssid 
+echo "set basic ap parameters" >> $LOG
+	GET_VALUE=`cat $CONFIG_DIR/ssid`
+	$SET_WLAN set_mib ssid="$GET_VALUE"
+	
+	GET_VALUE=`cat $CONFIG_DIR/hidden_ssid`
+	$SET_WLAN set_mib hiddenAP=$GET_VALUE
+
+	GET_VALUE=`cat $CONFIG_DIR/supported_sta_num`
+	$SET_WLAN set_mib stanum=$GET_VALUE
+
+	# for ap isolation 
+	# need to confirm which is for ap isolation
+	#GET_VALUE=`cat $CONFIG_DIR/group_id`
+	#$SET_WLAN set_mib groupID=$GET_VALUE
+
+	# set block relay
+	GET_VALUE=`cat $CONFIG_DIR/block_relay`
+	$SET_WLAN set_mib block_relay=$GET_VALUE
+
+
+	GET_WLAN_AUTH_TYPE=`cat $CONFIG_DIR/auth_type`
+	AUTH_TYPE=$GET_WLAN_AUTH_TYPE
+	GET_WLAN_ENCRYPT=`cat $CONFIG_DIR/encrypt`
+	if [ "$GET_WLAN_AUTH_TYPE" = '1' ] && [ "$GET_WLAN_ENCRYPT" != '1' ]; then
+		# shared-key and not WEP enabled, force to open-system
+		AUTH_TYPE=0
+	fi
+	$SET_WLAN set_mib authtype=$AUTH_TYPE
+	if [ "$GET_WLAN_ENCRYPT" = '0' ]; then
+		$SET_WLAN set_mib encmode=0
+	elif [ "$GET_WLAN_ENCRYPT" = '1' ]; then
+		### WEP mode ##
+		GET_WEP=`cat $CONFIG_DIR/wep`
+		GET_WEP_KEY_TYPE=`cat $CONFIG_DIR/wep_key_type`
+		GET_WEP_KEY_ID=`cat $CONFIG_DIR/wep_default_key`
+		
+		if [ "$GET_WEP" = '1' ]; then
+			if [ "$GET_WEP_KEY_TYPE" = '0' ]; then
+				GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_64_asc`
+				GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_64_asc`
+				GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_64_asc`
+				GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_64_asc`
+			else
+				GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_64_hex`
+				GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_64_hex`
+				GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_64_hex`
+				GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_64_hex`
+			fi
+		
+			$SET_WLAN set_mib encmode=1
+			$SET_WLAN set_mib wepkey1=$GET_WEP_KEY_1
+			$SET_WLAN set_mib wepkey2=$GET_WEP_KEY_2
+			$SET_WLAN set_mib wepkey3=$GET_WEP_KEY_3
+			$SET_WLAN set_mib wepkey4=$GET_WEP_KEY_4
+			$SET_WLAN set_mib wepdkeyid=$GET_WEP_KEY_ID
+		else
+			if [ "$GET_WEP_KEY_TYPE" = '0' ]; then
+				GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_128_asc`
+				GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_128_asc`
+				GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_128_asc`
+				GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_128_asc`
+			else
+				GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_128_hex`
+				GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_128_hex`
+				GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_128_hex`
+				GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_128_hex`
+			fi
+			$SET_WLAN set_mib encmode=5
+			$SET_WLAN set_mib wepkey1=$GET_WEP_KEY_1
+			$SET_WLAN set_mib wepkey2=$GET_WEP_KEY_2
+			$SET_WLAN set_mib wepkey3=$GET_WEP_KEY_3
+			$SET_WLAN set_mib wepkey4=$GET_WEP_KEY_4
+			$SET_WLAN set_mib wepdkeyid=$GET_WEP_KEY_ID
+		fi
+	else
+			## WPA mode ##
+		$SET_WLAN set_mib encmode=2
+	fi
+
+
+	## Set 802.1x flag ##
+	_ENABLE_1X=0
+	if [ $GET_WLAN_ENCRYPT -lt 2 ]; then
+		GET_ENABLE_1X=`cat $CONFIG_DIR/enable_1x`
+		GET_MAC_AUTH_ENABLED=`cat $CONFIG_DIR/mac_auth_enabled`
+		if [ "$GET_ENABLE_1X" != 0 ] || [ "$GET_MAC_AUTH_ENABLED" != 0 ]; then
+			_ENABLE_1X=1
+		fi
+	else
+		_ENABLE_1X=1
+	fi
+	$SET_WLAN set_mib 802_1x=$_ENABLE_1X
+	
+
+	echo "wpa relative settings"  >> $LOG
+#
+# following settings is used when driver WPA module is included
+#
+
+	GET_WPA_AUTH=`cat $CONFIG_DIR/wpa_auth`
+	#if [ $GET_VALUE_WLAN_MODE != 1 ] && [ $GET_WLAN_ENCRYPT -ge 2 ]  && [ $GET_WLAN_ENCRYPT -lt 7 ] && [ $GET_WPA_AUTH = 2 ]; then
+	if [ $GET_WLAN_ENCRYPT -ge 2 ]  && [ $GET_WLAN_ENCRYPT -lt 7 ]; then
+		if [ $GET_WPA_AUTH = 2 ]; then
+			if [ $GET_WLAN_ENCRYPT = 2 ]; then
+				ENABLE=1
+			elif [ $GET_WLAN_ENCRYPT = 4 ]; then
+				ENABLE=2
+			elif [ $GET_WLAN_ENCRYPT = 6 ]; then
+				ENABLE=3
+			else
+				echo "invalid ENCRYPT value!($GET_WLAN_ENCRYPT)" >> $LOG
+				exit $ERROR_INVALID_PARAMETERS;
+			fi
+			$SET_WLAN set_mib psk_enable=$ENABLE
+		else
+			$SET_WLAN set_mib psk_enable=0
+		fi
+
+		if [ $GET_WLAN_ENCRYPT = 2 ] || [ $GET_WLAN_ENCRYPT = 6 ]; then
+			GET_WPA_CIPHER_SUITE=`cat $CONFIG_DIR/wpa_cipher`
+			if [ $GET_WPA_CIPHER_SUITE = 1 ]; then
+				CIPHER=2
+			elif [ $GET_WPA_CIPHER_SUITE = 2 ]; then
+				CIPHER=8
+			elif [ $GET_WPA_CIPHER_SUITE = 3 ]; then
+				CIPHER=10
+			else
+				echo "invalid WPA_CIPHER_SUITE value!($GET_WPA_CIPHER_SUITE)" >> $LOG
+				exit $ERROR_INVALID_PARAMETERS;
+			fi
+		fi
+		$SET_WLAN set_mib wpa_cipher=$CIPHER
+
+		if [ $GET_WLAN_ENCRYPT = 4 ] || [ $GET_WLAN_ENCRYPT = 6 ]; then
+			GET_WPA2_CIPHER_SUITE=`cat $CONFIG_DIR/wpa2_cipher`
+			if [ $GET_WPA2_CIPHER_SUITE = 1 ]; then
+				CIPHER=2
+			elif [ $GET_WPA2_CIPHER_SUITE = 2 ]; then
+				CIPHER=8
+			elif [ $GET_WPA2_CIPHER_SUITE = 3 ]; then
+				CIPHER=10
+			else
+				echo "invalid WPA2_CIPHER_SUITE value!($GET_WPA2_CIPHER_SUITE)" >> $LOG
+				exit $ERROR_INVALID_PARAMETERS;
+			fi
+		fi
+		$SET_WLAN set_mib wpa2_cipher=$CIPHER
+
+		GET_WPA_PSK=`cat $CONFIG_DIR/wpa_psk`
+		$SET_WLAN set_mib passphrase=$GET_WPA_PSK
+
+	fi
+
+fi # [ $IS_ROOT_WLAN = 1 ]
+
+
+
+$IFCONFIG $1 up
+if [ $? != 0 ]; then
+	exit $ERROR_NO_SUCH_DEVICE
+fi
+
+if [ $IS_ROOT_WLAN = 1 ]; then
+	$IFCONFIG $1-va0 up
+	if [ $? != 0 ]; then
+		exit $ERROR_NO_SUCH_DEVICE
+	fi
+
+	MSSID=`nv get m_ssid_enable`	
+
+	if [ $MSSID = 1 ]; then
+		$IFCONFIG $1-va1 up
+		if [ $? != 0 ]; then
+			exit $ERROR_NO_SUCH_DEVICE
+		fi
+	fi
+fi
+
+date +[%H:%M:%S]paraset_$1_end >> $LOG
+exit $ERROR_SUCCESS
\ No newline at end of file
diff --git a/ap/app/Script/wifi_script/realtek_wpa2/para_set1.sh b/ap/app/Script/wifi_script/realtek_wpa2/para_set1.sh
new file mode 100755
index 0000000..e70a0ad
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek_wpa2/para_set1.sh
@@ -0,0 +1,318 @@
+#!/bin/sh
+#
+# script file to start WLAN
+#
+
+
+## error code
+ERROR_SUCCESS=0
+ERROR_INVALID_PARAMETERS=1
+ERROR_NO_SUCH_DEVICE=2
+ERROR_NO_CONFIG_FILE=3
+ERROR_NO_SUCH_FILE=4
+ERROR_NO_SUCH_DIRECTORY=5
+ERROR_NULL_FILE=6
+ERROR_NET_IF_UP_FAIL=7
+
+ROOT=`nv get wifi_root_dir`
+LOG=$ROOT/wifi/realtek/slog
+
+IWPRIV=iwpriv
+wifi_lte_intr=`nv get wifi_lte_intr`
+
+if [ $# -lt 1 ]; then
+	echo "Usage: $0 wlan_interface" >> $LOG
+	exit $ERROR_INVALID_PARAMETERS;
+fi
+
+date +[%H:%M:%S]paraset_$1_start >> $LOG
+
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+CONFIG_DIR=$CONFIG_ROOT_DIR/$1
+
+if [ ! -d "$CONFIG_DIR" ]; then
+	echo "$CONFIG_DIR: No such directory" >> $LOG
+	exit $ERROR_NO_CONFIG_FILE
+fi
+
+if [ -z "$WLAN_PREFIX" ]; then
+	WLAN_PREFIX=wlan
+fi
+
+if [ -z "$ROOT_WLAN" ]; then
+#	ROOT_WLAN=${1:0:$WLAN_NAME_LEN}
+### delete -va0 get wlan0
+	ROOT_WLAN=${1%%-*}  
+fi
+ROOT_CONFIG_DIR=$CONFIG_ROOT_DIR/$ROOT_WLAN
+
+IS_ROOT_WLAN=0
+if [ "$1" = "$ROOT_WLAN" ]; then
+	IS_ROOT_WLAN=1
+fi
+echo "IS_ROOT_WLAN is " $IS_ROOT_WLAN
+SET_WLAN="iwpriv $1"
+SET_WLAN_PARAM="$SET_WLAN set_mib"
+IFCONFIG=ifconfig
+
+
+$IFCONFIG $1 down
+if [ $? != 0 ]; then
+	exit $ERROR_NO_SUCH_DEVICE
+fi
+
+
+echo "set RF parameters" >> $LOG
+# set RF parameters
+
+
+# set channel
+	GET_VALUE=`cat $CONFIG_DIR/channel`
+	$SET_WLAN set_mib channel=$GET_VALUE
+
+##autochannel can use wifi_lte_intr
+	if [ "$wifi_lte_intr" = "1" -a "$GET_VALUE" = "0" ];then
+		echo "wifi_lte_intr=$wifi_lte_intr  $SET_WLAN set_mib ch_low=5" >> $LOG	
+#		$SET_WLAN set_mib ch_low=5
+		$SET_WLAN set_mib disable_acs_ch=15
+	else
+		GET_VALUE=`cat $CONFIG_DIR/ch_low`
+		$SET_WLAN set_mib ch_low=$GET_VALUE
+	fi
+
+# set wifi coverage	
+	GET_TX_POWER_PERCENT=`cat $CONFIG_DIR/tx_power_percet`
+	#echo "GET_TX_POWER_PERCENT is "$GET_TX_POWER_PERCENT
+	$SET_WLAN set_mib powerpercent=$GET_TX_POWER_PERCENT
+	
+# for country code
+	COUNTRY_CODE_ENABLE=`$SET_WLAN get_mib countrycode 2> /dev/null`
+	if [ ! -z "$COUNTRY_CODE_ENABLE" ]; then
+		GET_VALUE=`cat $ROOT_CONFIG_DIR/countrycode_enable`
+		$SET_WLAN set_mib countrycode=$GET_VALUE
+
+		GET_VALUE=`cat $ROOT_CONFIG_DIR/countrycode`
+		$SET_WLAN set_mib countrystr=$GET_VALUE
+	fi
+	
+	
+#set band	  bgn
+	GET_BAND=`cat $ROOT_CONFIG_DIR/band`
+	GET_WIFI_SPECIFIC=`cat $ROOT_CONFIG_DIR/wifi_specific`
+	if [ "$GET_VALUE_WLAN_MODE" != '1' ] && [ "$GET_WIFI_SPECIFIC" = 1 ] &&  [ "$GET_BAND" = '2' ] ; then
+		GET_BAND=3
+	fi
+	if [ "$GET_BAND" = '8' ]; then
+		GET_BAND=11
+		$SET_WLAN set_mib deny_legacy=3
+	elif [ "$GET_BAND" = '2' ]; then
+		GET_BAND=3
+		$SET_WLAN set_mib deny_legacy=1
+	elif [ "$GET_BAND" = '10' ]; then
+		GET_BAND=11
+		$SET_WLAN set_mib deny_legacy=1
+	elif [ "$GET_BAND" = '64' ]; then
+		GET_BAND=76
+		$SET_WLAN set_mib deny_legacy=12
+	elif [ "$GET_BAND" = '72' ]; then
+		GET_BAND=76
+		$SET_WLAN set_mib deny_legacy=4
+	else
+		$SET_WLAN set_mib deny_legacy=0
+	fi
+	
+	$SET_WLAN set_mib band=$GET_BAND	
+
+
+###Set 11n parameter
+		if [ $GET_BAND = 10 ] || [ $GET_BAND = 11 ] || [ $GET_BAND = 76 ]; then
+			if [ $IS_ROOT_WLAN = 1 ]; then
+				GET_CHANNEL_BONDING=`cat $CONFIG_DIR/channel_bonding`
+				$SET_WLAN set_mib use40M=$GET_CHANNEL_BONDING
+
+				GET_CONTROL_SIDEBAND=`cat $CONFIG_DIR/control_sideband`
+
+				if [ "$GET_CHANNEL_BONDING" = 0 ]; then
+					$SET_WLAN set_mib 2ndchoffset=0
+				else
+					if [ "$GET_CONTROL_SIDEBAND" = 0 ]; then
+						 $SET_WLAN set_mib 2ndchoffset=1
+					fi
+					if [ "$GET_CONTROL_SIDEBAND" = 1 ]; then
+						 $SET_WLAN set_mib 2ndchoffset=2
+					fi
+				fi
+			fi # [ $IS_ROOT_WLAN = 1 ]
+
+		GET_COEXIST_ENABLED=`cat $CONFIG_DIR/coexist_enabled`
+		$SET_WLAN set_mib coexist=$GET_COEXIST_ENABLED
+		fi # [ $GET_BAND = 10 ] || [ $GET_BAND = 11 ]
+##########
+	
+
+## for wlan0 set ssid 
+echo "set basic ap parameters" >> $LOG
+	GET_VALUE=`cat $CONFIG_DIR/ssid`
+	$SET_WLAN set_mib ssid="$GET_VALUE"
+	
+	GET_VALUE=`cat $CONFIG_DIR/hidden_ssid`
+	$SET_WLAN set_mib hiddenAP=$GET_VALUE
+
+	GET_VALUE=`cat $CONFIG_DIR/supported_sta_num`
+	$SET_WLAN set_mib stanum=$GET_VALUE
+
+	# for ap isolation 
+	# need to confirm which is for ap isolation
+	#GET_VALUE=`cat $CONFIG_DIR/group_id`
+	#$SET_WLAN set_mib groupID=$GET_VALUE
+
+	# set block relay
+	GET_VALUE=`cat $CONFIG_DIR/block_relay`
+	$SET_WLAN set_mib block_relay=$GET_VALUE
+
+
+	GET_WLAN_AUTH_TYPE=`cat $CONFIG_DIR/auth_type`
+	AUTH_TYPE=$GET_WLAN_AUTH_TYPE
+	GET_WLAN_ENCRYPT=`cat $CONFIG_DIR/encrypt`
+	if [ "$GET_WLAN_AUTH_TYPE" = '1' ] && [ "$GET_WLAN_ENCRYPT" != '1' ]; then
+		# shared-key and not WEP enabled, force to open-system
+		AUTH_TYPE=0
+	fi
+	$SET_WLAN set_mib authtype=$AUTH_TYPE
+	if [ "$GET_WLAN_ENCRYPT" = '0' ]; then
+		$SET_WLAN set_mib encmode=0
+	elif [ "$GET_WLAN_ENCRYPT" = '1' ]; then
+		### WEP mode ##
+		GET_WEP=`cat $CONFIG_DIR/wep`
+		GET_WEP_KEY_TYPE=`cat $CONFIG_DIR/wep_key_type`
+		GET_WEP_KEY_ID=`cat $CONFIG_DIR/wep_default_key`
+		
+		if [ "$GET_WEP" = '1' ]; then
+			if [ "$GET_WEP_KEY_TYPE" = '0' ]; then
+				GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_64_asc`
+				GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_64_asc`
+				GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_64_asc`
+				GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_64_asc`
+			else
+				GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_64_hex`
+				GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_64_hex`
+				GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_64_hex`
+				GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_64_hex`
+			fi
+		
+			$SET_WLAN set_mib encmode=1
+			$SET_WLAN set_mib wepkey1=$GET_WEP_KEY_1
+			$SET_WLAN set_mib wepkey2=$GET_WEP_KEY_2
+			$SET_WLAN set_mib wepkey3=$GET_WEP_KEY_3
+			$SET_WLAN set_mib wepkey4=$GET_WEP_KEY_4
+			$SET_WLAN set_mib wepdkeyid=$GET_WEP_KEY_ID
+		else
+			if [ "$GET_WEP_KEY_TYPE" = '0' ]; then
+				GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_128_asc`
+				GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_128_asc`
+				GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_128_asc`
+				GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_128_asc`
+			else
+				GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_128_hex`
+				GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_128_hex`
+				GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_128_hex`
+				GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_128_hex`
+			fi
+			$SET_WLAN set_mib encmode=5
+			$SET_WLAN set_mib wepkey1=$GET_WEP_KEY_1
+			$SET_WLAN set_mib wepkey2=$GET_WEP_KEY_2
+			$SET_WLAN set_mib wepkey3=$GET_WEP_KEY_3
+			$SET_WLAN set_mib wepkey4=$GET_WEP_KEY_4
+			$SET_WLAN set_mib wepdkeyid=$GET_WEP_KEY_ID
+		fi
+	else
+			## WPA mode ##
+		$SET_WLAN set_mib encmode=2
+	fi
+
+
+	## Set 802.1x flag ##
+	_ENABLE_1X=0
+	if [ $GET_WLAN_ENCRYPT -lt 2 ]; then
+		GET_ENABLE_1X=`cat $CONFIG_DIR/enable_1x`
+		GET_MAC_AUTH_ENABLED=`cat $CONFIG_DIR/mac_auth_enabled`
+		if [ "$GET_ENABLE_1X" != 0 ] || [ "$GET_MAC_AUTH_ENABLED" != 0 ]; then
+			_ENABLE_1X=1
+		fi
+	else
+		_ENABLE_1X=1
+	fi
+	$SET_WLAN set_mib 802_1x=$_ENABLE_1X
+	
+
+	echo "wpa relative settings"  >> $LOG
+#
+# following settings is used when driver WPA module is included
+#
+
+	GET_WPA_AUTH=`cat $CONFIG_DIR/wpa_auth`
+	#if [ $GET_VALUE_WLAN_MODE != 1 ] && [ $GET_WLAN_ENCRYPT -ge 2 ]  && [ $GET_WLAN_ENCRYPT -lt 7 ] && [ $GET_WPA_AUTH = 2 ]; then
+	if [ $GET_WLAN_ENCRYPT -ge 2 ]  && [ $GET_WLAN_ENCRYPT -lt 7 ]; then
+		if [ $GET_WPA_AUTH = 2 ]; then
+			if [ $GET_WLAN_ENCRYPT = 2 ]; then
+				ENABLE=1
+			elif [ $GET_WLAN_ENCRYPT = 4 ]; then
+				ENABLE=2
+			elif [ $GET_WLAN_ENCRYPT = 6 ]; then
+				ENABLE=3
+			else
+				echo "invalid ENCRYPT value!($GET_WLAN_ENCRYPT)" >> $LOG
+				exit $ERROR_INVALID_PARAMETERS;
+			fi
+			$SET_WLAN set_mib psk_enable=$ENABLE
+		else
+			$SET_WLAN set_mib psk_enable=0
+		fi
+
+		if [ $GET_WLAN_ENCRYPT = 2 ] || [ $GET_WLAN_ENCRYPT = 6 ]; then
+			GET_WPA_CIPHER_SUITE=`cat $CONFIG_DIR/wpa_cipher`
+			if [ $GET_WPA_CIPHER_SUITE = 1 ]; then
+				CIPHER=2
+			elif [ $GET_WPA_CIPHER_SUITE = 2 ]; then
+				CIPHER=8
+			elif [ $GET_WPA_CIPHER_SUITE = 3 ]; then
+				CIPHER=10
+			else
+				echo "invalid WPA_CIPHER_SUITE value!($GET_WPA_CIPHER_SUITE)" >> $LOG
+				exit $ERROR_INVALID_PARAMETERS;
+			fi
+		fi
+		$SET_WLAN set_mib wpa_cipher=$CIPHER
+
+		if [ $GET_WLAN_ENCRYPT = 4 ] || [ $GET_WLAN_ENCRYPT = 6 ]; then
+			GET_WPA2_CIPHER_SUITE=`cat $CONFIG_DIR/wpa2_cipher`
+			if [ $GET_WPA2_CIPHER_SUITE = 1 ]; then
+				CIPHER=2
+			elif [ $GET_WPA2_CIPHER_SUITE = 2 ]; then
+				CIPHER=8
+			elif [ $GET_WPA2_CIPHER_SUITE = 3 ]; then
+				CIPHER=10
+			else
+				echo "invalid WPA2_CIPHER_SUITE value!($GET_WPA2_CIPHER_SUITE)" >> $LOG
+				exit $ERROR_INVALID_PARAMETERS;
+			fi
+		fi
+		$SET_WLAN set_mib wpa2_cipher=$CIPHER
+
+		GET_WPA_PSK=`cat $CONFIG_DIR/wpa_psk`
+		$SET_WLAN set_mib passphrase=$GET_WPA_PSK
+
+	fi
+
+
+
+
+$IFCONFIG $1 up
+if [ $? != 0 ]; then
+	exit $ERROR_NO_SUCH_DEVICE
+fi
+
+
+
+
+exit $ERROR_SUCCESS
\ No newline at end of file
diff --git a/ap/app/Script/wifi_script/realtek_wpa2/trigger_wps.sh b/ap/app/Script/wifi_script/realtek_wpa2/trigger_wps.sh
new file mode 100755
index 0000000..d42f57c
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek_wpa2/trigger_wps.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+#
+# script file to start network
+#
+# Usage: trigger_wps.sh 
+#
+
+##if [ $# -lt 2 ]; then echo "Usage: $0 {gw | ap} {all | bridge | wan}"; exit 1 ; fi
+
+ROOT=`nv get wifi_root_dir`
+
+LOG=$ROOT/wifi/realtek/slog
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0
+
+ID=`nv get wifi_wps_index`
+echo "enter trigger_wps.sh wifi_wps_index=$ID >>>>>>>>" >> $LOG
+ID=`expr $ID - 1`
+echo "enter trigger_wps.sh ID=$ID >>>>>>>>" >> $LOG
+
+if [ "$ID" = "0" ];then
+#CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0
+#WLAN_INTERFACE="wlan0"
+CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0-va$ID
+WLAN_INTERFACE="wlan0-va$ID"
+else
+CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0-va$ID
+WLAN_INTERFACE="wlan0-va$ID"
+fi
+
+
+WPS_MODE=`cat $CONFIG_DIR/wsc_method`
+if [ "$WPS_MODE" = "2" ]; then
+	echo "wscd -sig_pbc $WLAN_INTERFACE" >> $LOG
+	wscd -sig_pbc $WLAN_INTERFACE
+else
+	PIN=`cat $CONFIG_DIR/wsc_pin`
+	echo "iwpriv $WLAN_INTERFACE set_mib pin=$PIN" >> $LOG
+	iwpriv $WLAN_INTERFACE set_mib pin=$PIN
+fi
+
diff --git a/ap/app/Script/wifi_script/realtek_wpa2/trigger_wps1.sh b/ap/app/Script/wifi_script/realtek_wpa2/trigger_wps1.sh
new file mode 100755
index 0000000..c020f1a
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek_wpa2/trigger_wps1.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+#
+# script file to start network
+#
+# Usage: trigger_wps.sh 
+#
+
+##if [ $# -lt 2 ]; then echo "Usage: $0 {gw | ap} {all | bridge | wan}"; exit 1 ; fi
+ROOT=`nv get wifi_root_dir`
+
+LOG=$ROOT/wifi/realtek/slog
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0
+
+ID=`nv get wifi_wps_index`
+echo "enter trigger_wps1.sh wifi_wps_index=$ID >>>>>>>>" >> $LOG
+
+CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0
+WLAN_INTERFACE="wlan0"
+
+
+WPS_MODE=`cat $CONFIG_DIR/wsc_method`
+
+echo "enter trigger_wps1.sh WPS_MODE=$WPS_MODE >>>>>>>>" >> $LOG
+
+if [ "$WPS_MODE" = "2" ]; then
+	echo "wscd -sig_pbc $WLAN_INTERFACE" >> $LOG
+	wscd -sig_pbc $WLAN_INTERFACE
+else
+	PIN=`cat $CONFIG_DIR/wsc_pin`
+	echo "iwpriv $WLAN_INTERFACE set_mib pin=$PIN" >> $LOG
+	iwpriv $WLAN_INTERFACE set_mib pin=$PIN
+fi
+
diff --git a/ap/app/Script/wifi_script/realtek_wpa2/wlan_8192c.sh b/ap/app/Script/wifi_script/realtek_wpa2/wlan_8192c.sh
new file mode 100755
index 0000000..0c669b8
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek_wpa2/wlan_8192c.sh
@@ -0,0 +1,595 @@
+#!/bin/sh
+#
+# script file to start WLAN
+#
+
+
+## error code
+ERROR_SUCCESS=0
+ERROR_INVALID_PARAMETERS=1
+ERROR_NO_SUCH_DEVICE=2
+ERROR_NO_CONFIG_FILE=3
+ERROR_NO_SUCH_FILE=4
+ERROR_NO_SUCH_DIRECTORY=5
+ERROR_NULL_FILE=6
+ERROR_NET_IF_UP_FAIL=7
+
+IWPRIV=iwpriv
+wifi_lte_intr=`nv get wifi_lte_intr`
+
+if [ $# -lt 1 ]; then
+	echo "Usage: $0 wlan_interface" >> $LOG
+	exit $ERROR_INVALID_PARAMETERS;
+fi
+
+ROOT=`nv get wifi_root_dir`
+LOG=$ROOT/wifi/realtek/slog
+
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+CONFIG_DIR=$CONFIG_ROOT_DIR/$1
+echo "$1 config para" >> $LOG
+if [ ! -d "$CONFIG_DIR" ]; then
+	echo "$CONFIG_DIR: No such directory" >> $LOG
+	exit $ERROR_NO_CONFIG_FILE
+fi
+
+if [ -z "$SCRIPT_DIR" ]; then
+	SCRIPT_DIR=`cat $CONFIG_ROOT_DIR/wifi_script_dir`
+fi
+#echo $SCRIPT_DIR
+#START_WLAN_APP=$SCRIPT_DIR/wlanapp_8192c.sh
+
+if [ -z "$WLAN_PREFIX" ]; then
+	WLAN_PREFIX=wlan
+fi
+#WLAN_PREFIX_LEN=${#WLAN_PREFIX}
+#WLAN_NAME_LEN=$((WLAN_PREFIX_LEN + 1))
+
+if [ -z "$ROOT_WLAN" ]; then
+#	ROOT_WLAN=${1:0:$WLAN_NAME_LEN}
+### delete -va0 get wlan0
+	ROOT_WLAN=${1%%-*}  
+fi
+ROOT_CONFIG_DIR=$CONFIG_ROOT_DIR/$ROOT_WLAN
+
+IS_ROOT_WLAN=0
+if [ "$1" = "$ROOT_WLAN" ]; then
+	IS_ROOT_WLAN=1
+fi
+echo "IS_ROOT_WLAN is " $IS_ROOT_WLAN
+SET_WLAN="iwpriv $1"
+SET_WLAN_PARAM="$SET_WLAN set_mib"
+IFCONFIG=ifconfig
+
+## Disable WLAN MAC driver and shutdown interface first ##
+$IFCONFIG $1 down
+if [ $? != 0 ]; then
+	exit $ERROR_NO_SUCH_DEVICE
+fi
+
+GET_VALUE=
+GET_VALUE_TMP=
+GET_VALUE_WLAN_DISABLED=`cat $CONFIG_DIR/wlan_disabled`
+GET_VALUE_WLAN_MODE=`cat $CONFIG_DIR/wlan_mode`
+
+echo "$CONFIG_DIR/wlan_disabled =$GET_VALUE_WLAN_DISABLED " >> $LOG
+echo "$CONFIG_DIR/wlan_mode =$GET_VALUE_WLAN_MODE " >> $LOG
+
+
+##$SET_WLAN set_mib vap_enable=0
+$SET_WLAN set_mib wsc_enable=0
+
+## kill wlan application daemon ##
+
+##$START_WLAN_APP kill $1
+
+## Set parameters to driver ##
+
+GET_VALUE=`cat $ROOT_CONFIG_DIR/reg_domain`
+$SET_WLAN set_mib regdomain=$GET_VALUE
+
+NUM=0
+case $1 in
+$ROOT_WLAN-va*)
+	NUM=${1#$ROOT_WLAN-va}
+	#NUM=$((NUM + 1))
+	NUM=`expr $NUM + 1`	
+	;;
+esac
+
+
+## first start up, must be single ap, wlan0 used 12345678ffbb , then to apsta, or mssid
+## ap to apsta: wlan0 need reset mac
+## ap to mssid: wlan0 no need reset mac
+## apsta to mssid: wlan0 need reset mac
+## apsta to ap: wlan0 need reset mac
+## mssid to apsta: wlan0 need reset mac
+## mssid to ap: wlan0 no need reset mac
+##
+
+## if mssid wlan0 use fixded mac, if vxd up, wlan0 use wlan0_addr
+
+if [ "1" = "2" ];then
+
+	MSSID=`nv get m_ssid_enable`
+	APSTA=`nv get wifi_sta_connection`
+
+	if [ "$1" = "wlan0" ];then
+		if [ "$APSTA" = "0" -a "$MSSID" = "0" ];then
+	### single ap	
+			GET_VALUE=12345678ffbb
+	### multissid		
+		elif ["$MSSID" = "1" ];then
+			GET_VALUE=12345678ffbb
+	### apsta		
+		elif [ "$APSTA" = "1" ];then
+			GET_VALUE=`cat $ROOT_CONFIG_DIR/wlan${NUM}_addr`
+		fi
+		$IFCONFIG $1 hw ether $GET_VALUE
+	else
+		GET_VALUE=`cat $ROOT_CONFIG_DIR/wlan${NUM}_addr`
+		$IFCONFIG $1 hw ether $GET_VALUE
+	fi
+	echo "$IFCONFIG $1 hw ether $GET_VALUE NOT GO here><><>" >> $LOG
+
+else
+
+	if [ "$1" = "wlan0" ];then
+##wlan0 use fixed addr	
+		GET_VALUE=12345678ffbb
+		
+		iwpriv $1 set_mib hwaddr=$GET_VALUE
+		#$IFCONFIG $1 hw ether $GET_VALUE
+	else
+	
+		if [ "$1" = "wlan0-vxd" ];then
+			echo "$IWPRIV $1 copy_mib" >> $LOG
+			$IWPRIV $1 copy_mib
+		fi
+	
+		GET_VALUE=`cat $ROOT_CONFIG_DIR/wlan${NUM}_addr`
+		#$IFCONFIG $1 hw ether $GET_VALUE
+		iwpriv $1 set_mib hwaddr=$GET_VALUE
+	fi
+fi
+echo "iwpriv $1 set_mib hwaddr=$GET_VALUE" >> $LOG
+
+if [ "$GET_VALUE_WLAN_MODE" = '1' ]; then
+	## client mode 0: infrastructure  1:Ad-hoc
+	
+#	hwaddr=`cat /proc/wlan0-vxd/mib_all | grep hwaddr`
+	
+#	echo wlan0-vxd hwaddr=$hwaddr >> $LOG
+	
+	GET_VALUE=`cat $CONFIG_DIR/network_type`
+	if  [ "$GET_VALUE" = '0' ]; then
+		$SET_WLAN set_mib opmode=8
+	else
+		$SET_WLAN set_mib opmode=32
+		GET_VALUE_TMP=`cat $CONFIG_DIR/default_ssid`
+		$SET_WLAN set_mib defssid="$GET_VALUE_TMP"
+	fi
+	echo "wlan0-vxd do not set para, exit directly" >> $LOG
+	exit $ERROR_SUCCESS
+else
+	## AP mode
+	$SET_WLAN set_mib opmode=16
+fi
+##$IFCONFIG $1 hw ether $WLAN_MAC_ADDR
+
+##if [ "$GET_VALUE_WLAN_MODE" = '2' ]; then
+##		$SET_WLAN set_mib wds_pure=1
+##else
+##		$SET_WLAN set_mib wds_pure=0
+##fi
+
+echo "set RF parameters" >> $LOG
+# set RF parameters
+if [ $IS_ROOT_WLAN = 1 ]; then
+	GET_VALUE=`cat $CONFIG_DIR/channel`
+	$SET_WLAN set_mib channel=$GET_VALUE
+##autochannel can use wifi_lte_intr
+	if [ "$wifi_lte_intr" = "1" -a "$GET_VALUE" = "0" ];then
+		echo "wifi_lte_intr=$wifi_lte_intr  $SET_WLAN set_mib ch_low=5" >> $LOG	
+#		$SET_WLAN set_mib ch_low=5
+		$SET_WLAN set_mib disable_acs_ch=15
+	else
+		GET_VALUE=`cat $CONFIG_DIR/ch_low`
+		$SET_WLAN set_mib ch_low=$GET_VALUE
+	fi
+	
+	GET_VALUE=`cat $CONFIG_DIR/ch_hi`
+	$SET_WLAN set_mib ch_hi=$GET_VALUE
+	
+	GET_VALUE=`cat $CONFIG_DIR/led_type`
+	$SET_WLAN set_mib led_type=$GET_VALUE
+	
+	GET_VALUE=`cat $CONFIG_DIR/MIMO_TR_mode`
+	$SET_WLAN set_mib MIMO_TR_mode=$GET_VALUE
+	
+	#GET_TX_POWER_CCK_A=`cat $CONFIG_DIR/tx_power_cck_a`
+	#GET_TX_POWER_CCK_B=`cat $CONFIG_DIR/tx_power_cck_b`
+	#GET_TX_POWER_HT40_1S_A=`cat $CONFIG_DIR/tx_power_ht40_1s_a`
+	#GET_TX_POWER_HT40_1S_B=`cat $CONFIG_DIR/tx_power_ht40_1s_b`
+
+	#GET_TX_POWER_DIFF_HT40_2S=`cat $CONFIG_DIR/tx_power_diff_ht40_2s`
+	#GET_TX_POWER_DIFF_HT20=`cat $CONFIG_DIR/tx_power_diff_ht20`
+	#GET_TX_POWER_DIFF_OFDM=`cat $CONFIG_DIR/tx_power_diff_ofdm`
+
+	#$SET_WLAN set_mib pwrlevelCCK_A=$GET_TX_POWER_CCK_A
+	#$SET_WLAN set_mib pwrlevelCCK_B=$GET_TX_POWER_CCK_B
+	#$SET_WLAN set_mib pwrlevelHT40_1S_A=$GET_TX_POWER_HT40_1S_A
+	#$SET_WLAN set_mib pwrlevelHT40_1S_B=$GET_TX_POWER_HT40_1S_B
+	#$SET_WLAN set_mib pwrdiffHT40_2S=$GET_TX_POWER_DIFF_HT40_2S
+	#$SET_WLAN set_mib pwrdiffHT20=$GET_TX_POWER_DIFF_HT20
+	#$SET_WLAN set_mib pwrdiffOFDM=$GET_TX_POWER_DIFF_OFDM
+	
+	GET_TX_POWER_PERCENT=`cat $CONFIG_DIR/tx_power_percet`
+	#echo "GET_TX_POWER_PERCENT is "$GET_TX_POWER_PERCENT
+	$SET_WLAN set_mib powerpercent=$GET_TX_POWER_PERCENT
+	
+	GET_11N_TSSI1=`cat $CONFIG_DIR/tssi_1`
+	$SET_WLAN set_mib tssi1=$GET_11N_TSSI1
+	GET_11N_TSSI2=`cat $CONFIG_DIR/tssi_2`
+	$SET_WLAN set_mib tssi2=$GET_11N_TSSI2
+	
+	#GET_VALUE=`cat $CONFIG_DIR/11n_ther`
+	#$SET_WLAN set_mib ther=$GET_VALUE
+	
+	GET_VALUE=`cat $CONFIG_DIR/trswitch`
+	$SET_WLAN set_mib trswitch=$GET_VALUE
+
+	#GET_VALUE=`cat $CONFIG_DIR/11n_xcap`
+	#$SET_WLAN set_mib xcap=$GET_VALUE
+	
+	#GET_VALUE=`cat $CONFIG_DIR/rfe_type`
+	#$SET_WLAN set_mib rfe_type=$GET_VALUE
+	
+	#exit $ERROR_SUCCESS
+	
+#	iwpriv wlan0 efuse_set SD=3
+#	iwpriv wlan0 efuse_sync
+	iwpriv wlan0 set_mib func_off=1
+
+fi # [ $IS_ROOT_WLAN = 1 ]
+	
+GET_VALUE=`cat $CONFIG_DIR/basic_rates`
+$SET_WLAN set_mib basicrates=$GET_VALUE
+
+GET_VALUE=`cat $CONFIG_DIR/supported_rate`
+$SET_WLAN set_mib oprates=$GET_VALUE
+	
+GET_RATE_ADAPTIVE_VALUE=`cat $CONFIG_DIR/rate_adaptive_enabled`
+if [ "$GET_RATE_ADAPTIVE_VALUE" = '0' ]; then
+	$SET_WLAN set_mib autorate=0
+	GET_FIX_RATE_VALUE=`cat $CONFIG_DIR/fix_rate`
+	$SET_WLAN set_mib fixrate=$GET_FIX_RATE_VALUE
+else
+	$SET_WLAN set_mib autorate=1
+fi
+
+GET_VALUE=`cat $CONFIG_DIR/rts_threshold`
+$SET_WLAN set_mib rtsthres=$GET_VALUE
+
+GET_VALUE=`cat $CONFIG_DIR/frag_threshold`
+$SET_WLAN set_mib fragthres=$GET_VALUE
+	
+GET_VALUE=`cat $CONFIG_DIR/inactivity_time`
+$SET_WLAN set_mib expired_time=$GET_VALUE
+GET_VALUE=`cat $ROOT_CONFIG_DIR/beacon_interval`
+$SET_WLAN set_mib bcnint=$GET_VALUE
+
+GET_VALUE=`cat $ROOT_CONFIG_DIR/dtim_period`
+$SET_WLAN set_mib dtimperiod=$GET_VALUE
+
+GET_VALUE=`cat $CONFIG_DIR/preamble_type`
+$SET_WLAN set_mib preamble=$GET_VALUE
+GET_VALUE=`cat $CONFIG_DIR/hidden_ssid`
+$SET_WLAN set_mib hiddenAP=$GET_VALUE
+
+GET_VALUE=`cat $CONFIG_DIR/supported_sta_num`
+$SET_WLAN set_mib stanum=$GET_VALUE
+
+GET_VALUE=`cat $CONFIG_DIR/ssid`
+$SET_WLAN set_mib ssid="$GET_VALUE"
+
+GET_VALUE=`cat $CONFIG_DIR/macac_enabled`
+$SET_WLAN set_mib aclmode=$GET_VALUE
+$SET_WLAN set_mib aclnum=0
+#ACL_NUM=`cat $CONFIG_DIR/macac_num`
+#_counter=1
+#while [ $_counter -le $ACL_NUM ]; do
+#	GET_VALUE=`cat $CONFIG_DIR/macac_addr$_counter`
+	#$SET_WLAN set_mib acladdr=$GET_VALUE
+#	echo "----add_acl_table is "$GET_VALUE
+	#$SET_WLAN add_acl_table $GET_VALUE
+#	_counter=$((_counter + 1))
+#done
+
+GET_WLAN_AUTH_TYPE=`cat $CONFIG_DIR/auth_type`
+AUTH_TYPE=$GET_WLAN_AUTH_TYPE
+GET_WLAN_ENCRYPT=`cat $CONFIG_DIR/encrypt`
+if [ "$GET_WLAN_AUTH_TYPE" = '1' ] && [ "$GET_WLAN_ENCRYPT" != '1' ]; then
+	# shared-key and not WEP enabled, force to open-system
+	AUTH_TYPE=0
+fi
+$SET_WLAN set_mib authtype=$AUTH_TYPE
+if [ "$GET_WLAN_ENCRYPT" = '0' ]; then
+	$SET_WLAN set_mib encmode=0
+elif [ "$GET_WLAN_ENCRYPT" = '1' ]; then
+	### WEP mode ##
+	GET_WEP=`cat $CONFIG_DIR/wep`
+	GET_WEP_KEY_TYPE=`cat $CONFIG_DIR/wep_key_type`
+	GET_WEP_KEY_ID=`cat $CONFIG_DIR/wep_default_key`
+	
+	if [ "$GET_WEP" = '1' ]; then
+		if [ "$GET_WEP_KEY_TYPE" = '0' ]; then
+			GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_64_asc`
+			GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_64_asc`
+			GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_64_asc`
+			GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_64_asc`
+		else
+			GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_64_hex`
+			GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_64_hex`
+			GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_64_hex`
+			GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_64_hex`
+		fi
+	
+		$SET_WLAN set_mib encmode=1
+		$SET_WLAN set_mib wepkey1=$GET_WEP_KEY_1
+		$SET_WLAN set_mib wepkey2=$GET_WEP_KEY_2
+		$SET_WLAN set_mib wepkey3=$GET_WEP_KEY_3
+		$SET_WLAN set_mib wepkey4=$GET_WEP_KEY_4
+		$SET_WLAN set_mib wepdkeyid=$GET_WEP_KEY_ID
+	else
+		if [ "$GET_WEP_KEY_TYPE" = '0' ]; then
+			GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_128_asc`
+			GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_128_asc`
+			GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_128_asc`
+			GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_128_asc`
+		else
+			GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_128_hex`
+			GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_128_hex`
+			GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_128_hex`
+			GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_128_hex`
+		fi
+		$SET_WLAN set_mib encmode=5
+		$SET_WLAN set_mib wepkey1=$GET_WEP_KEY_1
+		$SET_WLAN set_mib wepkey2=$GET_WEP_KEY_2
+		$SET_WLAN set_mib wepkey3=$GET_WEP_KEY_3
+		$SET_WLAN set_mib wepkey4=$GET_WEP_KEY_4
+		$SET_WLAN set_mib wepdkeyid=$GET_WEP_KEY_ID
+	fi
+else
+        ## WPA mode ##
+	$SET_WLAN set_mib encmode=2
+fi
+##$SET_WLAN set_mib wds_enable=0
+##$SET_WLAN set_mib wds_encrypt=0
+## Set 802.1x flag ##
+_ENABLE_1X=0
+if [ $GET_WLAN_ENCRYPT -lt 2 ]; then
+	GET_ENABLE_1X=`cat $CONFIG_DIR/enable_1x`
+	GET_MAC_AUTH_ENABLED=`cat $CONFIG_DIR/mac_auth_enabled`
+	if [ "$GET_ENABLE_1X" != 0 ] || [ "$GET_MAC_AUTH_ENABLED" != 0 ]; then
+		_ENABLE_1X=1
+	fi
+else
+	_ENABLE_1X=1
+fi
+$SET_WLAN set_mib 802_1x=$_ENABLE_1X
+	#set band
+GET_BAND=`cat $ROOT_CONFIG_DIR/band`
+GET_WIFI_SPECIFIC=`cat $ROOT_CONFIG_DIR/wifi_specific`
+if [ "$GET_VALUE_WLAN_MODE" != '1' ] && [ "$GET_WIFI_SPECIFIC" = 1 ] &&  [ "$GET_BAND" = '2' ] ; then
+	GET_BAND=3
+fi
+if [ "$GET_BAND" = '8' ]; then
+	GET_BAND=11
+	$SET_WLAN set_mib deny_legacy=3
+elif [ "$GET_BAND" = '2' ]; then
+	GET_BAND=3
+	$SET_WLAN set_mib deny_legacy=1
+elif [ "$GET_BAND" = '10' ]; then
+	GET_BAND=11
+	$SET_WLAN set_mib deny_legacy=1
+elif [ "$GET_BAND" = '64' ]; then
+	GET_BAND=76
+	$SET_WLAN set_mib deny_legacy=12
+elif [ "$GET_BAND" = '72' ]; then
+	GET_BAND=76
+	$SET_WLAN set_mib deny_legacy=4
+else
+	$SET_WLAN set_mib deny_legacy=0
+fi
+$SET_WLAN set_mib band=$GET_BAND
+
+
+echo "Set 11n parameter"  >> $LOG
+###Set 11n parameter
+	if [ $GET_BAND = 10 ] || [ $GET_BAND = 11 ] || [ $GET_BAND = 76 ]; then
+	if [ $IS_ROOT_WLAN = 1 ]; then
+		GET_CHANNEL_BONDING=`cat $CONFIG_DIR/channel_bonding`
+		$SET_WLAN set_mib use40M=$GET_CHANNEL_BONDING
+
+		GET_CONTROL_SIDEBAND=`cat $CONFIG_DIR/control_sideband`
+
+		if [ "$GET_CHANNEL_BONDING" = 0 ]; then
+			$SET_WLAN set_mib 2ndchoffset=0
+		else
+			if [ "$GET_CONTROL_SIDEBAND" = 0 ]; then
+				 $SET_WLAN set_mib 2ndchoffset=1
+			fi
+			if [ "$GET_CONTROL_SIDEBAND" = 1 ]; then
+				 $SET_WLAN set_mib 2ndchoffset=2
+			fi
+		fi
+	fi # [ $IS_ROOT_WLAN = 1 ]
+
+	GET_SHORT_GI=`cat $CONFIG_DIR/short_gi`
+	$SET_WLAN set_mib shortGI20M=$GET_SHORT_GI
+	$SET_WLAN set_mib shortGI40M=$GET_SHORT_GI
+
+	GET_AGGREGATION=`cat $CONFIG_DIR/aggregation`
+
+	if [ "$GET_AGGREGATION" = 0 ]; then
+		$SET_WLAN set_mib ampdu=$GET_AGGREGATION
+		$SET_WLAN set_mib amsdu=$GET_AGGREGATION
+	elif [ "$GET_AGGREGATION" = 1 ]; then
+		$SET_WLAN set_mib ampdu=1
+		$SET_WLAN set_mib amsdu=0
+	elif [ "$GET_AGGREGATION" = 2 ]; then
+		$SET_WLAN set_mib ampdu=0
+		$SET_WLAN set_mib amsdu=1
+	elif [ "$GET_AGGREGATION" = 3 ]; then
+		$SET_WLAN set_mib ampdu=1
+		$SET_WLAN set_mib amsdu=1
+	fi
+
+	GET_STBC_ENABLED=`cat $CONFIG_DIR/stbc_enabled`
+	$SET_WLAN set_mib stbc=$GET_STBC_ENABLED
+	GET_COEXIST_ENABLED=`cat $CONFIG_DIR/coexist_enabled`
+	$SET_WLAN set_mib coexist=$GET_COEXIST_ENABLED
+	fi # [ $GET_BAND = 10 ] || [ $GET_BAND = 11 ]
+##########
+
+#set nat2.5 disable when client and mac clone is set
+GET_MACCLONE_ENABLED=`cat $CONFIG_DIR/macclone_enable`
+if [ "$GET_MACCLONE_ENABLED" = '1' -a "$GET_VALUE_WLAN_MODE" = '1' ]; then
+	$SET_WLAN set_mib nat25_disable=1
+	$SET_WLAN set_mib macclone_enable=1
+else
+	$SET_WLAN set_mib nat25_disable=0
+	$SET_WLAN set_mib macclone_enable=0
+fi
+
+# set 11g protection mode
+GET_PROTECTION_DISABLED=`cat $CONFIG_DIR/protection_disabled`
+if  [ "$GET_PROTECTION_DISABLED" = '1' ] ;then
+	$SET_WLAN set_mib disable_protection=1
+else
+	$SET_WLAN set_mib disable_protection=0
+fi
+
+# for ap isolation
+GET_VALUE=`cat $CONFIG_DIR/group_id`
+$SET_WLAN set_mib groupID=$GET_VALUE
+
+# set block relay
+GET_VALUE=`cat $CONFIG_DIR/block_relay`
+$SET_WLAN set_mib block_relay=$GET_VALUE
+	
+	
+# set WiFi specific mode
+GET_VALUE=`cat $ROOT_CONFIG_DIR/wifi_specific`
+$SET_WLAN set_mib wifi_specific=$GET_VALUE
+
+# for WMM
+GET_VALUE=`cat $CONFIG_DIR/wmm_enabled`
+$SET_WLAN set_mib qos_enable=$GET_VALUE
+
+# for guest access
+GET_VALUE=`cat $CONFIG_DIR/guest_access`
+$SET_WLAN set_mib guest_access=$GET_VALUE
+
+
+
+# for country code
+COUNTRY_CODE_ENABLE=`$SET_WLAN get_mib countrycode 2> /dev/null`
+if [ ! -z "$COUNTRY_CODE_ENABLE" ]; then
+	GET_VALUE=`cat $ROOT_CONFIG_DIR/countrycode_enable`
+	$SET_WLAN set_mib countrycode=$GET_VALUE
+
+	GET_VALUE=`cat $ROOT_CONFIG_DIR/countrycode`
+	$SET_WLAN set_mib countrystr=$GET_VALUE
+fi
+
+echo "wpa relative settings"  >> $LOG
+#
+# following settings is used when driver WPA module is included
+#
+
+GET_WPA_AUTH=`cat $CONFIG_DIR/wpa_auth`
+#if [ $GET_VALUE_WLAN_MODE != 1 ] && [ $GET_WLAN_ENCRYPT -ge 2 ]  && [ $GET_WLAN_ENCRYPT -lt 7 ] && [ $GET_WPA_AUTH = 2 ]; then
+if [ $GET_WLAN_ENCRYPT -ge 2 ]  && [ $GET_WLAN_ENCRYPT -lt 7 ]; then
+	if [ $GET_WPA_AUTH = 2 ]; then
+		if [ $GET_WLAN_ENCRYPT = 2 ]; then
+			ENABLE=1
+		elif [ $GET_WLAN_ENCRYPT = 4 ]; then
+			ENABLE=2
+		elif [ $GET_WLAN_ENCRYPT = 6 ]; then
+			ENABLE=3
+		else
+			echo "invalid ENCRYPT value!($GET_WLAN_ENCRYPT)" >> $LOG
+			exit $ERROR_INVALID_PARAMETERS;
+		fi
+		$SET_WLAN set_mib psk_enable=$ENABLE
+	else
+		$SET_WLAN set_mib psk_enable=0
+	fi
+
+	if [ $GET_WLAN_ENCRYPT = 2 ] || [ $GET_WLAN_ENCRYPT = 6 ]; then
+		GET_WPA_CIPHER_SUITE=`cat $CONFIG_DIR/wpa_cipher`
+		if [ $GET_WPA_CIPHER_SUITE = 1 ]; then
+			CIPHER=2
+		elif [ $GET_WPA_CIPHER_SUITE = 2 ]; then
+			CIPHER=8
+		elif [ $GET_WPA_CIPHER_SUITE = 3 ]; then
+			CIPHER=10
+		else
+			echo "invalid WPA_CIPHER_SUITE value!($GET_WPA_CIPHER_SUITE)" >> $LOG
+			exit $ERROR_INVALID_PARAMETERS;
+		fi
+	fi
+	$SET_WLAN set_mib wpa_cipher=$CIPHER
+
+	if [ $GET_WLAN_ENCRYPT = 4 ] || [ $GET_WLAN_ENCRYPT = 6 ]; then
+		GET_WPA2_CIPHER_SUITE=`cat $CONFIG_DIR/wpa2_cipher`
+		if [ $GET_WPA2_CIPHER_SUITE = 1 ]; then
+			CIPHER=2
+		elif [ $GET_WPA2_CIPHER_SUITE = 2 ]; then
+			CIPHER=8
+		elif [ $GET_WPA2_CIPHER_SUITE = 3 ]; then
+			CIPHER=10
+		else
+			echo "invalid WPA2_CIPHER_SUITE value!($GET_WPA2_CIPHER_SUITE)" >> $LOG
+			exit $ERROR_INVALID_PARAMETERS;
+		fi
+	fi
+	$SET_WLAN set_mib wpa2_cipher=$CIPHER
+
+	GET_WPA_PSK=`cat $CONFIG_DIR/wpa_psk`
+	$SET_WLAN set_mib passphrase=$GET_WPA_PSK
+
+	
+	GET_WPA_GROUP_REKEY_TIME=`cat $CONFIG_DIR/gk_rekey`
+	$SET_WLAN set_mib gk_rekey=$GET_WPA_GROUP_REKEY_TIME
+fi
+# Set 11w parameter #
+#if [ $GET_WLAN_ENCRYPT = 4 ] || [ $GET_WLAN_ENCRYPT = 6 ]; then
+#	GET_WPA2_11W=`cat $CONFIG_DIR/wpa11w`
+#	GET_WPA2_SHA256=`cat $CONFIG_DIR/wpa2EnableSHA256`
+#	if [ $GET_WPA2_11W = 0 ]; then
+#		GET_WPA2_SHA256=0
+#	elif [ $GET_WPA2_11W = 1 ]; then
+#		if [ "$GET_WPA2_SHA256" != '0' ] && [ "$GET_WPA2_SHA256" != '1' ]; then
+#			GET_WPA2_SHA256=0
+#		fi
+#	elif [ $GET_WPA2_11W = 2 ]; then
+#		GET_WPA2_SHA256=1
+#	else
+#		echo "invalid GET_WPA2_11W value!($GET_WPA2_11W)";
+#		exit $ERROR_INVALID_PARAMETERS;
+#	fi
+#else
+#	GET_WPA2_11W=0
+#	GET_WPA2_SHA256=0
+#fi
+#IEEE80211W_ENABLE=`$SET_WLAN get_mib dot11IEEE80211W 2> /dev/null`
+#if [ ! -z "$IEEE80211W_ENABLE" ]; then
+#	GET_WPA2_11W=`cat $CONFIG_DIR/wpa11w`
+#	GET_WPA2_SHA256=`cat $CONFIG_DIR/wpa2EnableSHA256`
+#	$SET_WLAN set_mib dot11IEEE80211W=$GET_WPA2_11W
+#	$SET_WLAN set_mib enableSHA256=$GET_WPA2_SHA256
+#fi
+##########
diff --git a/ap/app/Script/wifi_script/realtek_wpa2/wlan_8192c1.sh b/ap/app/Script/wifi_script/realtek_wpa2/wlan_8192c1.sh
new file mode 100755
index 0000000..924212e
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek_wpa2/wlan_8192c1.sh
@@ -0,0 +1,547 @@
+#!/bin/sh
+#
+# script file to start WLAN
+#
+
+
+## error code
+ERROR_SUCCESS=0
+ERROR_INVALID_PARAMETERS=1
+ERROR_NO_SUCH_DEVICE=2
+ERROR_NO_CONFIG_FILE=3
+ERROR_NO_SUCH_FILE=4
+ERROR_NO_SUCH_DIRECTORY=5
+ERROR_NULL_FILE=6
+ERROR_NET_IF_UP_FAIL=7
+
+IWPRIV=iwpriv
+wifi_lte_intr=`nv get wifi_lte_intr`
+
+if [ $# -lt 1 ]; then
+	echo "Usage: $0 wlan_interface" >> $LOG
+	exit $ERROR_INVALID_PARAMETERS;
+fi
+
+ROOT=`nv get wifi_root_dir`
+
+LOG=$ROOT/wifi/realtek/slog
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+
+CONFIG_DIR=$CONFIG_ROOT_DIR/$1
+echo "$1 config para" >> $LOG
+if [ ! -d "$CONFIG_DIR" ]; then
+	echo "$CONFIG_DIR: No such directory" >> $LOG
+	exit $ERROR_NO_CONFIG_FILE
+fi
+
+if [ -z "$SCRIPT_DIR" ]; then
+	SCRIPT_DIR=`cat $CONFIG_ROOT_DIR/wifi_script_dir`
+fi
+#echo $SCRIPT_DIR
+#START_WLAN_APP=$SCRIPT_DIR/wlanapp_8192c.sh
+
+if [ -z "$WLAN_PREFIX" ]; then
+	WLAN_PREFIX=wlan
+fi
+#WLAN_PREFIX_LEN=${#WLAN_PREFIX}
+#WLAN_NAME_LEN=$((WLAN_PREFIX_LEN + 1))
+
+if [ -z "$ROOT_WLAN" ]; then
+#	ROOT_WLAN=${1:0:$WLAN_NAME_LEN}
+### delete -va0 get wlan0
+	ROOT_WLAN=${1%%-*}  
+fi
+ROOT_CONFIG_DIR=$CONFIG_ROOT_DIR/$ROOT_WLAN
+
+IS_ROOT_WLAN=0
+if [ "$1" = "$ROOT_WLAN" ]; then
+	IS_ROOT_WLAN=1
+fi
+echo "IS_ROOT_WLAN is " $IS_ROOT_WLAN
+SET_WLAN="iwpriv $1"
+SET_WLAN_PARAM="$SET_WLAN set_mib"
+IFCONFIG=ifconfig
+
+## Disable WLAN MAC driver and shutdown interface first ##
+$IFCONFIG $1 down
+if [ $? != 0 ]; then
+	exit $ERROR_NO_SUCH_DEVICE
+fi
+
+GET_VALUE=
+GET_VALUE_TMP=
+GET_VALUE_WLAN_DISABLED=`cat $CONFIG_DIR/wlan_disabled`
+GET_VALUE_WLAN_MODE=`cat $CONFIG_DIR/wlan_mode`
+
+echo "$CONFIG_DIR/wlan_disabled =$GET_VALUE_WLAN_DISABLED " >> $LOG
+echo "$CONFIG_DIR/wlan_mode =$GET_VALUE_WLAN_MODE " >> $LOG
+
+
+##$SET_WLAN set_mib vap_enable=0
+$SET_WLAN set_mib wsc_enable=0
+
+## kill wlan application daemon ##
+
+##$START_WLAN_APP kill $1
+
+## Set parameters to driver ##
+
+GET_VALUE=`cat $ROOT_CONFIG_DIR/reg_domain`
+$SET_WLAN set_mib regdomain=$GET_VALUE
+
+NUM=0
+case $1 in
+$ROOT_WLAN-va*)
+	NUM=${1#$ROOT_WLAN-va}
+	#NUM=$((NUM + 1))
+	NUM=`expr $NUM + 1`	
+	;;
+esac
+
+
+GET_VALUE=`cat $ROOT_CONFIG_DIR/wlan${NUM}_addr`
+iwpriv $1 set_mib hwaddr=$GET_VALUE
+
+echo "iwpriv $1 set_mib hwaddr=$GET_VALUE" >> $LOG
+
+if [ "$GET_VALUE_WLAN_MODE" = '1' ]; then
+	## client mode 0: infrastructure  1:Ad-hoc
+	
+	hwaddr=`cat /proc/wlan0-vxd/mib_all | grep hwaddr`
+	
+	echo wlan0-vxd hwaddr=$hwaddr >> $LOG
+	
+	GET_VALUE=`cat $CONFIG_DIR/network_type`
+	if  [ "$GET_VALUE" = '0' ]; then
+		$SET_WLAN set_mib opmode=8
+	else
+		$SET_WLAN set_mib opmode=32
+		GET_VALUE_TMP=`cat $CONFIG_DIR/default_ssid`
+		$SET_WLAN set_mib defssid="$GET_VALUE_TMP"
+	fi
+	echo "wlan0-vxd do not set para, exit directly" >> $LOG
+	exit $ERROR_SUCCESS
+else
+	## AP mode
+	$SET_WLAN set_mib opmode=16
+fi
+##$IFCONFIG $1 hw ether $WLAN_MAC_ADDR
+
+##if [ "$GET_VALUE_WLAN_MODE" = '2' ]; then
+##		$SET_WLAN set_mib wds_pure=1
+##else
+##		$SET_WLAN set_mib wds_pure=0
+##fi
+
+echo "set RF parameters" >> $LOG
+# set RF parameters
+if [ $IS_ROOT_WLAN = 1 ]; then
+	GET_VALUE=`cat $CONFIG_DIR/channel`
+	$SET_WLAN set_mib channel=$GET_VALUE
+##autochannel can use wifi_lte_intr
+	if [ "$wifi_lte_intr" = "1" -a "$GET_VALUE" = "0" ];then
+		echo "wifi_lte_intr=$wifi_lte_intr  $SET_WLAN set_mib ch_low=5" >> $LOG	
+		$SET_WLAN set_mib ch_low=5
+#		$SET_WLAN set_mib disable_acs_ch=15
+	else
+		GET_VALUE=`cat $CONFIG_DIR/ch_low`
+		$SET_WLAN set_mib ch_low=$GET_VALUE
+	fi
+	
+	GET_VALUE=`cat $CONFIG_DIR/ch_hi`
+	$SET_WLAN set_mib ch_hi=$GET_VALUE
+	
+	GET_VALUE=`cat $CONFIG_DIR/led_type`
+	$SET_WLAN set_mib led_type=$GET_VALUE
+	
+	GET_VALUE=`cat $CONFIG_DIR/MIMO_TR_mode`
+	$SET_WLAN set_mib MIMO_TR_mode=$GET_VALUE
+	
+	#GET_TX_POWER_CCK_A=`cat $CONFIG_DIR/tx_power_cck_a`
+	#GET_TX_POWER_CCK_B=`cat $CONFIG_DIR/tx_power_cck_b`
+	#GET_TX_POWER_HT40_1S_A=`cat $CONFIG_DIR/tx_power_ht40_1s_a`
+	#GET_TX_POWER_HT40_1S_B=`cat $CONFIG_DIR/tx_power_ht40_1s_b`
+
+	#GET_TX_POWER_DIFF_HT40_2S=`cat $CONFIG_DIR/tx_power_diff_ht40_2s`
+	#GET_TX_POWER_DIFF_HT20=`cat $CONFIG_DIR/tx_power_diff_ht20`
+	#GET_TX_POWER_DIFF_OFDM=`cat $CONFIG_DIR/tx_power_diff_ofdm`
+
+	#$SET_WLAN set_mib pwrlevelCCK_A=$GET_TX_POWER_CCK_A
+	#$SET_WLAN set_mib pwrlevelCCK_B=$GET_TX_POWER_CCK_B
+	#$SET_WLAN set_mib pwrlevelHT40_1S_A=$GET_TX_POWER_HT40_1S_A
+	#$SET_WLAN set_mib pwrlevelHT40_1S_B=$GET_TX_POWER_HT40_1S_B
+	#$SET_WLAN set_mib pwrdiffHT40_2S=$GET_TX_POWER_DIFF_HT40_2S
+	#$SET_WLAN set_mib pwrdiffHT20=$GET_TX_POWER_DIFF_HT20
+	#$SET_WLAN set_mib pwrdiffOFDM=$GET_TX_POWER_DIFF_OFDM
+	
+	GET_TX_POWER_PERCENT=`cat $CONFIG_DIR/tx_power_percet`
+	#echo "GET_TX_POWER_PERCENT is "$GET_TX_POWER_PERCENT
+	$SET_WLAN set_mib powerpercent=$GET_TX_POWER_PERCENT
+	
+	GET_11N_TSSI1=`cat $CONFIG_DIR/tssi_1`
+	$SET_WLAN set_mib tssi1=$GET_11N_TSSI1
+	GET_11N_TSSI2=`cat $CONFIG_DIR/tssi_2`
+	$SET_WLAN set_mib tssi2=$GET_11N_TSSI2
+	
+	#GET_VALUE=`cat $CONFIG_DIR/11n_ther`
+	#$SET_WLAN set_mib ther=$GET_VALUE
+	
+	GET_VALUE=`cat $CONFIG_DIR/trswitch`
+	$SET_WLAN set_mib trswitch=$GET_VALUE
+
+	#GET_VALUE=`cat $CONFIG_DIR/11n_xcap`
+	#$SET_WLAN set_mib xcap=$GET_VALUE
+	
+	#GET_VALUE=`cat $CONFIG_DIR/rfe_type`
+	#$SET_WLAN set_mib rfe_type=$GET_VALUE
+	
+	#exit $ERROR_SUCCESS
+	
+#	iwpriv wlan0 efuse_set SD=3
+#	iwpriv wlan0 efuse_sync
+#	iwpriv wlan0 set_mib func_off=1
+
+fi # [ $IS_ROOT_WLAN = 1 ]
+	
+GET_VALUE=`cat $CONFIG_DIR/basic_rates`
+$SET_WLAN set_mib basicrates=$GET_VALUE
+
+GET_VALUE=`cat $CONFIG_DIR/supported_rate`
+$SET_WLAN set_mib oprates=$GET_VALUE
+	
+GET_RATE_ADAPTIVE_VALUE=`cat $CONFIG_DIR/rate_adaptive_enabled`
+if [ "$GET_RATE_ADAPTIVE_VALUE" = '0' ]; then
+	$SET_WLAN set_mib autorate=0
+	GET_FIX_RATE_VALUE=`cat $CONFIG_DIR/fix_rate`
+	$SET_WLAN set_mib fixrate=$GET_FIX_RATE_VALUE
+else
+	$SET_WLAN set_mib autorate=1
+fi
+
+GET_VALUE=`cat $CONFIG_DIR/rts_threshold`
+$SET_WLAN set_mib rtsthres=$GET_VALUE
+
+GET_VALUE=`cat $CONFIG_DIR/frag_threshold`
+$SET_WLAN set_mib fragthres=$GET_VALUE
+	
+GET_VALUE=`cat $CONFIG_DIR/inactivity_time`
+$SET_WLAN set_mib expired_time=$GET_VALUE
+GET_VALUE=`cat $ROOT_CONFIG_DIR/beacon_interval`
+$SET_WLAN set_mib bcnint=$GET_VALUE
+
+GET_VALUE=`cat $ROOT_CONFIG_DIR/dtim_period`
+$SET_WLAN set_mib dtimperiod=$GET_VALUE
+
+GET_VALUE=`cat $CONFIG_DIR/preamble_type`
+$SET_WLAN set_mib preamble=$GET_VALUE
+GET_VALUE=`cat $CONFIG_DIR/hidden_ssid`
+$SET_WLAN set_mib hiddenAP=$GET_VALUE
+
+GET_VALUE=`cat $CONFIG_DIR/supported_sta_num`
+$SET_WLAN set_mib stanum=$GET_VALUE
+
+GET_VALUE=`cat $CONFIG_DIR/ssid`
+$SET_WLAN set_mib ssid="$GET_VALUE"
+
+GET_VALUE=`cat $CONFIG_DIR/macac_enabled`
+$SET_WLAN set_mib aclmode=$GET_VALUE
+$SET_WLAN set_mib aclnum=0
+#ACL_NUM=`cat $CONFIG_DIR/macac_num`
+#_counter=1
+#while [ $_counter -le $ACL_NUM ]; do
+#	GET_VALUE=`cat $CONFIG_DIR/macac_addr$_counter`
+	#$SET_WLAN set_mib acladdr=$GET_VALUE
+#	echo "----add_acl_table is "$GET_VALUE
+	#$SET_WLAN add_acl_table $GET_VALUE
+#	_counter=$((_counter + 1))
+#done
+
+GET_WLAN_AUTH_TYPE=`cat $CONFIG_DIR/auth_type`
+AUTH_TYPE=$GET_WLAN_AUTH_TYPE
+GET_WLAN_ENCRYPT=`cat $CONFIG_DIR/encrypt`
+if [ "$GET_WLAN_AUTH_TYPE" = '1' ] && [ "$GET_WLAN_ENCRYPT" != '1' ]; then
+	# shared-key and not WEP enabled, force to open-system
+	AUTH_TYPE=0
+fi
+$SET_WLAN set_mib authtype=$AUTH_TYPE
+if [ "$GET_WLAN_ENCRYPT" = '0' ]; then
+	$SET_WLAN set_mib encmode=0
+elif [ "$GET_WLAN_ENCRYPT" = '1' ]; then
+	### WEP mode ##
+	GET_WEP=`cat $CONFIG_DIR/wep`
+	GET_WEP_KEY_TYPE=`cat $CONFIG_DIR/wep_key_type`
+	GET_WEP_KEY_ID=`cat $CONFIG_DIR/wep_default_key`
+	
+	if [ "$GET_WEP" = '1' ]; then
+		if [ "$GET_WEP_KEY_TYPE" = '0' ]; then
+			GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_64_asc`
+			GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_64_asc`
+			GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_64_asc`
+			GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_64_asc`
+		else
+			GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_64_hex`
+			GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_64_hex`
+			GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_64_hex`
+			GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_64_hex`
+		fi
+	
+		$SET_WLAN set_mib encmode=1
+		$SET_WLAN set_mib wepkey1=$GET_WEP_KEY_1
+		$SET_WLAN set_mib wepkey2=$GET_WEP_KEY_2
+		$SET_WLAN set_mib wepkey3=$GET_WEP_KEY_3
+		$SET_WLAN set_mib wepkey4=$GET_WEP_KEY_4
+		$SET_WLAN set_mib wepdkeyid=$GET_WEP_KEY_ID
+	else
+		if [ "$GET_WEP_KEY_TYPE" = '0' ]; then
+			GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_128_asc`
+			GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_128_asc`
+			GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_128_asc`
+			GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_128_asc`
+		else
+			GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_128_hex`
+			GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_128_hex`
+			GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_128_hex`
+			GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_128_hex`
+		fi
+		$SET_WLAN set_mib encmode=5
+		$SET_WLAN set_mib wepkey1=$GET_WEP_KEY_1
+		$SET_WLAN set_mib wepkey2=$GET_WEP_KEY_2
+		$SET_WLAN set_mib wepkey3=$GET_WEP_KEY_3
+		$SET_WLAN set_mib wepkey4=$GET_WEP_KEY_4
+		$SET_WLAN set_mib wepdkeyid=$GET_WEP_KEY_ID
+	fi
+else
+        ## WPA mode ##
+	$SET_WLAN set_mib encmode=2
+fi
+##$SET_WLAN set_mib wds_enable=0
+##$SET_WLAN set_mib wds_encrypt=0
+## Set 802.1x flag ##
+_ENABLE_1X=0
+if [ $GET_WLAN_ENCRYPT -lt 2 ]; then
+	GET_ENABLE_1X=`cat $CONFIG_DIR/enable_1x`
+	GET_MAC_AUTH_ENABLED=`cat $CONFIG_DIR/mac_auth_enabled`
+	if [ "$GET_ENABLE_1X" != 0 ] || [ "$GET_MAC_AUTH_ENABLED" != 0 ]; then
+		_ENABLE_1X=1
+	fi
+else
+	_ENABLE_1X=1
+fi
+$SET_WLAN set_mib 802_1x=$_ENABLE_1X
+	#set band
+GET_BAND=`cat $ROOT_CONFIG_DIR/band`
+GET_WIFI_SPECIFIC=`cat $ROOT_CONFIG_DIR/wifi_specific`
+if [ "$GET_VALUE_WLAN_MODE" != '1' ] && [ "$GET_WIFI_SPECIFIC" = 1 ] &&  [ "$GET_BAND" = '2' ] ; then
+	GET_BAND=3
+fi
+if [ "$GET_BAND" = '8' ]; then
+	GET_BAND=11
+	$SET_WLAN set_mib deny_legacy=3
+elif [ "$GET_BAND" = '2' ]; then
+	GET_BAND=3
+	$SET_WLAN set_mib deny_legacy=1
+elif [ "$GET_BAND" = '10' ]; then
+	GET_BAND=11
+	$SET_WLAN set_mib deny_legacy=1
+elif [ "$GET_BAND" = '64' ]; then
+	GET_BAND=76
+	$SET_WLAN set_mib deny_legacy=12
+elif [ "$GET_BAND" = '72' ]; then
+	GET_BAND=76
+	$SET_WLAN set_mib deny_legacy=4
+else
+	$SET_WLAN set_mib deny_legacy=0
+fi
+$SET_WLAN set_mib band=$GET_BAND
+
+
+echo "Set 11n parameter"  >> $LOG
+###Set 11n parameter
+	if [ $GET_BAND = 10 ] || [ $GET_BAND = 11 ] || [ $GET_BAND = 76 ]; then
+	if [ $IS_ROOT_WLAN = 1 ]; then
+		GET_CHANNEL_BONDING=`cat $CONFIG_DIR/channel_bonding`
+		$SET_WLAN set_mib use40M=$GET_CHANNEL_BONDING
+
+		GET_CONTROL_SIDEBAND=`cat $CONFIG_DIR/control_sideband`
+
+		if [ "$GET_CHANNEL_BONDING" = 0 ]; then
+			$SET_WLAN set_mib 2ndchoffset=0
+		else
+			if [ "$GET_CONTROL_SIDEBAND" = 0 ]; then
+				 $SET_WLAN set_mib 2ndchoffset=1
+			fi
+			if [ "$GET_CONTROL_SIDEBAND" = 1 ]; then
+				 $SET_WLAN set_mib 2ndchoffset=2
+			fi
+		fi
+	fi # [ $IS_ROOT_WLAN = 1 ]
+
+	GET_SHORT_GI=`cat $CONFIG_DIR/short_gi`
+	$SET_WLAN set_mib shortGI20M=$GET_SHORT_GI
+	$SET_WLAN set_mib shortGI40M=$GET_SHORT_GI
+
+	GET_AGGREGATION=`cat $CONFIG_DIR/aggregation`
+
+	if [ "$GET_AGGREGATION" = 0 ]; then
+		$SET_WLAN set_mib ampdu=$GET_AGGREGATION
+		$SET_WLAN set_mib amsdu=$GET_AGGREGATION
+	elif [ "$GET_AGGREGATION" = 1 ]; then
+		$SET_WLAN set_mib ampdu=1
+		$SET_WLAN set_mib amsdu=0
+	elif [ "$GET_AGGREGATION" = 2 ]; then
+		$SET_WLAN set_mib ampdu=0
+		$SET_WLAN set_mib amsdu=1
+	elif [ "$GET_AGGREGATION" = 3 ]; then
+		$SET_WLAN set_mib ampdu=1
+		$SET_WLAN set_mib amsdu=1
+	fi
+
+	GET_STBC_ENABLED=`cat $CONFIG_DIR/stbc_enabled`
+	$SET_WLAN set_mib stbc=$GET_STBC_ENABLED
+	GET_COEXIST_ENABLED=`cat $CONFIG_DIR/coexist_enabled`
+	$SET_WLAN set_mib coexist=$GET_COEXIST_ENABLED
+	fi # [ $GET_BAND = 10 ] || [ $GET_BAND = 11 ]
+##########
+
+#set nat2.5 disable when client and mac clone is set
+GET_MACCLONE_ENABLED=`cat $CONFIG_DIR/macclone_enable`
+if [ "$GET_MACCLONE_ENABLED" = '1' -a "$GET_VALUE_WLAN_MODE" = '1' ]; then
+	$SET_WLAN set_mib nat25_disable=1
+	$SET_WLAN set_mib macclone_enable=1
+else
+	$SET_WLAN set_mib nat25_disable=0
+	$SET_WLAN set_mib macclone_enable=0
+fi
+
+# set 11g protection mode
+GET_PROTECTION_DISABLED=`cat $CONFIG_DIR/protection_disabled`
+if  [ "$GET_PROTECTION_DISABLED" = '1' ] ;then
+	$SET_WLAN set_mib disable_protection=1
+else
+	$SET_WLAN set_mib disable_protection=0
+fi
+
+# for ap isolation
+GET_VALUE=`cat $CONFIG_DIR/group_id`
+$SET_WLAN set_mib groupID=$GET_VALUE
+
+# set block relay
+GET_VALUE=`cat $CONFIG_DIR/block_relay`
+$SET_WLAN set_mib block_relay=$GET_VALUE
+	
+	
+# set WiFi specific mode
+GET_VALUE=`cat $ROOT_CONFIG_DIR/wifi_specific`
+$SET_WLAN set_mib wifi_specific=$GET_VALUE
+
+# for WMM
+GET_VALUE=`cat $CONFIG_DIR/wmm_enabled`
+$SET_WLAN set_mib qos_enable=$GET_VALUE
+
+# for guest access
+GET_VALUE=`cat $CONFIG_DIR/guest_access`
+$SET_WLAN set_mib guest_access=$GET_VALUE
+
+
+
+# for country code
+#COUNTRY_CODE_ENABLE=`$SET_WLAN get_mib countrycode 2> /dev/null`
+if [ ! -z "$COUNTRY_CODE_ENABLE" ]; then
+GET_VALUE=`cat $ROOT_CONFIG_DIR/countrycode_enable`
+#	$SET_WLAN set_mib countrycode=$GET_VALUE
+
+GET_VALUE=`cat $ROOT_CONFIG_DIR/countrycode`
+#	$SET_WLAN set_mib countrystr=$GET_VALUE
+
+
+fi
+
+echo "wpa relative settings"  >> $LOG
+#
+# following settings is used when driver WPA module is included
+#
+
+GET_WPA_AUTH=`cat $CONFIG_DIR/wpa_auth`
+#if [ $GET_VALUE_WLAN_MODE != 1 ] && [ $GET_WLAN_ENCRYPT -ge 2 ]  && [ $GET_WLAN_ENCRYPT -lt 7 ] && [ $GET_WPA_AUTH = 2 ]; then
+if [ $GET_WLAN_ENCRYPT -ge 2 ]  && [ $GET_WLAN_ENCRYPT -lt 7 ]; then
+	if [ $GET_WPA_AUTH = 2 ]; then
+		if [ $GET_WLAN_ENCRYPT = 2 ]; then
+			ENABLE=1
+		elif [ $GET_WLAN_ENCRYPT = 4 ]; then
+			ENABLE=2
+		elif [ $GET_WLAN_ENCRYPT = 6 ]; then
+			ENABLE=3
+		else
+			echo "invalid ENCRYPT value!($GET_WLAN_ENCRYPT)" >> $LOG
+			exit $ERROR_INVALID_PARAMETERS;
+		fi
+		$SET_WLAN set_mib psk_enable=$ENABLE
+	else
+		$SET_WLAN set_mib psk_enable=0
+	fi
+
+	if [ $GET_WLAN_ENCRYPT = 2 ] || [ $GET_WLAN_ENCRYPT = 6 ]; then
+		GET_WPA_CIPHER_SUITE=`cat $CONFIG_DIR/wpa_cipher`
+		if [ $GET_WPA_CIPHER_SUITE = 1 ]; then
+			CIPHER=2
+		elif [ $GET_WPA_CIPHER_SUITE = 2 ]; then
+			CIPHER=8
+		elif [ $GET_WPA_CIPHER_SUITE = 3 ]; then
+			CIPHER=10
+		else
+			echo "invalid WPA_CIPHER_SUITE value!($GET_WPA_CIPHER_SUITE)" >> $LOG
+			exit $ERROR_INVALID_PARAMETERS;
+		fi
+	fi
+	$SET_WLAN set_mib wpa_cipher=$CIPHER
+
+	if [ $GET_WLAN_ENCRYPT = 4 ] || [ $GET_WLAN_ENCRYPT = 6 ]; then
+		GET_WPA2_CIPHER_SUITE=`cat $CONFIG_DIR/wpa2_cipher`
+		if [ $GET_WPA2_CIPHER_SUITE = 1 ]; then
+			CIPHER=2
+		elif [ $GET_WPA2_CIPHER_SUITE = 2 ]; then
+			CIPHER=8
+		elif [ $GET_WPA2_CIPHER_SUITE = 3 ]; then
+			CIPHER=10
+		else
+			echo "invalid WPA2_CIPHER_SUITE value!($GET_WPA2_CIPHER_SUITE)" >> $LOG
+			exit $ERROR_INVALID_PARAMETERS;
+		fi
+	fi
+	$SET_WLAN set_mib wpa2_cipher=$CIPHER
+
+	GET_WPA_PSK=`cat $CONFIG_DIR/wpa_psk`
+	$SET_WLAN set_mib passphrase=$GET_WPA_PSK
+
+	
+	GET_WPA_GROUP_REKEY_TIME=`cat $CONFIG_DIR/gk_rekey`
+	$SET_WLAN set_mib gk_rekey=$GET_WPA_GROUP_REKEY_TIME
+fi
+# Set 11w parameter #
+#if [ $GET_WLAN_ENCRYPT = 4 ] || [ $GET_WLAN_ENCRYPT = 6 ]; then
+#	GET_WPA2_11W=`cat $CONFIG_DIR/wpa11w`
+#	GET_WPA2_SHA256=`cat $CONFIG_DIR/wpa2EnableSHA256`
+#	if [ $GET_WPA2_11W = 0 ]; then
+#		GET_WPA2_SHA256=0
+#	elif [ $GET_WPA2_11W = 1 ]; then
+#		if [ "$GET_WPA2_SHA256" != '0' ] && [ "$GET_WPA2_SHA256" != '1' ]; then
+#			GET_WPA2_SHA256=0
+#		fi
+#	elif [ $GET_WPA2_11W = 2 ]; then
+#		GET_WPA2_SHA256=1
+#	else
+#		echo "invalid GET_WPA2_11W value!($GET_WPA2_11W)";
+#		exit $ERROR_INVALID_PARAMETERS;
+#	fi
+#else
+#	GET_WPA2_11W=0
+#	GET_WPA2_SHA256=0
+#fi
+#IEEE80211W_ENABLE=`$SET_WLAN get_mib dot11IEEE80211W 2> /dev/null`
+#if [ ! -z "$IEEE80211W_ENABLE" ]; then
+#	GET_WPA2_11W=`cat $CONFIG_DIR/wpa11w`
+#	GET_WPA2_SHA256=`cat $CONFIG_DIR/wpa2EnableSHA256`
+#	$SET_WLAN set_mib dot11IEEE80211W=$GET_WPA2_11W
+#	$SET_WLAN set_mib enableSHA256=$GET_WPA2_SHA256
+#fi
+##########
diff --git a/ap/app/Script/wifi_script/realtek_wpa2/wlan_basic_deal.sh b/ap/app/Script/wifi_script/realtek_wpa2/wlan_basic_deal.sh
new file mode 100755
index 0000000..9dbff1b
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek_wpa2/wlan_basic_deal.sh
@@ -0,0 +1,180 @@
+#!/bin/sh
+#
+# script file to down up WLAN quickly
+#
+
+
+## error code
+ERROR_SUCCESS=0
+ERROR_INVALID_PARAMETERS=1
+ERROR_NO_SUCH_DEVICE=2
+ERROR_NO_CONFIG_FILE=3
+ERROR_NO_SUCH_FILE=4
+ERROR_NO_SUCH_DIRECTORY=5
+ERROR_NULL_FILE=6
+ERROR_NET_IF_UP_FAIL=7
+ERROR_ADD_BR_FAIL=8
+ERROR_ADD_IF_FAIL=9
+
+
+ROOT=`nv get wifi_root_dir`
+LOG=$ROOT/wifi/realtek/slog
+
+IWPRIV=iwpriv
+BR_UTIL=brctl
+
+if [ $# -lt 1 ]; then
+	echo "Usage: $0 wlan_interface" >> $LOG
+	exit $ERROR_INVALID_PARAMETERS;
+fi
+
+SET_WLAN="iwpriv $1"
+SET_WLAN_PARAM="$SET_WLAN set_mib"
+IFCONFIG=ifconfig
+SET_VA0="iwpriv wlan0-va0"
+SET_VA1="iwpriv wlan0-va1"
+
+
+
+
+br0_add_va1()
+{
+	HAS_BEEN_ADDED=`$BR_UTIL show | grep va1`
+	if [ -z "$HAS_BEEN_ADDED" ]; then
+		echo "$BR_UTIL addif br0 wlan0-va1"  >> $LOG
+		$BR_UTIL addif br0 wlan0-va1 2> /dev/null
+		
+		if [ $? != 0 ]; then
+			echo "Failed: $BR_UTIL addif br0 wlan0-va1"  >> $LOG
+			exit $ERROR_ADD_IF_FAIL;
+		fi
+
+	fi
+}
+
+ifconfig_wlan0_up()
+{
+	ifconfig wlan0 up
+	if [ $? != 0 ]; then
+		exit $ERROR_NO_SUCH_DEVICE
+	fi
+}
+
+ifconfig_wlan0_down()
+{
+	ifconfig wlan0 down
+	if [ $? != 0 ]; then
+		exit $ERROR_NO_SUCH_DEVICE
+	fi
+}
+
+ifconfig_wlan0_va0_up()
+{
+	ifconfig wlan0-va0 up
+	if [ $? != 0 ]; then
+		exit $ERROR_NO_SUCH_DEVICE
+	fi
+}
+
+ifconfig_wlan0_va0_down()
+{
+	ifconfig wlan0-va0 down
+	if [ $? != 0 ]; then
+		exit $ERROR_NO_SUCH_DEVICE
+	fi
+}
+
+ifconfig_wlan0_va1_up()
+{
+	ifconfig wlan0-va1 up
+	if [ $? != 0 ]; then
+		exit $ERROR_NO_SUCH_DEVICE
+	fi
+}
+
+ifconfig_wlan0_va1_down()
+{
+	ifconfig wlan0-va1 down
+	if [ $? != 0 ]; then
+		exit $ERROR_NO_SUCH_DEVICE
+	fi
+}
+ifconfig_wlan0_vxd_down()
+{
+	ifconfig wlan0-vxd down
+	if [ $? != 0 ]; then
+		exit $ERROR_NO_SUCH_DEVICE
+	fi
+}
+
+basic_open_va0()
+{
+	ifconfig_wlan0_up
+	ifconfig_wlan0_va0_up
+}				
+
+basic_open_va0_va1()
+{
+	iwpriv wlan0-va0 set_mib  stanum=`nv get  MAX_Access_num`
+    iwpriv wlan0-va1  set_mib  stanum=`nv get  m_MAX_Access_num`
+	ifconfig_wlan0_up
+	ifconfig_wlan0_va0_up
+	ifconfig_wlan0_va1_up
+	br0_add_va1
+}
+
+basic_open_va1()
+{
+	ifconfig_wlan0_va0_down
+	iwpriv wlan0-va0 set_mib stanum=`nv get MAX_Access_num` 
+	iwpriv wlan0-va1 set_mib stanum=`nv get m_MAX_Access_num` 
+	ifconfig_wlan0_va0_up
+	ifconfig_wlan0_va1_up
+	br0_add_va1
+}
+
+basic_close_va1()
+{
+	iwpriv	wlan0-va1  clear_acl_table
+	ifconfig_wlan0_va1_down
+	
+	ifconfig_wlan0_va0_down	
+	iwpriv wlan0-va0 set_mib stanum=`nv get MAX_Access_num` 
+	ifconfig_wlan0_va0_up
+}
+
+basic_closesta_openmssid()
+{
+	ifconfig_wlan0_va0_down 
+	ifconfig_wlan0_vxd_down
+	iwpriv wlan0-va0 set_mib  stanum=`nv get  MAX_Access_num` 
+	iwpriv wlan0-va1 set_mib  stanum=`nv get  m_MAX_Access_num` 
+	ifconfig_wlan0_va0_up 
+	ifconfig_wlan0_va1_up
+	br0_add_va1
+}
+
+
+main()
+{
+	if [ "$1" == "open_va0" ]; then
+		basic_open_va0
+	elif  [ "$1" == "open_va1" ]; then
+		basic_open_va1
+	elif [ "$1" == "close_va1" ]; then
+		basic_close_va1
+	elif [ "$1" == "open_va0_va1"  ]; then
+		basic_open_va0_va1
+	elif  [  "$1" == "close_sta_open_va1" ] ; then
+		basic_closesta_openmssid
+	else
+		echo "$1 para wrong"  >> $LOG
+		exit $ERROR_INVALID_PARAMETERS;
+	fi
+
+}
+
+date +[%H:%M:%S]$1_start >> $LOG
+main $1
+date +[%H:%M:%S]$1_end >> $LOG
+exit $ERROR_SUCCESS
\ No newline at end of file
diff --git a/ap/app/Script/wifi_script/realtek_wpa2/wlanapp_8192c.sh b/ap/app/Script/wifi_script/realtek_wpa2/wlanapp_8192c.sh
new file mode 100755
index 0000000..3848dbf
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek_wpa2/wlanapp_8192c.sh
@@ -0,0 +1,464 @@
+#!/bin/sh
+#
+# script file to start wlan applications (IAPP, Auth, Autoconf) daemon
+#
+# Usage: wlanapp.sh [start|kill] wlan_interface...br_interface
+#
+
+## error code
+ERROR_WSCD_START_FAIL=8
+
+if [ $# -lt 2 ] || [ $1 != 'start' -a $1 != 'kill' ] ; then 
+	echo "Usage: $0 [start|kill] wlan_interface...br_interface" >> $LOG
+	exit 1 
+fi
+#CUR_PATH=`pwd`
+#TOP_VAR_DIR="/etc_ro"
+ROOT=`nv get wifi_root_dir`
+LOG=$ROOT/wifi/realtek/slog
+
+TOP_VAR_DIR="$ROOT/wifi/realtek"
+TOP_ETC_DIR="/etc_ro/realtek/ath"
+TOP_TMP_DIR="$ROOT/tmp"
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+
+if [ ! -d "$TOP_TMP_DIR" ]; then
+    mkdir $TOP_TMP_DIR
+fi
+
+if [ -z "$BIN_DIR" ]; then
+	BIN_DIR=`cat $CONFIG_ROOT_DIR/wifi_bin_dir`
+fi
+
+if [ -z "$WLAN_PREFIX" ]; then
+	WLAN_PREFIX=wlan
+fi
+#WLAN_PREFIX_LEN=${#WLAN_PREFIX}
+#WLAN_NAME_LEN=$((WLAN_PREFIX_LEN + 1))
+
+if [ -z "$ROOT_WLAN" ]; then
+#	ROOT_WLAN=${2:0:$WLAN_NAME_LEN}
+	ROOT_WLAN=${2%%-*}
+fi
+ROOT_CONFIG_DIR=$CONFIG_ROOT_DIR/$ROOT_WLAN
+
+GET_VALUE=
+GET_VALUE_TMP=
+KILLALL=killall
+FLASH_PROG=flash
+SLEEP=sleep
+
+START=1
+PARAM_NUM=$#
+PARAM_ALL=$*
+PARAM1=$1
+PARAM_BR=
+WLAN_INTERFACE=
+
+WLAN0_MODE=
+WLAN0_DISABLED=
+WLAN0_WSC_DISABLED=
+
+WLAN1_MODE=0
+WLAN1_DISABLED=1
+WLAN1_WSC_DISABLED=1
+both_band_ap=0
+
+rtl_check_wlan_band(){
+
+	WLAN0_MODE=`cat $CONFIG_ROOT_DIR/wlan0/wlan_mode`
+	WLAN0_DISABLED=`cat $CONFIG_ROOT_DIR/wlan0/wlan_disabled`
+	WLAN0_WSC_DISABLED=`cat $CONFIG_ROOT_DIR/wlan0/wsc_disabled`
+
+	if [ -d "$CONFIG_ROOT_DIR/wlan1" ] ; then
+		WLAN1_MODE=`cat $CONFIG_ROOT_DIR/wlan1/wlan_mode`
+		WLAN1_DISABLED=`cat $CONFIG_ROOT_DIR/wlan1/wlan_disabled`
+		WLAN1_WSC_DISABLED=`cat $CONFIG_ROOT_DIR/wlan1/wsc_disabled`
+	fi
+
+	if [ "$WLAN0_MODE" = "0" -o "$WLAN0_MODE" = "3" ] && [ "$WLAN1_MODE" = "0" -o "$WLAN1_MODE" = "3" ] && [ "$WLAN0_DISABLED" = "0" ] && [ "$WLAN1_DISABLED" = "0" ] && [ "$WLAN0_WSC_DISABLED" = "0" ] && [ "$WLAN1_WSC_DISABLED" = "0" ]; then
+		both_band_ap = 1
+	fi
+}
+
+rtl_check_wlan_if() {
+
+	echo "wlanapp_8192c.sh --rtl_check_wlan_if" >> $LOG
+
+	if [ $PARAM_NUM -ge 1 ]; then
+		for ARG in $PARAM_ALL ; do
+			case $ARG in
+			$WLAN_PREFIX*)
+				if [ -z "$WLAN_INTERFACE" ]; then
+					WLAN_INTERFACE="$ARG"
+				else
+					WLAN_INTERFACE="$WLAN_INTERFACE $ARG"
+				fi
+				;;
+			*)
+				PARAM_BR=$ARG
+				;;
+			esac
+		done
+	fi
+}
+	
+DEBUG_EASYCONF=
+VXD_INTERFACE=
+
+
+## kill 802.1x, autoconf and IAPP daemon ##
+rtl_kill_iwcontrol_pid() { 
+	PIDFILE="$TOP_VAR_DIR/run/iwcontrol.pid"
+	echo "wlanapp_8192c.sh --rtl_kill_iwcontrol_pid"  >> $LOG
+	if [ -f $PIDFILE ] ; then
+		PID=`cat $PIDFILE`
+		echo "IWCONTROL_PID=$PID"  >> $LOG
+		if [ "$PID" != "0" ]; then
+			kill -9 $PID 2>/dev/null
+		fi
+		rm -f $PIDFILE
+	fi
+}
+
+
+rtl_kill_wlan_pid() {
+
+	echo "wlanapp_8192c.sh --rtl_kill_wlan_pid"  >>  $LOG
+	for WLAN in $WLAN_INTERFACE ; do
+		PIDFILE=$TOP_VAR_DIR/run/auth-$WLAN.pid
+		if [ -f $PIDFILE ] ; then
+			PID=`cat $PIDFILE`
+			echo "AUTH_PID=$PID"
+			if [ "$PID" != "0" ]; then
+				kill -9 $PID 2>/dev/null
+			fi
+			rm -f $PIDFILE
+			
+			PIDFILE=$TOP_VAR_DIR/run/auth-$WLAN-vxd.pid 
+			if [ -f $PIDFILE ] ; then		
+				PID=`cat $PIDFILE`
+				if [ "$PID" != "0" ]; then
+					kill -9 $PID 2>/dev/null
+				fi
+				rm -f $PIDFILE       		
+			fi
+		fi
+		
+		# for WPS ---------------------------------->>
+		PIDFILE=$TOP_VAR_DIR/run/wscd-$WLAN.pid
+		if [ "$both_band_ap" = "1" ]; then
+			PIDFILE=$TOP_VAR_DIR/run/wscd-wlan0-wlan1.pid
+		fi
+		
+		if [ -f $PIDFILE ] ; then
+			PID=`cat $PIDFILE`
+			echo "WSCD_PID=$PID"  >> $LOG
+			if [ "$PID" != "0" ]; then
+				kill -9 $PID 2>/dev/null
+			fi
+			rm -f $PIDFILE   
+		fi 
+	done
+	#<<----------------------------------- for WPS
+}
+
+## start 802.1x daemon ##
+DEAMON_CREATED=0
+VALID_WLAN_INTERFACE=
+
+
+rtl_start_wlan() {
+	echo "rtl_start_wlan WLAN_INTERFACE is "$WLAN_INTERFACE >> $LOG
+	for WLAN in $WLAN_INTERFACE ; do
+		CONFIG_DIR=$CONFIG_ROOT_DIR/$WLAN
+		echo "rtl_start_wlan start-1------------ CONFIG_DIR is "$CONFIG_DIR  >> $LOG
+		GET_VALUE_WLAN_DISABLED=`cat $CONFIG_DIR/wlan_disabled`
+		if [ "$GET_VALUE_WLAN_DISABLED" != 0 ]; then
+			continue
+		fi
+		
+		GET_VALUE_WLAN_MODE=`cat $CONFIG_DIR/wlan_mode`
+		GET_WLAN_WPA_AUTH_TYPE=`cat $CONFIG_DIR/wpa_auth`
+		GET_WLAN_ENCRYPT=`cat $CONFIG_DIR/encrypt`
+		
+		EXT=${WLAN#$WLAN_PREFIX[0-9]}
+		EXT=${EXT#-}
+		VAP_AUTH_ENABLE=0
+		ROOT_AUTH_ENABLE=0
+		
+		_ENABLE_1X=0
+		_USE_RS=0
+
+		if [ "$GET_WLAN_ENCRYPT" -lt 2 ]; then
+			GET_ENABLE_1X=`cat $CONFIG_DIR/enable_1x`
+			GET_MAC_AUTH_ENABLED=`cat $ROOT_CONFIG_DIR/mac_auth_enabled`
+			if [ "$GET_ENABLE_1X" != 0 ] || [ "$GET_MAC_AUTH_ENABLED" != 0 ]; then
+				_ENABLE_1X=1
+				_USE_RS=1
+			fi
+		else
+			_ENABLE_1X=1
+			if  [ "$GET_WLAN_WPA_AUTH_TYPE" = 1 ]; then
+				_USE_RS=1
+			fi		
+		fi
+
+		echo "_ENABLE_1X= $_ENABLE_1X" >> $LOG	
+		ROLE=
+		if [ "$_ENABLE_1X" != 0 ]; then	
+			echo "$BIN_DIR/$FLASH_PROG wpa $WLAN $TOP_VAR_DIR/wpa-$WLAN.conf $WLAN" >> $LOG
+			$BIN_DIR/$FLASH_PROG wpa $WLAN $TOP_VAR_DIR/wpa-$WLAN.conf $WLAN
+			if [ "$GET_VALUE_WLAN_MODE" = '1' ]; then
+				GET_VALUE=`cat $CONFIG_DIR/network_type`
+				if [ "$GET_VALUE" = '0' ]; then
+					ROLE=client-infra
+				else
+					ROLE=client-adhoc			
+				fi
+			else
+				ROLE=auth
+			fi
+
+			VAP_NOT_IN_PURE_AP_MODE=0		
+		
+			
+			if [ "$GET_VALUE_WLAN_MODE" = '0' ] && [ "$VAP_NOT_IN_PURE_AP_MODE" = '0' ]; then
+				if  [ "$GET_WLAN_WPA_AUTH_TYPE" != 2 ] || [ "$_USE_RS" != 0 ]; then
+					echo "$BIN_DIR/auth $WLAN $PARAM_BR $ROLE $TOP_VAR_DIR/wpa-$WLAN.conf" >> $LOG
+					$BIN_DIR/auth $WLAN $PARAM_BR $ROLE $TOP_VAR_DIR/wpa-$WLAN.conf
+					
+					DEAMON_CREATED=1
+					ROOT_AUTH_ENABLE=1
+				fi
+		
+			fi
+		fi
+		
+		if [ "$EXT" = "vxd" ]; then	
+			if [ "$ROLE" != "auth" ] || [ "$ROLE" = "auth" -a "$_USE_RS" != 0 ]; then
+				VXD_INTERFACE=$WLAN
+			fi
+		else
+			GET_WSC_DISABLE=`cat $CONFIG_DIR/wsc_disabled`
+			#|| [ $GET_WSC_DISABLE = 0 ]
+			if [ $ROOT_AUTH_ENABLE = 1 ] || [ $GET_WSC_DISABLE = 0 ]; then
+				if [ -z "$VALID_WLAN_INTERFACE" ]; then
+					VALID_WLAN_INTERFACE="$WLAN"
+				else
+					VALID_WLAN_INTERFACE="$VALID_WLAN_INTERFACE $WLAN"
+				fi
+			fi
+		fi
+		
+	done
+
+}
+
+#end of start wlan
+
+
+# for WPS ------------------------------------------------->>
+rtl_start_wps() {
+
+
+	if [ ! -e $BIN_DIR/wscd ]; then
+		echo "wscd not exist $BIN_DIR is " $BIN_DIR  >> $LOG
+		return;
+	fi
+	echo "rtl_start_wps  WLAN is " $WLAN >> $LOG
+	echo "VALID_WLAN_INTERFACE is " $VALID_WLAN_INTERFACE  >> $LOG
+	
+	
+	for WLAN in $VALID_WLAN_INTERFACE ; do
+		EXT=${WLAN#$WLAN_PREFIX[0-9]}
+		EXT=${EXT#-}
+		echo  "EXT=$EXT" >> $LOG
+		if [ "$EXT" = "" ] || [ "$EXT" = "va0" ] || [ "$EXT" = "va1" ] || [ "$EXT" = "vxd" ]; then
+			
+			USE_IWCONTROL=1
+			DEBUG_ON=0
+			_ENABLE_1X=0
+			WSC=1
+			CONFIG_DIR=$CONFIG_ROOT_DIR/$WLAN
+			CONF_FILE=$TOP_VAR_DIR/wsc-$WLAN.conf
+			FiFO_File=$TOP_VAR_DIR/wscd-$WLAN.fifo
+			
+			echo "rtl_start_wps  CONFIG_DIR is " $CONFIG_DIR  >> $LOG
+			
+			GET_WSC_DISABLE=`cat $CONFIG_DIR/wsc_disabled`
+			GET_VALUE_WLAN_DISABLED=`cat $CONFIG_DIR/wlan_disabled`
+			GET_VALUE_WLAN_MODE=`cat $CONFIG_DIR/wlan_mode`
+			GET_WLAN_ENCRYPT=`cat $CONFIG_DIR/encrypt`
+			GET_WLAN_WPA_AUTH_TYPE=`cat $CONFIG_DIR/wpa_auth`
+
+			if [ "$GET_WLAN_ENCRYPT" -lt 2 ]; then
+				GET_ENABLE_1X=`cat $CONFIG_DIR/enable_1x`
+				GET_MAC_AUTH_ENABLED=`cat $CONFIG_DIR/mac_auth_enabled`
+				if [ "$GET_ENABLE_1X" != 0 ] || [ "$GET_MAC_AUTH_ENABLED" != 0 ]; then
+					_ENABLE_1X=1
+				fi
+			else
+				_ENABLE_1X=1
+			fi
+			echo "_ENABLE_1X is " $_ENABLE_1X  >> $LOG
+			if [ "$EXT" = "vxd" ]; then
+				GET_VALUE_WLAN_CURR_MODE=`cat $CONFIG_DIR/wlan_mode`
+				if [ $GET_VALUE_WLAN_CURR_MODE = 1 ]; then
+					GET_WSC_DISABLE = 1
+				fi
+			fi
+			
+			if [ $GET_WSC_DISABLE != 0 ]; then
+				echo "GET_WSC_DISABLE is " $GET_WSC_DISABLE   >> $LOG
+				WSC=0
+			else
+				if  [ "$GET_VALUE_WLAN_DISABLED" != 0 ] || [ "$GET_VALUE_WLAN_MODE" = 2 ]; then
+					echo "GET_VALUE_WLAN_DISABLED is "$GET_VALUE_WLAN_DISABLED  >> $LOG
+					echo "GET_VALUE_WLAN_MODE is "$GET_VALUE_WLAN_MODE  >> $LOG
+					WSC=0
+				else  
+					if [ $GET_VALUE_WLAN_MODE = 1 ]; then	
+						GET_VALUE=`cat $CONFIG_DIR/network_type`
+						if [ "$GET_VALUE" != 0 ]; then
+							echo "network_type is "$GET_VALUE  >> $LOG
+							WSC=0
+						fi
+					fi
+					if [ $GET_VALUE_WLAN_MODE = 0 ]; then	
+						if [ $GET_WLAN_ENCRYPT -lt 2 ] && [ $_ENABLE_1X != 0 ]; then
+							echo "GET_WLAN_ENCRYPT is "$GET_WLAN_ENCRYPT  >> $LOG
+							echo "_ENABLE_1X is "$_ENABLE_1X  >> $LOG
+							WSC=0
+						fi			
+						if [ $GET_WLAN_ENCRYPT -ge 2 ] && [ $GET_WLAN_WPA_AUTH_TYPE = 1 ]; then
+							echo "GET_WLAN_ENCRYPT is "$GET_WLAN_ENCRYPT  >> $LOG
+							echo "GET_WLAN_WPA_AUTH_TYPE is "$GET_WLAN_WPA_AUTH_TYPE  >> $LOG
+							WSC=0
+						fi			
+					fi
+				fi
+			fi
+			echo "-----------------WSC is "$WSC  >> $LOG 
+			if [ $WSC = 1 ]; then
+				if [ ! -f $TOP_VAR_DIR/wps/simplecfgservice.xml ]; then
+					if [ -e $TOP_VAR_DIR/wps ]; then
+						rm $TOP_VAR_DIR/wps -rf
+					fi
+					mkdir $TOP_VAR_DIR/wps
+					#cp $TOP_ETC_DIR/simplecfg*.xml $TOP_VAR_DIR/wps
+					cat $TOP_ETC_DIR/simplecfgservice.xml > $TOP_VAR_DIR/wps/simplecfgservice.xml
+				fi
+
+				if [ $GET_VALUE_WLAN_MODE = 1 ]; then			
+					UPNP=0
+					_CMD="-mode 2"
+				else		
+					GET_WSC_UPNP_ENABLED=`cat $CONFIG_DIR/wsc_upnp_enabled`
+					UPNP=$GET_WSC_UPNP_ENABLED
+					_CMD="-start"
+				fi
+				WPS_MODE=`cat $CONFIG_DIR/wsc_method`
+				if [ "$WPS_MODE" = "1" ]; then
+					_CMD="$_CMD -method 1"
+				fi
+				echo " UPNP is " $UPNP >> $LOG
+				if [ $UPNP = 1 ]; then
+					route del -net 239.255.255.250 netmask 255.255.255.255 dev "$PARAM_BR"
+					route add -net 239.255.255.250 netmask 255.255.255.255 dev "$PARAM_BR"
+				fi
+		
+				if [ "$both_band_ap" = "1" ]; then
+					_CMD="$_CMD -both_band_ap"	
+				fi
+				echo "$BIN_DIR/$FLASH_PROG upd-wsc-conf $TOP_ETC_DIR/wscd.conf $CONF_FILE $WLAN"  >> $LOG
+				$BIN_DIR/$FLASH_PROG upd-wsc-conf $TOP_ETC_DIR/wscd.conf $CONF_FILE $WLAN
+				
+				_CMD="$_CMD -c $CONF_FILE -w $WLAN"
+		
+				if [ $DEBUG_ON = 1 ]; then
+					_CMD="$_CMD -debug"	
+				fi	
+				if [ $USE_IWCONTROL = 1 ]; then
+					_CMD="$_CMD -fi $FiFO_File"
+					DEAMON_CREATED=1
+					echo "DEAMON_CREATED=1" >> $LOG
+				fi
+		
+				if [ -f "$TOP_VAR_DIR/wps_start_pbc" ]; then		
+					_CMD="$_CMD -start_pbc"
+					rm -f $TOP_VAR_DIR/wps_start_pbc
+				fi
+
+				if [ -f "$TOP_VAR_DIR/wps_start_pin" ]; then		
+					_CMD="$_CMD -start"
+					rm -f $TOP_VAR_DIR/wps_start_pin
+				fi	
+				if [ -f "$TOP_VAR_DIR/wps_local_pin" ]; then		
+					PIN=`cat $TOP_VAR_DIR/wps_local_pin`		
+					_CMD="$_CMD -local_pin $PIN"
+					rm -f $TOP_VAR_DIR/wps_local_pin
+				fi
+				if [ -f "$TOP_VAR_DIR/wps_peer_pin" ]; then		
+					PIN=`cat $TOP_VAR_DIR/wps_peer_pin`		
+					_CMD="$_CMD -peer_pin $PIN"
+					rm -f $TOP_VAR_DIR/wps_peer_pin
+				fi				
+				WSC_CMD=$_CMD
+				echo "$BIN_DIR/wscd $WSC_CMD -daemon" >> $LOG
+				$BIN_DIR/wscd $WSC_CMD -daemon
+				echo "<<<<<<<<<<wscd >>>>>>>>>>> over" >> $LOG
+				WAIT=5
+				while [ $USE_IWCONTROL != 0 -a $WAIT != 0 ]		
+				do	
+					if [ -e $FiFO_File ]; then
+						break;
+					else
+						$SLEEP 1
+						WAIT=`expr $WAIT - 1`
+						#WAIT=$((WAIT - 1))
+					fi
+				done
+				if [ $WAIT = 0 ]; then
+					exit $ERROR_WSCD_START_FAIL;
+				fi
+			fi
+		fi
+	done
+}
+#<<--------------------------------------------------- for WPS
+
+rtl_start_iwcontrol() {
+	echo "rtl_start_iwcontrol"  >> $LOG
+	if [ $DEAMON_CREATED = 1 ]; then
+		echo "$BIN_DIR/iwcontrol $VALID_WLAN_INTERFACE $VXD_INTERFACE $POLL"  >> $LOG
+		$BIN_DIR/iwcontrol $VALID_WLAN_INTERFACE $VXD_INTERFACE $POLL
+	fi
+}
+
+rtl_wlanapp() {
+
+	echo "rtl_wlanapp"  >> $LOG
+
+	if [ $PARAM1 = 'kill' ]; then
+		START=0
+	fi
+	rtl_check_wlan_if
+	if [ -z "$WLAN_INTERFACE" ]; then
+		echo "Error in $0, no wlan interface is given!"  >> $LOG
+		exit 0
+	fi
+	rtl_kill_iwcontrol_pid
+	rtl_kill_wlan_pid
+	rm -f $TOP_VAR_DIR/*.fifo
+	if [ $START = 0 ]; then
+		return;
+	fi
+	
+#	rtl_check_wlan_band
+	rtl_start_wlan
+	rtl_start_wps
+	rtl_start_iwcontrol
+}
+
+rtl_wlanapp
diff --git a/ap/app/Script/wifi_script/realtek_wpa2/wps_init.sh b/ap/app/Script/wifi_script/realtek_wpa2/wps_init.sh
new file mode 100755
index 0000000..922935e
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek_wpa2/wps_init.sh
@@ -0,0 +1,103 @@
+#!/bin/sh
+#
+# script file to start network
+#
+# Usage: wps_init.sh {pbc | pin} {PINNUM}
+#
+
+##if [ $# -lt 2 ]; then echo "Usage: $0 {gw | ap} {all | bridge | wan}"; exit 1 ; fi
+ROOT=`nv get wifi_root_dir`
+LOG=$ROOT/wifi/realtek/slog
+
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+
+ID=`nv get wifi_wps_index`
+echo "enter wps init.sh wifi_wps_index=$ID >>>>>>>>" >> $LOG
+ID=`expr $ID - 1`
+echo "enter wps init.sh ID=$ID >>>>>>>>" >> $LOG
+
+if [ "$ID" = "0" ];then
+#CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0
+#WLAN_INTERFACE="wlan0"
+CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0-va$ID
+WLAN_INTERFACE="wlan0-va$ID"
+else
+CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0-va$ID
+WLAN_INTERFACE="wlan0-va$ID"
+fi
+ 
+echo "enter wps init.sh $CONFIG_DIR >>>>>>>>" >> $LOG
+if [ -z "$SCRIPT_DIR" ]; then
+	SCRIPT_DIR=`cat $CONFIG_ROOT_DIR/wifi_script_dir`
+fi
+START_WLAN_APP=$SCRIPT_DIR/wlanapp_8192c.sh
+echo "0" > $CONFIG_DIR/wsc_upnp_enabled
+echo "1" > $CONFIG_DIR/wsc_configured
+echo "0" > $CONFIG_DIR/wsc_disabled
+if [ $1 = "pbc" ]; then
+	echo "2" > $CONFIG_DIR/wsc_method
+else
+	echo "1" > $CONFIG_DIR/wsc_method
+	echo $2 > $CONFIG_DIR/wsc_pin
+fi
+
+echo "<<<<<wps init $1 $2 >>>>>>>>" >> $LOG
+
+
+GET_WLAN_ENCRYPT=`cat $CONFIG_DIR/encrypt`
+if [ "$GET_WLAN_ENCRYPT" = "2" ]; then #WPAPSK
+	echo "2" > $CONFIG_DIR/wsc_auth
+	GET_WLAN_AUTH=`cat $CONFIG_DIR/wpa_cipher`
+	if [ "$GET_WLAN_AUTH" = "1" ]; then #TKIP
+		echo "4" > $CONFIG_DIR/wsc_enc
+	elif [ "$GET_WLAN_AUTH" = "2" ]; then #AES
+		echo "8" > $CONFIG_DIR/wsc_enc
+	else  #TKIPAES
+		echo "12" > $CONFIG_DIR/wsc_enc
+	fi
+	GET_PSK=`cat $CONFIG_DIR/wpa_psk`
+	echo $GET_PSK > $CONFIG_DIR/wsc_psk
+elif [ "$GET_WLAN_ENCRYPT" = "4" ]; then #WPA2PSK
+	echo "32" > $CONFIG_DIR/wsc_auth
+	if [ "$GET_WLAN_AUTH" = "1" ]; then #TKIP
+		echo "4" > $CONFIG_DIR/wsc_enc
+	elif [ "$GET_WLAN_AUTH" = "2" ]; then #AES
+		echo "8" > $CONFIG_DIR/wsc_enc
+	else             #TKIPAES
+		echo "12" > $CONFIG_DIR/wsc_enc
+	fi
+	GET_PSK=`cat $CONFIG_DIR/wpa_psk`
+	echo $GET_PSK > $CONFIG_DIR/wsc_psk
+elif [ "$GET_WLAN_ENCRYPT" = "6" ]; then #WPAPSKWPA2PSK
+	echo "34" > $CONFIG_DIR/wsc_auth
+	if [ "$GET_WLAN_AUTH" = "1" ]; then #TKIP
+		echo "4" > $CONFIG_DIR/wsc_enc
+	elif [ "$GET_WLAN_AUTH" = "2" ]; then #AES
+		echo "8" > $CONFIG_DIR/wsc_enc
+	else  #TKIPAES
+		echo "12" > $CONFIG_DIR/wsc_enc
+	fi
+	GET_PSK=`cat $CONFIG_DIR/wpa_psk`
+	echo $GET_PSK > $CONFIG_DIR/wsc_psk
+else									 #open
+	echo "1" > $CONFIG_DIR/wsc_auth
+	echo "1" > $CONFIG_DIR/wsc_enc
+fi
+
+	
+echo "0" > $CONFIG_DIR/wsc_manual_enabled
+echo "0" > $CONFIG_DIR/wsc_upnp_enabled
+echo "1" > $CONFIG_DIR/wsc_registrar_enabled
+ESSID=`cat $CONFIG_DIR/ssid`
+echo $ESSID > $CONFIG_DIR/wsc_ssid
+echo "0" > $CONFIG_DIR/wsc_configbyextreg
+
+echo -e "\n test to check if loop here\n" >> $LOG
+
+BR_INTERFACE="br0"
+echo -e "\n <<<${START_WLAN_APP##*/} start $WLAN_INTERFACE $BR_INTERFACE>>>" >> $LOG
+$START_WLAN_APP start $WLAN_INTERFACE $BR_INTERFACE 
+ERR=`echo $?`
+if [ $ERR != 0 ]; then
+	exit $ERR;
+fi
diff --git a/ap/app/Script/wifi_script/realtek_wpa2/wps_init1.sh b/ap/app/Script/wifi_script/realtek_wpa2/wps_init1.sh
new file mode 100755
index 0000000..8f2c8b2
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek_wpa2/wps_init1.sh
@@ -0,0 +1,94 @@
+#!/bin/sh
+#
+# script file to start network
+#
+# Usage: wps_init.sh {pbc | pin} {PINNUM}
+#
+
+##if [ $# -lt 2 ]; then echo "Usage: $0 {gw | ap} {all | bridge | wan}"; exit 1 ; fi
+ROOT=`nv get wifi_root_dir`
+LOG=$ROOT/wifi/realtek/slog
+
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+
+ID=`nv get wifi_wps_index`
+echo "enter wps init1.sh wifi_wps_index=$ID >>>>>>>>" >> $LOG
+
+CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0
+WLAN_INTERFACE="wlan0"
+ 
+echo "enter wps init.sh $CONFIG_DIR >>>>>>>>" >> $LOG
+if [ -z "$SCRIPT_DIR" ]; then
+	SCRIPT_DIR=`cat $CONFIG_ROOT_DIR/wifi_script_dir`
+fi
+START_WLAN_APP=$SCRIPT_DIR/wlanapp_8192c.sh
+echo "0" > $CONFIG_DIR/wsc_upnp_enabled
+echo "1" > $CONFIG_DIR/wsc_configured
+echo "0" > $CONFIG_DIR/wsc_disabled
+if [ $1 = "pbc" ]; then
+	echo "2" > $CONFIG_DIR/wsc_method
+else
+	echo "1" > $CONFIG_DIR/wsc_method
+	echo $2 > $CONFIG_DIR/wsc_pin
+fi
+
+echo "<<<<<wps init $1 $2 >>>>>>>>" >> $LOG
+
+
+GET_WLAN_ENCRYPT=`cat $CONFIG_DIR/encrypt`
+if [ "$GET_WLAN_ENCRYPT" = "2" ]; then #WPAPSK
+	echo "2" > $CONFIG_DIR/wsc_auth
+	GET_WLAN_AUTH=`cat $CONFIG_DIR/wpa_cipher`
+	if [ "$GET_WLAN_AUTH" = "1" ]; then #TKIP
+		echo "4" > $CONFIG_DIR/wsc_enc
+	elif [ "$GET_WLAN_AUTH" = "2" ]; then #AES
+		echo "8" > $CONFIG_DIR/wsc_enc
+	else  #TKIPAES
+		echo "12" > $CONFIG_DIR/wsc_enc
+	fi
+	GET_PSK=`cat $CONFIG_DIR/wpa_psk`
+	echo $GET_PSK > $CONFIG_DIR/wsc_psk
+elif [ "$GET_WLAN_ENCRYPT" = "4" ]; then #WPA2PSK
+	echo "32" > $CONFIG_DIR/wsc_auth
+	if [ "$GET_WLAN_AUTH" = "1" ]; then #TKIP
+		echo "4" > $CONFIG_DIR/wsc_enc
+	elif [ "$GET_WLAN_AUTH" = "2" ]; then #AES
+		echo "8" > $CONFIG_DIR/wsc_enc
+	else             #TKIPAES
+		echo "12" > $CONFIG_DIR/wsc_enc
+	fi
+	GET_PSK=`cat $CONFIG_DIR/wpa_psk`
+	echo $GET_PSK > $CONFIG_DIR/wsc_psk
+elif [ "$GET_WLAN_ENCRYPT" = "6" ]; then #WPAPSKWPA2PSK
+	echo "34" > $CONFIG_DIR/wsc_auth
+	if [ "$GET_WLAN_AUTH" = "1" ]; then #TKIP
+		echo "4" > $CONFIG_DIR/wsc_enc
+	elif [ "$GET_WLAN_AUTH" = "2" ]; then #AES
+		echo "8" > $CONFIG_DIR/wsc_enc
+	else  #TKIPAES
+		echo "12" > $CONFIG_DIR/wsc_enc
+	fi
+	GET_PSK=`cat $CONFIG_DIR/wpa_psk`
+	echo $GET_PSK > $CONFIG_DIR/wsc_psk
+else									 #open
+	echo "1" > $CONFIG_DIR/wsc_auth
+	echo "1" > $CONFIG_DIR/wsc_enc
+fi
+
+	
+echo "0" > $CONFIG_DIR/wsc_manual_enabled
+echo "0" > $CONFIG_DIR/wsc_upnp_enabled
+echo "1" > $CONFIG_DIR/wsc_registrar_enabled
+ESSID=`cat $CONFIG_DIR/ssid`
+echo $ESSID > $CONFIG_DIR/wsc_ssid
+echo "0" > $CONFIG_DIR/wsc_configbyextreg
+
+echo -e "\n test to check if loop here\n" >> $LOG
+
+BR_INTERFACE="br0"
+echo -e "\n <<<${START_WLAN_APP##*/} start $WLAN_INTERFACE $BR_INTERFACE>>>" >> $LOG
+$START_WLAN_APP start $WLAN_INTERFACE $BR_INTERFACE 
+ERR=`echo $?`
+if [ $ERR != 0 ]; then
+	exit $ERR;
+fi
diff --git a/ap/app/Script/wifi_script/realtek_wpa2/zte_qrcode_create.sh b/ap/app/Script/wifi_script/realtek_wpa2/zte_qrcode_create.sh
new file mode 100755
index 0000000..06345b7
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek_wpa2/zte_qrcode_create.sh
@@ -0,0 +1,152 @@
+#!/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'
+
+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"
+
+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"
+
+#target_web_dir="$ROOT/securefs/web/img/"
+
+#if [ "$ROOT" = "" ]; then
+#    target_web_dir="/etc_ro/web/img/"
+#else
+#    target_web_dir="$ROOT/etc/web/img/"
+#fi
+
+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'`
+	
+	if [ -n "$auth_wpa" ];then  # wpa
+		wifi_password=`nv get WPAPSK1`     # wifi password
+		qrcode_text='WIFI:T:WPA;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
+	
+	;;
+ 
+ "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'`
+	
+	if [ -n "$auth_wpa" ];then  # wpa
+		qrcode_text='WIFI:T:WPA;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
+	;;
+	
+ "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