From b11317b551f08ba520e6a2c292b08a8d7dbe67f4 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Tue, 6 Mar 2018 13:28:02 +0100 Subject: luci-mod-admin-full: add protocol column to active routes tables --- .../luasrc/view/admin_status/routes.htm | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_status/routes.htm b/modules/luci-mod-admin-full/luasrc/view/admin_status/routes.htm index 5f2c07493..12e580656 100644 --- a/modules/luci-mod-admin-full/luasrc/view/admin_status/routes.htm +++ b/modules/luci-mod-admin-full/luasrc/view/admin_status/routes.htm @@ -18,16 +18,26 @@ [253] = "default", [0] = "unspec" } + local rpn = { + [0] = "unspec", + } + - if nixio.fs.access("/etc/iproute2/rt_tables") then + local function read_rt_info(file, tbl) local ln - for ln in io.lines("/etc/iproute2/rt_tables") do + if not nixio.fs.access(file) then + return + end + for ln in io.lines(file) do local i, n = ln:match("^(%d+)%s+(%S+)") if i and n then - rtn[tonumber(i)] = n + tbl[tonumber(i)] = n end end end + + read_rt_info("/etc/iproute2/rt_tables", rtn) + read_rt_info("/etc/iproute2/rt_protos", rpn) -%> <%+header%> @@ -74,6 +84,7 @@ <%:Network%> <%:Target%> <%_IPv4-Gateway%> + <%:Proto%> <%:Metric%> <%:Table%> @@ -82,6 +93,7 @@ <%=luci.tools.webadmin.iface_get_network(v.dev) or v.dev%> <%=v.dest%> <%=v.gw%> + <%=rpn[v.proto] or v.proto%> <%=v.metric or 0%> <%=rtn[v.table] or v.table%> @@ -104,6 +116,7 @@ <%:Network%> <%:Target%> <%:Source%> + <%:Proto%> <%:Metric%> <%:Table%> @@ -115,6 +128,7 @@ <%=luci.tools.webadmin.iface_get_network(v.dev) or '(' .. v.dev .. ')'%> <%=v.dest%> <%=v.from%> + <%=rpn[v.proto] or v.proto%> <%=v.metric or 0%> <%=rtn[v.table] or v.table%> -- cgit v1.2.3