|
|
|
@ -19,6 +19,8 @@ load_easymesh_config() {
|
|
|
|
|
backbone=$(uci get easymesh.@easymesh[0].backbone)
|
|
|
|
|
apname=$(uci get easymesh.@easymesh[0].apname)
|
|
|
|
|
appass=$(uci get easymesh.@easymesh[0].appass)
|
|
|
|
|
# On a single line, print all of the variables to a file
|
|
|
|
|
printf "enable: $enable\nmesh_bat0: $mesh_bat0\nap_mode: $ap_mode\nlan: $lan\nipaddr: $ipaddr\nnetmask: $netmask\ngateway: $gateway\ndns: $dns\nap_ipaddr: $ap_ipaddr\nap_ipaddr1: $ap_ipaddr1\napRadio: $apRadio\nkvr: $kvr\niapp: $iapp\nbrlan: $brlan\nrole: $role\nbackbone: $backbone\napname: $apname\nappass: $appass" > /root/.easymesh
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ap_mode_stop() {
|
|
|
|
@ -50,7 +52,7 @@ add_wifi_mesh() {
|
|
|
|
|
key=$(uci -q get easymesh.config.key)
|
|
|
|
|
encryption=$(uci -q get easymesh.config.encryption)
|
|
|
|
|
# Print out all the variables
|
|
|
|
|
echo "mesh_nwi_mesh: $mesh_nwi_mesh\nmesh_apRadio: $mesh_apRadio\nmesh_mesh: $mesh_mesh\nmesh_id: $mesh_id\nmobility_domain: $mobility_domain\nkey: $key\nencryption: $encryption" > /root/.newmesh
|
|
|
|
|
printf "mesh_nwi_mesh: $mesh_nwi_mesh\nmesh_apRadio: $mesh_apRadio\nmesh_mesh: $mesh_mesh\nmesh_id: $mesh_id\nmobility_domain: $mobility_domain\nkey: $key\nencryption: $encryption" > /root/.newmesh
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ "$mesh_nwi_mesh" != "interface" ]; then
|
|
|
|
@ -69,24 +71,24 @@ add_wifi_mesh() {
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ "$mesh_mesh" != "wifi-iface" ]; then
|
|
|
|
|
uci set wireless.mesh_$apall=wifi-iface
|
|
|
|
|
uci set wireless.mesh_$apall.device=$apall
|
|
|
|
|
uci set wireless.mesh_$apall.ifname=mesh_${apall}
|
|
|
|
|
uci set wireless.mesh_$apall.network=nwi_mesh_${apall}
|
|
|
|
|
uci set wireless.mesh_$apall.mode='mesh'
|
|
|
|
|
uci set wireless.mesh_$apall.mesh_id=$mesh_id
|
|
|
|
|
uci set wireless.mesh_$apall.mesh_fwding='1'
|
|
|
|
|
uci set wireless.mesh_$apall.mesh_ttl='1'
|
|
|
|
|
uci set wireless.mesh_$apall.mcast_rate='24000'
|
|
|
|
|
uci set wireless.mesh_$apall.disabled='0'
|
|
|
|
|
uci commit wireless
|
|
|
|
|
uci set wireless.mesh_$apall=wifi-iface
|
|
|
|
|
uci set wireless.mesh_$apall.device=$apall
|
|
|
|
|
uci set wireless.mesh_$apall.ifname=mesh_${apall}
|
|
|
|
|
uci set wireless.mesh_$apall.network=nwi_mesh_${apall}
|
|
|
|
|
uci set wireless.mesh_$apall.mode='mesh'
|
|
|
|
|
uci set wireless.mesh_$apall.mesh_id=$mesh_id
|
|
|
|
|
uci set wireless.mesh_$apall.mesh_fwding='1'
|
|
|
|
|
uci set wireless.mesh_$apall.mesh_ttl='1'
|
|
|
|
|
uci set wireless.mesh_$apall.mcast_rate='24000'
|
|
|
|
|
uci set wireless.mesh_$apall.disabled='0'
|
|
|
|
|
uci commit wireless
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ "$mesh_mesh" = "wifi-iface" ]; then
|
|
|
|
|
if [ "$mesh_apRadio" != "$apall" ]; then
|
|
|
|
|
uci set wireless.mesh_$apall.device=$apall
|
|
|
|
|
uci commit wireless
|
|
|
|
|
fi
|
|
|
|
|
if [ "$mesh_apRadio" != "$apall" ]; then
|
|
|
|
|
uci set wireless.mesh_$apall.device=$apall
|
|
|
|
|
uci commit wireless
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ "$encryption" != 1 ]; then
|
|
|
|
@ -155,7 +157,7 @@ add_wifi_mesh() {
|
|
|
|
|
uci set wireless.wifinet$apnum.device=$apall
|
|
|
|
|
uci set wireless.wifinet$apnum.mode='ap'
|
|
|
|
|
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.ieee80211r='1'
|
|
|
|
|
uci set wireless.wifinet$apnum.mobility_domain=$mobility_domain
|
|
|
|
@ -170,51 +172,51 @@ fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
add_kvr() {
|
|
|
|
|
kvr=$(uci -q get easymesh.config.kvr)
|
|
|
|
|
mobility_domain=$(uci -q get easymesh.config.mobility_domain)
|
|
|
|
|
iapp=$(uci -q get easymesh.config.iapp)
|
|
|
|
|
for apall in $(uci -X show wireless | grep wifi-device | awk -F'[.=]' '{print $2}'); do
|
|
|
|
|
if [ "$kvr" = 1 ]; then
|
|
|
|
|
uci set wireless.default_$apall.ieee80211k='1'
|
|
|
|
|
uci set wireless.default_$apall.rrm_neighbor_report='1'
|
|
|
|
|
uci set wireless.default_$apall.rrm_beacon_report='1'
|
|
|
|
|
uci set wireless.default_$apall.ieee80211v='1'
|
|
|
|
|
uci set wireless.default_$apall.bss_transition='1'
|
|
|
|
|
uci set wireless.default_$apall.ieee80211r='1'
|
|
|
|
|
uci set wireless.default_$apall.encryption='sae'
|
|
|
|
|
uci set wireless.default_$apall.mobility_domain=$mobility_domain
|
|
|
|
|
uci set wireless.default_$apall.ft_over_ds='1'
|
|
|
|
|
uci set wireless.default_$apall.ft_psk_generate_local='1'
|
|
|
|
|
uci commit wireless
|
|
|
|
|
else
|
|
|
|
|
uci -q delete wireless.default_$apall.ieee80211k
|
|
|
|
|
uci -q delete wireless.default_$apall.ieee80211v
|
|
|
|
|
uci -q delete wireless.default_$apall.ieee80211r
|
|
|
|
|
uci commit wireless
|
|
|
|
|
fi
|
|
|
|
|
if [ "$iapp" = 1 ]; then
|
|
|
|
|
uci set wireless.default_$apall.iapp_interface='br-lan'
|
|
|
|
|
uci commit wireless
|
|
|
|
|
else
|
|
|
|
|
uci -q delete wireless.default_$apall.iapp_interface
|
|
|
|
|
uci commit wireless
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
add_dawn() {
|
|
|
|
|
kvr=$(uci -q get easymesh.config.kvr)
|
|
|
|
|
rssi_val=$(uci -q get easymesh.config.rssi_val)
|
|
|
|
|
low_rssi_val=$(uci -q get easymesh.config.low_rssi_val)
|
|
|
|
|
|
|
|
|
|
kvr=$(uci -q get easymesh.config.kvr)
|
|
|
|
|
mobility_domain=$(uci -q get easymesh.config.mobility_domain)
|
|
|
|
|
iapp=$(uci -q get easymesh.config.iapp)
|
|
|
|
|
for apall in $(uci -X show wireless | grep wifi-device | awk -F'[.=]' '{print $2}'); do
|
|
|
|
|
if [ "$kvr" = 1 ]; then
|
|
|
|
|
uci set dawn.@metric[0].rssi_val=$rssi_val
|
|
|
|
|
uci set dawn.@metric[0].low_rssi_val=$low_rssi_val
|
|
|
|
|
uci commit dawn
|
|
|
|
|
/etc/init.d/dawn enable && /etc/init.d/dawn start
|
|
|
|
|
uci set wireless.default_$apall.ieee80211k='1'
|
|
|
|
|
uci set wireless.default_$apall.rrm_neighbor_report='1'
|
|
|
|
|
uci set wireless.default_$apall.rrm_beacon_report='1'
|
|
|
|
|
uci set wireless.default_$apall.ieee80211v='1'
|
|
|
|
|
uci set wireless.default_$apall.bss_transition='1'
|
|
|
|
|
uci set wireless.default_$apall.ieee80211r='1'
|
|
|
|
|
uci set wireless.default_$apall.encryption='sae'
|
|
|
|
|
uci set wireless.default_$apall.mobility_domain=$mobility_domain
|
|
|
|
|
uci set wireless.default_$apall.ft_over_ds='1'
|
|
|
|
|
uci set wireless.default_$apall.ft_psk_generate_local='1'
|
|
|
|
|
uci commit wireless
|
|
|
|
|
else
|
|
|
|
|
/etc/init.d/dawn stop && /etc/init.d/dawn disable
|
|
|
|
|
uci -q delete wireless.default_$apall.ieee80211k
|
|
|
|
|
uci -q delete wireless.default_$apall.ieee80211v
|
|
|
|
|
uci -q delete wireless.default_$apall.ieee80211r
|
|
|
|
|
uci commit wireless
|
|
|
|
|
fi
|
|
|
|
|
if [ "$iapp" = 1 ]; then
|
|
|
|
|
uci set wireless.default_$apall.iapp_interface='br-lan'
|
|
|
|
|
uci commit wireless
|
|
|
|
|
else
|
|
|
|
|
uci -q delete wireless.default_$apall.iapp_interface
|
|
|
|
|
uci commit wireless
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
add_dawn() {
|
|
|
|
|
kvr=$(uci -q get easymesh.config.kvr)
|
|
|
|
|
rssi_val=$(uci -q get easymesh.config.rssi_val)
|
|
|
|
|
low_rssi_val=$(uci -q get easymesh.config.low_rssi_val)
|
|
|
|
|
|
|
|
|
|
if [ "$kvr" = 1 ]; then
|
|
|
|
|
uci set dawn.@metric[0].rssi_val=$rssi_val
|
|
|
|
|
uci set dawn.@metric[0].low_rssi_val=$low_rssi_val
|
|
|
|
|
uci commit dawn
|
|
|
|
|
/etc/init.d/dawn enable && /etc/init.d/dawn start
|
|
|
|
|
else
|
|
|
|
|
/etc/init.d/dawn stop && /etc/init.d/dawn disable
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
set_easymesh() {
|
|
|
|
@ -239,7 +241,6 @@ set_easymesh() {
|
|
|
|
|
uci set network.bat0.network_coding='0'
|
|
|
|
|
uci set network.bat0.orig_interval='1000'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ "$role" = "server" ]; then
|
|
|
|
|
uci set network.bat0.gw_mode='server'
|
|
|
|
|
elif [ "$role" = "client" ]; then
|
|
|
|
@ -258,14 +259,18 @@ set_easymesh() {
|
|
|
|
|
fi # end [ "$mesh_bat0" != "interface" ]
|
|
|
|
|
|
|
|
|
|
# When this is called, the add_wifi_mesh function does not load variables properly
|
|
|
|
|
# if [ "$apRadio" = "all" ]; then
|
|
|
|
|
# for apall in $(uci -X show wireless | grep wifi-device | awk -F'[.=]' '{print $2}'); do
|
|
|
|
|
# add_wifi_mesh
|
|
|
|
|
# done
|
|
|
|
|
# else
|
|
|
|
|
# apall=$apRadio
|
|
|
|
|
# add_wifi_mesh
|
|
|
|
|
# fi
|
|
|
|
|
if [ "$apRadio" = "all" ]; then
|
|
|
|
|
for apall in $(uci -X show wireless | grep wifi-device | awk -F'[.=]' '{print $2}'); do
|
|
|
|
|
add_wifi_mesh
|
|
|
|
|
add_kvr
|
|
|
|
|
add_dawn
|
|
|
|
|
done
|
|
|
|
|
else
|
|
|
|
|
apall=$apRadio
|
|
|
|
|
add_wifi_mesh
|
|
|
|
|
add_kvr
|
|
|
|
|
add_dawn
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
add_kvr
|
|
|
|
|
add_dawn
|
|
|
|
@ -335,7 +340,7 @@ set_easymesh() {
|
|
|
|
|
else
|
|
|
|
|
ap_mode_stop
|
|
|
|
|
fi # end if [ "$ap_mode" = 1 ]
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
if [ "$mesh_bat0" = "interface" ]; then
|
|
|
|
|
uci -q delete network.bat0
|
|
|
|
|
if [ "$brlan" = "br-lan" ]; then
|
|
|
|
@ -347,40 +352,28 @@ set_easymesh() {
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
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_mesh=$(uci -q get wireless.mesh_${apall})
|
|
|
|
|
mesh_nwi_mesh=$(uci -q get network.nwi_mesh_${apall})
|
|
|
|
|
mesh_mesh=$(uci -q get wireless.mesh_${apall})
|
|
|
|
|
|
|
|
|
|
if [ "$mesh_nwi_mesh" = "interface" ]; then
|
|
|
|
|
uci -q delete network.nwi_mesh_$apall
|
|
|
|
|
uci commit network
|
|
|
|
|
fi
|
|
|
|
|
if [ "$mesh_nwi_mesh" = "interface" ]; then
|
|
|
|
|
uci -q delete network.nwi_mesh_$apall
|
|
|
|
|
uci commit network
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ "$mesh_mesh" = "wifi-iface" ]; then
|
|
|
|
|
uci -q delete wireless.mesh_$apall
|
|
|
|
|
uci commit wireless
|
|
|
|
|
fi
|
|
|
|
|
if [ "$mesh_mesh" = "wifi-iface" ]; then
|
|
|
|
|
uci -q delete wireless.mesh_$apall
|
|
|
|
|
uci commit wireless
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
add_kvr
|
|
|
|
|
add_dawn
|
|
|
|
|
|
|
|
|
|
if [ "$ap_mode" = 1 ]; then
|
|
|
|
|
ap_mode_stop
|
|
|
|
|
fi
|
|
|
|
|
if [ "$ap_mode" = 0 ]; then
|
|
|
|
|
ap_mode_stop
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
/etc/init.d/network restart
|
|
|
|
|
} # end set_easymesh()
|
|
|
|
|
|
|
|
|
|
# Call our functions set above
|
|
|
|
|
load_easymesh_config
|
|
|
|
|
set_easymesh
|
|
|
|
|
|
|
|
|
|
if [ "$apRadio" = "all" ]; then
|
|
|
|
|
for apall in $(uci -X show wireless | grep wifi-device | awk -F'[.=]' '{print $2}'); do
|
|
|
|
|
add_wifi_mesh
|
|
|
|
|
done
|
|
|
|
|
else
|
|
|
|
|
apall=$apRadio
|
|
|
|
|
add_wifi_mesh
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|