http://www.apache.org/licenses/LICENSE-2.0
-$Id$
]]--
module("luci.controller.admin.network", package.seeall)
page.target = cbi("admin_network/vlan")
page.title = _("Switch")
page.order = 20
+
+ page = entry({"admin", "network", "switch_status"}, call("switch_status"), nil)
+ page.leaf = true
end
page = entry({"admin", "network", "diag_traceroute"}, call("diag_traceroute"), nil)
page.leaf = true
+
+ page = entry({"admin", "network", "diag_ping6"}, call("diag_ping6"), nil)
+ page.leaf = true
+
+ page = entry({"admin", "network", "diag_traceroute6"}, call("diag_traceroute6"), nil)
+ page.leaf = true
-- end
end
luci.http.write(']')
end
+function switch_status()
+ local path = luci.dispatcher.context.requestpath
+ local s = require "luci.tools.status"
+
+ luci.http.prepare_content("application/json")
+ luci.http.write_json(s.switch_status(path[#path]))
+end
+
function diag_command(cmd)
local path = luci.dispatcher.context.requestpath
local addr = path[#path]
function diag_nslookup()
diag_command("nslookup %q 2>&1")
end
+
+function diag_ping6()
+ diag_command("ping6 -c 5 %q 2>&1")
+end
+
+function diag_traceroute6()
+ diag_command("traceroute6 -q 1 -w 2 -n %q 2>&1")
+end