From ab07b8c4d960925fe3467ea666871965b5b34259 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sun, 15 Dec 2019 22:35:21 +0100 Subject: luci-mod-network: reimplement diagnostics page as client side view Signed-off-by: Jo-Philipp Wich --- .../luasrc/controller/admin/network.lua | 42 -------- .../luasrc/view/admin_network/diagnostics.htm | 117 --------------------- 2 files changed, 159 deletions(-) delete mode 100644 modules/luci-mod-network/luasrc/view/admin_network/diagnostics.htm (limited to 'modules/luci-mod-network/luasrc') diff --git a/modules/luci-mod-network/luasrc/controller/admin/network.lua b/modules/luci-mod-network/luasrc/controller/admin/network.lua index 4e9d27e8a8..109c59f2a7 100644 --- a/modules/luci-mod-network/luasrc/controller/admin/network.lua +++ b/modules/luci-mod-network/luasrc/controller/admin/network.lua @@ -66,45 +66,3 @@ function remote_addr() luci.http.prepare_content("application/json") luci.http.write_json(result) end - -function diag_command(cmd, addr) - if addr and addr:match("^[a-zA-Z0-9%-%.:_]+$") then - luci.http.prepare_content("text/plain") - - local util = io.popen(cmd % luci.util.shellquote(addr)) - if util then - while true do - local ln = util:read("*l") - if not ln then break end - luci.http.write(ln) - luci.http.write("\n") - end - - util:close() - end - - return - end - - luci.http.status(500, "Bad address") -end - -function diag_ping(addr) - diag_command("ping -c 5 -W 1 %s 2>&1", addr) -end - -function diag_traceroute(addr) - diag_command("traceroute -q 1 -w 1 -n %s 2>&1", addr) -end - -function diag_nslookup(addr) - diag_command("nslookup %s 2>&1", addr) -end - -function diag_ping6(addr) - diag_command("ping6 -c 5 %s 2>&1", addr) -end - -function diag_traceroute6(addr) - diag_command("traceroute6 -q 1 -w 2 -n %s 2>&1", addr) -end diff --git a/modules/luci-mod-network/luasrc/view/admin_network/diagnostics.htm b/modules/luci-mod-network/luasrc/view/admin_network/diagnostics.htm deleted file mode 100644 index 03dd5aab29..0000000000 --- a/modules/luci-mod-network/luasrc/view/admin_network/diagnostics.htm +++ /dev/null @@ -1,117 +0,0 @@ -<%# - Copyright 2010 Jo-Philipp Wich - Licensed to the public under the Apache License 2.0. --%> - -<%+header%> - -<% -local fs = require "nixio.fs" -local has_ping6 = fs.access("/bin/ping6") or fs.access("/usr/bin/ping6") -local has_traceroute6 = fs.access("/bin/traceroute6") or 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" -%> - - - -
-
-

<%:Diagnostics%>

- -
- <%:Network Utilities%> - -
-
-
-
- <% if has_ping6 then %> - - - - - <% else %> - - <% end %> -
- -
-
- <% if has_traceroute6 then %> - - - - - <% else %> - - <% end %> - <% if not has_traceroute6 then %> -

 

-

<%:Install iputils-traceroute6 for IPv6 traceroute%>

- <% end %> -
- -
-
- -
-
-
-
-
- - -
- -<%+footer%> -- cgit v1.2.3