|
|
@ -1,4 +1,5 @@
|
|
|
|
#!/bin/bash /etc/rc.common
|
|
|
|
#!/bin/bash /etc/rc.common
|
|
|
|
|
|
|
|
|
|
|
|
START=99
|
|
|
|
START=99
|
|
|
|
STOP=70
|
|
|
|
STOP=70
|
|
|
|
|
|
|
|
|
|
|
@ -94,23 +95,25 @@ if [ "$encryption" != 1 ]; then
|
|
|
|
apnum=$((apnum + 1))
|
|
|
|
apnum=$((apnum + 1))
|
|
|
|
found=0
|
|
|
|
found=0
|
|
|
|
|
|
|
|
|
|
|
|
# Check all existing wifinetX and remove if SSID matches with $mesh_id and mode is 'ap'
|
|
|
|
# # Check all existing wifinetX and remove if SSID matches with $mesh_id and mode is 'ap'
|
|
|
|
while uci get wireless.wifinet$apnum > /dev/null 2>&1; do
|
|
|
|
# while uci get wireless.wifinet$apnum > /dev/null 2>&1; do
|
|
|
|
existing_ssid=$(uci get wireless.wifinet$apnum.ssid 2> /dev/null)
|
|
|
|
# existing_ssid=$(uci get wireless.wifinet$apnum.ssid 2> /dev/null)
|
|
|
|
existing_mode=$(uci get wireless.wifinet$apnum.mode 2> /dev/null)
|
|
|
|
# existing_mode=$(uci get wireless.wifinet$apnum.mode 2> /dev/null)
|
|
|
|
if [ "$existing_ssid" = "$mesh_id" ] && [ "$existing_mode" = "ap" ]; then
|
|
|
|
# if [ "$existing_ssid" = "$mesh_id" ] && [ "$existing_mode" = "ap" ]; then
|
|
|
|
if [ $found -eq 0 ]; then
|
|
|
|
# if [ $found -eq 0 ]; then
|
|
|
|
found=1
|
|
|
|
# found=1
|
|
|
|
else
|
|
|
|
# else
|
|
|
|
uci delete wireless.wifinet$apnum
|
|
|
|
# uci delete wireless.wifinet$apnum
|
|
|
|
fi
|
|
|
|
# fi
|
|
|
|
fi
|
|
|
|
# fi
|
|
|
|
apnum=$((apnum + 1))
|
|
|
|
# apnum=$((apnum + 1))
|
|
|
|
done
|
|
|
|
# done
|
|
|
|
uci commit wireless
|
|
|
|
# uci commit wireless
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ $found -eq 0 ]; then
|
|
|
|
if [ $found -eq 0 ]; then
|
|
|
|
uci set wireless.mesh_$apall.encryption='none'
|
|
|
|
uci set wireless.mesh_$apall.encryption='none'
|
|
|
|
|
|
|
|
# uci set wireless.mesh_$apall.disabled='0'
|
|
|
|
uci set wireless.wifinet$apnum=wifi-iface
|
|
|
|
uci set wireless.wifinet$apnum=wifi-iface
|
|
|
|
uci set wireless.wifinet$apnum.device=$mesh_apRadio
|
|
|
|
uci set wireless.wifinet$apnum.device=$mesh_apRadio
|
|
|
|
uci set wireless.wifinet$apnum.mode='ap'
|
|
|
|
uci set wireless.wifinet$apnum.mode='ap'
|
|
|
@ -122,6 +125,7 @@ if [ "$encryption" != 1 ]; then
|
|
|
|
uci set wireless.wifinet$apnum.ft_over_ds='0'
|
|
|
|
uci set wireless.wifinet$apnum.ft_over_ds='0'
|
|
|
|
uci set wireless.wifinet$apnum.ft_psk_generate_local='1'
|
|
|
|
uci set wireless.wifinet$apnum.ft_psk_generate_local='1'
|
|
|
|
uci set wireless.wifinet$apnum.network='lan'
|
|
|
|
uci set wireless.wifinet$apnum.network='lan'
|
|
|
|
|
|
|
|
uci set wireless.wifinet$apnum.disabled=0
|
|
|
|
uci commit wireless
|
|
|
|
uci commit wireless
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
@ -130,35 +134,37 @@ else
|
|
|
|
apnum=$((apnum + 1))
|
|
|
|
apnum=$((apnum + 1))
|
|
|
|
found=0
|
|
|
|
found=0
|
|
|
|
|
|
|
|
|
|
|
|
# Check all existing wifinetX and remove if SSID matches with $mesh_id and mode is 'ap'
|
|
|
|
# # Check all existing wifinetX and remove if SSID matches with $mesh_id and mode is 'ap'
|
|
|
|
while uci get wireless.wifinet$apnum > /dev/null 2>&1; do
|
|
|
|
# while uci get wireless.wifinet$apnum > /dev/null 2>&1; do
|
|
|
|
existing_ssid=$(uci get wireless.wifinet$apnum.ssid 2> /dev/null)
|
|
|
|
# existing_ssid=$(uci get wireless.wifinet$apnum.ssid 2> /dev/null)
|
|
|
|
existing_mode=$(uci get wireless.wifinet$apnum.mode 2> /dev/null)
|
|
|
|
# existing_mode=$(uci get wireless.wifinet$apnum.mode 2> /dev/null)
|
|
|
|
if [ "$existing_ssid" = "$mesh_id" ] && [ "$existing_mode" = "ap" ]; then
|
|
|
|
# if [ "$existing_ssid" = "$mesh_id" ] && [ "$existing_mode" = "ap" ]; then
|
|
|
|
if [ $found -eq 0 ]; then
|
|
|
|
# if [ $found -eq 0 ]; then
|
|
|
|
found=1
|
|
|
|
# found=1
|
|
|
|
else
|
|
|
|
# else
|
|
|
|
uci delete wireless.wifinet$apnum
|
|
|
|
# uci delete wireless.wifinet$apnum
|
|
|
|
fi
|
|
|
|
# fi
|
|
|
|
fi
|
|
|
|
# fi
|
|
|
|
apnum=$((apnum + 1))
|
|
|
|
# apnum=$((apnum + 1))
|
|
|
|
done
|
|
|
|
# done
|
|
|
|
uci commit wireless
|
|
|
|
# uci commit wireless
|
|
|
|
|
|
|
|
|
|
|
|
if [ $found -eq 0 ]; then
|
|
|
|
if [ $found -eq 0 ]; then
|
|
|
|
uci set wireless.mesh_$apall.encryption='sae'
|
|
|
|
uci set wireless.mesh_$apall.encryption='sae'
|
|
|
|
|
|
|
|
# uci set wireless.mesh_$apall.disabled='0'
|
|
|
|
uci set wireless.mesh_$apall.key=$key
|
|
|
|
uci set wireless.mesh_$apall.key=$key
|
|
|
|
uci set wireless.wifinet$apnum=wifi-iface
|
|
|
|
uci set wireless.wifinet$apnum=wifi-iface
|
|
|
|
uci set wireless.wifinet$apnum.device=$apall
|
|
|
|
uci set wireless.wifinet$apnum.device=$apall
|
|
|
|
uci set wireless.wifinet$apnum.mode='ap'
|
|
|
|
uci set wireless.wifinet$apnum.mode='ap'
|
|
|
|
uci set wireless.wifinet$apnum.ssid=$mesh_id
|
|
|
|
uci set wireless.wifinet$apnum.ssid=$mesh_id
|
|
|
|
uci set wireless.wifinet$apnum.encryption='psk2'
|
|
|
|
uci set wireless.wifinet$apnum.encryption='sae-mixed'
|
|
|
|
uci set wireless.wifinet$apnum.key=$key
|
|
|
|
uci set wireless.wifinet$apnum.key=$key
|
|
|
|
uci set wireless.wifinet$apnum.ieee80211r='1'
|
|
|
|
uci set wireless.wifinet$apnum.ieee80211r='1'
|
|
|
|
uci set wireless.wifinet$apnum.mobility_domain=$mobility_domain
|
|
|
|
uci set wireless.wifinet$apnum.mobility_domain=$mobility_domain
|
|
|
|
uci set wireless.wifinet$apnum.ft_over_ds='0'
|
|
|
|
uci set wireless.wifinet$apnum.ft_over_ds='0'
|
|
|
|
uci set wireless.wifinet$apnum.ft_psk_generate_local='1'
|
|
|
|
uci set wireless.wifinet$apnum.ft_psk_generate_local='1'
|
|
|
|
uci set wireless.wifinet$apnum.network='lan'
|
|
|
|
uci set wireless.wifinet$apnum.network='lan'
|
|
|
|
|
|
|
|
uci set wireless.wifinet$apnum.disabled=0
|
|
|
|
uci commit wireless
|
|
|
|
uci commit wireless
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
@ -266,6 +272,7 @@ set_easymesh() {
|
|
|
|
add_dawn
|
|
|
|
add_dawn
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ "$ap_mode" = 1 ]; then
|
|
|
|
if [ "$ap_mode" = 1 ]; then
|
|
|
|
# Backup Configurations if your scared
|
|
|
|
# Backup Configurations if your scared
|
|
|
|
cp /etc/config/wireless /etc/config/wireless.backup
|
|
|
|
cp /etc/config/wireless /etc/config/wireless.backup
|
|
|
@ -300,8 +307,11 @@ uci set network.lan.netmask=$netmask
|
|
|
|
uci set network.lan.gateway=$dns
|
|
|
|
uci set network.lan.gateway=$dns
|
|
|
|
uci set system.@system[0].hostname=$gateway
|
|
|
|
uci set system.@system[0].hostname=$gateway
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# First, delete the existing interface list from br-lan
|
|
|
|
|
|
|
|
uci -q delete network.lan.ifname
|
|
|
|
|
|
|
|
|
|
|
|
# Configure LAN bridge and add ethernet interfaces to the bridge
|
|
|
|
# Configure LAN bridge and add ethernet interfaces to the bridge
|
|
|
|
uci set network.lan.ifname='eth0 eth1 wan lan1 lan2 lan3' # Add ethernet interfaces and the kitchen sink here
|
|
|
|
uci set network.lan.ifname='eth0 eth1 wan lan1 lan2' # Add ethernet and wan
|
|
|
|
uci set network.lan.type='bridge'
|
|
|
|
uci set network.lan.type='bridge'
|
|
|
|
|
|
|
|
|
|
|
|
# If you also need to configure the wireless network to be part of the bridge:
|
|
|
|
# If you also need to configure the wireless network to be part of the bridge:
|
|
|
@ -328,7 +338,6 @@ mv /etc/config/firewall /etc/config/firewall.unused
|
|
|
|
#fi
|
|
|
|
#fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
else
|
|
|
|
ap_mode_stop
|
|
|
|
ap_mode_stop
|
|
|
|
fi
|
|
|
|
fi
|
|
|
@ -378,4 +387,5 @@ stop() {
|
|
|
|
|
|
|
|
|
|
|
|
restart() {
|
|
|
|
restart() {
|
|
|
|
set_easymesh
|
|
|
|
set_easymesh
|
|
|
|
|
|
|
|
add_wifi_mesh
|
|
|
|
}
|
|
|
|
}
|