summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/htdocs/luci-static
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2019-10-22 22:38:09 +0200
committerJo-Philipp Wich <jo@mein.io>2019-10-22 22:38:29 +0200
commit199428a9c3fdff57f80afaeb33be615a37bb3f81 (patch)
tree81302a6a4cb1fa5d2e11898e345c531f513a3a51 /modules/luci-base/htdocs/luci-static
parent5bb7d55ed166ac734c34adc702fb545cb4346073 (diff)
luci-base: network.js: implement Protocol.getGateway6Addr()
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-base/htdocs/luci-static')
-rw-r--r--modules/luci-base/htdocs/luci-static/resources/network.js21
1 files changed, 21 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 c5b0c3027d..5fa6167b27 100644
--- a/modules/luci-base/htdocs/luci-static/resources/network.js
+++ b/modules/luci-base/htdocs/luci-static/resources/network.js
@@ -2159,6 +2159,27 @@ Protocol = L.Class.extend(/** @lends LuCI.Network.Protocol.prototype */ {
},
/**
+ * Query the gateway (nexthop) of the IPv6 default route associated with
+ * this logical interface.
+ *
+ * @returns {string}
+ * Returns a string containing the IPv6 nexthop address of the associated
+ * default route or `null` if no default route was found.
+ */
+ getGateway6Addr: function() {
+ var routes = this._ubus('route');
+
+ if (Array.isArray(routes))
+ for (var i = 0; i < routes.length; i++)
+ if (typeof(routes[i]) == 'object' &&
+ routes[i].target == '::' &&
+ routes[i].mask == 0)
+ return routes[i].nexthop;
+
+ return null;
+ },
+
+ /**
* Query the IPv6 DNS servers associated with the logical interface.
*
* @returns {string[]}