blob: 6534722c16dcb43adc97ad81017eb2c1a108fab0 [file] [log] [blame]
developer90379572024-05-29 17:23:20 +08001#!/bin/sh
2
3########################### FOR BRIDGE MODE SET UP ##############################
4
5sleep 5
6
7BRIDGE_MODE=`dmcli eRT getv Device.X_CISCO_COM_DeviceControl.LanManagementEntry.1.LanMode | grep value | cut -d ':' -f3 | cut -d ' ' -f2`
8PRIVATE_WIFI_2G=`cat /nvram/hostapd0.conf | grep interface= | head -n1 | cut -d '=' -f2`
9PRIVATE_WIFI_5G=`cat /nvram/hostapd1.conf | grep interface= | head -n1 | cut -d '=' -f2`
10echo "BRIDGE MODE is $BRIDGE_MODE"
11if [ "$BRIDGE_MODE" = "bridge-static" ] ; then
12 sysevent set lan-stop
13 hostapd_cli -i$PRIVATE_WIFI_2G disable
14 hostapd_cli -i$PRIVATE_WIFI_5G disable
15 ps aux | grep hostapd1 | grep -v grep | awk '{print $1}' | xargs kill -9
16 ps aux | grep hostapd0 | grep -v grep | awk '{print $1}' | xargs kill -9
17else
18 echo "Running in Router Mode"
19fi
20
21################# Make Persistent after reboot ################
22
23
24######## SSID status
25pri_2g=`cat /var/Get2gssidEnable.txt`
26pri_5g=`cat /var/Get5gssidEnable.txt`
27pub_2g=`cat /var/GetPub2gssidEnable.txt`
28pub_5g=`cat /var/GetPub5gssidEnable.txt`
29
30######## Radio Status
31Rad_2g=`cat /var/Get2gRadioEnable.txt`
32Rad_5g=`cat /var/Get5gRadioEnable.txt`
33
34######### Current Wireless interfaces names
35pri_wifi_2g=`grep interface= /nvram/hostapd0.conf | cut -d '=' -f2 | head -n 1`
36pri_wifi_5g=`grep interface= /nvram/hostapd1.conf | cut -d '=' -f2 | head -n 1`
37pub_wifi_2g=`grep interface= /nvram/hostapd4.conf | cut -d '=' -f2 | head -n 1`
38pub_wifi_5g=`grep interface= /nvram/hostapd5.conf | cut -d '=' -f2 | head -n 1`
39
40echo "wireless interface names : $pri_wifi_2g $pri_wifi_5g $pub_wifi_2g $pub_wifi_5g"
41
42Disable_WiFi ()
43{
44 wifi_status=`ifconfig $1 | grep RUNNING | wc -l`
45 if [ $wifi_status == 1 ] ; then
46 hostapd_cli -i$1 disable
47 fi
48}
49
50if [ $Rad_2g == 0 ] ; then
51 Disable_WiFi $pri_wifi_2g
52 Disable_WiFi $pub_wifi_2g
53else
54 if [ $pub_2g == 0 ] ; then
55 Disable_WiFi $pub_wifi_2g
56 fi
57 if [ $pri_2g == 0 ] ; then
58 Disable_WiFi $pri_wifi_2g
59 fi
60fi
61
62if [ $Rad_5g == 0 ] ; then
63 Disable_WiFi $pri_wifi_5g
64 Disable_WiFi $pub_wifi_5g
65else
66 if [ $pri_5g == 0 ] ; then
67 Disable_WiFi $pri_wifi_5g
68 fi
69 if [ $pub_5g == 0 ] ; then
70 Disable_WiFi $pub_wifi_5g
71 fi
72fi
73
74##Added workaround fix for LAN connection issue
75
76ETH_INTERFACE=`ifconfig eth0 | grep eth0 | wc -l`
77if [ $ETH_INTERFACE == 1 ] ; then
78 ifconfig eth0 down
79 ip link set dev eth0 name eth1
80fi
81
82ETH_INTERFACE=`ifconfig eth1 | grep eth1 | wc -l`
83if [ $ETH_INTERFACE == 1 ] ; then
84 ifconfig eth1 up
85 brctl addif brlan0 eth1
86fi