summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-mod-admin-full
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2016-07-31 15:59:58 +0200
committerJo-Philipp Wich <jo@mein.io>2016-07-31 16:00:09 +0200
commit1367f7b624e9ee926cdbd3235a9fec4450c904b5 (patch)
treea4e660c0c6a6a24a20bb2092a012a388a267a87f /modules/luci-mod-admin-full
parentf9e5d11d62cbb3c4203a07ac5cc3873a783bb824 (diff)
luci-mod-admin-full: fix net diagnostics with missing config
Gracefully handle a missing diag section in /etc/config/luci when rendering the network diagnostics tool page. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-mod-admin-full')
-rw-r--r--modules/luci-mod-admin-full/luasrc/view/admin_network/diagnostics.htm10
1 files changed, 7 insertions, 3 deletions
diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_network/diagnostics.htm b/modules/luci-mod-admin-full/luasrc/view/admin_network/diagnostics.htm
index 90d711717..f4adb2606 100644
--- a/modules/luci-mod-admin-full/luasrc/view/admin_network/diagnostics.htm
+++ b/modules/luci-mod-admin-full/luasrc/view/admin_network/diagnostics.htm
@@ -9,6 +9,10 @@
local fs = require "nixio.fs"
local has_ping6 = fs.access("/bin/ping6") or fs.access("/usr/bin/ping6")
local has_traceroute6 = fs.access("/usr/bin/traceroute6")
+
+local dns_host = luci.config.diag and luci.config.diag.dns or "dev.openwrt.org"
+local ping_host = luci.config.diag and luci.config.diag.ping or "dev.openwrt.org"
+local route_host = luci.config.diag and luci.config.diag.route or "dev.openwrt.org"
%>
<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
@@ -63,7 +67,7 @@ local has_traceroute6 = fs.access("/usr/bin/traceroute6")
<br />
<div style="width:30%; float:left">
- <input style="margin: 5px 0" type="text" value="<%=luci.config.diag.ping%>" name="ping" /><br />
+ <input style="margin: 5px 0" type="text" value="<%=ping_host%>" name="ping" /><br />
<% if has_ping6 then %>
<select name="ping_proto" style="width:auto">
<option value="" selected="selected"><%:IPv4%></option>
@@ -76,7 +80,7 @@ local has_traceroute6 = fs.access("/usr/bin/traceroute6")
</div>
<div style="width:33%; float:left">
- <input style="margin: 5px 0" type="text" value="<%=luci.config.diag.route%>" name="traceroute" /><br />
+ <input style="margin: 5px 0" type="text" value="<%=route_host%>" name="traceroute" /><br />
<% if has_traceroute6 then %>
<select name="traceroute_proto" style="width:auto">
<option value="" selected="selected"><%:IPv4%></option>
@@ -93,7 +97,7 @@ local has_traceroute6 = fs.access("/usr/bin/traceroute6")
</div>
<div style="width:33%; float:left;">
- <input style="margin: 5px 0" type="text" value="<%=luci.config.diag.dns%>" name="nslookup" /><br />
+ <input style="margin: 5px 0" type="text" value="<%=dns_host%>" name="nslookup" /><br />
<input type="button" value="<%:Nslookup%>" class="cbi-button cbi-button-apply" onclick="update_status(this.form.nslookup)" />
</div>