diff options
Diffstat (limited to 'libs/rpcd-mod-luci')
-rw-r--r-- | libs/rpcd-mod-luci/Makefile | 2 | ||||
-rw-r--r-- | libs/rpcd-mod-luci/src/luci.c | 20 |
2 files changed, 13 insertions, 9 deletions
diff --git a/libs/rpcd-mod-luci/Makefile b/libs/rpcd-mod-luci/Makefile index 65a436b3e6..01b581d240 100644 --- a/libs/rpcd-mod-luci/Makefile +++ b/libs/rpcd-mod-luci/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=rpcd-mod-luci -PKG_VERSION:=20191031 +PKG_VERSION:=20191102 PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io> PKG_LICENSE:=Apache-2.0 diff --git a/libs/rpcd-mod-luci/src/luci.c b/libs/rpcd-mod-luci/src/luci.c index 04d3a15b7b..91f6798d79 100644 --- a/libs/rpcd-mod-luci/src/luci.c +++ b/libs/rpcd-mod-luci/src/luci.c @@ -359,7 +359,7 @@ find_leasefile(struct uci_context *uci, const char *section) ptr.option = "leasefile"; ptr.o = NULL; - if (uci_lookup_ptr(uci, &ptr, NULL, true)) + if (uci_lookup_ptr(uci, &ptr, NULL, true) || ptr.o == NULL) continue; if (ptr.o->type != UCI_TYPE_STRING) @@ -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; } @@ -1254,7 +1258,7 @@ rpc_luci_get_host_hints_uci(struct reply_context *rctx) ptr.option = "ip"; ptr.o = NULL; - if (uci_lookup_ptr(uci, &ptr, NULL, true)) + if (uci_lookup_ptr(uci, &ptr, NULL, true) || ptr.o == NULL) continue; if (ptr.o->type != UCI_TYPE_STRING) @@ -1266,7 +1270,7 @@ rpc_luci_get_host_hints_uci(struct reply_context *rctx) ptr.option = "name"; ptr.o = NULL; - if (!uci_lookup_ptr(uci, &ptr, NULL, true) && + if (!uci_lookup_ptr(uci, &ptr, NULL, true) && ptr.o != NULL && ptr.o->type == UCI_TYPE_STRING) n = ptr.o->v.string; else @@ -1275,7 +1279,7 @@ rpc_luci_get_host_hints_uci(struct reply_context *rctx) ptr.option = "mac"; ptr.o = NULL; - if (uci_lookup_ptr(uci, &ptr, NULL, true)) + if (uci_lookup_ptr(uci, &ptr, NULL, true) || ptr.o == NULL) continue; if (ptr.o->type == UCI_TYPE_STRING) { |