Fix broken reboot on advancedconfig page (#239)

This commit is contained in:
Tim Wilkinson 2022-02-28 12:38:05 -08:00 committed by GitHub
parent 253b23d303
commit 7600284487
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 29 additions and 29 deletions

View File

@ -244,6 +244,34 @@ function msg(m)
msgs[#msgs + 1] = m msgs[#msgs + 1] = m
end end
-- uci cursor
local cursora = uci:cursor()
local cursorb = uci:cursor("/etc/config.mesh")
function cursor_set(a, b, c, d)
cursora:set(a, b, c, d)
cursorb:set(a, b, c, d)
cursora:commit(a)
cursorb:commit(a)
end
function cursor_add(a, b, c)
cursora:set(a, b, c)
cursorb:set(a, b, c)
cursora:commit(a)
cursorb:commit(a)
end
function cursor_delete(a, b)
cursora:delete(a, b)
cursorb:delete(a, b)
cursora:commit(a)
cursorb:commit(a)
end
function cursor_get(a, b, c)
return cursora:get(a, b, c)
end
function reboot() function reboot()
local node = aredn.info.get_nvram("node") local node = aredn.info.get_nvram("node")
if node == "" then if node == "" then
@ -263,7 +291,7 @@ function reboot()
lanmask = ip_to_decimal(lanmask) lanmask = ip_to_decimal(lanmask)
local cfgip = cursor_get("network", "lan", "ipaddr") local cfgip = cursor_get("network", "lan", "ipaddr")
local cfgmask = ip_to_decimal(cursor_get("network", "lan", "netmask")) local cfgmask = ip_to_decimal(cursor_get("network", "lan", "netmask"))
if lanmask ~= cfgmask or decimal_to_ip(nixio.bit.band(ip_to_decimal(ip), lanmask)) ~= nixio.bit.band(ip_to_decimal(cfgip), cfgmask) then if lanmask ~= cfgmask or decimal_to_ip(nixio.bit.band(ip_to_decimal(lanip), lanmask)) ~= nixio.bit.band(ip_to_decimal(cfgip), cfgmask) then
subnet_change = true subnet_change = true
end end
end end
@ -296,34 +324,6 @@ function reboot()
os.exit() os.exit()
end end
-- uci cursor
local cursora = uci:cursor()
local cursorb = uci:cursor("/etc/config.mesh")
function cursor_set(a, b, c, d)
cursora:set(a, b, c, d)
cursorb:set(a, b, c, d)
cursora:commit(a)
cursorb:commit(a)
end
function cursor_add(a, b, c)
cursora:set(a, b, c)
cursorb:set(a, b, c)
cursora:commit(a)
cursorb:commit(a)
end
function cursor_delete(a, b)
cursora:delete(a, b)
cursorb:delete(a, b)
cursora:commit(a)
cursorb:commit(a)
end
function cursor_get(a, b, c)
return cursora:get(a, b, c)
end
-- conditionals -- conditionals
function hasPOE() function hasPOE()