luci-app-easymesh: update to v1.7 (#8057)

This commit is contained in:
ntlf9t 2021-10-15 23:20:16 +08:00 committed by GitHub
parent 1a4f339cb5
commit f598cbf18d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 145 additions and 2 deletions

View File

@ -5,8 +5,8 @@
include $(TOPDIR)/rules.mk
LUCI_TITLE:=LuCI Support for easymesh
LUCI_DEPENDS:= +kmod-cfg80211 +batctl-default +kmod-batman-adv +wpad-openssl
PKG_VERSION:=1.6
LUCI_DEPENDS:= +kmod-cfg80211 +batctl-default +kmod-batman-adv +wpad-openssl +dawn
PKG_VERSION:=1.7
include $(TOPDIR)/feeds/luci/luci.mk

View File

@ -67,4 +67,49 @@ o = s:option(Value, "key", translate("Key"))
o.default = "easymesh"
o:depends("encryption", 1)
---- kvr
enable = s:option(Flag, "kvr", translate("K/V/R"), translate(""))
enable.default = 1
enable.rmempty = false
o = s:option(Value, "mobility_domain", translate("Mobility Domain"), translate("4-character hexadecimal ID"))
o.default = "4f57"
o.datatype = "and(hexstring,rangelength(4,4))"
o:depends("kvr", 1)
o = s:option(Value, "rssi_val", translate("Threshold for an good RSSI"))
o.default = "-60"
o.atatype = "range(-20,-120)"
o:depends("kvr", 1)
o = s:option(Value, "low_rssi_val", translate("Threshold for an bad RSSI"))
o.default = "-88"
o.atatype = "range(-20,-120)"
o:depends("kvr", 1)
---- ap_mode
enable = s:option(Flag, "ap_mode", translate("AP MODE Enable"), translate("Enable or disable AP MODE"))
enable.default = 0
enable.rmempty = false
o = s:option(Value, "ipaddr", translate("IPv4-Address"))
o.default = "192.168.1.10"
o.datatype = "ip4addr"
o:depends("ap_mode", 1)
o = s:option(Value, "netmask", translate("IPv4 netmask"))
o.default = "255.255.255.0"
o.datatype = "ip4addr"
o:depends("ap_mode", 1)
o = s:option(Value, "gateway", translate("IPv4 gateway"))
o.default = "192.168.1.1"
o.datatype = "ip4addr"
o:depends("ap_mode", 1)
o = s:option(Value, "dns", translate("Use custom DNS servers"))
o.default = "192.168.1.1"
o.datatype = "ip4addr"
o:depends("ap_mode", 1)
return m

View File

@ -6,12 +6,54 @@ enable=$(uci get easymesh.config.enabled 2>/dev/null)
mesh_bat0=$(uci get network.bat0 2>/dev/null)
mesh_nwi_mesh0=$(uci get network.nwi_mesh0 2>/dev/null)
mesh_mesh0=$(uci get wireless.mesh0 2>/dev/null)
ap_mode=$(uci get easymesh.config.ap_mode 2>/dev/null)
lan=$(uci get network.lan.ifname 2>/dev/null)
ipaddr=$(uci get easymesh.config.ipaddr 2>/dev/null)
netmask=$(uci get easymesh.config.netmask 2>/dev/null)
gateway=$(uci get easymesh.config.gateway 2>/dev/null)
ap_gateway=$(uci get network.lan.gateway 2>/dev/null)
ap_gateway1=$(cat /etc/easymesh | sed -n '1p')
dns1=$(cat /etc/easymesh | sed -n '2p')
dns=$(uci get easymesh.config.dns 2>/dev/null)
mesh_id=$(uci get easymesh.config.mesh_id 2>/dev/null)
apRadio=$(uci get easymesh.config.apRadio 2>/dev/null)
mesh0_apRadio=$(uci get wireless.mesh0.device 2>/dev/null)
encryption=$(uci get easymesh.config.encryption 2>/dev/null)
key=$(uci get easymesh.config.key 2>/dev/null)
kvr=$(uci get easymesh.config.kvr 2>/dev/null)
mobility_domain=$(uci get easymesh.config.mobility_domain 2>/dev/null)
rssi_val=$(uci get easymesh.config.rssi_val 2>/dev/null)
low_rssi_val=$(uci get easymesh.config.low_rssi_val 2>/dev/null)
ap_mode_stop(){
if [ "$ap_gateway" = "$ap_gateway1" ]; then
uci delete network.lan.gateway
uci del_list network.lan.dns=$dns1
uci commit network
echo "" > /etc/easymesh
uci delete dhcp.lan.dynamicdhcp
uci delete dhcp.lan.ignore
uci commit dhcp
/etc/init.d/odhcpd enable && /etc/init.d/odhcpd start
/etc/init.d/firewall enable && /etc/init.d/firewall start >/dev/null 2>&1
fi
}
kvr_stop(){
for wifiiface in $(uci -X show wireless | grep wifi-iface | awk -F'[=]' '{print $1}'); do
if [ "${wifiiface}" != "wireless.mesh0" ]; then
uci delete ${wifiiface}.ieee80211k
uci delete ${wifiiface}.ieee80211v
uci delete ${wifiiface}.ieee80211r
uci commit network
fi
done
/etc/init.d/dawn stop && /etc/init.d/dawn disable
}
start(){
if [ "$enable" == 1 ]; then
@ -73,6 +115,56 @@ start(){
uci set wireless.mesh0.key=$key
uci commit wireless
fi
if [ "$kvr" = 1 ]; then
for wifiiface in $(uci -X show wireless | grep wifi-iface | awk -F'[=]' '{print $1}'); do
if [ "${wifiiface}" != "wireless.mesh0" ]; then
uci set ${wifiiface}.ieee80211k='1'
uci set ${wifiiface}.rrm_neighbor_report='1'
uci set ${wifiiface}.rrm_beacon_report='1'
uci set ${wifiiface}.ieee80211v='1'
uci set ${wifiiface}.bss_transition='1'
uci set ${wifiiface}.ieee80211r='1'
uci set ${wifiiface}.encryption='psk-mixed'
uci set ${wifiiface}.mobility_domain=$mobility_domain
uci set ${wifiiface}.ft_over_ds='1'
uci commit network
uci set dawn.@metric[0].rssi_val=$rssi_val
uci set dawn.@metric[0].low_rssi_val=$low_rssi_val
uci commit dawn
fi
done
/etc/init.d/dawn enable && /etc/init.d/dawn start
else
kvr_stop
fi
if [ "$ap_mode" == 1 ]; then
if [ "$ap_gateway" != "$gateway" ]; then
uci set network.lan.ipaddr=$ipaddr
uci set network.lan.netmask=$netmask
uci set network.lan.gateway=$gateway
uci add_list network.lan.dns=$dns
uci commit network
echo "" > /etc/easymesh
echo "$gateway" > /etc/easymesh
echo "$dns" >> /etc/easymesh
uci set dhcp.lan.dynamicdhcp='0'
uci set dhcp.lan.ignore='1'
uci delete dhcp.lan.ra
uci delete dhcp.lan.dhcpv6
uci delete dhcp.lan.ra_management
uci commit dhcp
/etc/init.d/odhcpd stop && /etc/init.d/odhcpd disable
/etc/init.d/firewall stop && /etc/init.d/firewall disable >/dev/null 2>&1
fi
else
ap_mode_stop
fi
/etc/init.d/network restart
else
@ -96,6 +188,12 @@ stop(){
if [ "$mesh_mesh0" = "wifi-iface" ]; then
uci delete wireless.mesh0
uci commit wireless
kvr_stop
fi
if [ "$ap_mode" == 1 ]; then
ap_mode_stop
fi
/etc/init.d/network restart