1
0
mirror of https://git.openwrt.org/project/luci.git synced 2025-10-14 01:32:18 +08:00

luci-mod-network,-status: show DHCPv6 lease IAID

The IAID is important information as it allows the user to know which
interface on the client device a given DHCPv6 lease corresponds to.
odhcpd already exposes this information (e.g. via "ubus call dhcp
ipv6leases"), but it would be good to have access to the same
information via the web interface, especially since odhcpd does take the
IAID into account when allocating addresses.

Signed-off-by: David Härdeman <david@hardeman.nu>
This commit is contained in:
David Härdeman
2025-09-16 18:27:56 +02:00
committed by Paul Donald
parent 7f8a6b701e
commit 19057e3760
3 changed files with 12 additions and 5 deletions

View File

@@ -355,6 +355,7 @@ struct lease_entry {
struct ether_addr mac;
char *hostname;
char *duid;
char *iaid;
union {
struct in_addr in;
struct in6_addr in6;
@@ -487,16 +488,14 @@ lease_next(void)
strtok(NULL, " \t\n"); /* iface */
e.duid = strtok(NULL, " \t\n"); /* duid */
if (!e.duid)
continue;
p = strtok(NULL, " \t\n"); /* iaid */
if (!p)
e.iaid = strtok(NULL, " \t\n"); /* iaid */
if (!e.iaid)
continue;
if (!strcmp(p, "ipv4")) {
if (!strcmp(e.iaid, "ipv4")) {
e.af = AF_INET;
e.mask = 32;
}
@@ -597,6 +596,7 @@ lease_next(void)
e.hostname = strtok(NULL, " \t\n");
e.duid = strtok(NULL, " \t\n");
e.iaid = NULL;
if (!e.hostname || !e.duid)
continue;
@@ -1964,6 +1964,9 @@ rpc_luci_get_dhcp_leases(struct ubus_context *ctx, struct ubus_object *obj,
if (lease->duid)
blobmsg_add_string(&blob, "duid", lease->duid);
if (lease->iaid)
blobmsg_add_string(&blob, "iaid", lease->iaid);
inet_ntop(lease->af, &lease->addr[0].in6, s, sizeof(s));
blobmsg_add_string(&blob, (af == AF_INET) ? "ipaddr" : "ip6addr", s);

View File

@@ -58,6 +58,7 @@ CBILease6Status = form.DummyValue.extend({
E('th', { 'class': 'th' }, _('Hostname')),
E('th', { 'class': 'th' }, _('IPv6 address')),
E('th', { 'class': 'th' }, _('DUID')),
E('th', { 'class': 'th' }, _('IAID')),
E('th', { 'class': 'th' }, _('Lease time remaining'))
]),
E('tr', { 'class': 'tr placeholder' }, [
@@ -1417,6 +1418,7 @@ return view.extend({
host || '-',
lease.ip6addrs ? lease.ip6addrs.join('<br />') : lease.ip6addr,
lease.duid,
lease.iaid,
exp
];
}),

View File

@@ -135,6 +135,7 @@ return baseclass.extend({
E('th', { 'class': 'th' }, _('Host')),
E('th', { 'class': 'th' }, _('IPv6 address')),
E('th', { 'class': 'th' }, _('DUID')),
E('th', { 'class': 'th' }, _('IAID')),
E('th', { 'class': 'th' }, _('Lease time remaining')),
isReadonlyView ? E([]) : E('th', { 'class': 'th cbi-section-actions' }, _('Static Lease'))
])
@@ -164,6 +165,7 @@ return baseclass.extend({
host || '-',
lease.ip6addrs ? lease.ip6addrs.join('<br />') : lease.ip6addr,
lease.duid,
lease.iaid,
exp
];