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