diff mbox series

[OpenWrt-Devel] luci: dhcpv6 leases

Message ID 8199acc3-4c3b-f5d3-52be-896220b4da42@gmail.com
State Not Applicable
Headers show
Series [OpenWrt-Devel] luci: dhcpv6 leases | expand

Commit Message

e9hack Nov. 3, 2019, 8:05 a.m. UTC
Hi,

Luci doesn't show dhcpv6 leases from a dnsmasq lease file. For dhcpv6, the second entry of a lease is the IAID. The
parsing code expects a MAC instead of a IAID. I did fix this for me. I'm not sure, if there is any influence, if the MAC
of a lease entry is zero.

Regards,
Hartmut
diff mbox series

Patch

diff --git a/libs/rpcd-mod-luci/src/luci.c b/libs/rpcd-mod-luci/src/luci.c
index 245ca636b..b94772be4 100644
--- a/libs/rpcd-mod-luci/src/luci.c
+++ b/libs/rpcd-mod-luci/src/luci.c
@@ -435,9 +435,6 @@  lease_next(void)

 			ea = ether_aton(p);

-			if (!ea)
-				continue;
-
 			p = strtok(NULL, " \t\n");

 			if (p && inet_pton(AF_INET6, p, &e.addr.in6))
@@ -446,6 +443,9 @@  lease_next(void)
 				e.af = AF_INET;
 			else
 				continue;
+			
+			if (!ea && e.af != AF_INET6)
+				continue;

 			e.hostname = strtok(NULL, " \t\n");
 			e.duid     = strtok(NULL, " \t\n");
@@ -459,7 +459,8 @@  lease_next(void)
 			if (!strcmp(e.duid, "*"))
 				e.duid = NULL;

-			e.mac = *ea;
+			if (ea)
+				e.mac = *ea;

 			return &e;
 		}