diff options
author | Jo-Philipp Wich <jo@mein.io> | 2017-01-28 13:45:44 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-28 13:45:44 +0100 |
commit | e6f158b2ee3cbc8b81734a21ab6aa1db7ff020ac (patch) | |
tree | cde177de7120a18110d6281deebc3137241128d2 /modules | |
parent | f5461669afa4aba943ecc5800d9a468fb0ce1cd0 (diff) | |
parent | 5377d22b4a8d8f2234ddb5e65783343a6f2f6897 (diff) |
Merge pull request #981 from NvrBst/pull-request-ipv6_prefix_status_display
mod-admin-full: Add IPv6 Prefix Delegation information to Status Pages
Diffstat (limited to 'modules')
5 files changed, 53 insertions, 8 deletions
diff --git a/modules/luci-base/luasrc/model/network.lua b/modules/luci-base/luasrc/model/network.lua index 2d8336bf33..49d91b875a 100644 --- a/modules/luci-base/luasrc/model/network.lua +++ b/modules/luci-base/luasrc/model/network.lua @@ -950,6 +950,13 @@ function protocol.dns6addrs(self) return dns end +function protocol.ip6prefix(self) + local prefix = self:_ubus("ipv6-prefix") + if prefix and #prefix > 0 then + return "%s/%d" %{ prefix[1].address, prefix[1].mask } + end +end + function protocol.is_bridge(self) return (not self:is_virtual() and self:type() == "bridge") end diff --git a/modules/luci-mod-admin-full/luasrc/controller/admin/network.lua b/modules/luci-mod-admin-full/luasrc/controller/admin/network.lua index 3b5f3eb8de..2cb2108b9f 100644 --- a/modules/luci-mod-admin-full/luasrc/controller/admin/network.lua +++ b/modules/luci-mod-admin-full/luasrc/controller/admin/network.lua @@ -238,6 +238,7 @@ function iface_status(ifaces) ipaddrs = net:ipaddrs(), ip6addrs = net:ip6addrs(), dnsaddrs = net:dnsaddrs(), + ip6prefix = net:ip6prefix(), name = device:shortname(), type = device:type(), ifname = device:name(), diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_network/iface_overview.htm b/modules/luci-mod-admin-full/luasrc/view/admin_network/iface_overview.htm index 646d931f37..2512a35b3c 100644 --- a/modules/luci-mod-admin-full/luasrc/view/admin_network/iface_overview.htm +++ b/modules/luci-mod-admin-full/luasrc/view/admin_network/iface_overview.htm @@ -164,6 +164,11 @@ ifc.ip6addrs[i] ); } + + if (ifc.ip6prefix) + { + html += String.format('<strong><%:IPv6-PD%>:</strong> %s<br />', ifc.ip6prefix); + } d.innerHTML = html; } diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_network/iface_status.htm b/modules/luci-mod-admin-full/luasrc/view/admin_network/iface_status.htm index 8c3b1abcc7..b15dd13f39 100644 --- a/modules/luci-mod-admin-full/luasrc/view/admin_network/iface_status.htm +++ b/modules/luci-mod-admin-full/luasrc/view/admin_network/iface_status.htm @@ -54,6 +54,11 @@ ifc.ip6addrs[i] ); } + + if (ifc.ip6prefix) + { + html += String.format('<strong><%:IPv6-PD%>:</strong> %s<br />', ifc.ip6prefix); + } d.innerHTML = html; } diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm b/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm index 8976e30cba..206f9ef82a 100644 --- a/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm +++ b/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm @@ -76,12 +76,14 @@ if wan6 then rv.wan6 = { - ip6addr = wan6:ip6addr(), - gw6addr = wan6:gw6addr(), - dns = wan6:dns6addrs(), - uptime = wan6:uptime(), - ifname = wan6:ifname(), - link = wan6:adminlink() + ip6addr = wan6:ip6addr(), + gw6addr = wan6:gw6addr(), + dns = wan6:dns6addrs(), + ip6prefix = wan6:ip6prefix(), + uptime = wan6:uptime(), + proto = wan6:proto(), + ifname = wan6:ifname(), + link = wan6:adminlink() } end @@ -233,9 +235,34 @@ if (ifc6 && ifc6.ifname && ifc6.proto != 'none') { var s = String.format( - '<strong><%:Address%>: </strong>%s<br />' + + '<strong><%:Type%>: </strong>%s%s<br />', + ifc6.proto, (ifc6.ip6prefix) ? '-pd' : '' + ); + + if (!ifc6.ip6prefix) + { + s += String.format( + '<strong><%:Address%>: </strong>%s<br />', + (ifc6.ip6addr) ? ifc6.ip6addr : '::' + ); + } + else + { + s += String.format( + '<strong><%:Prefix Delegated%>: </strong>%s<br />', + ifc6.ip6prefix + ); + if (ifc6.ip6addr) + { + s += String.format( + '<strong><%:Address%>: </strong>%s<br />', + ifc6.ip6addr + ); + } + } + + s += String.format( '<strong><%:Gateway%>: </strong>%s<br />', - (ifc6.ip6addr) ? ifc6.ip6addr : '::', (ifc6.gw6addr) ? ifc6.gw6addr : '::' ); |