|
|
@ -1,63 +1,64 @@
|
|
|
|
#!/bin/bash /etc/rc.common
|
|
|
|
#!/bin/bash /etc/rc.common
|
|
|
|
|
|
|
|
|
|
|
|
START=99
|
|
|
|
START=99
|
|
|
|
STOP=70
|
|
|
|
STOP=70
|
|
|
|
|
|
|
|
|
|
|
|
load_easymesh_config() {
|
|
|
|
load_easymesh_config() {
|
|
|
|
enable=$(uci -q get easymesh.config.enabled)
|
|
|
|
enable=$(uci -q get easymesh.config.enabled)
|
|
|
|
mesh_bat0=$(uci -q get network.bat0)
|
|
|
|
mesh_bat0=$(uci -q get network.bat0)
|
|
|
|
ap_mode=$(uci -q get easymesh.config.ap_mode)
|
|
|
|
ap_mode=$(uci -q get easymesh.config.ap_mode)
|
|
|
|
lan=$(uci -q get network.lan.ifname)
|
|
|
|
lan=$(uci -q get network.lan.ifname)
|
|
|
|
ipaddr=$(uci -q get easymesh.config.ipaddr)
|
|
|
|
ipaddr=$(uci -q get easymesh.config.ipaddr)
|
|
|
|
netmask=$(uci -q get easymesh.config.netmask)
|
|
|
|
netmask=$(uci -q get easymesh.config.netmask)
|
|
|
|
gateway=$(uci -q get easymesh.config.gateway)
|
|
|
|
gateway=$(uci -q get easymesh.config.gateway)
|
|
|
|
dns=$(uci -q get easymesh.config.dns)
|
|
|
|
dns=$(uci -q get easymesh.config.dns)
|
|
|
|
ap_ipaddr=$(uci -q get network.lan.ipaddr)
|
|
|
|
ap_ipaddr=$(uci -q get network.lan.ipaddr)
|
|
|
|
ap_ipaddr1=$(sed -n '1p' /etc/easymesh 2>/dev/null)
|
|
|
|
ap_ipaddr1=$(sed -n '1p' /etc/easymesh 2>/dev/null)
|
|
|
|
apRadio=$(uci -q get easymesh.config.apRadio)
|
|
|
|
apRadio=$(uci -q get easymesh.config.apRadio)
|
|
|
|
kvr=$(uci -q get easymesh.config.kvr)
|
|
|
|
kvr=$(uci -q get easymesh.config.kvr)
|
|
|
|
iapp=$(uci -q get easymesh.config.iapp)
|
|
|
|
iapp=$(uci -q get easymesh.config.iapp)
|
|
|
|
brlan=$(uci -q get network.@device[0].name)
|
|
|
|
brlan=$(uci -q get network.@device[0].name)
|
|
|
|
role=$(uci -q get easymesh.config.role)
|
|
|
|
role=$(uci -q get easymesh.config.role)
|
|
|
|
backbone=$(uci get easymesh.@easymesh[0].backbone)
|
|
|
|
backbone=$(uci get easymesh.@easymesh[0].backbone)
|
|
|
|
apname=$(uci get easymesh.@easymesh[0].apname)
|
|
|
|
apname=$(uci get easymesh.@easymesh[0].apname)
|
|
|
|
appass=$(uci get easymesh.@easymesh[0].appass)
|
|
|
|
appass=$(uci get easymesh.@easymesh[0].appass)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ap_mode_stop() {
|
|
|
|
ap_mode_stop() {
|
|
|
|
ap_ipaddr=$(uci -q get network.lan.ipaddr)
|
|
|
|
ap_ipaddr=$(uci -q get network.lan.ipaddr)
|
|
|
|
ap_ipaddr1=$(sed -n '1p' /etc/easymesh 2>/dev/null)
|
|
|
|
ap_ipaddr1=$(sed -n '1p' /etc/easymesh 2>/dev/null)
|
|
|
|
dns1=$(sed -n '2p' /etc/easymesh 2>/dev/null)
|
|
|
|
dns1=$(sed -n '2p' /etc/easymesh 2>/dev/null)
|
|
|
|
if [ "$ap_ipaddr" = "$ap_ipaddr1" ]; then
|
|
|
|
if [ "$ap_ipaddr" = "$ap_ipaddr1" ]; then
|
|
|
|
uci -q delete network.lan.gateway
|
|
|
|
uci -q delete network.lan.gateway
|
|
|
|
uci -q del_list network.lan.dns=$dns1
|
|
|
|
uci -q del_list network.lan.dns=$dns1
|
|
|
|
uci commit network
|
|
|
|
uci commit network
|
|
|
|
|
|
|
|
|
|
|
|
echo "" >/etc/easymesh
|
|
|
|
echo "" >/etc/easymesh
|
|
|
|
|
|
|
|
|
|
|
|
uci -q delete dhcp.lan.dynamicdhcp
|
|
|
|
uci -q delete dhcp.lan.dynamicdhcp
|
|
|
|
uci -q delete dhcp.lan.ignore
|
|
|
|
uci -q delete dhcp.lan.ignore
|
|
|
|
uci commit dhcp
|
|
|
|
uci commit dhcp
|
|
|
|
|
|
|
|
|
|
|
|
/etc/init.d/odhcpd enable && /etc/init.d/odhcpd start
|
|
|
|
/etc/init.d/odhcpd enable && /etc/init.d/odhcpd start
|
|
|
|
/etc/init.d/firewall enable && /etc/init.d/firewall start >/dev/null 2>&1
|
|
|
|
/etc/init.d/firewall enable && /etc/init.d/firewall start >/dev/null 2>&1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
add_wifi_mesh() {
|
|
|
|
add_wifi_mesh() {
|
|
|
|
mesh_nwi_mesh=$(uci -q get network.nwi_mesh_${apall})
|
|
|
|
mesh_nwi_mesh=$(uci -q get network.nwi_mesh_${apall})
|
|
|
|
mesh_apRadio=$(uci -q get wireless.mesh_${apall}.device)
|
|
|
|
mesh_apRadio=$(uci -q get wireless.mesh_${apall}.device)
|
|
|
|
mesh_mesh=$(uci -q get wireless.mesh_${apall})
|
|
|
|
mesh_mesh=$(uci -q get wireless.mesh_${apall})
|
|
|
|
mesh_id=$(uci -q get easymesh.config.mesh_id)
|
|
|
|
mesh_id=$(uci -q get easymesh.config.mesh_id)
|
|
|
|
mobility_domain=$(uci -q get easymesh.config.mobility_domain)
|
|
|
|
mobility_domain=$(uci -q get easymesh.config.mobility_domain)
|
|
|
|
key=$(uci -q get easymesh.config.key)
|
|
|
|
key=$(uci -q get easymesh.config.key)
|
|
|
|
encryption=$(uci -q get easymesh.config.encryption)
|
|
|
|
encryption=$(uci -q get easymesh.config.encryption)
|
|
|
|
|
|
|
|
|
|
|
|
if [ "$mesh_nwi_mesh" != "interface" ]; then
|
|
|
|
if [ "$mesh_nwi_mesh" != "interface" ]; then
|
|
|
|
uci set network.nwi_mesh_$apall=interface
|
|
|
|
uci set network.nwi_mesh_$apall=interface
|
|
|
|
uci set network.nwi_mesh_$apall.proto='batadv_hardif'
|
|
|
|
uci set network.nwi_mesh_$apall.proto='batadv_hardif'
|
|
|
|
uci set network.nwi_mesh_$apall.master='bat0'
|
|
|
|
uci set network.nwi_mesh_$apall.master='bat0'
|
|
|
|
uci set network.nwi_mesh_$apall.mtu='1536'
|
|
|
|
uci set network.nwi_mesh_$apall.mtu='1536'
|
|
|
|
# adding batman to the 'lan' zone in fw
|
|
|
|
# adding batman to the 'lan' zone in fw
|
|
|
|
uci del_list firewall.lan.network="bat0"
|
|
|
|
uci del_list firewall.lan.network="bat0"
|
|
|
|
uci add_list firewall.lan.network='bat0'
|
|
|
|
uci add_list firewall.lan.network='bat0'
|
|
|
|
uci del_list firewall.lan.network="nwi_mesh_$apall"
|
|
|
|
uci del_list firewall.lan.network="nwi_mesh_$apall"
|
|
|
@ -65,28 +66,28 @@ add_wifi_mesh() {
|
|
|
|
uci commit network
|
|
|
|
uci commit network
|
|
|
|
uci commit firewall
|
|
|
|
uci commit firewall
|
|
|
|
/etc/init.d/firewall restart
|
|
|
|
/etc/init.d/firewall restart
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ "$mesh_mesh" != "wifi-iface" ]; then
|
|
|
|
if [ "$mesh_mesh" != "wifi-iface" ]; then
|
|
|
|
uci set wireless.mesh_$apall=wifi-iface
|
|
|
|
uci set wireless.mesh_$apall=wifi-iface
|
|
|
|
uci set wireless.mesh_$apall.device=$apall
|
|
|
|
uci set wireless.mesh_$apall.device=$apall
|
|
|
|
uci set wireless.mesh_$apall.ifname=mesh_${apall}
|
|
|
|
uci set wireless.mesh_$apall.ifname=mesh_${apall}
|
|
|
|
uci set wireless.mesh_$apall.network=nwi_mesh_${apall}
|
|
|
|
uci set wireless.mesh_$apall.network=nwi_mesh_${apall}
|
|
|
|
uci set wireless.mesh_$apall.mode='mesh'
|
|
|
|
uci set wireless.mesh_$apall.mode='mesh'
|
|
|
|
uci set wireless.mesh_$apall.mesh_id=$mesh_id
|
|
|
|
uci set wireless.mesh_$apall.mesh_id=$mesh_id
|
|
|
|
uci set wireless.mesh_$apall.mesh_fwding='1'
|
|
|
|
uci set wireless.mesh_$apall.mesh_fwding='1'
|
|
|
|
uci set wireless.mesh_$apall.mesh_ttl='1'
|
|
|
|
uci set wireless.mesh_$apall.mesh_ttl='1'
|
|
|
|
uci set wireless.mesh_$apall.mcast_rate='24000'
|
|
|
|
uci set wireless.mesh_$apall.mcast_rate='24000'
|
|
|
|
uci set wireless.mesh_$apall.disabled='0'
|
|
|
|
uci set wireless.mesh_$apall.disabled='0'
|
|
|
|
uci commit wireless
|
|
|
|
uci commit wireless
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ "$mesh_mesh" = "wifi-iface" ]; then
|
|
|
|
if [ "$mesh_mesh" = "wifi-iface" ]; then
|
|
|
|
if [ "$mesh_apRadio" != "$apall" ]; then
|
|
|
|
if [ "$mesh_apRadio" != "$apall" ]; then
|
|
|
|
uci set wireless.mesh_$apall.device=$apall
|
|
|
|
uci set wireless.mesh_$apall.device=$apall
|
|
|
|
uci commit wireless
|
|
|
|
uci commit wireless
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ "$encryption" != 1 ]; then
|
|
|
|
if [ "$encryption" != 1 ]; then
|
|
|
@ -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
|
|
|
@ -166,104 +172,105 @@ fi
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
add_kvr() {
|
|
|
|
add_kvr() {
|
|
|
|
kvr=$(uci -q get easymesh.config.kvr)
|
|
|
|
kvr=$(uci -q get easymesh.config.kvr)
|
|
|
|
mobility_domain=$(uci -q get easymesh.config.mobility_domain)
|
|
|
|
mobility_domain=$(uci -q get easymesh.config.mobility_domain)
|
|
|
|
iapp=$(uci -q get easymesh.config.iapp)
|
|
|
|
iapp=$(uci -q get easymesh.config.iapp)
|
|
|
|
for apall in $(uci -X show wireless | grep wifi-device | awk -F'[.=]' '{print $2}'); do
|
|
|
|
for apall in $(uci -X show wireless | grep wifi-device | awk -F'[.=]' '{print $2}'); do
|
|
|
|
if [ "$kvr" = 1 ]; then
|
|
|
|
if [ "$kvr" = 1 ]; then
|
|
|
|
uci set wireless.default_$apall.ieee80211k='1'
|
|
|
|
uci set wireless.default_$apall.ieee80211k='1'
|
|
|
|
uci set wireless.default_$apall.rrm_neighbor_report='1'
|
|
|
|
uci set wireless.default_$apall.rrm_neighbor_report='1'
|
|
|
|
uci set wireless.default_$apall.rrm_beacon_report='1'
|
|
|
|
uci set wireless.default_$apall.rrm_beacon_report='1'
|
|
|
|
uci set wireless.default_$apall.ieee80211v='1'
|
|
|
|
uci set wireless.default_$apall.ieee80211v='1'
|
|
|
|
uci set wireless.default_$apall.bss_transition='1'
|
|
|
|
uci set wireless.default_$apall.bss_transition='1'
|
|
|
|
uci set wireless.default_$apall.ieee80211r='1'
|
|
|
|
uci set wireless.default_$apall.ieee80211r='1'
|
|
|
|
uci set wireless.default_$apall.encryption='sae'
|
|
|
|
uci set wireless.default_$apall.encryption='sae'
|
|
|
|
uci set wireless.default_$apall.mobility_domain=$mobility_domain
|
|
|
|
uci set wireless.default_$apall.mobility_domain=$mobility_domain
|
|
|
|
uci set wireless.default_$apall.ft_over_ds='1'
|
|
|
|
uci set wireless.default_$apall.ft_over_ds='1'
|
|
|
|
uci set wireless.default_$apall.ft_psk_generate_local='1'
|
|
|
|
uci set wireless.default_$apall.ft_psk_generate_local='1'
|
|
|
|
uci commit wireless
|
|
|
|
uci commit wireless
|
|
|
|
else
|
|
|
|
else
|
|
|
|
uci -q delete wireless.default_$apall.ieee80211k
|
|
|
|
uci -q delete wireless.default_$apall.ieee80211k
|
|
|
|
uci -q delete wireless.default_$apall.ieee80211v
|
|
|
|
uci -q delete wireless.default_$apall.ieee80211v
|
|
|
|
uci -q delete wireless.default_$apall.ieee80211r
|
|
|
|
uci -q delete wireless.default_$apall.ieee80211r
|
|
|
|
uci commit wireless
|
|
|
|
uci commit wireless
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if [ "$iapp" = 1 ]; then
|
|
|
|
if [ "$iapp" = 1 ]; then
|
|
|
|
uci set wireless.default_$apall.iapp_interface='br-lan'
|
|
|
|
uci set wireless.default_$apall.iapp_interface='br-lan'
|
|
|
|
uci commit wireless
|
|
|
|
uci commit wireless
|
|
|
|
else
|
|
|
|
else
|
|
|
|
uci -q delete wireless.default_$apall.iapp_interface
|
|
|
|
uci -q delete wireless.default_$apall.iapp_interface
|
|
|
|
uci commit wireless
|
|
|
|
uci commit wireless
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
done
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
add_dawn() {
|
|
|
|
add_dawn() {
|
|
|
|
kvr=$(uci -q get easymesh.config.kvr)
|
|
|
|
kvr=$(uci -q get easymesh.config.kvr)
|
|
|
|
rssi_val=$(uci -q get easymesh.config.rssi_val)
|
|
|
|
rssi_val=$(uci -q get easymesh.config.rssi_val)
|
|
|
|
low_rssi_val=$(uci -q get easymesh.config.low_rssi_val)
|
|
|
|
low_rssi_val=$(uci -q get easymesh.config.low_rssi_val)
|
|
|
|
|
|
|
|
|
|
|
|
if [ "$kvr" = 1 ]; then
|
|
|
|
if [ "$kvr" = 1 ]; then
|
|
|
|
uci set dawn.@metric[0].rssi_val=$rssi_val
|
|
|
|
uci set dawn.@metric[0].rssi_val=$rssi_val
|
|
|
|
uci set dawn.@metric[0].low_rssi_val=$low_rssi_val
|
|
|
|
uci set dawn.@metric[0].low_rssi_val=$low_rssi_val
|
|
|
|
uci commit dawn
|
|
|
|
uci commit dawn
|
|
|
|
/etc/init.d/dawn enable && /etc/init.d/dawn start
|
|
|
|
/etc/init.d/dawn enable && /etc/init.d/dawn start
|
|
|
|
else
|
|
|
|
else
|
|
|
|
/etc/init.d/dawn stop && /etc/init.d/dawn disable
|
|
|
|
/etc/init.d/dawn stop && /etc/init.d/dawn disable
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
set_easymesh() {
|
|
|
|
set_easymesh() {
|
|
|
|
load_easymesh_config
|
|
|
|
load_easymesh_config
|
|
|
|
if [ "$enable" = 1 ]; then
|
|
|
|
if [ "$enable" = 1 ]; then
|
|
|
|
if [ "$mesh_bat0" != "interface" ]; then
|
|
|
|
if [ "$mesh_bat0" != "interface" ]; then
|
|
|
|
uci set network.bat0=interface
|
|
|
|
uci set network.bat0=interface
|
|
|
|
uci set network.bat0.proto='batadv'
|
|
|
|
uci set network.bat0.proto='batadv'
|
|
|
|
uci set network.bat0.routing_algo='BATMAN_IV'
|
|
|
|
uci set network.bat0.routing_algo='BATMAN_IV'
|
|
|
|
uci set network.bat0.aggregated_ogms='1'
|
|
|
|
uci set network.bat0.aggregated_ogms='1'
|
|
|
|
uci set network.bat0.ap_isolation='0'
|
|
|
|
uci set network.bat0.ap_isolation='0'
|
|
|
|
uci set network.bat0.bonding='1'
|
|
|
|
uci set network.bat0.bonding='1'
|
|
|
|
uci set network.bat0.bridge_loop_avoidance='1'
|
|
|
|
uci set network.bat0.bridge_loop_avoidance='1'
|
|
|
|
uci set network.bat0.distributed_arp_table='1'
|
|
|
|
uci set network.bat0.distributed_arp_table='1'
|
|
|
|
uci set network.bat0.fragmentation='1'
|
|
|
|
uci set network.bat0.fragmentation='1'
|
|
|
|
# uci set network.bat0.gw_bandwidth='10000/2000'
|
|
|
|
# uci set network.bat0.gw_bandwidth='10000/2000'
|
|
|
|
# uci set network.bat0.gw_sel_class='20'
|
|
|
|
# uci set network.bat0.gw_sel_class='20'
|
|
|
|
uci set network.bat0.hop_penalty='30'
|
|
|
|
uci set network.bat0.hop_penalty='30'
|
|
|
|
uci set network.bat0.isolation_mark='0x00000000/0x00000000'
|
|
|
|
uci set network.bat0.isolation_mark='0x00000000/0x00000000'
|
|
|
|
uci set network.bat0.log_level='0'
|
|
|
|
uci set network.bat0.log_level='0'
|
|
|
|
uci set network.bat0.multicast_fanout='16'
|
|
|
|
uci set network.bat0.multicast_fanout='16'
|
|
|
|
uci set network.bat0.multicast_mode='1'
|
|
|
|
uci set network.bat0.multicast_mode='1'
|
|
|
|
uci set network.bat0.network_coding='0'
|
|
|
|
uci set network.bat0.network_coding='0'
|
|
|
|
uci set network.bat0.orig_interval='1000'
|
|
|
|
uci set network.bat0.orig_interval='1000'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ "$role" = "server" ]; then
|
|
|
|
if [ "$role" = "server" ]; then
|
|
|
|
uci set network.bat0.gw_mode='server'
|
|
|
|
uci set network.bat0.gw_mode='server'
|
|
|
|
elif [ "$role" = "client" ]; then
|
|
|
|
elif [ "$role" = "client" ]; then
|
|
|
|
uci set network.bat0.gw_mode='client'
|
|
|
|
uci set network.bat0.gw_mode='client'
|
|
|
|
else
|
|
|
|
else
|
|
|
|
uci set network.bat0.gw_mode='off'
|
|
|
|
uci set network.bat0.gw_mode='off'
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ "$brlan" = "br-lan" ]; then
|
|
|
|
if [ "$brlan" = "br-lan" ]; then
|
|
|
|
uci add_list network.@device[0].ports='bat0'
|
|
|
|
uci add_list network.@device[0].ports='bat0'
|
|
|
|
else
|
|
|
|
else
|
|
|
|
uci set network.lan.ifname="${lan} bat0"
|
|
|
|
uci set network.lan.ifname="${lan} bat0"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
uci commit network
|
|
|
|
uci commit network
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ "$apRadio" = "all" ]; then
|
|
|
|
if [ "$apRadio" = "all" ]; then
|
|
|
|
for apall in $(uci -X show wireless | grep wifi-device | awk -F'[.=]' '{print $2}'); do
|
|
|
|
for apall in $(uci -X show wireless | grep wifi-device | awk -F'[.=]' '{print $2}'); do
|
|
|
|
add_wifi_mesh
|
|
|
|
add_wifi_mesh
|
|
|
|
done
|
|
|
|
done
|
|
|
|
else
|
|
|
|
else
|
|
|
|
apall=$apRadio
|
|
|
|
apall=$apRadio
|
|
|
|
add_wifi_mesh
|
|
|
|
add_wifi_mesh
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
add_kvr
|
|
|
|
add_kvr
|
|
|
|
add_dawn
|
|
|
|
add_dawn
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ "$ap_mode" = 1 ]; then
|
|
|
|
if [ "$ap_mode" = 1 ]; then
|
|
|
@ -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,54 +338,54 @@ mv /etc/config/firewall /etc/config/firewall.unused
|
|
|
|
#fi
|
|
|
|
#fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
else
|
|
|
|
ap_mode_stop
|
|
|
|
ap_mode_stop
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ "$mesh_bat0" = "interface" ]; then
|
|
|
|
if [ "$mesh_bat0" = "interface" ]; then
|
|
|
|
uci -q delete network.bat0
|
|
|
|
uci -q delete network.bat0
|
|
|
|
if [ "$brlan" = "br-lan" ]; then
|
|
|
|
if [ "$brlan" = "br-lan" ]; then
|
|
|
|
uci -q del_list network.@device[0].ports='bat0'
|
|
|
|
uci -q del_list network.@device[0].ports='bat0'
|
|
|
|
else
|
|
|
|
else
|
|
|
|
sed -i 's/ bat0//' /etc/config/network
|
|
|
|
sed -i 's/ bat0//' /etc/config/network
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
uci commit network
|
|
|
|
uci commit network
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
for apall in $(uci -X show wireless | grep wifi-device | awk -F'[.=]' '{print $2}'); do
|
|
|
|
for apall in $(uci -X show wireless | grep wifi-device | awk -F'[.=]' '{print $2}'); do
|
|
|
|
mesh_nwi_mesh=$(uci -q get network.nwi_mesh_${apall})
|
|
|
|
mesh_nwi_mesh=$(uci -q get network.nwi_mesh_${apall})
|
|
|
|
mesh_mesh=$(uci -q get wireless.mesh_${apall})
|
|
|
|
mesh_mesh=$(uci -q get wireless.mesh_${apall})
|
|
|
|
|
|
|
|
|
|
|
|
if [ "$mesh_nwi_mesh" = "interface" ]; then
|
|
|
|
if [ "$mesh_nwi_mesh" = "interface" ]; then
|
|
|
|
uci -q delete network.nwi_mesh_$apall
|
|
|
|
uci -q delete network.nwi_mesh_$apall
|
|
|
|
uci commit network
|
|
|
|
uci commit network
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ "$mesh_mesh" = "wifi-iface" ]; then
|
|
|
|
if [ "$mesh_mesh" = "wifi-iface" ]; then
|
|
|
|
uci -q delete wireless.mesh_$apall
|
|
|
|
uci -q delete wireless.mesh_$apall
|
|
|
|
uci commit wireless
|
|
|
|
uci commit wireless
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
|
add_kvr
|
|
|
|
add_kvr
|
|
|
|
add_dawn
|
|
|
|
add_dawn
|
|
|
|
|
|
|
|
|
|
|
|
if [ "$ap_mode" = 1 ]; then
|
|
|
|
if [ "$ap_mode" = 1 ]; then
|
|
|
|
ap_mode_stop
|
|
|
|
ap_mode_stop
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
/etc/init.d/network restart
|
|
|
|
/etc/init.d/network restart
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
start() {
|
|
|
|
start() {
|
|
|
|
return 0
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
stop() {
|
|
|
|
stop() {
|
|
|
|
return 0
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
restart() {
|
|
|
|
restart() {
|
|
|
|
set_easymesh
|
|
|
|
set_easymesh
|
|
|
|
|
|
|
|
add_wifi_mesh
|
|
|
|
}
|
|
|
|
}
|