X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=modules%2Fadmin-full%2Fluasrc%2Fcontroller%2Fadmin%2Fnetwork.lua;h=6f55ff77796162feadb125fc8ccd68a81947d219;hp=00e1fe2ff1fb9f676a7cc924633bd1ae2ebdfb36;hb=69dbc27ce0517c0bd414bbfb9cdff53fa968a3cd;hpb=dce04bbcb2b2b41898281ed5de0622705bf17b1e diff --git a/modules/admin-full/luasrc/controller/admin/network.lua b/modules/admin-full/luasrc/controller/admin/network.lua index 00e1fe2ff..6f55ff777 100644 --- a/modules/admin-full/luasrc/controller/admin/network.lua +++ b/modules/admin-full/luasrc/controller/admin/network.lua @@ -10,7 +10,6 @@ You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 -$Id$ ]]-- module("luci.controller.admin.network", package.seeall) @@ -39,6 +38,9 @@ function index() 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 @@ -154,6 +156,12 @@ function index() 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 @@ -417,6 +425,14 @@ function lease_status() 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] @@ -453,3 +469,11 @@ end 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