root/luci/trunk/protocols/core/luasrc/model/cbi/admin_network/proto_dhcp.lua @ 8848

Revision 8848, 2.5 KB (checked in by jow, 11 months ago)

protocols/core: fix dhcp defaultroute option

Line 
1--[[
2LuCI - Lua Configuration Interface
3
4Copyright 2011-2012 Jo-Philipp Wich <xm@subsignal.org>
5
6Licensed under the Apache License, Version 2.0 (the "License");
7you may not use this file except in compliance with the License.
8You may obtain a copy of the License at
9
10    http://www.apache.org/licenses/LICENSE-2.0
11]]--
12
13local map, section, net = ...
14local ifc = net:get_interface()
15
16local hostname, accept_ra, send_rs
17local bcast, defaultroute, peerdns, dns, metric, clientid, vendorclass
18
19
20hostname = section:taboption("general", Value, "hostname",
21    translate("Hostname to send when requesting DHCP"))
22
23hostname.placeholder = luci.sys.hostname()
24hostname.datatype    = "hostname"
25
26
27if luci.model.network:has_ipv6() then
28
29    accept_ra = s:taboption("general", Flag, "accept_ra", translate("Accept router advertisements"))
30    accept_ra.default = accept_ra.enabled
31
32
33    send_rs = s:taboption("general", Flag, "send_rs", translate("Send router solicitations"))
34    send_rs.default = send_rs.disabled
35    send_rs:depends("accept_ra", "")
36
37end
38
39bcast = section:taboption("advanced", Flag, "broadcast",
40    translate("Use broadcast flag"),
41    translate("Required for certain ISPs, e.g. Charter with DOCSIS 3"))
42
43bcast.default = bcast.disabled
44
45
46defaultroute = section:taboption("advanced", Flag, "defaultroute",
47    translate("Use default gateway"),
48    translate("If unchecked, no default route is configured"))
49
50defaultroute.default = defaultroute.enabled
51
52
53peerdns = section:taboption("advanced", Flag, "peerdns",
54    translate("Use DNS servers advertised by peer"),
55    translate("If unchecked, the advertised DNS server addresses are ignored"))
56
57peerdns.default = peerdns.enabled
58
59
60dns = section:taboption("advanced", DynamicList, "dns",
61    translate("Use custom DNS servers"))
62
63dns:depends("peerdns", "")
64dns.datatype = "ipaddr"
65dns.cast     = "string"
66
67
68metric = section:taboption("advanced", Value, "metric",
69    translate("Use gateway metric"))
70
71metric.placeholder = "0"
72metric.datatype    = "uinteger"
73metric:depends("gateway", "1")
74
75
76clientid = section:taboption("advanced", Value, "clientid",
77    translate("Client ID to send when requesting DHCP"))
78
79
80vendorclass = section:taboption("advanced", Value, "vendorid",
81    translate("Vendor Class to send when requesting DHCP"))
82
83
84macaddr = section:taboption("advanced", Value, "macaddr", translate("Override MAC address"))
85macaddr.placeholder = ifc and ifc:mac() or "00:00:00:00:00:00"
86macaddr.datatype    = "macaddr"
87
88
89mtu = section:taboption("advanced", Value, "mtu", translate("Override MTU"))
90mtu.placeholder = "1500"
91mtu.datatype    = "max(1500)"
Note: See TracBrowser for help on using the browser.