diff options
author | Paul Donald <newtwen+github@gmail.com> | 2024-11-05 18:33:05 +0100 |
---|---|---|
committer | Paul Donald <newtwen+github@gmail.com> | 2024-11-05 18:33:29 +0100 |
commit | 37682ded6f0cf8ca495f7ea95f72a15995ffaa03 (patch) | |
tree | 89d17af4a9b9c848f6ae44cc067f3f03fc2ba201 /modules/luci-base/htdocs/luci-static | |
parent | d90728d2c05da46fe5c2a1a1100a93f9a55730d7 (diff) |
luci-base: network; implement getIP6Prefixes()
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
Diffstat (limited to 'modules/luci-base/htdocs/luci-static')
-rw-r--r-- | modules/luci-base/htdocs/luci-static/resources/network.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/network.js b/modules/luci-base/htdocs/luci-static/resources/network.js index 3bd344a61e..d9a0ef24c0 100644 --- a/modules/luci-base/htdocs/luci-static/resources/network.js +++ b/modules/luci-base/htdocs/luci-static/resources/network.js @@ -2388,6 +2388,25 @@ Protocol = baseclass.extend(/** @lends LuCI.network.Protocol.prototype */ { }, /** + * Query the routed IPv6 prefixes associated with the logical interface. + * + * @returns {null|string[]} + * Returns an array of the routed IPv6 prefixes registered by the remote + * protocol handler or `null` if no prefixes are present. + */ + getIP6Prefixes: function() { + var prefixes = this._ubus('ipv6-prefix'); + var rv = []; + + if (Array.isArray(prefixes)) + for (var i = 0; i < prefixes.length; i++) + if (L.isObject(prefixes[i])) + rv.push('%s/%d'.format(prefixes[i].address, prefixes[i].mask)); + + return rv.length > 0 ? rv: null; + }, + + /** * Query interface error messages published in `ubus` runtime state. * * Interface errors are emitted by remote protocol handlers if the setup |