Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/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
- > /tmp/running_init
- . /web/FUNCTION_SCRIPT
- TOOL=flash
- GETMIB="$TOOL get"
- LOADDEF="$TOOL default"
- LOADDS="$TOOL reset"
- SETMIB="$TOOL set"
- SET_IP=fixedip.sh
- START_DHCP_SERVER=dhcpd.sh
- START_DHCP_CLIENT=dhcpc.sh
- START_BRIDGE=bridge.sh
- START_WLAN=wlan.sh
- START_WLAN_APP=wlanapp.sh
- WLAN_PREFIX=wlan
- $TOOL test-hwconf
- if [ $2 = 'wlan0-vxd' ];then #EDX patrick add
- if [ "$WLAN_DISABLED" = "0" ]; then
- ifconfig $2 up
- fi
- exit 0
- fi
- if [ $? != 0 ]; then
- echo 'HW configuration invalid, reset default!'
- $LOADDEF
- fi
- $TOOL test-dsconf
- if [ $? != 0 ]; then
- echo 'Default configuration invalid, reset default!'
- $LOADDEF
- fi
- HW_BOARD_ID_VALUE=`$GETMIB HW_BOARD_ID | cut -d= -f 2`
- if [ "$HW_BOARD_ID_VALUE" != '2' ] && [ "$_MODEL_" = "EW7228APN" ]; then
- $SETMIB HW_BOARD_ID 2
- fi
- HW_LED_TYPE_VALUE=`$GETMIB HW_LED_TYPE | cut -d= -f 2`
- if [ "$HW_LED_TYPE_VALUE" = '11' ] && [ "$_MODE_" = "Edimax" ]; then
- $SETMIB HW_LED_TYPE 0
- fi
- DISCONNECT=2
- FIRSTFILE0=/etc/ppp/first0
- FIRSTFILE1=/etc/ppp/first1
- FIRSTFILE2=/etc/ppp/first2
- #START_IAPP_8021X=iappauth.sh
- SEC_LOG=/var/log/security
- #WLAN_IF2=wlan0-vxd
- WLAN_IF2=wlan0
- if [ "$_MSSID_" = "y" ]; then
- /bin/mssid.sh
- . /tmp/mssid.txt
- fi
- # See if flash data is valid
- $TOOL test-hwconf
- if [ $? != 0 ]; then
- echo 'HW configuration invalid, reset default!'
- $LOADDEF
- fi
- $TOOL test-dsconf
- if [ $? != 0 ]; then
- echo 'Default configuration invalid, reset default!'
- $LOADDEF
- fi
- ##########################################################
- #此區域為init前置處理程序,建立一些需立即生效的flash欄位質,
- #在此區中的code並無include flash.inc若要取得flash欄位,
- #所使用script_util.sh的findCurrentFlashValue取得.
- #patrick add
- if [ "$_MODE_" = "Edimax" ]; then
- echo 1 > /proc/sw_nat #Felix
- fi
- if [ "$_MODE_" = "Edimax" ]; then #EDX patrick
- ISDEFAULTVALUE=`flash get IS_RESET_DEFAULT | cut -d "=" -f 2` # 0: default 1: not defaul
- DHCP_ENABLE=`flash get STAINFO | cut -d "=" -f 2` # 3: client selected
- if [ "$ISDEFAULTVALUE" = "0" ] && [ "$_MSSID_" = "y" ]; then
- if [ "$_MODEL_" = "EW7428HCN" ] || [ "$_MODEL_" = "HP5101WN" ]; then #EDX patrick add for init MSSID band
- flash set BAND_1 5
- flash set BAND_2 5
- flash set BAND_3 5
- flash set BAND_4 5
- fi
- if [ "$_ENVLAN_" = "y" ]; then
- flash set VLANID 1
- flash set VLANID_1 1
- flash set VLANID_2 1
- flash set VLANID_3 1
- flash set VLANID_4 1
- fi
- fi
- fi
- if [ "$_SETTING_WIZARD_" = "y" ]; then #Felix
- if [ "$_APMODE_SWITCH_" = "y" ]; then
- if [ -f /proc/apmode_switch ]; then
- APMODE_SWITCH=`cat /proc/apmode_switch`
- APMODE=`flash get AP_MODE | cut -d "=" -f 2`
- echo " ====$APMODE_SWITCH===="
- if [ "$APMODE_SWITCH" = "0" ] && [ "$APMODE" != "0" ]; then #AP Mode
- flash set AP_MODE 0
- flash set IS_RESET_DEFAULT 0
- flash set DHCP 2
- elif [ "$APMODE_SWITCH" = "1" ] && [ "$APMODE" != "6" ]; then #Repeater Mode
- flash set AP_MODE 6
- flash set IS_RESET_DEFAULT 0
- flash set DHCP 2
- elif [ "$APMODE_SWITCH" = "2" ] && [ "$APMODE" != "2" ]; then #Converter Mode
- flash set AP_MODE 2
- flash set IS_RESET_DEFAULT 0
- flash set DHCP 2
- fi
- APMODE=`flash get AP_MODE | cut -d "=" -f 2` #get again
- IPADDR=`flash get IP_ADDR | cut -d "'" -f 2`
- if [ "$IPADDR" = "192.168.2.1" -o "$IPADDR" = "192.168.2.253" -o "$IPADDR" = "192.168.2.254" ]; then
- if [ "$APMODE" = "0" ]; then
- flash set IP_ADDR 192.168.2.1
- elif [ "$APMODE" = "6" ]; then
- flash set IP_ADDR 192.168.2.254
- elif [ "$APMODE" = "2" ]; then
- flash set IP_ADDR 192.168.2.253
- fi
- fi
- fi
- fi
- fi
- if [ "$_MODEL_" = "EW7428HRN" ]; then #check wlan switch
- rfswitch=`cat /proc/rf_switch`
- if [ "$rfswitch" = "1" ]; then
- flash set WLAN_DISABLED 1
- else
- flash set WLAN_DISABLED 0
- fi
- fi
- ##################################################
- #結束前置處理
- ##################################################
- #Reload flash.inc
- rm -f /var/flash.inc
- #include script lib
- . /bin/scriptlib.sh
- if [ "$_LED_SWITCH_" = "y" ]; then
- echo "$LED_SWITCH" > /proc/led_switch
- fi
- if [ "$_LED_SWITCH_" = "y" -o "$_SW_LED_SWITCH_" = "y" ]; then
- if [ "$_LED_SWITCH_" = "y" ]; then
- echo "$LED_SWITCH" > /proc/led_switch
- elif [ "$_SW_LED_SWITCH_" = "y" ]; then
- if [ "$LED_SWITCH" = "0" ]; then
- echo 3 > /proc/wlan_led #0.1:on 2:blink 3:off 4:faster 5:slower
- echo 3 > /proc/power_led #0.1:on 3:off
- #EDX shakim start
- if [ "$_MODEL_" = "EW9458PLN" ];then
- echo 0 > /proc/lan_mode #lan led disable
- else
- #EDX shakim end
- iwpriv wlan0 write_mem dw,b8000040,1,343c30 #lan led off
- fi #EDX shakim
- else
- echo 1 > /proc/power_led
- #EDX shakim start
- if [ "$_MODEL_" = "EW9458PLN" ];then
- echo 1 > /proc/lan_mode #lan led auto
- else
- #EDX shakim end
- iwpriv wlan0 write_mem dw,b8000040,1,343c00 #lan led on
- fi #EDX shakim
- fi
- fi
- fi
- if [ "$_PSK_BY_MD5_" = "y" ]; then
- /bin/md5.sh 12 PSK
- MD5_PSK=`flash get WLAN_WPA_PSK | cut -d "=" -f 2 | cut -d "'" -f 2`
- echo "###### MD5_PSK : $MD5_PSK ######"
- fi
- if [ "$_WPS_LED_" = "y" ] && [ "$_MODEL_" != "EW9458PLN" ]; then #EDX shakim
- echo "LED OFF" > /dev/WPS_LED
- fi
- if [ "$IS_RESET_DEFAULT" = "0" ]; then
- if [ "$_SSID_MAC_" = "y" ]; then
- /bin/setssidmac.sh
- fi
- if [ "$_WEP_MAC_" = "y" ]; then
- /bin/AutoWPA $HW_NIC0_ADDR wepmac
- elif [ "$_WPA_KEY_BY_MAC_" = "y" ]; then
- /bin/AutoWPA $HW_NIC0_ADDR wpamac
- elif [ "$_AUTOWPA_BY_DEFAULT_" = "y" ]; then
- AutoWPAKey=`AutoWPA $HW_NIC0_ADDR`
- flash set WPA2_CIPHER_SUITE 2
- flash set SECURITY_MODE 2
- flash set WLAN_ENCRYPT 6
- flash set WPS_CONFIG_TYPE 1
- flash set WLAN_WPA_CIPHER_SUITE 1
- flash set WLAN_WPA_PSK $AutoWPAKey
- fi
- if [ "$_LED_SWITCH_" = "y" ]; then
- flash set LED_SWITCH 1
- fi
- reloadFlash
- if [ "$_SETTING_WIZARD_" != "y" ]; then #Felix
- flash set IS_RESET_DEFAULT 1
- fi
- fi
- ifconfig wlan0 down 2> /dev/null
- brctl delif br0 wlan0 2> /dev/null
- if [ "$1" = 'ap' ]; then
- ### bridge ($_LAN_IF_+wlan0) confiuration #########
- GATEWAY='false'
- BR_INTERFACE=br0
- WLAN_INTERFACE=wlan0
- BR_LAN1_INTERFACE=eth0
- #BR_LAN2_INTERFACE=$WLAN_INTERFACE
- ##############################################
- fi
- if [ "$1" = 'gw' ]; then
- GATEWAY='true'
- if [ "$OP_MODE" = '1' ];then
- #WAN_INTERFACE=ra$WISP_WAN_ID
- WAN_INTERFACE=$WLAN_IF2
- else
- WAN_INTERFACE=$_WAN_IF_
- fi
- #WAN_INTERFACE=$_WAN_IF_
- BR_INTERFACE=br0
- WLAN_INTERFACE=wlan0
- BR_LAN1_INTERFACE=$_LAN_IF_
- if [ "$OP_MODE" = '1' ];then
- BR_LAN2_INTERFACE=$_WAN_IF_
- #else
- #BR_LAN2_INTERFACE=$WLAN_INTERFACE
- fi
- ##############################################
- fi
- if [ "$2" = 'all' ]; then
- #ENABLE_WAN=1
- ENABLE_BR=1
- elif [ "$2" = 'wan' ]; then
- ENABLE_WAN=1
- ENABLE_BR=0
- elif [ "$2" = 'bridge' ]; then
- # if WISP mode , restart wan for pppoe ,pptp
- if [ "$OP_MODE" = '2' ]; then
- ENABLE_WAN=1
- else
- ENABLE_WAN=0
- fi
- ENABLE_BR=1
- elif [ $2 = 'wlan_app' ]; then
- $START_WLAN_APP start $WLAN_INTERFACE $BR_INTERFACE
- exit 0
- else
- echo "Usage: $0 {all | bridge | wan | wlan_app}"; exit 1
- fi
- # When configured as AP, update DHCP value if it is invalid
- if [ "$_KERNEL_VERSION_26_" = "y" ]; then
- # Cleanup hardware tables
- if [ "$OP_MODE" = '0' ]; then
- # gateway mode
- echo "1" > /proc/hw_nat
- elif [ "$OP_MODE" = '1' ] || [ "$OP_MODE" = '2' ]; then
- # wisp mode
- echo "3" > /proc/hw_nat
- else
- # wisp mode with multiple vlan
- echo "5" > /proc/hw_nat
- fi
- #"Clean conntrack table first before Re-Set Iptables Rules"
- echo 2 > /proc/fast_nat
- #"Finish clean conntrack table......................................."
- fi
- # Set Ethernet0 MAC address
- if [ "$ELAN_MAC_ADDR" = "000000000000" ]; then
- ELAN_MAC_ADDR=$HW_NIC0_ADDR
- fi
- ifconfig $BR_LAN1_INTERFACE down
- ifconfig $BR_LAN1_INTERFACE hw ether $ELAN_MAC_ADDR
- ifconfig $BR_LAN1_INTERFACE up
- #set Ethernet 1 MAC Address for bridge mode and WISP
- #if [ "$OP_MODE" = '1' ]; then
- # if [ "$ELAN_MAC_ADDR" = "000000000000" ]; then
- # ELAN_MAC_ADDR=$HW_NIC1_ADDR
- #
- # fi
- # ifconfig $BR_LAN2_INTERFACE hw ether $ELAN_MAC_ADDR
- #fi
- # Start WLAN interface
- if [ "$_MSSID_" = "y" ]; then
- #iwpriv $WLAN_INTERFACE set_mib vap_enable=1
- NUM=0
- NUM1=0 #EDX Patrick
- while [ $NUM -lt $NUM_INTERFACE -a $ENABLE_BR = 1 ]
- do
- echo 'Initialize '$WLAN_PREFIX$NUM' interface'
- if [ "$_TR_SWITCH_" = "y" ]; then
- iwpriv $WLAN_PREFIX$NUM set_mib trswitch=1 #tr switch
- fi
- $START_WLAN $WLAN_PREFIX$NUM
- VIRTUAL_NUM=0
- while [ $VIRTUAL_NUM -lt $_MSSIDNUM_ -a $ENABLE_BR = 1 ]
- do
- echo 'Initialize '$WLAN_PREFIX$NUM-va$VIRTUAL_NUM' interface'
- if [ "$_TR_SWITCH_" = "y" ]; then
- iwpriv $WLAN_PREFIX$NUM-va$VIRTUAL_NUM set_mib trswitch=1 #tr switch
- fi
- iwpriv $WLAN_PREFIX$NUM-va$VIRTUAL_NUM copy_mib
- NUM1=`expr $NUM1 + 1`
- REL_UP_FLAG=`flash get SSID_MIRROR_$NUM1 | cut -d "=" -f 2` #EDX Patrick , if -va* up, SSID_MIRROR_* != 0
- if [ "$REL_UP_FLAG" != "0" ]; then
- $START_WLAN $WLAN_PREFIX$NUM-va$VIRTUAL_NUM
- fi
- VIRTUAL_NUM=`expr $VIRTUAL_NUM + 1`
- done
- NUM=`expr $NUM + 1`
- done
- if [ "$ENABLE_BR" = "1" ] && [ -n "$WLAN_INTERFACE" ]; then
- if [ "$AP_MODE" = '6' -o "$OP_MODE" != '0' ]; then
- if [ "$OP_MODE" = '1' -o "$AP_MODE" = '6' ]; then
- echo 'Initialize '$WLAN_INTERFACE-vxd' interface'
- if [ "$_TR_SWITCH_" = "y" ]; then
- iwpriv $WLAN_INTERFACE-vxd set_mib trswitch=1 #tr switch
- fi
- $START_WLAN $WLAN_INTERFACE-vxd
- fi
- fi
- fi
- else
- if [ "$ENABLE_BR" = "1" ] && [ -n "$WLAN_INTERFACE" ]; then
- if [ "$_TR_SWITCH_" = "y" ]; then
- iwpriv wlan0 set_mib trswitch=1 #tr switch
- fi
- echo 'Initialize WLAN interface'
- $START_WLAN $WLAN_INTERFACE
- if [ "$AP_MODE" = '6' -o "$OP_MODE" != '0' ]; then
- if [ "$OP_MODE" = '1' -o "$AP_MODE" = '6' ]; then
- echo 'Initialize '$WLAN_INTERFACE-vxd' interface'
- if [ "$_TR_SWITCH_" = "y" ]; then
- iwpriv $WLAN_INTERFACE-vxd set_mib trswitch=1 #tr switch
- fi
- $START_WLAN $WLAN_INTERFACE-vxd
- fi
- fi
- fi
- fi
- if [ "$_MSSID_" = "y" ]; then
- V_WLAN_APP_ENABLE=1
- if [ "$AP_MODE" != 0 ] && [ "$AP_MODE" != 5 ]; then
- V_WLAN_APP_ENABLE=0
- fi
- fi
- # check repeater interface for wlan0
- WLAN_INTERFACE_REPEATER=$WLAN_INTERFACE
- if [ "$GATEWAY" != 'true' ]; then
- # Delete DHCP client process
- kill -9 `pidof udhcpc` 2> /dev/null
- if [ "$ENABLE_BR" = "1" ]; then
- echo 'Setup BRIDGE interface'
- #Initialize bridge interface
- # start Bridge
- if [ "$_MSSID_" = "y" ] ; then
- $START_BRIDGE $BR_INTERFACE $BR_LAN1_INTERFACE $WLAN_INTERFACE $BR_LAN2_INTERFACE $VIRTUAL_WLAN_INTERFACE
- else
- $START_BRIDGE $BR_INTERFACE $BR_LAN1_INTERFACE $WLAN_INTERFACE_REPEATER $BR_LAN2_INTERFACE
- fi
- #Start DHCP & wlanapps.h 802.1x Radius
- kill -9 `pidof udhcpd` 2> /dev/null
- if [ "$DHCP" = '0' ]; then
- $SET_IP $BR_INTERFACE $IP_ADDR $SUBNET_MASK $DEFAULT_GATEWAY
- #$START_WLAN_APP start $WLAN_INTERFACE $BR_INTERFACE
- elif [ "$DHCP" = '2' ]; then
- #sleep 1
- $START_DHCP_SERVER $BR_INTERFACE
- #$START_WLAN_APP start $WLAN_INTERFACE $BR_INTERFACE
- fi
- fi
- fi
- #/bin/zebra.sh &
- #/bin/ripd.sh &
- #/bin/snmpd.sh &
- if [ "$AP_MODE" = "6" ]; then
- if [ "$REPEATER_ENABLED" != "1" ]; then
- flash set REPEATER_ENABLED 1
- fi
- fi
- REPEATER_ENABLED_STATUS=`flash get REPEATER_ENABLED | cut -d = -f2`
- if [ "$REPEATER_ENABLED_STATUS" = '1' ]; then
- ifconfig $WLAN_INTERFACE down
- ifconfig $WLAN_INTERFACE-vxd down
- if [ "$WLAN_DISABLED" = "0" ]; then
- ifconfig $WLAN_INTERFACE up
- ifconfig $WLAN_INTERFACE-vxd up
- fi
- fi
- ifconfig $WLAN_INTERFACE down
- if [ "$CHANNEL" = "0" ]; then #Fix Channel Always select 1 when use auto channel selection
- iwpriv wlan0 set_mib channel=0
- fi
- if [ "$WLAN_DISABLED" = "0" ]; then
- ifconfig $WLAN_INTERFACE up
- fi
- if [ "$_MODE_" = "Edimax" ]; then #EDX patrick, avoid wireless off wlan_led still ON
- if [ "$WLAN_DISABLED" = 1 ]; then
- echo 1 > /proc/sw_led_switch
- else
- echo 0 > /proc/sw_led_switch
- fi
- fi
- #echo "**********************************************************************"
- #echo "* Enable WSC_UPnP *"
- #echo "**********************************************************************"
- # start mini_upnpd shared daemon
- #killall -9 mini_upnpd 2> /dev/null
- #if [ $WPS_ENABLE = 1 ]; then
- # _CMD="$_CMD -wsc /tmp/wscd_config"
- #fi
- #if [ "$_CMD" != "" ]; then
- # mini_upnpd $_CMD &
- #fi
- echo "**********************************************************************"
- echo "* Enable LLTD *"
- echo "**********************************************************************"
- killall lld2d
- /bin/lld2d br0
- echo "**********************************************************************"
- echo "* Enable GPIO Interrupt *"
- echo "**********************************************************************"
- if [ "`pidof reload`" = "" ]; then
- echo 0 > /tmp/mp_mode #1=mp_mode enable
- /bin/reload&
- fi
- if [ -f /bin/agent ]; then
- echo "**********************************************************************"
- echo "* Enable Agent *"
- echo "**********************************************************************"
- killall agent 2> /dev/null
- rm /tmp/agentenabledflag
- /bin/agent&
- fi
- killall cleanlog.sh 2> /dev/null
- if [ "$_IGMPSNOOP_" = "y" ]; then
- echo 1 > /proc/br_igmpsnoop 2>/dev/null
- else
- echo 0 > /proc/br_igmpsnoop 2>/dev/null
- fi
- #Fixed Wireless Client can't get IP from Root AP in WDS & Universal Repeater mode.
- if [ "$AP_MODE" = '5' ] || [ "$AP_MODE" = '6' ]; then
- if [ "$_KERNEL_VERSION_26_" = "y" ]; then
- brctl delif br0 $_LAN_IF_ 2>/dev/null
- brctl delif br0 wlan0 2>/dev/null
- brctl delif br0 wlan0-vxd 2>/dev/null
- brctl addif br0 $_LAN_IF_ 2>/dev/null
- brctl addif br0 wlan0 2>/dev/null
- brctl addif br0 wlan0-vxd 2>/dev/null
- else
- brctl delif br0 $_LAN_IF_ 2>/dev/null
- brctl addif br0 $_LAN_IF_ 2>/dev/null
- fi
- fi
- if [ "$_ENVLAN_" = "y" ]; then
- if [ "$_MODEL_" = "EW7428HCN" ] || [ "$_MODEL_" = "HP5101WN" ]; then
- echo "## init groupID & AP isolation ##"
- MAIN_GROUPID=`flash get VLANID | cut -d "=" -f 2`
- iwpriv $WLAN_INTERFACE set_mib groupID=$MAIN_GROUPID #wlan0 EDX patrick
- # init_vlan.sh #wlan0-va*
- else
- if [ -f /proc/mode_switch ]; then
- MODE_SWITCH=`cat /proc/mode_switch`
- echo " ====$MODE_SWITCH===="
- if [ "$MODE_SWITCH" = "1" ] || [ "$MODE_SWITCH" = "2" ]; then
- flash set VLANID_1 1
- flash set VLANID_2 2
- flash set VLANID_3 3
- flash set VLANID_4 4
- else
- flash set VLANID_1 0
- flash set VLANID_2 0
- flash set VLANID_3 0
- flash set VLANID_4 0
- fi
- # init_vlan.sh
- fi
- fi
- init_vlan.sh
- fi
- if [ "$_MODE_" != "Edimax" ]; then # EDX patrick for iQSetup connent test
- if [ "$AP_MODE" != '6' ]; then
- ifconfig $WLAN_INTERFACE-vxd down
- fi
- fi
- if [ "$_PLC_DUAL_BRIDGE_" = "y" ]; then
- echo 0 > /tmp/PLCdisconnect
- echo 1 > /tmp/full_screen
- brctl delif br1 eth1
- brctl delif br1 eth4
- ifconfig br1 down
- brctl delbr br1
- brctl addbr br1
- if [ "$STP_ENABLED" = '0' ]; then
- brctl setfd br1 0
- brctl stp br1 0
- else
- brctl setfd br1 4
- brctl stp br1 1
- fi
- ifconfig br1 up
- sleep 1
- ifconfig eth1 down
- ifconfig eth4 down
- ifconfig eth1 hw ether $HW_NIC0_ADDR
- ifconfig eth4 hw ether $HW_NIC1_ADDR
- ifconfig eth1 up
- ifconfig eth4 up
- brctl addif br1 eth1
- brctl addif br1 eth4
- fixedip.sh br1 0.0.0.0
- fi
- #check external DHCP server
- if [ "$_AP_WITH_DHCP_CLIENT_" = "y" ] && [ "$IS_RESET_DEFAULT" = "1" ]; then
- if [ "$_MODE_" = "Edimax" ] && [ "$_MODEL_" = "CV7428NS" ]; then
- if [ "$REPEATER_SSID" != "" ] && [ "$DHCP_SWITCH" = "1" ]; then # Add fixed IP function, so check DHCP_SWITCH
- udhcpc -i br0 -a -s /etc/udhcpc/br0.sh &
- fi
- elif [ "$DHCP_CHECK_ENABLED" = '1' ] && [ "$DHCP_SWITCH" = "1" ]; then
- if [ "$_PLC_DUAL_BRIDGE_" = "y" ]; then
- udhcpc -i br1 -a -s /etc/udhcpc/br1.sh &
- else
- udhcpc -i br0 -a -s /etc/udhcpc/br0.sh &
- fi
- else
- if [ "$DHCP" = "0" ]; then
- kill -9 `pidof udhcpd` 2> /dev/null
- fi
- fi
- elif [ "$_AP_WITH_DHCP_CLIENT_" = "y" ] && [ "$_PLC_DUAL_BRIDGE_" = "y" ]; then
- if [ "$DHCP_CHECK_ENABLED" = '1' ] && [ "$DHCP_SWITCH" = "1" ]; then
- udhcpc -i br1 -a -s /etc/udhcpc/br1.sh &
- else
- if [ "$DHCP" = "0" ]; then
- kill -9 `pidof udhcpd` 2> /dev/null
- fi
- fi
- fi
- #patrick
- if [ "$_MDNS_RESPONDER_" = "y" ]; then
- if [ "$_MODE_" = "Edimax" ]; then
- if [ "$_MODEL_" = "CV7428NS" ]; then
- MDNS_NAME="edimax.go"
- else
- MAC_END=`flash get HW_NIC0_ADDR | cut -b 20-25`
- MDNS_NAME="edimax$MAC_END"
- fi
- else
- MAC_END=`flash get HW_NIC0_ADDR | cut -b 22-25`
- MDNS_NAME="repeater$MAC_END"
- fi
- killall mDNSResponderPosix
- hostname $MDNS_NAME
- /bin/mDNSResponderPosix -n $MDNS_NAME -t _http._tcp -p 80 -x "WIRELESS REPEATER"&
- fi
- if [ "$_NETBIOS_RESPONDER_" = "y" ]; then
- killall nbnsd
- if [ "$_MODE_" = "Edimax" ]; then
- if [ "$_MODEL_" = "CV7428NS" ]; then
- NETBIOS_NAME="edimax.go"
- elif [ "$_MODEL_" = "HP5101WN" ]; then
- NETBIOS_NAME="edimax.setup"
- else
- MAC_END=`flash get HW_NIC0_ADDR | cut -b 20-25`
- NETBIOS_NAME="edimax$MAC_END"
- fi
- else
- MAC_END=`flash get HW_NIC0_ADDR | cut -b 22-25`
- NETBIOS_NAME="repeater$MAC_END"
- fi
- /bin/nbnsd -n $NETBIOS_NAME&
- fi
- #patrick end
- if [ "$_DNS_HIJACK_" = "y" ]; then
- echo 1 > /proc/br_dnshijack
- fi
- #ReInit APMIB. Kyle 2008.03.27
- kill -USR1 `pidof webs`
- if [ "$_SREBOOT_BLINK_POWER_" = "y" ] && [ "$IS_REBOOT" = "1" ]; then
- flash set IS_REBOOT 0
- echo LED ON > /dev/PowerLED
- fi
- echo "**********************************************************************"
- echo "* FREE Page,Dentries and Inodes Cache *"
- echo "**********************************************************************"
- sleep 1
- cat /proc/meminfo | grep -i MemFree
- cat /proc/meminfo | grep Cached | grep -v Swap
- case "$OP_MODE" in
- "0")
- route_ip=`route -n | grep $WLAN_IF2 | cut -b 1-16`
- route_mask=`route -n | grep $WLAN_IF2 | cut -b 33-48`
- if [ "`echo $route_ip | tr -d \" \"`" != "" ] && [ "`echo $route_mask | tr -d \" \"`" != "" ]; then
- route del -net $route_ip netmask $route_mask $WLAN_IF2 2>/dev/null
- fi
- ;;
- esac
- route_ip=`route -n | grep wlan0 | cut -b 1-16`
- route_mask=`route -n | grep wlan0 | cut -b 33-48`
- if [ "`echo $route_ip | tr -d \" \"`" != "" ] && [ "`echo $route_mask | tr -d \" \"`" != "" ]; then
- route del -net $route_ip netmask $route_mask wlan0
- fi
- if [ "$_PLC_DUAL_BRIDGE_" != "y" ]; then
- #restart MSSID IAPP & IWCONTROL & MSSID VAP 802.1X RADIUS
- if [ "$V_WLAN_APP_ENABLE" = '1' ] && [ "$_MSSID_" = "y" ]; then
- #sleep 1
- $START_WLAN_APP start $WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE $BR_INTERFACE
- else
- $START_WLAN_APP start $WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE $BR_INTERFACE
- fi
- fi
- if [ "$_AP_WITH_TIMEZONE_" = "y" ]; then
- echo 0 > /var/log/sntp_status
- fi
- if [ "$_WEB_ACCESS_CONTROL_" = "y" ]; then
- echo "$WEB_CONTROL" > /var/access_web.txt
- fi
- if [ "$_USE_DNRD_" = "y" ] && [ "$DNS_MODE" = "0" ]; then
- if [ "$_SETTING_WIZARD_" = "y" ]; then #patrick
- if [ "$IS_RESET_DEFAULT" = "0" ]; then
- /bin/dnrd.sh
- else
- killall dnrd
- fi
- else #patrick end
- /bin/dnrd.sh
- fi
- fi
- if [ "$_PLC_DUAL_BRIDGE_" != "y" ]; then
- /bin/cleanlog.sh &
- fi
- if [ -f /tmp/running_init ]; then
- rm -rf /tmp/running_init
- fi
- #patrick
- if [ "$_UPNP_RESPONDER_" = "y" ]; then
- #killall upnpc
- kill -9 `pidof upnpc`
- /bin/upnpc &
- fi
- #patrick end
- if [ "$_GO_DISCONNECT_PAGE_" = "y" ]; then
- flash set GO_DISCONNECT 0
- fi
- if [ "$_WMM_SWITCH_" = "y" ]; then
- #realBAndValue=`iwpriv wlan0-vxd get_mib band | cut -d ":" -f 2 | cut -f 1 -d " "`
- realBAndValue=`flash get BAND | cut -d "=" -f 2`
- if [ "$realBAndValue" = '2' ] || [ "$realBAndValue" = '5' ]; then # if n band
- flash set WMM_SWITCH 1 # UI lock
- else
- flash set WMM_SWITCH 0 # UI can set WMM
- fi
- fi
- if [ "$_MODE_" = "Edimax" ] && [ "$_MODEL_" = "CV7428NS" ]; then
- echo 0 auto > /proc/link_speed
- echo 1 auto > /proc/link_speed
- echo 2 auto > /proc/link_speed
- echo 3 auto > /proc/link_speed
- echo 4 auto > /proc/link_speed
- fi
- if [ "$_PLC_DUAL_BRIDGE_" = "y" ]; then
- echo 3 > proc/wps_led # 3 off
- fi
- rm -f /tmp/wps_Success
- if [ "$_CONTROL_SIDEBAND_" = "y" ]; then
- echo 1 > /tmp/force_detect_flag # 1:force do Channel & center freq. detection
- fi
- #patrick
- if [ "$_BOA_" = "y" ]; then
- echo "===== Starting BOA WEB SERVER ====="
- else
- killall webs #Felix+20111220 for UPNP_RESPONDER & MDNS_RESPONDER
- fi
- #patrick end
- if [ "$_POWER_SAVING_" = "y" ]; then
- if [ "$POWER_SAVING" = "0" ]; then #all on
- if [ "$_MODE_" = "Edimax" ] && [ "$_MODEL_" = "CV7428NS" ]; then
- WLANLED_CHANGE=`cat /tmp/wps_Success`
- if [ "$WLANLED_CHANGE" != '1' ]; then # if wps connect, wlan led keep on 5 min
- echo 2 > /proc/wlan_led
- fi
- else
- echo 2 > /proc/wlan_led
- fi
- echo 1 > /proc/power_led
- echo 1 > /proc/lan_mode
- elif [ "$POWER_SAVING" = "1" ]; then
- if [ "$LED_SEL" = "0" ]; then #all off
- echo 1 > /proc/sw_led_switch
- echo 3 > /proc/wlan_led
- echo 0 > /proc/lan_mode
- sleep 12
- echo 3 > /proc/power_led
- else
- echo 1 > /proc/sw_led_switch #only power on
- echo 3 > /proc/wlan_led
- echo 1 > /proc/power_led
- echo 0 > /proc/lan_mode
- fi
- fi
- fi
- if [ "$_PLC_DUAL_BRIDGE_" = "y" ]; then
- #Fixed IQsetup set AES, wps can not work
- $START_WLAN_APP start $WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE $BR_INTERFACE
- echo 1 > /proc/disable_l2_table
- echo 4 > /proc/wan_port
- brctl delif br0 wlan0-vxd
- brctl delif br0 eth0
- if [ "$IS_RESET_DEFAULT" = "1" ]; then #no default
- if [ "$DHCP_SWITCH" = "0" ]; then #FollowIp
- echo "DHCP_SWITCH=0 init.sh!!!!!!!!!!!!!!!!!!"
- if [ "`pidof udhcpc`" != "" ]; then
- killall udhcpc
- fi
- sleep 1
- defaultgateway=`flash get DEFAULT_GATEWAY | cut -d "=" -f 2 | cut -d "'" -f 2`
- Wlan0=`brctl show |grep br0|grep wlan0`
- if [ "$Wlan0" != "" ]; then
- /bin/PLC_MSSID.sh
- fi
- sleep 1
- $SET_IP br1 $IP_ADDR $SUBNET_MASK $DEFAULT_GATEWAY
- if [ "$defaultgateway" = "" ]; then
- echo 1 > /tmp/full_screen
- else
- if [ "`arping -I br1 -c 1 $defaultgateway | grep -i Received | cut -d " " -f 2`" = "0" ]; then
- echo 1 > /tmp/full_screen
- else
- echo 0 > /tmp/full_screen
- fi
- fi
- fixedip.sh br0 0.0.0.0
- else #ObtainIp
- echo "DHCP_SWITCH=1 init.sh!!!!!!!!!!!!!!!!!!!"
- if [ "`pidof udhcpc`" = "" ]; then
- udhcpc -i br1 -a -s /etc/udhcpc/br1.sh &
- fi
- sleep 5
- gateway=`route -n | grep ^0.0.0.0 | tr -s " " | cut -d " " -f 2`
- if [ "$gateway" = "" ]; then
- echo "auto IP disconnect no GW!!!!!!!!!!!!!!!!!!"
- echo 1 > /tmp/full_screen
- else
- if [ "`arping -I br1 -c 1 $gateway | grep -i Received | cut -d " " -f 2`" = "0" ]; then
- echo "auto IP disconnect"
- echo 1 > /tmp/full_screen
- else
- echo "auto IP connect"
- Wlan0=`brctl show |grep br0|grep wlan0`
- if [ "$Wlan0" != "" ]; then
- /bin/PLC_MSSID.sh
- fi
- echo 0 > /tmp/full_screen
- fi
- fi
- fi
- fi
- sleep 5
- /bin/cleanlog.sh &
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement