diff options
author | Mikael Magnusson <mikma@users.sourceforge.net> | 2019-09-13 22:38:33 +0200 |
---|---|---|
committer | Mikael Magnusson <mikma@users.sourceforge.net> | 2019-09-13 22:38:33 +0200 |
commit | ae27901c888a8c4565be25c5e36904654739c089 (patch) | |
tree | 86e586b1795fc88586f5c491ec4f30778432152e | |
parent | 98cde82e4d585e432efcb468a3e4cdc52b685a25 (diff) |
WIP from 2018-11-28multiplipv6prefixes
5 files changed, 20 insertions, 3 deletions
diff --git a/modules/luci-base/luasrc/model/cbi/admin_network/proto_static.lua b/modules/luci-base/luasrc/model/cbi/admin_network/proto_static.lua index 3f8b091cf..ac8b7bf65 100644 --- a/modules/luci-base/luasrc/model/cbi/admin_network/proto_static.lua +++ b/modules/luci-base/luasrc/model/cbi/admin_network/proto_static.lua @@ -60,7 +60,7 @@ if luci.model.network:has_ipv6() then local ip6prefix = s:taboption("general", Value, "ip6prefix", translate("IPv6 routed prefix"), translate("Public prefix routed to this device for distribution to clients.")) - ip6prefix.datatype = "ip6addr" + ip6prefix.datatype = "list(ip6addr)" ip6prefix:depends("ip6assign", "") local ip6ifaceid = s:taboption("general", Value, "ip6ifaceid", translate("IPv6 suffix"), diff --git a/modules/luci-base/luasrc/model/network.lua b/modules/luci-base/luasrc/model/network.lua index 49e1657aa..5910a7856 100644 --- a/modules/luci-base/luasrc/model/network.lua +++ b/modules/luci-base/luasrc/model/network.lua @@ -1119,6 +1119,14 @@ function protocol.ip6prefix(self) end end +function protocol.ip6prefixes(self) + local prefixes = { } + for _, prefix in ipairs(self:_ubus("ipv6-prefix") or { }) do + prefixes[#prefixes+1] = "%s/%d" %{ prefix.address, prefix.mask } + end + return prefixes +end + function protocol.errors(self) local _, err, rv local errors = self:_ubus("errors") diff --git a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/iface_status.js b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/iface_status.js index 88f48d189..dbde0beab 100644 --- a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/iface_status.js +++ b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/iface_status.js @@ -30,7 +30,11 @@ requestAnimationFrame(function() { _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[7] : null, _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[8] : null, _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[9] : null, - _('IPv6-PD'), ifc.ip6prefix, + _('IPv6-PD'), ifc.ip6prefixes ? ifc.ip6prefixes[0] : null, + _('IPv6-PD'), ifc.ip6prefixes ? ifc.ip6prefixes[1] : null, + _('IPv6-PD'), ifc.ip6prefixes ? ifc.ip6prefixes[2] : null, + _('IPv6-PD'), ifc.ip6prefixes ? ifc.ip6prefixes[3] : null, + _('IPv6-PD'), ifc.ip6prefixes ? ifc.ip6prefixes[4] : null, null, ifc.ifname ? null : E('em', _('Interface not present or not connected yet.')) ]); diff --git a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/network.js b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/network.js index acca7cf8a..4bce1ecb8 100644 --- a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/network.js +++ b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/network.js @@ -101,7 +101,11 @@ L.poll(5, L.url('admin/network/iface_status', networks.join(',')), null, _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[7] : null, _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[8] : null, _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[9] : null, - _('IPv6-PD'), ifc.ip6prefix, + _('IPv6-PD'), ifc.ip6prefixes ? ifc.ip6prefixes[0] : null, + _('IPv6-PD'), ifc.ip6prefixes ? ifc.ip6prefixes[1] : null, + _('IPv6-PD'), ifc.ip6prefixes ? ifc.ip6prefixes[2] : null, + _('IPv6-PD'), ifc.ip6prefixes ? ifc.ip6prefixes[3] : null, + _('IPv6-PD'), ifc.ip6prefixes ? ifc.ip6prefixes[4] : null, _('Error'), ifc.errors ? ifc.errors[0] : null, _('Error'), ifc.errors ? ifc.errors[1] : null, _('Error'), ifc.errors ? ifc.errors[2] : null, diff --git a/modules/luci-mod-network/luasrc/controller/admin/network.lua b/modules/luci-mod-network/luasrc/controller/admin/network.lua index 1da5eac46..6d3e3026d 100644 --- a/modules/luci-mod-network/luasrc/controller/admin/network.lua +++ b/modules/luci-mod-network/luasrc/controller/admin/network.lua @@ -203,6 +203,7 @@ function iface_status(ifaces) ip6addrs = net:ip6addrs(), dnsaddrs = net:dnsaddrs(), ip6prefix = net:ip6prefix(), + ip6prefixes= net:ip6prefixes(), errors = net:errors(), name = device:shortname(), type = device:type(), |