X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=protocols%2Fcore%2Fluasrc%2Fmodel%2Fcbi%2Fadmin_network%2Fproto_dhcp.lua;h=fe3fec6fa12b998b4e14055d03ce8002f59d3e1e;hp=aaac14ebb8b222c266ee058e90c0cd80cf2e2a64;hb=bbb44cf245c11bc0c1d59e836007c9e8c3bfa209;hpb=86a5b610feedada4b620fdf7f369d01c03166fa0 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 aaac14ebb..fe3fec6fa 100644 --- a/protocols/core/luasrc/model/cbi/admin_network/proto_dhcp.lua +++ b/protocols/core/luasrc/model/cbi/admin_network/proto_dhcp.lua @@ -1,7 +1,7 @@ --[[ LuCI - Lua Configuration Interface -Copyright 2011 Jo-Philipp Wich +Copyright 2011-2012 Jo-Philipp Wich Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ local map, section, net = ... local ifc = net:get_interface() local hostname, accept_ra, send_rs -local bcast, no_gw, no_dns, dns, metric, clientid, vendorclass +local bcast, defaultroute, peerdns, dns, metric, clientid, vendorclass hostname = section:taboption("general", Value, "hostname", @@ -24,18 +24,6 @@ hostname.placeholder = luci.sys.hostname() hostname.datatype = "hostname" -if luci.model.network:has_ipv6() then - - accept_ra = s:taboption("general", Flag, "accept_ra", translate("Accept router advertisements")) - accept_ra.default = accept_ra.enabled - - - send_rs = s:taboption("general", Flag, "send_rs", translate("Send router solicitations")) - send_rs.default = send_rs.disabled - send_rs:depends("accept_ra", "") - -end - bcast = section:taboption("advanced", Flag, "broadcast", translate("Use broadcast flag"), translate("Required for certain ISPs, e.g. Charter with DOCSIS 3")) @@ -43,50 +31,24 @@ bcast = section:taboption("advanced", Flag, "broadcast", bcast.default = bcast.disabled -no_gw = section:taboption("advanced", Flag, "gateway", +defaultroute = section:taboption("advanced", Flag, "defaultroute", translate("Use default gateway"), translate("If unchecked, no default route is configured")) -no_gw.default = no_gw.enabled +defaultroute.default = defaultroute.enabled -function no_gw.cfgvalue(...) - return Flag.cfgvalue(...) == "0.0.0.0" and "0" or "1" -end -function no_gw.write(self, section, value) - if value == "1" then - m:set(section, "gateway", nil) - else - m:set(section, "gateway", "0.0.0.0") - end -end - - -no_dns = section:taboption("advanced", Flag, "_no_dns", +peerdns = section:taboption("advanced", Flag, "peerdns", 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 +peerdns.default = peerdns.enabled dns = section:taboption("advanced", DynamicList, "dns", translate("Use custom DNS servers")) -dns:depends("_no_dns", "") +dns:depends("peerdns", "") dns.datatype = "ipaddr" dns.cast = "string" @@ -96,7 +58,6 @@ metric = section:taboption("advanced", Value, "metric", metric.placeholder = "0" metric.datatype = "uinteger" -metric:depends("gateway", "1") clientid = section:taboption("advanced", Value, "clientid", @@ -107,11 +68,9 @@ vendorclass = section:taboption("advanced", Value, "vendorid", translate("Vendor Class to send when requesting DHCP")) -macaddr = section:taboption("advanced", Value, "macaddr", translate("Override MAC address")) -macaddr.placeholder = ifc and ifc:mac() or "00:00:00:00:00:00" -macaddr.datatype = "macaddr" +luci.tools.proto.opt_macaddr(section, ifc, translate("Override MAC address")) mtu = section:taboption("advanced", Value, "mtu", translate("Override MTU")) mtu.placeholder = "1500" -mtu.datatype = "max(1500)" +mtu.datatype = "max(9200)"