developer | 9037957 | 2024-05-29 17:23:20 +0800 | [diff] [blame^] | 1 | #!/bin/sh |
| 2 | |
| 3 | ########################### FOR BRIDGE MODE SET UP ############################## |
| 4 | |
| 5 | sleep 5 |
| 6 | |
| 7 | BRIDGE_MODE=`dmcli eRT getv Device.X_CISCO_COM_DeviceControl.LanManagementEntry.1.LanMode | grep value | cut -d ':' -f3 | cut -d ' ' -f2` |
| 8 | PRIVATE_WIFI_2G=`cat /nvram/hostapd0.conf | grep interface= | head -n1 | cut -d '=' -f2` |
| 9 | PRIVATE_WIFI_5G=`cat /nvram/hostapd1.conf | grep interface= | head -n1 | cut -d '=' -f2` |
| 10 | echo "BRIDGE MODE is $BRIDGE_MODE" |
| 11 | if [ "$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 |
| 17 | else |
| 18 | echo "Running in Router Mode" |
| 19 | fi |
| 20 | |
| 21 | ################# Make Persistent after reboot ################ |
| 22 | |
| 23 | |
| 24 | ######## SSID status |
| 25 | pri_2g=`cat /var/Get2gssidEnable.txt` |
| 26 | pri_5g=`cat /var/Get5gssidEnable.txt` |
| 27 | pub_2g=`cat /var/GetPub2gssidEnable.txt` |
| 28 | pub_5g=`cat /var/GetPub5gssidEnable.txt` |
| 29 | |
| 30 | ######## Radio Status |
| 31 | Rad_2g=`cat /var/Get2gRadioEnable.txt` |
| 32 | Rad_5g=`cat /var/Get5gRadioEnable.txt` |
| 33 | |
| 34 | ######### Current Wireless interfaces names |
| 35 | pri_wifi_2g=`grep interface= /nvram/hostapd0.conf | cut -d '=' -f2 | head -n 1` |
| 36 | pri_wifi_5g=`grep interface= /nvram/hostapd1.conf | cut -d '=' -f2 | head -n 1` |
| 37 | pub_wifi_2g=`grep interface= /nvram/hostapd4.conf | cut -d '=' -f2 | head -n 1` |
| 38 | pub_wifi_5g=`grep interface= /nvram/hostapd5.conf | cut -d '=' -f2 | head -n 1` |
| 39 | |
| 40 | echo "wireless interface names : $pri_wifi_2g $pri_wifi_5g $pub_wifi_2g $pub_wifi_5g" |
| 41 | |
| 42 | Disable_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 | |
| 50 | if [ $Rad_2g == 0 ] ; then |
| 51 | Disable_WiFi $pri_wifi_2g |
| 52 | Disable_WiFi $pub_wifi_2g |
| 53 | else |
| 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 |
| 60 | fi |
| 61 | |
| 62 | if [ $Rad_5g == 0 ] ; then |
| 63 | Disable_WiFi $pri_wifi_5g |
| 64 | Disable_WiFi $pub_wifi_5g |
| 65 | else |
| 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 |
| 72 | fi |
| 73 | |
| 74 | ##Added workaround fix for LAN connection issue |
| 75 | |
| 76 | ETH_INTERFACE=`ifconfig eth0 | grep eth0 | wc -l` |
| 77 | if [ $ETH_INTERFACE == 1 ] ; then |
| 78 | ifconfig eth0 down |
| 79 | ip link set dev eth0 name eth1 |
| 80 | fi |
| 81 | |
| 82 | ETH_INTERFACE=`ifconfig eth1 | grep eth1 | wc -l` |
| 83 | if [ $ETH_INTERFACE == 1 ] ; then |
| 84 | ifconfig eth1 up |
| 85 | brctl addif brlan0 eth1 |
| 86 | fi |