summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2020-01-29 09:37:43 +0100
committerJo-Philipp Wich <jo@mein.io>2020-01-29 09:37:43 +0100
commit0a07d53594b1b9152ea87e4be7366cc91ad36cc1 (patch)
tree5f2ab7638d43dd3423cfb232ac5359651e043490
parent885c97da535c0c77d79e53391de5c37f2704e01a (diff)
luci-app-advanced-reboot: properly handle multiple or missing lan IPs
Fixes: #3587 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
-rw-r--r--applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua b/applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua
index 8b68ecbed..097c71d67 100644
--- a/applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua
+++ b/applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua
@@ -183,7 +183,7 @@ function action_reboot()
ltemplate.render("advanced_reboot/applyreboot", {
title = i18n.translate("Rebooting..."),
msg = i18n.translate("The system is rebooting now.<br /> DO NOT POWER OFF THE DEVICE!<br /> Wait a few minutes before you try to reconnect. It might be necessary to renew the address of your computer to reach the device again, depending on your settings."),
- addr = ip.new(type(ip) == "string" and ip or "192.168.1.1") or "192.168.1.1"
+ addr = ip.new(util.imatch(ip)() or "192.168.1.1")
})
sys.reboot()
end
@@ -255,7 +255,7 @@ function action_altreboot()
ltemplate.render("advanced_reboot/applyreboot", {
title = i18n.translate("Rebooting..."),
msg = i18n.translate("The system is rebooting to an alternative partition now.<br /> DO NOT POWER OFF THE DEVICE!<br /> Wait a few minutes before you try to reconnect. It might be necessary to renew the address of your computer to reach the device again, depending on your settings."),
- addr = ip.new(uci:get("network", "lan", "ipaddr")) or "192.168.1.1"
+ addr = ip.new(util.imatch(uci:get("network", "lan", "ipaddr"))() or "192.168.1.1")
})
sys.reboot()
else
@@ -288,7 +288,7 @@ function action_poweroff()
ltemplate.render("advanced_reboot/applyreboot", {
title = i18n.translate("Shutting down..."),
msg = i18n.translate("The system is shutting down now.<br /> DO NOT POWER OFF THE DEVICE!<br /> It might be necessary to renew the address of your computer to reach the device again, depending on your settings."),
- addr = ip.new(uci:get("network", "lan", "ipaddr")) or "192.168.1.1"
+ addr = ip.new(util.imatch(uci:get("network", "lan", "ipaddr"))() or "192.168.1.1")
})
sys.call("/sbin/poweroff")
end