Merge pull request #981 from NvrBst/pull-request-ipv6_prefix_status_display
mod-admin-full: Add IPv6 Prefix Delegation information to Status Pages
This commit is contained in:
commit
e6f158b2ee
5 changed files with 53 additions and 8 deletions
|
@ -950,6 +950,13 @@ function protocol.dns6addrs(self)
|
||||||
return dns
|
return dns
|
||||||
end
|
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)
|
function protocol.is_bridge(self)
|
||||||
return (not self:is_virtual() and self:type() == "bridge")
|
return (not self:is_virtual() and self:type() == "bridge")
|
||||||
end
|
end
|
||||||
|
|
|
@ -238,6 +238,7 @@ function iface_status(ifaces)
|
||||||
ipaddrs = net:ipaddrs(),
|
ipaddrs = net:ipaddrs(),
|
||||||
ip6addrs = net:ip6addrs(),
|
ip6addrs = net:ip6addrs(),
|
||||||
dnsaddrs = net:dnsaddrs(),
|
dnsaddrs = net:dnsaddrs(),
|
||||||
|
ip6prefix = net:ip6prefix(),
|
||||||
name = device:shortname(),
|
name = device:shortname(),
|
||||||
type = device:type(),
|
type = device:type(),
|
||||||
ifname = device:name(),
|
ifname = device:name(),
|
||||||
|
|
|
@ -165,6 +165,11 @@
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ifc.ip6prefix)
|
||||||
|
{
|
||||||
|
html += String.format('<strong><%:IPv6-PD%>:</strong> %s<br />', ifc.ip6prefix);
|
||||||
|
}
|
||||||
|
|
||||||
d.innerHTML = html;
|
d.innerHTML = html;
|
||||||
}
|
}
|
||||||
else if (d && !ifc.proto)
|
else if (d && !ifc.proto)
|
||||||
|
|
|
@ -55,6 +55,11 @@
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ifc.ip6prefix)
|
||||||
|
{
|
||||||
|
html += String.format('<strong><%:IPv6-PD%>:</strong> %s<br />', ifc.ip6prefix);
|
||||||
|
}
|
||||||
|
|
||||||
d.innerHTML = html;
|
d.innerHTML = html;
|
||||||
}
|
}
|
||||||
else if (d)
|
else if (d)
|
||||||
|
|
|
@ -79,7 +79,9 @@
|
||||||
ip6addr = wan6:ip6addr(),
|
ip6addr = wan6:ip6addr(),
|
||||||
gw6addr = wan6:gw6addr(),
|
gw6addr = wan6:gw6addr(),
|
||||||
dns = wan6:dns6addrs(),
|
dns = wan6:dns6addrs(),
|
||||||
|
ip6prefix = wan6:ip6prefix(),
|
||||||
uptime = wan6:uptime(),
|
uptime = wan6:uptime(),
|
||||||
|
proto = wan6:proto(),
|
||||||
ifname = wan6:ifname(),
|
ifname = wan6:ifname(),
|
||||||
link = wan6:adminlink()
|
link = wan6:adminlink()
|
||||||
}
|
}
|
||||||
|
@ -233,9 +235,34 @@
|
||||||
if (ifc6 && ifc6.ifname && ifc6.proto != 'none')
|
if (ifc6 && ifc6.ifname && ifc6.proto != 'none')
|
||||||
{
|
{
|
||||||
var s = String.format(
|
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 />',
|
'<strong><%:Gateway%>: </strong>%s<br />',
|
||||||
(ifc6.ip6addr) ? ifc6.ip6addr : '::',
|
|
||||||
(ifc6.gw6addr) ? ifc6.gw6addr : '::'
|
(ifc6.gw6addr) ? ifc6.gw6addr : '::'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue