summaryrefslogtreecommitdiffstats
path: root/dhcp-model.lua
diff options
context:
space:
mode:
authorAndreas Brodmann <andreas.brodmann@gmail.com>2007-11-08 23:08:21 +0000
committerAndreas Brodmann <andreas.brodmann@gmail.com>2007-11-08 23:08:21 +0000
commit1d102c4c33c28f3ff6644060511930e8dbd768b0 (patch)
treeeaa9565e2337e2057ce52e129c73cb19871a843b /dhcp-model.lua
parenta64807c3203df02548d775afada0e315bc4f58b4 (diff)
downloadacf-dhcp-1d102c4c33c28f3ff6644060511930e8dbd768b0.tar.bz2
acf-dhcp-1d102c4c33c28f3ff6644060511930e8dbd768b0.tar.xz
updated /acf/dhcp - subnets are now dynamically looked up
git-svn-id: svn://svn.alpinelinux.org/acf/dhcp@277 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'dhcp-model.lua')
-rw-r--r--dhcp-model.lua17
1 files changed, 16 insertions, 1 deletions
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