luci-base: implement lease status ubus call
authorJo-Philipp Wich <jo@mein.io>
Fri, 5 Apr 2019 07:25:00 +0000 (09:25 +0200)
committerJo-Philipp Wich <jo@mein.io>
Sun, 7 Jul 2019 13:36:25 +0000 (15:36 +0200)
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
modules/luci-base/root/usr/libexec/rpcd/luci

index d668e789fb5cb0dd83782986298c2dad57cf6f64..c4566210f6ca33338172841d19332b757d37bed2 100755 (executable)
@@ -178,6 +178,24 @@ local methods = {
                        end
                        return result
                end
+       },
+
+       leases = {
+               args = { family = 0 },
+               call = function(args)
+                       local s = require "luci.tools.status"
+
+                       if args.family == 4 then
+                               return { dhcp_leases = s.dhcp_leases() }
+                       elseif args.family == 6 then
+                               return { dhcp6_leases = s.dhcp6_leases() }
+                       else
+                               return {
+                                       dhcp_leases = s.dhcp_leases(),
+                                       dhcp6_leases = s.dhcp6_leases()
+                               }
+                       end
+               end
        }
 }