From 1d102c4c33c28f3ff6644060511930e8dbd768b0 Mon Sep 17 00:00:00 2001 From: Andreas Brodmann Date: Thu, 8 Nov 2007 23:08:21 +0000 Subject: updated /acf/dhcp - subnets are now dynamically looked up git-svn-id: svn://svn.alpinelinux.org/acf/dhcp@277 ab2d0c66-481e-0410-8bed-d214d4d58bed --- dhcp-model.lua | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'dhcp-model.lua') diff --git a/dhcp-model.lua b/dhcp-model.lua index 2a952f7..4fca1a9 100644 --- a/dhcp-model.lua +++ b/dhcp-model.lua @@ -2,6 +2,8 @@ -- Copyright(c) 2007 A. Brodmann - Licensed under terms of GPL2 module (..., package.seeall) +require("lfs") + local subnet = { } local cfgdir = "/etc/dhcp/" @@ -18,7 +20,7 @@ subnet_read = function( name ) netmask = cfe({ label="Netmask" }), leaserangestart = cfe({ label="Lease Range Start" }), leaserangeend = cfe({ label="Lease Range End" }), - wpad = cfe({ label="Web Proxy Auto Discovery" }) + wpad = cfe({ label="Web Proxy Auto Discovery", type="select", option = { "yes", "no" } }) } for line in io.lines(filename) do @@ -139,4 +141,17 @@ function nonil( value ) return retval end + +get_subnets = function () + + local retval = retval or {} + + for sn in lfs.dir( cfgdir ) do + if string.sub(sn, -7) == ".subnet" then + table.insert(retval, string.sub(sn, 1, -8)) + end + end + + return retval +end -- cgit v1.2.3