summaryrefslogtreecommitdiffhomepage
path: root/libs/rpcd-mod-luci
diff options
context:
space:
mode:
authore9hack <e9hack@gmail.com>2019-11-03 09:05:37 +0100
committerJo-Philipp Wich <jo@mein.io>2019-11-03 17:56:58 +0100
commitdbafa93e81af0ede914875b2eeeb94179b7eef44 (patch)
tree09075d87c5b960907979a39100aeac4eb636bf98 /libs/rpcd-mod-luci
parentcfb5af89e108960c33d12cbd6dd76e9aa4e19bee (diff)
rpcd-mod-luci: handle DHCPv6 leases in dnsmasq lease file
For DHCPv6, the second entry of a lease is the IAID. The parsing code expects a MAC instead of a IAID. Reported-by: Hartmut Birr <e9hack@gmail.com> Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'libs/rpcd-mod-luci')
-rw-r--r--libs/rpcd-mod-luci/src/luci.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/libs/rpcd-mod-luci/src/luci.c b/libs/rpcd-mod-luci/src/luci.c
index 245ca636b..91f6798d7 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))
@@ -447,6 +444,9 @@ lease_next(void)
else
continue;
+ if (!ea && e.af != AF_INET6)
+ continue;
+
e.hostname = strtok(NULL, " \t\n");
e.duid = strtok(NULL, " \t\n");
@@ -459,7 +459,11 @@ lease_next(void)
if (!strcmp(e.duid, "*"))
e.duid = NULL;
- e.mac = *ea;
+ if (!ea && e.duid)
+ ea = duid2ea(e.duid);
+
+ if (ea)
+ e.mac = *ea;
return &e;
}