aredn/files/www/cgi-bin/advancedconfig

785 lines
26 KiB
Plaintext
Raw Normal View History

#!/usr/bin/lua
--[[
2024-05-29 01:45:25 -06:00
Part of AREDN® -- Used for creating Amateur Radio Emergency Data Networks
Copyright (C) 2021 Tim Wilkinson
Original Perl Copyright (C) 2020 - Darryl Quinn
See Contributors file for additional contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation version 3 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional Terms:
2024-05-29 01:45:25 -06:00
Additional use restrictions exist on the AREDN® trademark and logo.
See AREDNLicense.txt for more info.
2024-05-29 01:45:25 -06:00
Attributions to the AREDN® Project must be retained in the source code.
If importing this code into a new or existing project attribution
2024-05-29 01:45:25 -06:00
to the AREDN® project must be added to the source code.
You must not misrepresent the origin of the material contained within.
Modified versions must be modified to attribute to the original source
and be marked in reasonable ways as differentiate it from the original
version
--]]
require("nixio")
require("aredn.hardware")
require("aredn.http")
require("aredn.utils")
require("aredn.html")
require("uci")
require("aredn.info")
local html = aredn.html
local settings = {
{
2022-08-09 20:44:45 -06:00
category = "Link Quality Settings",
key = "aredn.@lqm[0].enable",
type = "boolean",
2022-09-09 08:41:52 -06:00
desc = "Enable <b>Link Quality Management</b><br><br><small>aredn.@lqm[0].enable</small>",
2022-08-09 20:44:45 -06:00
default = "1",
postcallback = "lqm_defaults()"
},
{
2022-08-09 20:44:45 -06:00
category = "Link Quality Settings",
key = "aredn.@lqm[0].margin_snr",
type = "string",
2022-09-09 08:41:52 -06:00
desc = "<b>SNR Margin</b> in dB above Min SNR a signal must reach to be re-activated<br><br><small>aredn.@lqm[0].margin_snr</small>",
2022-08-09 20:44:45 -06:00
default = "1",
condition = "lqm_enabled()"
},
{
2022-08-09 20:44:45 -06:00
category = "Link Quality Settings",
key = "aredn.@lqm[0].min_distance",
type = "string",
2022-09-09 08:41:52 -06:00
desc = "<b>Min Distance</b> in meters beyond which a neighbor RF link is allowed<br><br><small>aredn.@lqm[0].min_distance</small>",
2022-08-09 20:44:45 -06:00
default = "0",
condition = "lqm_enabled()"
},
{
2022-08-09 20:44:45 -06:00
category = "Link Quality Settings",
key = "aredn.@lqm[0].auto_distance",
type = "string",
2022-09-09 08:41:52 -06:00
desc = "<b>Default Distance</b> in meters to use when actual distance cannot be calculated<br><br><small>aredn.@lqm[0].auto_distance</small>",
2022-08-09 20:44:45 -06:00
default = "0",
condition = "lqm_enabled()"
},
{
2022-08-09 20:44:45 -06:00
category = "Link Quality Settings",
key = "aredn.@lqm[0].margin_quality",
type = "string",
2022-09-09 08:41:52 -06:00
desc = "<b>Quality Margin</b> percentage increase before neighbor can be re-activated<br><br><small>aredn.@lqm[0].margin_quality</small>",
2022-08-09 20:44:45 -06:00
default = "1",
condition = "lqm_enabled()"
},
{
2022-08-09 20:44:45 -06:00
category = "Link Quality Settings",
key = "aredn.@lqm[0].ping_penalty",
type = "string",
2022-09-09 08:41:52 -06:00
desc = "<b>Ping Penalty</b> quality percentage to add when neighbor cannot be pinged<br><br><small>aredn.@lqm[0].ping_penalty</small>",
2022-08-09 20:44:45 -06:00
default = "5",
condition = "lqm_enabled()"
},
{
category = "Link Quality Settings",
key = "aredn.@lqm[0].rts_threshold",
type = "string",
desc = "<b>RTS Threshold</b> in bytes before using RTS/CTS when hidden nodes are detected<br><br><small>aredn.@lqm[0].rts_threshold</small>",
default = "1",
condition = "lqm_enabled()"
},
{
category = "Link Quality Settings",
key = "aredn.@lqm[0].mtu",
type = "string",
desc = "<b>Maximum packet size</b> in bytes sent over WiFi (256 to 1500)<br><br><small>aredn.@lqm[0].mtu</small>",
default = "1500"
},
{
2022-08-09 20:44:45 -06:00
category = "Link Quality Settings",
key = "aredn.@lqm[0].user_blocks",
type = "string",
2022-09-09 08:41:52 -06:00
desc = "<b>User Blocked</b> comma-separated list of blocked MACs<br><br><small>aredn.@lqm[0].user_blocks</small>",
2022-08-09 20:44:45 -06:00
default = "",
condition = "lqm_enabled()"
},
{
2022-08-09 20:44:45 -06:00
category = "Link Quality Settings",
key = "aredn.@lqm[0].user_allows",
type = "string",
2022-09-09 08:41:52 -06:00
desc = "<b>User Allowed</b> comma-separated list of always allowed MACs<br><br><small>aredn.@lqm[0].user_allows</small>",
2022-08-09 20:44:45 -06:00
default = "",
condition = "lqm_enabled()"
},
{
category = "WAN Settings",
key = "aredn.@wan[0].olsrd_gw",
2022-08-11 09:30:08 -06:00
type = "boolean",
2022-09-09 08:41:52 -06:00
desc = "<b>Allow other MESH nodes to use my WAN</b> - not recommended and OFF by default<br><br><small>aredn.@wan[0].olsrd_gw</small>",
default = "0"
},
{
category = "WAN Settings",
key = "aredn.@wan[0].lan_dhcp_route",
2022-08-11 09:30:08 -06:00
type = "boolean",
2022-09-09 08:41:52 -06:00
desc = "<b>Allow my LAN devices to access my WAN</b> - ON by default<br><br><small>aredn.@wan[0].lan_dhcp_route</small>",
default = "1"
},
{
category = "WAN Settings",
key = "aredn.@wan[0].lan_dhcp_defaultroute",
2022-08-11 09:30:08 -06:00
type = "boolean",
2022-09-09 08:41:52 -06:00
desc = "<b>Provide default route to LAN devices</b> even when WAN access is disabled<br><br><small>aredn.@wan[0].lan_dhcp_defaultroute</small>",
default = "0"
},
{
2022-08-09 20:44:45 -06:00
category = "WAN Settings",
key = "aredn.wan.vlanid",
type = "string",
2022-09-09 08:41:52 -06:00
desc = "<b>WAN VLAN Number</b> - must be an integer in the range [1,4094]<br><br><small>aredn.wan.vlanid</small>",
2022-08-09 20:44:45 -06:00
default = "",
condition = "supportsVLANChange()",
current = "currentWANVLAN()",
postcallback = "changeWANVLAN()"
},
{
category = "WAN Settings",
key = "aredn.@wan[0].web_access",
type = "boolean",
desc = "<b>Enable web access</b> to the node from the WAN interface<br><br><small>aredn.@wan[0].web_access</small>",
default = "1"
},
{
category = "WAN Settings",
key = "aredn.@wan[0].ssh_access",
type = "boolean",
desc = "<b>Enable SSH access</b> to the node from the WAN interface<br><br><small>aredn.@wan[0].ssh_access</small>",
default = "1"
},
{
category = "WAN Settings",
key = "aredn.@wan[0].telnet_access",
type = "boolean",
desc = "<b>Enable TELNET access</b> to the node from the WAN interface<br><br><small>aredn.@wan[0].telnet_access</small>",
default = "1"
},
{
category = "Power Options",
key = "aredn.@poe[0].passthrough",
type = "boolean",
2022-09-09 08:41:52 -06:00
desc = "<b>PoE Passthrough</b> specifies whether PoE power should be enabled (Not all devices have PoE passthrough ports)<br><br><small>aredn.@poe[0].passthrough</small>",
default = "0",
condition = "hasPOE()",
postcallback = "setPOEOutput()"
},
{
category = "Power Options",
key = "aredn.@usb[0].passthrough",
type = "boolean",
2022-09-09 08:41:52 -06:00
desc = "<b>USB Power Passthrough</b> specifies whether USB power should be enabled (Not all devices have USB powered ports)<br><br><small>aredn.@usb[0].passthrough</small>",
default = "1",
postcallback = "setUSBOutput()",
condition = "hasUSB()"
},
{
category = "Tunnel Options",
key = "aredn.@tunnel[0].weight",
type = "string",
2023-09-20 11:05:17 -06:00
desc = "<b>Tunnel Weight</b> specifies the cost of using a tunnel. The higher the number, the less likely a tunnel is used.<br><br><small>aredn.@tunnel[0].weight</small>",
default = "1",
condition = "not isSupernode()"
},
{
category = "Tunnel Options",
key = "aredn.@tunnel[0].wanonly",
type = "boolean",
2022-09-09 08:41:52 -06:00
desc = "<b>WAN-Only Tunnel</b> prevents tunnel traffic from being routed over the Mesh network itself<br><br><small>aredn.@tunnel[0].wanonly</small>",
default = "1"
},
{
category = "Watchdog",
key = "aredn.@watchdog[0].enable",
type = "boolean",
desc = "<b>The Watchdog</b> will reboot the node if it stops operating correctly<br><br><small>aredn.@watchdog[0].enable</small>",
default = "0"
},
{
category = "Watchdog",
key = "aredn.@watchdog[0].ping_addresses",
type = "string",
desc = "<b>Watchdog IP addresses</b> is a whitespace seperated list of IP addresses, one of which should always be pingable<br><br><small>aredn.@watchdog[0].ping_addresses</small>",
default = ""
},
{
category = "Watchdog",
key = "aredn.@watchdog[0].daily",
type = "string",
desc = "<b>Daily Watchdog hour</b> is the hour every day (0-23) to automatically reboot the node<br><br><small>aredn.@watchdog[0].daily</small>",
default = ""
},
{
2022-08-09 20:44:45 -06:00
category = "Memory Settings",
key = "aredn.@meshstatus[0].lowmem",
type = "string",
2022-09-09 08:41:52 -06:00
desc = "<b>Low Memory Threshold</b> in KB when the Mesh Status page will be truncated<br><br><small>aredn.@meshstatus[0].lowmem</small>",
default = "10000"
},
{
2022-08-09 20:44:45 -06:00
category = "Memory Settings",
key = "aredn.@meshstatus[0].lowroutes",
type = "string",
2022-09-09 08:41:52 -06:00
desc = "<b>Low Memory Max Routes</b> is the maximum number of routes shown on the Mesh Status page when low memory is detected<br><br><small>aredn.@meshstatus[0].lowroutes</small>",
default = "1000"
},
{
category = "Supernode Settings",
key = "aredn.@supernode[0].support",
type = "boolean",
desc = "<b>Use any Supernodes</b> found on the mesh <br><br><small>aredn.@supernode[0].support</small>",
default = "1"
},
{
2022-07-25 15:38:18 -06:00
category = "Network Tools",
key = "aredn.olsr.restart",
type = "none",
2022-09-09 08:41:52 -06:00
desc = "<b>OLSR Restart</b> will restart OLSR when executed; wait up to 2 or 3 minutes to receive response<br><br><small>aredn.olsr.restart</small>",
default = "0",
postcallback = "olsr_restart()"
},
2022-07-25 15:38:18 -06:00
{
category = "Network Tools",
key = "aredn.@iperf[0].enable",
type = "boolean",
2022-09-09 08:41:52 -06:00
desc = "<b>IPERF Enable</b> allows the included iperf3 client/server<br><br><small>aredn.@iperf[0].enable</small>",
2022-07-25 15:38:18 -06:00
default = "1"
},
2023-12-06 13:19:18 -07:00
{
category = "Remote Logging",
key = "aredn.@remotelog[0].url",
type = "string",
desc = "<b>Remote logging URL</b> for the remote syslog machine. Must be formatted as <i>protocol://ipaddress:port</i><br><br><small>aredn.@remotelog[0].url</small>",
default = "",
precallback = "validate_rsyslog()"
},
{
2022-08-09 20:44:45 -06:00
category = "Map Paths",
key = "aredn.@location[0].map",
Link Quality Management (#360) * Link Quality Management experiment (built in) * Protect LQM pages * Omit "empty" mac addresses * Integrate LQM v0.2 Includes proposed UI if this were built-in. When LQM is enabled (advanced settings) the usual distance inputs are replaced with "min snr' and "max distance" inputs which are the major ones you might tweak, as well as a link to the LQM status page. Other controls are now available (so protected) in advanced settings. * Improve LQM updating * Use running snr averages * Merge app changes * AREDN-ize the UI * Improve status language * Improved DtD detection * Improve quality reporting * Link Quality category * Enable by default * Better intergration * Link => Neighbor * Formatting * Make sure initial page is populated without extra fetch * Handle empty lqm.info * Update with latest experiment algorithm changes * Validate LQM settings before applying them * Algorithm updates * Improve quality reporting * %% -> % * Default max distance now 50 miles * Get actual noise if radio will provide it * low_snr => min_snr * Dont print node description if we dont have one * Remove properties duplicated from setup page * Localize max distance. Miles in GB and US, Kilometers everywhere else. * Ping link quality testing * UDP 'ping' for quality check * Change Active Settings title * Expand ping test * Improve messaging * Add a ping penalty for neighbors which cannot be contacted in a timely manner. * Remove user_blocks config option. No one needs to use this anymore. * Localize distances on lqm page * Improve status reporting * First run emergency node setup. When a node first runs LQM, if the default settings fail to connect to a node we will now adjust them so that at least one node is viable. * Restore blocking of mac addresses * LQM now off by default fixed #47
2022-05-18 11:49:00 -06:00
type = "string",
desc = "<b>Map URL</b><br><br><small>aredn.@location[0].maps</small>",
default = "https://worldmap.arednmesh.org/#12/(lat)/(lon)"
Link Quality Management (#360) * Link Quality Management experiment (built in) * Protect LQM pages * Omit "empty" mac addresses * Integrate LQM v0.2 Includes proposed UI if this were built-in. When LQM is enabled (advanced settings) the usual distance inputs are replaced with "min snr' and "max distance" inputs which are the major ones you might tweak, as well as a link to the LQM status page. Other controls are now available (so protected) in advanced settings. * Improve LQM updating * Use running snr averages * Merge app changes * AREDN-ize the UI * Improve status language * Improved DtD detection * Improve quality reporting * Link Quality category * Enable by default * Better intergration * Link => Neighbor * Formatting * Make sure initial page is populated without extra fetch * Handle empty lqm.info * Update with latest experiment algorithm changes * Validate LQM settings before applying them * Algorithm updates * Improve quality reporting * %% -> % * Default max distance now 50 miles * Get actual noise if radio will provide it * low_snr => min_snr * Dont print node description if we dont have one * Remove properties duplicated from setup page * Localize max distance. Miles in GB and US, Kilometers everywhere else. * Ping link quality testing * UDP 'ping' for quality check * Change Active Settings title * Expand ping test * Improve messaging * Add a ping penalty for neighbors which cannot be contacted in a timely manner. * Remove user_blocks config option. No one needs to use this anymore. * Localize distances on lqm page * Improve status reporting * First run emergency node setup. When a node first runs LQM, if the default settings fail to connect to a node we will now adjust them so that at least one node is viable. * Restore blocking of mac addresses * LQM now off by default fixed #47
2022-05-18 11:49:00 -06:00
},
{
category = "Firmware",
key = "aredn.@downloads[0].firmware_aredn",
Link Quality Management (#360) * Link Quality Management experiment (built in) * Protect LQM pages * Omit "empty" mac addresses * Integrate LQM v0.2 Includes proposed UI if this were built-in. When LQM is enabled (advanced settings) the usual distance inputs are replaced with "min snr' and "max distance" inputs which are the major ones you might tweak, as well as a link to the LQM status page. Other controls are now available (so protected) in advanced settings. * Improve LQM updating * Use running snr averages * Merge app changes * AREDN-ize the UI * Improve status language * Improved DtD detection * Improve quality reporting * Link Quality category * Enable by default * Better intergration * Link => Neighbor * Formatting * Make sure initial page is populated without extra fetch * Handle empty lqm.info * Update with latest experiment algorithm changes * Validate LQM settings before applying them * Algorithm updates * Improve quality reporting * %% -> % * Default max distance now 50 miles * Get actual noise if radio will provide it * low_snr => min_snr * Dont print node description if we dont have one * Remove properties duplicated from setup page * Localize max distance. Miles in GB and US, Kilometers everywhere else. * Ping link quality testing * UDP 'ping' for quality check * Change Active Settings title * Expand ping test * Improve messaging * Add a ping penalty for neighbors which cannot be contacted in a timely manner. * Remove user_blocks config option. No one needs to use this anymore. * Localize distances on lqm page * Improve status reporting * First run emergency node setup. When a node first runs LQM, if the default settings fail to connect to a node we will now adjust them so that at least one node is viable. * Restore blocking of mac addresses * LQM now off by default fixed #47
2022-05-18 11:49:00 -06:00
type = "string",
desc = "<b>Firmware Download URL</b><br><br><small>aredn.@downloads[0].firmware_aredn</small>",
default = "http://downloads.arednmesh.org"
},
{
category = "Firmware",
key = "aredn.@downloads[0].packages_default",
type = "string",
desc = "<b>Packages Download URL</b><br><br><small>aredn.@downloads[0].packages_default</small>",
default = "http://downloads.arednmesh.org"
2022-08-09 20:44:45 -06:00
},
{
category = "Firmware",
key = "aredn.firmware.dangerous_upgrade",
type = "boolean",
desc = "<b>Dangerous Upgrade Disables</b> all safety checks usually applied when upgrading firmware<br><br><small>aredn.firmware.dangerous_upgrade</small>",
default = "0",
current = "current_force_upgrade()",
postcallback = "update_force_upgrade()"
},
2022-08-09 20:44:45 -06:00
{
category = "AREDN Alert Settings",
key = "aredn.aam.refresh",
type = "none",
2022-09-09 08:41:52 -06:00
desc = "<b>Alert Message Refresh</b> - Execute to pull any AREDN Alert messages<br><br><small>aredn.aam.refresh</small>",
2022-08-09 20:44:45 -06:00
default = "0",
postcallback = "aam_refresh()"
},
{
category = "AREDN Alert Settings",
key = "aredn.@alerts[0].localpath",
type = "string",
2022-09-09 08:41:52 -06:00
desc = "<b>Alert Message Local URL</b> - location from which local AREDN Alerts can be downloaded<br><br><small>aredn.@alerts[0].localpath</small>",
2022-08-09 20:44:45 -06:00
default = ""
},
{
category = "AREDN Alert Settings",
key = "aredn.@alerts[0].groups",
type = "string",
desc = "<b>Alert Message Groups</b> - comma seperated list of group names to check for alert messages<br><br><small>aredn.@alerts[0].groups</small>",
default = ""
},
2022-08-09 20:44:45 -06:00
{
category = "AREDN Alert Settings",
key = "aredn.@alerts[0].pollrate",
type = "string",
2022-09-09 08:41:52 -06:00
desc = "<b>Alert Message Pollrate</b> - how many hours to wait between polling for new AREDN Alerts<br><br><small>aredn.@alerts[0].pollrate</small>",
default = "1"
2022-08-09 20:44:45 -06:00
},
{
category = "AREDN Alert Settings",
key = "aredn.aam.purge",
type = "none",
2022-09-09 08:41:52 -06:00
desc = "<b>Alert Message Purge</b> - execute to immediately delete all alerts from this node<br><br><small>aredn.aam.purge</small>",
default = "",
2022-08-09 20:44:45 -06:00
postcallback = "alert_purge()"
}
}
local msgs = {}
--
-- helpers
--
function msg(m)
msgs[#msgs + 1] = m
end
-- uci cursor
local cursor = uci.cursor("/etc/config.mesh")
function cursor_set(a, b, c, d)
if not cursor:get(a, b) and b:match("@(.+)%[0%]") then
cursor:add(a, b:match("@(.+)%[0%]"))
2022-03-03 16:03:08 -07:00
end
cursor:set(a, b, c, d)
cursor:commit(a)
end
function cursor_get(a, b, c)
return cursor:get(a, b, c)
end
-- conditionals
function hasPOE()
return aredn.hardware.has_poe()
end
function hasUSB()
return aredn.hardware.has_usb()
end
function supportsVLANChange()
-- If we support advanced networking, we dont provide this option here
local board = aredn.hardware.get_board_type()
if board == "mikrotik,hap-ac2" or board == "mikrotik,hap-ac3" then
return false
end
local stat = nixio.fs.stat("/etc/aredn_include/swconfig")
-- We always support VLAN changing on devices without switches
if not (stat and stat.size > 0) then
return true
end
2022-07-25 14:55:56 -06:00
-- We also support VLAN changing on hAP, A750 and AR150 as WAN is on it's own ethernet port
local type = aredn.hardware.get_type()
if type == "rb-952ui-5ac2nd" or type == "routerboard-952ui-5ac2nd" or type == "gl-ar750" then
return true
end
-- Otherwise
return false
end
function isSupernode()
return cursor_get("aredn", "@supernode[0]", "enable") == "1"
end
-- callbacks
local newval
local key
function setPOEOutput()
if not newval then
newval = 0
end
os.execute("/usr/local/bin/poe_passthrough " .. newval)
end
function setUSBOutput()
if not newval then
newval = 0
end
os.execute("/usr/local/bin/usb_passthrough " .. newval)
end
function olsr_restart()
os.execute("/etc/init.d/olsrd restart")
end
function aam_refresh()
os.execute("/usr/local/bin/aredn_message.sh")
end
function alert_purge()
os.remove("/tmp/aredn_message")
os.remove("/tmp/local_message")
end
Link Quality Management (#360) * Link Quality Management experiment (built in) * Protect LQM pages * Omit "empty" mac addresses * Integrate LQM v0.2 Includes proposed UI if this were built-in. When LQM is enabled (advanced settings) the usual distance inputs are replaced with "min snr' and "max distance" inputs which are the major ones you might tweak, as well as a link to the LQM status page. Other controls are now available (so protected) in advanced settings. * Improve LQM updating * Use running snr averages * Merge app changes * AREDN-ize the UI * Improve status language * Improved DtD detection * Improve quality reporting * Link Quality category * Enable by default * Better intergration * Link => Neighbor * Formatting * Make sure initial page is populated without extra fetch * Handle empty lqm.info * Update with latest experiment algorithm changes * Validate LQM settings before applying them * Algorithm updates * Improve quality reporting * %% -> % * Default max distance now 50 miles * Get actual noise if radio will provide it * low_snr => min_snr * Dont print node description if we dont have one * Remove properties duplicated from setup page * Localize max distance. Miles in GB and US, Kilometers everywhere else. * Ping link quality testing * UDP 'ping' for quality check * Change Active Settings title * Expand ping test * Improve messaging * Add a ping penalty for neighbors which cannot be contacted in a timely manner. * Remove user_blocks config option. No one needs to use this anymore. * Localize distances on lqm page * Improve status reporting * First run emergency node setup. When a node first runs LQM, if the default settings fail to connect to a node we will now adjust them so that at least one node is viable. * Restore blocking of mac addresses * LQM now off by default fixed #47
2022-05-18 11:49:00 -06:00
function lqm_enabled()
return cursor_get("aredn", "@lqm[0]", "enable") == "1"
end
function lqm_defaults()
cursor_set("aredn", "@lqm[0]", "min_snr", "15")
cursor_set("aredn", "@lqm[0]", "margin_snr", "1")
cursor_set("aredn", "@lqm[0]", "min_distance", "0")
cursor_set("aredn", "@lqm[0]", "auto_distance", "0")
Link Quality Management (#360) * Link Quality Management experiment (built in) * Protect LQM pages * Omit "empty" mac addresses * Integrate LQM v0.2 Includes proposed UI if this were built-in. When LQM is enabled (advanced settings) the usual distance inputs are replaced with "min snr' and "max distance" inputs which are the major ones you might tweak, as well as a link to the LQM status page. Other controls are now available (so protected) in advanced settings. * Improve LQM updating * Use running snr averages * Merge app changes * AREDN-ize the UI * Improve status language * Improved DtD detection * Improve quality reporting * Link Quality category * Enable by default * Better intergration * Link => Neighbor * Formatting * Make sure initial page is populated without extra fetch * Handle empty lqm.info * Update with latest experiment algorithm changes * Validate LQM settings before applying them * Algorithm updates * Improve quality reporting * %% -> % * Default max distance now 50 miles * Get actual noise if radio will provide it * low_snr => min_snr * Dont print node description if we dont have one * Remove properties duplicated from setup page * Localize max distance. Miles in GB and US, Kilometers everywhere else. * Ping link quality testing * UDP 'ping' for quality check * Change Active Settings title * Expand ping test * Improve messaging * Add a ping penalty for neighbors which cannot be contacted in a timely manner. * Remove user_blocks config option. No one needs to use this anymore. * Localize distances on lqm page * Improve status reporting * First run emergency node setup. When a node first runs LQM, if the default settings fail to connect to a node we will now adjust them so that at least one node is viable. * Restore blocking of mac addresses * LQM now off by default fixed #47
2022-05-18 11:49:00 -06:00
cursor_set("aredn", "@lqm[0]", "max_distance", "80467")
cursor_set("aredn", "@lqm[0]", "min_quality", "50")
2022-05-20 07:10:01 -06:00
cursor_set("aredn", "@lqm[0]", "ping_penalty", "5")
Link Quality Management (#360) * Link Quality Management experiment (built in) * Protect LQM pages * Omit "empty" mac addresses * Integrate LQM v0.2 Includes proposed UI if this were built-in. When LQM is enabled (advanced settings) the usual distance inputs are replaced with "min snr' and "max distance" inputs which are the major ones you might tweak, as well as a link to the LQM status page. Other controls are now available (so protected) in advanced settings. * Improve LQM updating * Use running snr averages * Merge app changes * AREDN-ize the UI * Improve status language * Improved DtD detection * Improve quality reporting * Link Quality category * Enable by default * Better intergration * Link => Neighbor * Formatting * Make sure initial page is populated without extra fetch * Handle empty lqm.info * Update with latest experiment algorithm changes * Validate LQM settings before applying them * Algorithm updates * Improve quality reporting * %% -> % * Default max distance now 50 miles * Get actual noise if radio will provide it * low_snr => min_snr * Dont print node description if we dont have one * Remove properties duplicated from setup page * Localize max distance. Miles in GB and US, Kilometers everywhere else. * Ping link quality testing * UDP 'ping' for quality check * Change Active Settings title * Expand ping test * Improve messaging * Add a ping penalty for neighbors which cannot be contacted in a timely manner. * Remove user_blocks config option. No one needs to use this anymore. * Localize distances on lqm page * Improve status reporting * First run emergency node setup. When a node first runs LQM, if the default settings fail to connect to a node we will now adjust them so that at least one node is viable. * Restore blocking of mac addresses * LQM now off by default fixed #47
2022-05-18 11:49:00 -06:00
cursor_set("aredn", "@lqm[0]", "margin_quality", "1")
end
function current_force_upgrade()
return nixio.fs.stat("/tmp/force-upgrade-this-is-dangerous") and 1 or 0
end
function update_force_upgrade()
if not newval or newval ~= "1" then
nixio.fs.remove("/tmp/force-upgrade-this-is-dangerous")
else
io.open("/tmp/force-upgrade-this-is-dangerous", "w+"):close()
end
end
function writePackageRepo(repo)
2022-03-03 16:03:08 -07:00
local uciurl = cursor_get("aredn", "@downloads[0]", "pkgs_" .. repo)
local disturl = capture("grep aredn_" .. repo .. " /etc/opkg/distfeeds.conf | cut -d' ' -f3")
if uciurl and disturl ~= "" then
os.execute("sed -i 's|" .. disturl:chomp() .. "|" .. uciurl:chomp() .. "|g' /etc/opkg/distfeeds.conf")
end
end
function currentWANVLAN()
for line in io.lines("/etc/config.mesh/_setup")
do
Update AREDN to OpenWRT 22.3.2 (Major Upgrade) (#574) * Update to Openwrt 21.02 and add support for the CPE710 v1 Update scripts to change references to ifname to device due to a change in Openwrt naming reverse-wpad-basic-wolfssl and disable SSL on Curl NOTE: The compile host must have python3-distutils installed for gpsd to build * aredn: initial working upgrade to openwrt 21.02.1 * aredn: update 1 to working upgrade to openwrt 21.02.1 * aredn: add cpe710v1 to build config * Andrew's patches * Remove duplicates + display perl * Temp disable wifi extension patch * ifname/ports support * Add spectrum patch back in * Generic function to extra interfaces * New api to get wifi ifname * Disables jails * Style link * aredn: partial upgrade to openwrt 22.0.3.0 added AC device images and partial migration to 22.0.3.0 firewall upgrade pending * aredn: update mesh-release and revert config.mk * Unused * NFT firewall rewrite * Common-isze configs * Fix network layout for hap2 * Use local packages dev (new firewall rules) * Add HAP2 * Add pause after network restart to let bridge reinitialize * Various lua fixes for new lua version * Tweak config * Re-fix networking (lost patch change) * Add new radio names * Tolerate missing wifi * Fix hap-lite switch setup * More devices * New radio id * Build Rocket 5AC lite * Remove need for luci.sys * Remove need for luci.sys * Explicitly name wlan interfaces * Handle different compatibility verisoning * Update networking for switches * ipref version bump * Extra flag for curl * Better compat_version fix * Remove wolfssl * Fix dns server * Fix device name * Unused * Remove things we dont need * Remove unused packages * Generic macaddr overrides * Fix uci commit * Fix luci.template.parser to avoid luci.http loading the real thing * Rocket-M build * Add search-domain dhcp option * Turn of ipv6 * No IPV6 in dnsmasq * Override mac addresses if devices all the same * Working from master (for now) * Put back hostap * Disable old ethmac fixup * Tweak configs * Move back to v22.03.2 Leave ipq4019 builds to master * Need IPV6 to compile nft firewall * Rocket-M fixes * Before we start * WIP * Working snapshot * Cleaned patches * Merged patch * Single patch to support HAP2 * Fix typo * Add nanostation-m * 5/10Mhz patch * 5+10MHz patch for ath10k-ct driver * Extend 2Ghz channel check to include -4 to -1 * Add chanbw setup for ath10k (like ath9k) * Added TP-Link CPE710 v1 * Override firmwares * Missing patch * Dropbear config like 3.22.8.0 * Add Ubiquiti Rocket 5AC Lite * Fix c6 * Update * Need more scan channels * Remove IPV6 * Improve mac fixups * Put back missing nft app * IPv6 removed so dont have to disable it * Fix rocket-m flash bug * Fix nanostation-m * Nanobridge is tiny * Fix wifi order for ar750 * Rocket M5 XW support * New rates * Fix firewall4 so we don't need IPv6 * Allow channel width to be restricted * Move channel list into library * Fix naming * Mechanism to block specific channels on specific radios * Refresh buttons * routerboard-sxt-5nd * CPE605 v1.0 * Improve rocket m xw * tpink * Update patch * Update to remove disable * Remove BW restrictions on cpe710 * Restrict to what has been tested * Remove test BW restrictions * sxtsq-5-ac * Update * Update * powerbeam-m5-300 support * Fix * Fix hap2 * Tidy unused patches * Remove limit * Add ubnt_bullet-m-ar7241 * Added ubnt_nanobeam-ac-gen2 * Fix typo * Tolerate missing dtd ip * Explicitly gix hap2 mac addresses * Fix some broken patches * Hap2 wont work at 5MHz * Ubiquiti LiteBeam 5AC Gen2 * Fix compat_version for sxt 5ac * Update patch * Unused * Fix lan configuration for some devices * Rolling average of noise level * Unused * Split out the ath10k rssi monitor (its very simple at the moment) * Ignore .DS_Store * Reboot if ethernet doesnt come up (but only once!) * reboot returns - add exit * Add some logging info * Fix ] * Check all possibly ethernet bridges * Improve mac fixing * Remove HostAP on small memory devices * Reduce dropbear footprint * Add setsid * Kill hostap when upgrading to save memory * Different way to detect hostapd unavailable * New build steps * Improve manager logging * Fix name conflict for the two monitors * Try to improve test mesh name resolve problem * Migrate tiny to generic (tiny doesnt work properly) * Typo * Another attempt to fix macs for Mikrotik * Protect against missing trackers * Fix wpad for ipq40xx * Remove old tunnel check code * Enable ZRAM swap to aid low memory devices * ath10k noise can something be out of range - protect against that * Updated with current devices and status * Update firmware which has been tested * Updated with more builds * More binary/README * Fix css error * Start noise at sensible base level * Unfix the css so it looks how it use to. * Save as much memory as we can on lowmem nodes * Hide some options on low memory devices * Add "eol" to 32MB devices * Restart network rather than reboot node if it seems to be broken * Fixes * Revert network reset * Fix ar750 networking * Continue to trim tiny configs * More devices * Dump IW output messages * Fix Rocket 5AC intermittent ethernet issue * Ethernet fix for PowerBeam 5AC 500 * More tiny size reduction * More support data * Fixed POE and USB power features * Add Ubiquiti NanoBeam AC (gen1) * NanoStation (not NanoBeam) * Add mii-tool package * Device updates * Bump update time to 5 minutes * Fix ethernet negotiation for rocker-5ac and nanobeam * Fix iplookup * Config changes based on call feedback * Radio listing fixes * Update with more untested builds * Fallback TxMbps extracted from iw station dump * Fix tunnel detection for low memory nodes * Remove unused feed packages * snapshot build * Update stability info * Add powerbeam-5ac-500 * Typo * Add missing 3.22.1.0 * Add MikroTik LHG 5 AC * Fix permissions * Fix permissions * AirGrid's take Bullet builds * Mikrotik AC3 * Improve supportdata structure a little to make it easier to find things * Restore WAN VLAN overrides * Fix vlan regex for hap2 and hap3 * Support old and new style poe controls * hap-ac3 is version 1.1 * Handle typo in some openwrt config files * Fix HAP AC3 install * Update hap ac3 status * Support user overrides for network ports (non-swconfig devices) * LHG 5AC support * Remove -nand * Remove non-working platform.sh change * tunnel weight override * Omit LinkQualityMult when value is 1 * Add mANTBox 19s and 15s * Support ath79 mikrotik devices which require ath10k in the initramfs Co-authored-by: apcameron <apcameron@softhome.net> Co-authored-by: Joe AE6XE <ae6xe@arrl.net> Co-authored-by: Joe Ayers <joe@arrl.net>
2022-12-22 13:22:49 -07:00
local vlan = line:match("^wan_intf = %w+%.(%d+)")
if vlan then
return vlan
end
end
Update AREDN to OpenWRT 22.3.2 (Major Upgrade) (#574) * Update to Openwrt 21.02 and add support for the CPE710 v1 Update scripts to change references to ifname to device due to a change in Openwrt naming reverse-wpad-basic-wolfssl and disable SSL on Curl NOTE: The compile host must have python3-distutils installed for gpsd to build * aredn: initial working upgrade to openwrt 21.02.1 * aredn: update 1 to working upgrade to openwrt 21.02.1 * aredn: add cpe710v1 to build config * Andrew's patches * Remove duplicates + display perl * Temp disable wifi extension patch * ifname/ports support * Add spectrum patch back in * Generic function to extra interfaces * New api to get wifi ifname * Disables jails * Style link * aredn: partial upgrade to openwrt 22.0.3.0 added AC device images and partial migration to 22.0.3.0 firewall upgrade pending * aredn: update mesh-release and revert config.mk * Unused * NFT firewall rewrite * Common-isze configs * Fix network layout for hap2 * Use local packages dev (new firewall rules) * Add HAP2 * Add pause after network restart to let bridge reinitialize * Various lua fixes for new lua version * Tweak config * Re-fix networking (lost patch change) * Add new radio names * Tolerate missing wifi * Fix hap-lite switch setup * More devices * New radio id * Build Rocket 5AC lite * Remove need for luci.sys * Remove need for luci.sys * Explicitly name wlan interfaces * Handle different compatibility verisoning * Update networking for switches * ipref version bump * Extra flag for curl * Better compat_version fix * Remove wolfssl * Fix dns server * Fix device name * Unused * Remove things we dont need * Remove unused packages * Generic macaddr overrides * Fix uci commit * Fix luci.template.parser to avoid luci.http loading the real thing * Rocket-M build * Add search-domain dhcp option * Turn of ipv6 * No IPV6 in dnsmasq * Override mac addresses if devices all the same * Working from master (for now) * Put back hostap * Disable old ethmac fixup * Tweak configs * Move back to v22.03.2 Leave ipq4019 builds to master * Need IPV6 to compile nft firewall * Rocket-M fixes * Before we start * WIP * Working snapshot * Cleaned patches * Merged patch * Single patch to support HAP2 * Fix typo * Add nanostation-m * 5/10Mhz patch * 5+10MHz patch for ath10k-ct driver * Extend 2Ghz channel check to include -4 to -1 * Add chanbw setup for ath10k (like ath9k) * Added TP-Link CPE710 v1 * Override firmwares * Missing patch * Dropbear config like 3.22.8.0 * Add Ubiquiti Rocket 5AC Lite * Fix c6 * Update * Need more scan channels * Remove IPV6 * Improve mac fixups * Put back missing nft app * IPv6 removed so dont have to disable it * Fix rocket-m flash bug * Fix nanostation-m * Nanobridge is tiny * Fix wifi order for ar750 * Rocket M5 XW support * New rates * Fix firewall4 so we don't need IPv6 * Allow channel width to be restricted * Move channel list into library * Fix naming * Mechanism to block specific channels on specific radios * Refresh buttons * routerboard-sxt-5nd * CPE605 v1.0 * Improve rocket m xw * tpink * Update patch * Update to remove disable * Remove BW restrictions on cpe710 * Restrict to what has been tested * Remove test BW restrictions * sxtsq-5-ac * Update * Update * powerbeam-m5-300 support * Fix * Fix hap2 * Tidy unused patches * Remove limit * Add ubnt_bullet-m-ar7241 * Added ubnt_nanobeam-ac-gen2 * Fix typo * Tolerate missing dtd ip * Explicitly gix hap2 mac addresses * Fix some broken patches * Hap2 wont work at 5MHz * Ubiquiti LiteBeam 5AC Gen2 * Fix compat_version for sxt 5ac * Update patch * Unused * Fix lan configuration for some devices * Rolling average of noise level * Unused * Split out the ath10k rssi monitor (its very simple at the moment) * Ignore .DS_Store * Reboot if ethernet doesnt come up (but only once!) * reboot returns - add exit * Add some logging info * Fix ] * Check all possibly ethernet bridges * Improve mac fixing * Remove HostAP on small memory devices * Reduce dropbear footprint * Add setsid * Kill hostap when upgrading to save memory * Different way to detect hostapd unavailable * New build steps * Improve manager logging * Fix name conflict for the two monitors * Try to improve test mesh name resolve problem * Migrate tiny to generic (tiny doesnt work properly) * Typo * Another attempt to fix macs for Mikrotik * Protect against missing trackers * Fix wpad for ipq40xx * Remove old tunnel check code * Enable ZRAM swap to aid low memory devices * ath10k noise can something be out of range - protect against that * Updated with current devices and status * Update firmware which has been tested * Updated with more builds * More binary/README * Fix css error * Start noise at sensible base level * Unfix the css so it looks how it use to. * Save as much memory as we can on lowmem nodes * Hide some options on low memory devices * Add "eol" to 32MB devices * Restart network rather than reboot node if it seems to be broken * Fixes * Revert network reset * Fix ar750 networking * Continue to trim tiny configs * More devices * Dump IW output messages * Fix Rocket 5AC intermittent ethernet issue * Ethernet fix for PowerBeam 5AC 500 * More tiny size reduction * More support data * Fixed POE and USB power features * Add Ubiquiti NanoBeam AC (gen1) * NanoStation (not NanoBeam) * Add mii-tool package * Device updates * Bump update time to 5 minutes * Fix ethernet negotiation for rocker-5ac and nanobeam * Fix iplookup * Config changes based on call feedback * Radio listing fixes * Update with more untested builds * Fallback TxMbps extracted from iw station dump * Fix tunnel detection for low memory nodes * Remove unused feed packages * snapshot build * Update stability info * Add powerbeam-5ac-500 * Typo * Add missing 3.22.1.0 * Add MikroTik LHG 5 AC * Fix permissions * Fix permissions * AirGrid's take Bullet builds * Mikrotik AC3 * Improve supportdata structure a little to make it easier to find things * Restore WAN VLAN overrides * Fix vlan regex for hap2 and hap3 * Support old and new style poe controls * hap-ac3 is version 1.1 * Handle typo in some openwrt config files * Fix HAP AC3 install * Update hap ac3 status * Support user overrides for network ports (non-swconfig devices) * LHG 5AC support * Remove -nand * Remove non-working platform.sh change * tunnel weight override * Omit LinkQualityMult when value is 1 * Add mANTBox 19s and 15s * Support ath79 mikrotik devices which require ath10k in the initramfs Co-authored-by: apcameron <apcameron@softhome.net> Co-authored-by: Joe AE6XE <ae6xe@arrl.net> Co-authored-by: Joe Ayers <joe@arrl.net>
2022-12-22 13:22:49 -07:00
local vlan = aredn.hardware.get_board_network_ifname("wan"):match("^%w+%.(%d+)")
if vlan then
return vlan
end
return ""
end
function changeWANVLAN()
2022-04-16 17:32:23 -06:00
local lines = {}
for line in io.lines("/etc/config.mesh/_setup")
do
if not line:match("^wan_intf = ") then
lines[#lines + 1] = line
end
end
if newval ~= "" then
local wan_intf = ""
Update AREDN to OpenWRT 22.3.2 (Major Upgrade) (#574) * Update to Openwrt 21.02 and add support for the CPE710 v1 Update scripts to change references to ifname to device due to a change in Openwrt naming reverse-wpad-basic-wolfssl and disable SSL on Curl NOTE: The compile host must have python3-distutils installed for gpsd to build * aredn: initial working upgrade to openwrt 21.02.1 * aredn: update 1 to working upgrade to openwrt 21.02.1 * aredn: add cpe710v1 to build config * Andrew's patches * Remove duplicates + display perl * Temp disable wifi extension patch * ifname/ports support * Add spectrum patch back in * Generic function to extra interfaces * New api to get wifi ifname * Disables jails * Style link * aredn: partial upgrade to openwrt 22.0.3.0 added AC device images and partial migration to 22.0.3.0 firewall upgrade pending * aredn: update mesh-release and revert config.mk * Unused * NFT firewall rewrite * Common-isze configs * Fix network layout for hap2 * Use local packages dev (new firewall rules) * Add HAP2 * Add pause after network restart to let bridge reinitialize * Various lua fixes for new lua version * Tweak config * Re-fix networking (lost patch change) * Add new radio names * Tolerate missing wifi * Fix hap-lite switch setup * More devices * New radio id * Build Rocket 5AC lite * Remove need for luci.sys * Remove need for luci.sys * Explicitly name wlan interfaces * Handle different compatibility verisoning * Update networking for switches * ipref version bump * Extra flag for curl * Better compat_version fix * Remove wolfssl * Fix dns server * Fix device name * Unused * Remove things we dont need * Remove unused packages * Generic macaddr overrides * Fix uci commit * Fix luci.template.parser to avoid luci.http loading the real thing * Rocket-M build * Add search-domain dhcp option * Turn of ipv6 * No IPV6 in dnsmasq * Override mac addresses if devices all the same * Working from master (for now) * Put back hostap * Disable old ethmac fixup * Tweak configs * Move back to v22.03.2 Leave ipq4019 builds to master * Need IPV6 to compile nft firewall * Rocket-M fixes * Before we start * WIP * Working snapshot * Cleaned patches * Merged patch * Single patch to support HAP2 * Fix typo * Add nanostation-m * 5/10Mhz patch * 5+10MHz patch for ath10k-ct driver * Extend 2Ghz channel check to include -4 to -1 * Add chanbw setup for ath10k (like ath9k) * Added TP-Link CPE710 v1 * Override firmwares * Missing patch * Dropbear config like 3.22.8.0 * Add Ubiquiti Rocket 5AC Lite * Fix c6 * Update * Need more scan channels * Remove IPV6 * Improve mac fixups * Put back missing nft app * IPv6 removed so dont have to disable it * Fix rocket-m flash bug * Fix nanostation-m * Nanobridge is tiny * Fix wifi order for ar750 * Rocket M5 XW support * New rates * Fix firewall4 so we don't need IPv6 * Allow channel width to be restricted * Move channel list into library * Fix naming * Mechanism to block specific channels on specific radios * Refresh buttons * routerboard-sxt-5nd * CPE605 v1.0 * Improve rocket m xw * tpink * Update patch * Update to remove disable * Remove BW restrictions on cpe710 * Restrict to what has been tested * Remove test BW restrictions * sxtsq-5-ac * Update * Update * powerbeam-m5-300 support * Fix * Fix hap2 * Tidy unused patches * Remove limit * Add ubnt_bullet-m-ar7241 * Added ubnt_nanobeam-ac-gen2 * Fix typo * Tolerate missing dtd ip * Explicitly gix hap2 mac addresses * Fix some broken patches * Hap2 wont work at 5MHz * Ubiquiti LiteBeam 5AC Gen2 * Fix compat_version for sxt 5ac * Update patch * Unused * Fix lan configuration for some devices * Rolling average of noise level * Unused * Split out the ath10k rssi monitor (its very simple at the moment) * Ignore .DS_Store * Reboot if ethernet doesnt come up (but only once!) * reboot returns - add exit * Add some logging info * Fix ] * Check all possibly ethernet bridges * Improve mac fixing * Remove HostAP on small memory devices * Reduce dropbear footprint * Add setsid * Kill hostap when upgrading to save memory * Different way to detect hostapd unavailable * New build steps * Improve manager logging * Fix name conflict for the two monitors * Try to improve test mesh name resolve problem * Migrate tiny to generic (tiny doesnt work properly) * Typo * Another attempt to fix macs for Mikrotik * Protect against missing trackers * Fix wpad for ipq40xx * Remove old tunnel check code * Enable ZRAM swap to aid low memory devices * ath10k noise can something be out of range - protect against that * Updated with current devices and status * Update firmware which has been tested * Updated with more builds * More binary/README * Fix css error * Start noise at sensible base level * Unfix the css so it looks how it use to. * Save as much memory as we can on lowmem nodes * Hide some options on low memory devices * Add "eol" to 32MB devices * Restart network rather than reboot node if it seems to be broken * Fixes * Revert network reset * Fix ar750 networking * Continue to trim tiny configs * More devices * Dump IW output messages * Fix Rocket 5AC intermittent ethernet issue * Ethernet fix for PowerBeam 5AC 500 * More tiny size reduction * More support data * Fixed POE and USB power features * Add Ubiquiti NanoBeam AC (gen1) * NanoStation (not NanoBeam) * Add mii-tool package * Device updates * Bump update time to 5 minutes * Fix ethernet negotiation for rocker-5ac and nanobeam * Fix iplookup * Config changes based on call feedback * Radio listing fixes * Update with more untested builds * Fallback TxMbps extracted from iw station dump * Fix tunnel detection for low memory nodes * Remove unused feed packages * snapshot build * Update stability info * Add powerbeam-5ac-500 * Typo * Add missing 3.22.1.0 * Add MikroTik LHG 5 AC * Fix permissions * Fix permissions * AirGrid's take Bullet builds * Mikrotik AC3 * Improve supportdata structure a little to make it easier to find things * Restore WAN VLAN overrides * Fix vlan regex for hap2 and hap3 * Support old and new style poe controls * hap-ac3 is version 1.1 * Handle typo in some openwrt config files * Fix HAP AC3 install * Update hap ac3 status * Support user overrides for network ports (non-swconfig devices) * LHG 5AC support * Remove -nand * Remove non-working platform.sh change * tunnel weight override * Omit LinkQualityMult when value is 1 * Add mANTBox 19s and 15s * Support ath79 mikrotik devices which require ath10k in the initramfs Co-authored-by: apcameron <apcameron@softhome.net> Co-authored-by: Joe AE6XE <ae6xe@arrl.net> Co-authored-by: Joe Ayers <joe@arrl.net>
2022-12-22 13:22:49 -07:00
for dev in aredn.hardware.get_board_network_ifname("wan"):gmatch("%S+")
do
wan_intf = wan_intf .. " " .. dev:match("^([^%.]+)") .. "." .. newval
end
if wan_intf ~= "" then
lines[#lines + 1] = "wan_intf =" .. wan_intf
end
2022-04-16 17:32:23 -06:00
end
local f = io.open("/etc/config.mesh/_setup", "w")
if f then
for _, line in ipairs(lines)
do
f:write(line .. "\n")
end
f:close()
end
end
2023-12-06 13:19:18 -07:00
function validate_rsyslog()
if newval ~= "" then
local proto, ip, port = newval:match("^(.+)://(%d+%.%d+%.%d+%.%d+):(%d+)$")
if not proto or not (proto == "tcp" or proto == "udp") then
msg("Badly formatted remote logging URL")
newval = ""
end
end
end
-- read_postdata
local parms = {}
if os.getenv("REQUEST_METHOD") == "POST" then
require('luci.http')
Update AREDN to OpenWRT 22.3.2 (Major Upgrade) (#574) * Update to Openwrt 21.02 and add support for the CPE710 v1 Update scripts to change references to ifname to device due to a change in Openwrt naming reverse-wpad-basic-wolfssl and disable SSL on Curl NOTE: The compile host must have python3-distutils installed for gpsd to build * aredn: initial working upgrade to openwrt 21.02.1 * aredn: update 1 to working upgrade to openwrt 21.02.1 * aredn: add cpe710v1 to build config * Andrew's patches * Remove duplicates + display perl * Temp disable wifi extension patch * ifname/ports support * Add spectrum patch back in * Generic function to extra interfaces * New api to get wifi ifname * Disables jails * Style link * aredn: partial upgrade to openwrt 22.0.3.0 added AC device images and partial migration to 22.0.3.0 firewall upgrade pending * aredn: update mesh-release and revert config.mk * Unused * NFT firewall rewrite * Common-isze configs * Fix network layout for hap2 * Use local packages dev (new firewall rules) * Add HAP2 * Add pause after network restart to let bridge reinitialize * Various lua fixes for new lua version * Tweak config * Re-fix networking (lost patch change) * Add new radio names * Tolerate missing wifi * Fix hap-lite switch setup * More devices * New radio id * Build Rocket 5AC lite * Remove need for luci.sys * Remove need for luci.sys * Explicitly name wlan interfaces * Handle different compatibility verisoning * Update networking for switches * ipref version bump * Extra flag for curl * Better compat_version fix * Remove wolfssl * Fix dns server * Fix device name * Unused * Remove things we dont need * Remove unused packages * Generic macaddr overrides * Fix uci commit * Fix luci.template.parser to avoid luci.http loading the real thing * Rocket-M build * Add search-domain dhcp option * Turn of ipv6 * No IPV6 in dnsmasq * Override mac addresses if devices all the same * Working from master (for now) * Put back hostap * Disable old ethmac fixup * Tweak configs * Move back to v22.03.2 Leave ipq4019 builds to master * Need IPV6 to compile nft firewall * Rocket-M fixes * Before we start * WIP * Working snapshot * Cleaned patches * Merged patch * Single patch to support HAP2 * Fix typo * Add nanostation-m * 5/10Mhz patch * 5+10MHz patch for ath10k-ct driver * Extend 2Ghz channel check to include -4 to -1 * Add chanbw setup for ath10k (like ath9k) * Added TP-Link CPE710 v1 * Override firmwares * Missing patch * Dropbear config like 3.22.8.0 * Add Ubiquiti Rocket 5AC Lite * Fix c6 * Update * Need more scan channels * Remove IPV6 * Improve mac fixups * Put back missing nft app * IPv6 removed so dont have to disable it * Fix rocket-m flash bug * Fix nanostation-m * Nanobridge is tiny * Fix wifi order for ar750 * Rocket M5 XW support * New rates * Fix firewall4 so we don't need IPv6 * Allow channel width to be restricted * Move channel list into library * Fix naming * Mechanism to block specific channels on specific radios * Refresh buttons * routerboard-sxt-5nd * CPE605 v1.0 * Improve rocket m xw * tpink * Update patch * Update to remove disable * Remove BW restrictions on cpe710 * Restrict to what has been tested * Remove test BW restrictions * sxtsq-5-ac * Update * Update * powerbeam-m5-300 support * Fix * Fix hap2 * Tidy unused patches * Remove limit * Add ubnt_bullet-m-ar7241 * Added ubnt_nanobeam-ac-gen2 * Fix typo * Tolerate missing dtd ip * Explicitly gix hap2 mac addresses * Fix some broken patches * Hap2 wont work at 5MHz * Ubiquiti LiteBeam 5AC Gen2 * Fix compat_version for sxt 5ac * Update patch * Unused * Fix lan configuration for some devices * Rolling average of noise level * Unused * Split out the ath10k rssi monitor (its very simple at the moment) * Ignore .DS_Store * Reboot if ethernet doesnt come up (but only once!) * reboot returns - add exit * Add some logging info * Fix ] * Check all possibly ethernet bridges * Improve mac fixing * Remove HostAP on small memory devices * Reduce dropbear footprint * Add setsid * Kill hostap when upgrading to save memory * Different way to detect hostapd unavailable * New build steps * Improve manager logging * Fix name conflict for the two monitors * Try to improve test mesh name resolve problem * Migrate tiny to generic (tiny doesnt work properly) * Typo * Another attempt to fix macs for Mikrotik * Protect against missing trackers * Fix wpad for ipq40xx * Remove old tunnel check code * Enable ZRAM swap to aid low memory devices * ath10k noise can something be out of range - protect against that * Updated with current devices and status * Update firmware which has been tested * Updated with more builds * More binary/README * Fix css error * Start noise at sensible base level * Unfix the css so it looks how it use to. * Save as much memory as we can on lowmem nodes * Hide some options on low memory devices * Add "eol" to 32MB devices * Restart network rather than reboot node if it seems to be broken * Fixes * Revert network reset * Fix ar750 networking * Continue to trim tiny configs * More devices * Dump IW output messages * Fix Rocket 5AC intermittent ethernet issue * Ethernet fix for PowerBeam 5AC 500 * More tiny size reduction * More support data * Fixed POE and USB power features * Add Ubiquiti NanoBeam AC (gen1) * NanoStation (not NanoBeam) * Add mii-tool package * Device updates * Bump update time to 5 minutes * Fix ethernet negotiation for rocker-5ac and nanobeam * Fix iplookup * Config changes based on call feedback * Radio listing fixes * Update with more untested builds * Fallback TxMbps extracted from iw station dump * Fix tunnel detection for low memory nodes * Remove unused feed packages * snapshot build * Update stability info * Add powerbeam-5ac-500 * Typo * Add missing 3.22.1.0 * Add MikroTik LHG 5 AC * Fix permissions * Fix permissions * AirGrid's take Bullet builds * Mikrotik AC3 * Improve supportdata structure a little to make it easier to find things * Restore WAN VLAN overrides * Fix vlan regex for hap2 and hap3 * Support old and new style poe controls * hap-ac3 is version 1.1 * Handle typo in some openwrt config files * Fix HAP AC3 install * Update hap ac3 status * Support user overrides for network ports (non-swconfig devices) * LHG 5AC support * Remove -nand * Remove non-working platform.sh change * tunnel weight override * Omit LinkQualityMult when value is 1 * Add mANTBox 19s and 15s * Support ath79 mikrotik devices which require ath10k in the initramfs Co-authored-by: apcameron <apcameron@softhome.net> Co-authored-by: Joe AE6XE <ae6xe@arrl.net> Co-authored-by: Joe Ayers <joe@arrl.net>
2022-12-22 13:22:49 -07:00
local request = luci.http.Request(nixio.getenv(),
function()
local v = io.read(1024)
if not v then
io.close()
end
return v
end
)
parms = request:formvalue()
end
if parms.button_firstboot then
os.execute("firstboot -y")
end
if parms.button_firstboot or parms.button_reboot then
html.reboot()
end
local node = aredn.info.get_nvram("node")
for i, setting in ipairs(settings)
do
if parms["button_save_" .. i] then
newval = parms["newval_" .. i]
if not newval then
newval = ""
else
newval = newval:gsub("^%s+", ""):gsub("%s+$", "")
end
if setting.type == "boolean" then
if newval == "1" or newval == "true" then
newval = "1"
else
newval = "0"
end
end
key = setting.key
if setting.precallback then
loadstring(setting.precallback)()
end
local a, b, c = setting.key:match("(.+)%.(.+)%.(.*)")
cursor_set(a, b, c, newval)
msg("Changed " .. key)
if setting.postcallback then
loadstring(setting.postcallback)()
end
os.execute("/usr/local/bin/node-setup > /dev/null 2>&1")
os.execute("/usr/local/bin/restart-services.sh > /dev/null 2>&1")
break
end
end
-- generate the page
http_header()
html.header(node .. " Advanced Configuration", false)
html.print([[
<style>
th {
padding:5px;
}
.brsm {
display:block;
margin-top:0.5em;
margin-bottom:0.5em;
}
#settings tr:hover {
background-color:gainsboro;
}
/* The switch - the box around the slider */
.switch {
position: relative;
display: inline-block;
2022-03-22 05:33:00 -06:00
vertical-align:middle;
width: 48px;
height: 20px;
}
/* Hide default HTML checkbox */
.switch input {
opacity: 0;
width: 0;
height: 0;
}
/* The slider */
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
-webkit-transition: .4s;
transition: .4s;
}
.slider:before {
position: absolute;
content: "";
2022-03-22 05:33:00 -06:00
height: 13px;
width: 13px;
left: 4px;
bottom: 4px;
background-color: white;
-webkit-transition: .4s;
transition: .4s;
}
input:checked + .slider {
background-color: #2196F3;
}
input:focus + .slider {
box-shadow: 0 0 1px #2196F3;
}
input:checked + .slider:before {
-webkit-transform: translateX(26px);
-ms-transform: translateX(26px);
transform: translateX(26px);
}
/* Rounded sliders */
.slider.round {
border-radius: 34px;
}
.slider.round:before {
border-radius: 50%;
2021-03-27 10:28:17 -06:00
}
</style>
<script>
function toggleDefault(fname, defval) {
if(document.getElementById(fname).checked) {
cval = '1'
} else {
cval = '0'
}
if(cval != defval) {
document.getElementById(fname).click();
}
return true;
}
</script>
</head>
]])
html.print("<body><center>")
html.alert_banner();
2022-09-09 08:41:52 -06:00
html.print("<form method=post action=advancedconfig enctype='multipart/form-data'>")
-- navbar
html.navbar_admin("advancedconfig")
2022-09-09 08:41:52 -06:00
-- help link and buttons table
html.print("<table width=800px><tr align=center><td>")
html.print("<a href='/help.html#advancedconfig' target='_blank'>Help</a>")
html.print("&nbsp; &nbsp; <input type=submit name=button_reboot value=Reboot style='font-weight:bold' title='Immediately reboot this node'>")
local overlay = false
for line in io.lines("/proc/mounts")
do
if line:match("overlay") then
overlay = true
break
end
end
if overlay then
html.print("&nbsp; &nbsp; <input type=submit name=button_firstboot value='Reset to Firstboot' onclick=\"return confirm('All config settings and add-on packages will be lost back to first boot state. Continue?')\" title='Reset this node to the initial/firstboot status and reboot.'>")
end
html.print("</td></tr></table>")
2022-09-09 08:41:52 -06:00
html.print("<div style='margin:10px;padding:5px;background-color:#FF0000;color:#FFFFFF;width:650px;'>")
html.print("<strong>WARNING:</strong> Changing advanced settings can be harmful to the stability, security, and performance of this node and potentially the entire mesh network.<br><strong>You should only continue if you are sure of what you are doing.</strong></div>")
2022-09-09 08:41:52 -06:00
-- messages table
html.print("<table width=800px>")
2022-04-16 17:32:23 -06:00
if nixio.fs.stat("/tmp/reboot-required") then
2022-09-09 08:41:52 -06:00
html.print("<tr align=center><td width=100%><h3>Reboot is required for changes to take effect</h3></td></tr>")
2022-04-16 17:32:23 -06:00
end
for _, m in ipairs(msgs)
do
2022-09-09 08:41:52 -06:00
html.print("<tr align=center><td width=100%><strong>" .. m .. "</strong></td></tr>")
end
2022-09-09 08:41:52 -06:00
html.print("</table><br />")
2022-09-09 08:41:52 -06:00
-- advanced configuration settings table
html.print([[
<table id=settings border=1 style='border-collapse:collapse;' width=800px>
<thead>
2022-09-09 08:41:52 -06:00
<tr align=center>
<th>Setting</th>
<th>Value</th>
<th>Actions</th>
</tr>
</thead>
]])
-- settings
2022-09-09 08:41:52 -06:00
html.print("<tbody>")
local prior_category = ""
for i, setting in ipairs(settings)
do
if not setting.condition or loadstring("return " .. setting.condition)() then
local sval
if setting.current then
sval = loadstring("return " .. setting.current)()
else
local a, b, c = setting.key:match("(.+)%.(.+)%.(.*)")
sval = cursor_get(a, b, c)
end
2022-03-03 16:03:08 -07:00
sval = sval and tostring(sval) or ""
if setting.category ~= prior_category then
2022-09-09 08:41:52 -06:00
html.print([[<tr align=center style=background-color:lightseagreen><td colspan=3><b>]] .. setting.category .. [[</b></td></tr>]])
prior_category = setting.category
end
2022-09-09 08:41:52 -06:00
html.print("<tr><td width=40%>" .. setting.desc .. "</td>")
html.print("<td width=45%>")
if setting.type == "string" then
2022-09-09 08:41:52 -06:00
html.print("<input type='text' id='field_" .. i .. "' name='newval_" .. i .. "' style='width:100%' value='" .. sval .. "'>")
elseif setting.type == "boolean" then
if sval == "" then
sval = setting.default
end
if sval == "1" then
html.print("OFF<label class='switch'><input type='checkbox' id='field_" .. i .. "' name='newval_" .. i .."' value='1' checked><span class='slider round'></span></label>ON")
else
html.print("OFF<label class='switch'><input type='checkbox' id='field_" .. i .. "' name='newval_" .. i .. "' value='1'><span class='slider round'></span></label>ON")
end
elseif setting.type == "none" then
html.print("Click EXECUTE button to trigger this action<input type='hidden' id='field_" .. i .. "' name='newval_" .. i .."' value='" .. sval .."'>")
end
html.print("</td>")
if setting.type ~= "none" then
html.print("<td align='center' width=15%><span class=brsm /><input type='submit' name='button_save_" .. i .. "' value='Save Setting' /><br><span class=brsm />")
else
html.print("<td align='center' width=15%><span style='vertical-align:middle;'><input type='submit' name='button_save_" .. i .. "' value='Execute' /><span>")
end
if setting.type == "string" then
html.print("<input value='Set to Default' type='button' onclick=\"document.getElementById('field_" .. i .. "').value='" .. setting.default .. "';\">")
elseif setting.type == "boolean" then
html.print("<input value='Set to Default' type='button' onclick=\"return toggleDefault('field_" .. i .. "', '" .. setting.default .. "' );\">")
end
html.print("</td></tr>")
end
end
2022-09-09 08:41:52 -06:00
html.print("</tbody></table></form></center>")
html.footer()
html.print("</body></html>")
http_footer()