Testing Push

pull/2/head
Jason Hawks 1 year ago
parent d8b557d107
commit 26e57ec5b2

@ -154,7 +154,7 @@ o.default = "192.168.8.1"
o.datatype = "ip4addr" o.datatype = "ip4addr"
o:depends("ap_mode", 1) o:depends("ap_mode", 1)
so = s:option(Value, "netmask", translate("IPv4 netmask")) o = s:option(Value, "netmask", translate("IPv4 netmask"))
o.default = "255.255.255.0" o.default = "255.255.255.0"
o.datatype = "ip4addr" o.datatype = "ip4addr"
o:depends("ap_mode", 1) o:depends("ap_mode", 1)

@ -19,6 +19,8 @@ load_easymesh_config() {
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)
# 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() { ap_mode_stop() {
@ -50,7 +52,7 @@ add_wifi_mesh() {
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)
# Print out all the variables # 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 if [ "$mesh_nwi_mesh" != "interface" ]; then
@ -69,24 +71,24 @@ add_wifi_mesh() {
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
@ -155,7 +157,7 @@ add_wifi_mesh() {
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
@ -170,51 +172,51 @@ 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
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)
if [ "$kvr" = 1 ]; then if [ "$kvr" = 1 ]; then
uci set dawn.@metric[0].rssi_val=$rssi_val uci set wireless.default_$apall.ieee80211k='1'
uci set dawn.@metric[0].low_rssi_val=$low_rssi_val uci set wireless.default_$apall.rrm_neighbor_report='1'
uci commit dawn uci set wireless.default_$apall.rrm_beacon_report='1'
/etc/init.d/dawn enable && /etc/init.d/dawn start 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 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 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() { set_easymesh() {
@ -239,7 +241,6 @@ set_easymesh() {
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
@ -258,14 +259,18 @@ set_easymesh() {
fi # end [ "$mesh_bat0" != "interface" ] fi # end [ "$mesh_bat0" != "interface" ]
# When this is called, the add_wifi_mesh function does not load variables properly # When this is called, the add_wifi_mesh function does not load variables properly
# 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 add_kvr
# else add_dawn
# apall=$apRadio done
# add_wifi_mesh else
# fi apall=$apRadio
add_wifi_mesh
add_kvr
add_dawn
fi
add_kvr add_kvr
add_dawn add_dawn
@ -335,7 +340,7 @@ set_easymesh() {
else else
ap_mode_stop ap_mode_stop
fi # end if [ "$ap_mode" = 1 ] fi # end if [ "$ap_mode" = 1 ]
else
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
@ -347,40 +352,28 @@ set_easymesh() {
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
fi
add_kvr if [ "$ap_mode" = 0 ]; then
add_dawn ap_mode_stop
if [ "$ap_mode" = 1 ]; then
ap_mode_stop
fi
fi fi
/etc/init.d/network restart /etc/init.d/network restart
} # end set_easymesh() } # end set_easymesh()
# Call our functions set above # Call our functions set above
load_easymesh_config load_easymesh_config
set_easymesh 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

Loading…
Cancel
Save