321fd88ff4e254b60baad2aeff99420c52e720b3
[project/luci.git] / modules / admin-core / luasrc / model / cbi / admin_network / dhcp.lua
1 --[[
2 LuCI - Lua Configuration Interface
3
4 Copyright 2008 Steven Barth <steven@midlink.org>
5
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9
10         http://www.apache.org/licenses/LICENSE-2.0
11
12 $Id$
13 ]]--
14 require("luci.model.uci")
15 require("luci.sys")
16
17 m = Map("dhcp", "DHCP", [[Mit Hilfe von DHCP können Netzteilnehmer automatisch
18 ihre Netzwerkkonfiguration (IP-Adresse, Netzmaske, DNS-Server, DHCP, ...) beziehen.]])
19
20 s = m:section(TypedSection, "dhcp", "")
21 s.addremove = true
22 s.anonymous = true
23
24 iface = s:option(ListValue, "interface", "Schnittstelle")
25 luci.model.uci.foreach("network", "interface",
26         function (section)
27                 if section[".name"] ~= "loopback" then
28                         iface:value(section[".name"])
29                         s:depends("interface", section[".name"])
30                 end
31         end)
32
33 s:option(Value, "start", "Start", "Erste vergebene Adresse (letztes Oktett)").rmempty = true
34
35 s:option(Value, "limit", "Limit", "Anzahl zu vergebender Adressen -1").rmempty = true
36
37 s:option(Value, "leasetime", "Laufzeit").rmempty = true
38
39 s:option(Flag, "dynamicdhcp", "Dynamisches DHCP").rmempty = true
40
41 s:option(Value, "name", "Name").optional = true
42
43 s:option(Flag, "ignore", "Schnittstelle ignorieren", "DHCP für dieses Netzwerk deaktivieren").optional = true
44
45 s:option(Value, "netmask", "Netzmaske").optional = true
46
47 s:option(Flag, "force", "Start erzwingen").optional = true
48
49 for i, line in pairs(luci.sys.execl("dnsmasq --help dhcp")) do
50         k, v = line:match("([^ ]+) +([^ ]+)")
51         s:option(Value, "dhcp"..k, v).optional = true
52 end
53         
54 return m