diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2011-10-15 04:32:14 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2011-10-15 04:32:14 +0000 |
commit | 620c216b3a996328ae2087f0eca6f2cb1c112131 (patch) | |
tree | aeb47f01548d7f544ac38d6db488042b3ea9b3ce | |
parent | 632632f92bfe23a2c9f2fec04217cefa5db3eabb (diff) |
protocols/core: add back dns server options to dhcp and static protocols
-rw-r--r-- | protocols/core/luasrc/model/cbi/admin_network/proto_dhcp.lua | 30 | ||||
-rw-r--r-- | protocols/core/luasrc/model/cbi/admin_network/proto_static.lua | 10 |
2 files changed, 37 insertions, 3 deletions
diff --git a/protocols/core/luasrc/model/cbi/admin_network/proto_dhcp.lua b/protocols/core/luasrc/model/cbi/admin_network/proto_dhcp.lua index 566ea2331..806d5cd31 100644 --- a/protocols/core/luasrc/model/cbi/admin_network/proto_dhcp.lua +++ b/protocols/core/luasrc/model/cbi/admin_network/proto_dhcp.lua @@ -14,7 +14,7 @@ local map, section, net = ... local ifc = net:get_interface() local hostname, accept_ra, send_rs -local bcast, no_gw, metric, clientid, vendorclass +local bcast, no_gw, no_dns, dns, metric, clientid, vendorclass hostname = section:taboption("general", Value, "hostname", @@ -62,6 +62,34 @@ function no_gw.write(self, section, value) end +no_dns = section:taboption("advanced", Flag, "_no_dns", + translate("Use DNS servers advertised by peer"), + translate("If unchecked, the advertised DNS server addresses are ignored")) + +no_dns.default = no_dns.enabled + +function no_dns.cfgvalue(self, section) + local addr + for addr in luci.util.imatch(m:get(section, "dns")) do + return self.disabled + end + return self.enabled +end + +function no_dns.remove(self, section) + return m:del(section, "dns") +end + +function no_dns.write() end + + +dns = section:taboption("advanced", DynamicList, "dns", + translate("Use custom DNS servers")) + +dns:depends("_no_dns", "") +dns.datatype = "ipaddr" + + metric = section:taboption("advanced", Value, "metric", translate("Use gateway metric")) diff --git a/protocols/core/luasrc/model/cbi/admin_network/proto_static.lua b/protocols/core/luasrc/model/cbi/admin_network/proto_static.lua index 8ae9b7eab..3c9b14b2b 100644 --- a/protocols/core/luasrc/model/cbi/admin_network/proto_static.lua +++ b/protocols/core/luasrc/model/cbi/admin_network/proto_static.lua @@ -13,7 +13,7 @@ You may obtain a copy of the License at local map, section, net = ... local ifc = net:get_interface() -local ipaddr, netmask, gateway, broadcast, accept_ra, send_rs, ip6addr, ip6gw +local ipaddr, netmask, gateway, broadcast, dns, accept_ra, send_rs, ip6addr, ip6gw local macaddr, mtu, metric @@ -38,6 +38,12 @@ broadcast = section:taboption("general", Value, "broadcast", translate("IPv4 bro broadcast.datatype = "ip4addr" +dns = section:taboption("general", DynamicList, "dns", + translate("Use custom DNS servers")) + +dns.datatype = "ipaddr" + + if luci.model.network:has_ipv6() then accept_ra = s:taboption("general", Flag, "accept_ra", translate("Accept router advertisements")) @@ -57,7 +63,7 @@ if luci.model.network:has_ipv6() then ip6gw = section:taboption("general", Value, "ip6gw", translate("IPv6 gateway")) ip6gw.datatype = "ip6addr" ip6gw:depends("accept_ra", "") - + end |