Supernode improvements (#945)

* Supernode tunnels are always "perfect"

* Move Super Mesh button onto mesh page
This commit is contained in:
Tim Wilkinson 2023-09-24 20:40:28 -07:00 committed by GitHub
parent 57e0d045e9
commit da8520e202
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 17 deletions

View File

@ -1,8 +0,0 @@
if nixio.fs.stat("/tmp/dnsmasq.d/supernode.conf") then
local ip = read_all("/tmp/dnsmasq.d/supernode.conf"):match("^#(%S+)")
if ip then
return { href = "http://" .. ip .. "/cgi-bin/mesh", display = "Super Mesh", hint = "See what is on the supernode mesh" }
end
elseif uci.cursor():get("aredn", "@supernode[0]", "enable") == "1" then
return { href = "/cgi-bin/mesh", display = "Super Mesh", hint = "See what is on the supernode mesh" }
end

View File

@ -349,7 +349,8 @@ if #tunnels > 0 then
print([[Interface]] .. tuns)
print([[{]])
print([[ Ip4Broadcast 255.255.255.255]])
if not tun_weight or tun_weight < 1 then
local is_supernode = cursor:get("aredn", "@supernode[0]", "enable") == "1"
if not tun_weight or tun_weight < 1 or is_supernode then
print([[ Mode "ether"]])
elseif tun_weight > 1 then
print([[ LinkQualityMult default ]] .. (1 / tun_weight))

View File

@ -269,7 +269,8 @@ local settings = {
type = "string",
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",
needreboot= true
needreboot= true,
condition = "not isSupernode()"
},
{
category = "Tunnel Options",
@ -581,12 +582,8 @@ function supportsVLANChange()
return false
end
function canBeSupernode()
local board = aredn.hardware.get_board_type()
if board == "mikrotik,hap-ac2" or board == "qemu-standard-pc-i440fx-piix-1996" then
return true
end
return false
function isSupernode()
return cursor_get("aredn", "@supernode[0]", "enable") == "1"
end
-- callbacks

View File

@ -511,7 +511,13 @@ else
html.print("&nbsp;&nbsp;")
html.print("<input type=submit name=auto value=Auto title='Automatic page refresh'>")
end
if nixio.fs.stat("/tmp/dnsmasq.d/supernode.conf") then
local ip = read_all("/tmp/dnsmasq.d/supernode.conf"):match("^#(%S+)")
if ip then
html.print("&nbsp;&nbsp;")
html.print("<a target=_blank href='http://" .. ip .. "/cgi-bin/mesh'><button type=button title='See what is on the whole AREDN mesh'>Super Mesh</button></a>")
end
end
html.print("&nbsp;&nbsp;")
html.print("<button type=button onClick='window.location=\"status\"' title='Return to the status page'>Quit</button>")
html.print("&nbsp;&nbsp;")