luci-base: network.js: implement Protocol.getGateway6Addr()
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
parent
5bb7d55ed1
commit
199428a9c3
1 changed files with 21 additions and 0 deletions
|
@ -2158,6 +2158,27 @@ Protocol = L.Class.extend(/** @lends LuCI.Network.Protocol.prototype */ {
|
|||
return rv;
|
||||
},
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue