build: introduce luci-base
[project/luci.git] / modules / base / luasrc / model / cbi / admin_network / proto_dhcp.lua
1 --[[
2 LuCI - Lua Configuration Interface
3
4 Copyright 2011-2012 Jo-Philipp Wich <xm@subsignal.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
13 local map, section, net = ...
14 local ifc = net:get_interface()
15
16 local hostname, accept_ra, send_rs
17 local bcast, defaultroute, peerdns, dns, metric, clientid, vendorclass
18
19
20 hostname = section:taboption("general", Value, "hostname",
21         translate("Hostname to send when requesting DHCP"))
22
23 hostname.placeholder = luci.sys.hostname()
24 hostname.datatype    = "hostname"
25
26
27 bcast = section:taboption("advanced", Flag, "broadcast",
28         translate("Use broadcast flag"),
29         translate("Required for certain ISPs, e.g. Charter with DOCSIS 3"))
30
31 bcast.default = bcast.disabled
32
33
34 defaultroute = section:taboption("advanced", Flag, "defaultroute",
35         translate("Use default gateway"),
36         translate("If unchecked, no default route is configured"))
37
38 defaultroute.default = defaultroute.enabled
39
40
41 peerdns = section:taboption("advanced", Flag, "peerdns",
42         translate("Use DNS servers advertised by peer"),
43         translate("If unchecked, the advertised DNS server addresses are ignored"))
44
45 peerdns.default = peerdns.enabled
46
47
48 dns = section:taboption("advanced", DynamicList, "dns",
49         translate("Use custom DNS servers"))
50
51 dns:depends("peerdns", "")
52 dns.datatype = "ipaddr"
53 dns.cast     = "string"
54
55
56 metric = section:taboption("advanced", Value, "metric",
57         translate("Use gateway metric"))
58
59 metric.placeholder = "0"
60 metric.datatype    = "uinteger"
61
62
63 clientid = section:taboption("advanced", Value, "clientid",
64         translate("Client ID to send when requesting DHCP"))
65
66
67 vendorclass = section:taboption("advanced", Value, "vendorid",
68         translate("Vendor Class to send when requesting DHCP"))
69
70
71 luci.tools.proto.opt_macaddr(section, ifc, translate("Override MAC address"))
72
73
74 mtu = section:taboption("advanced", Value, "mtu", translate("Override MTU"))
75 mtu.placeholder = "1500"
76 mtu.datatype    = "max(9200)"