2 LuCI - Lua Configuration Interface
4 Copyright 2011 Jo-Philipp Wich <xm@subsignal.org>
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
10 http://www.apache.org/licenses/LICENSE-2.0
12 $Id: init.lua 5764 2010-03-08 19:05:34Z jow $
15 m = Map("ahcpd", translate("AHCP Server"), translate("AHCP is an autoconfiguration protocol " ..
16 "for IPv6 and dual-stack IPv6/IPv4 networks designed to be used in place of router " ..
17 "discovery and DHCP on networks where it is difficult or impossible to configure a " ..
18 "server within every link-layer broadcast domain, for example mobile ad-hoc networks."))
21 m:section(SimpleSection).template = "ahcp_status"
23 s = m:section(TypedSection, "ahcpd")
24 s:tab("general", translate("General Setup"))
25 s:tab("advanced", translate("Advanced Settings"))
30 mode = s:taboption("general", ListValue, "mode", translate("Operation mode"))
31 mode:value("server", translate("Server"))
32 mode:value("forwarder", translate("Forwarder"))
34 net = s:taboption("general", Value, "interface", translate("Served interfaces"))
35 net.template = "cbi/network_netlist"
36 net.widget = "checkbox"
39 function net.cfgvalue(self, section)
40 return m.uci:get("ahcpd", section, "interface")
43 pfx = s:taboption("general", DynamicList, "prefix", translate("Announced prefixes"),
44 translate("Specifies the announced IPv4 and IPv6 network prefixes in CIDR notation"))
46 pfx.datatype = "ipaddr"
47 pfx:depends("mode", "server")
49 nss = s:taboption("general", DynamicList, "name_server", translate("Announced DNS servers"),
50 translate("Specifies the announced IPv4 and IPv6 name servers"))
52 nss.datatype = "ipaddr"
53 nss:depends("mode", "server")
55 ntp = s:taboption("general", DynamicList, "ntp_server", translate("Announced NTP servers"),
56 translate("Specifies the announced IPv4 and IPv6 NTP servers"))
58 ntp.datatype = "ipaddr"
59 ntp:depends("mode", "server")
61 mca = s:taboption("general", Value, "multicast_address", translate("Multicast address"))
63 mca.placeholder = "ff02::cca6:c0f9:e182:5359"
64 mca.datatype = "ip6addr"
66 port = s:taboption("general", Value, "port", translate("Port"))
68 port.placeholder = 5359
69 port.datatype = "port"
71 fam = s:taboption("general", ListValue, "_family", translate("Protocol family"))
72 fam:value("", translate("IPv4 and IPv6"))
73 fam:value("ipv4", translate("IPv4 only"))
74 fam:value("ipv6", translate("IPv6 only"))
76 function fam.cfgvalue(self, section)
77 local v4 = m.uci:get_bool("ahcpd", section, "ipv4_only")
78 local v6 = m.uci:get_bool("ahcpd", section, "ipv6_only")
87 function fam.write(self, section, value)
88 if value == "ipv4" then
89 m.uci:set("ahcpd", section, "ipv4_only", "true")
90 m.uci:delete("ahcpd", section, "ipv6_only")
91 elseif value == "ipv6" then
92 m.uci:set("ahcpd", section, "ipv6_only", "true")
93 m.uci:delete("ahcpd", section, "ipv4_only")
97 function fam.remove(self, section)
98 m.uci:delete("ahcpd", section, "ipv4_only")
99 m.uci:delete("ahcpd", section, "ipv6_only")
102 ltime = s:taboption("general", Value, "lease_time", translate("Lease validity time"))
103 ltime.optional = true
104 ltime.placeholder = 3666
105 ltime.datatype = "uinteger"
108 ld = s:taboption("advanced", Value, "lease_dir", translate("Lease directory"))
109 ld.datatype = "directory"
110 ld.placeholder = "/var/lib/leases"
112 id = s:taboption("advanced", Value, "id_file", translate("Unique ID file"))
113 --id.datatype = "file"
114 id.placeholder = "/var/lib/ahcpd-unique-id"
116 log = s:taboption("advanced", Value, "log_file", translate("Log file"))
117 --log.datatype = "file"
118 log.placeholder = "/var/log/ahcpd.log"