--[[
LuCI - Lua Configuration Interface
-Copyright 2011 Jo-Philipp Wich <xm@subsignal.org>
+Copyright 2011-2012 Jo-Philipp Wich <xm@subsignal.org>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
local ifc = net:get_interface()
local hostname, accept_ra, send_rs
-local bcast, no_gw, metric, clientid, vendorclass
+local bcast, defaultroute, peerdns, dns, metric, clientid, vendorclass
hostname = section:taboption("general", Value, "hostname",
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
+peerdns = section:taboption("advanced", Flag, "peerdns",
+ translate("Use DNS servers advertised by peer"),
+ translate("If unchecked, the advertised DNS server addresses are ignored"))
+
+peerdns.default = peerdns.enabled
+
+
+dns = section:taboption("advanced", DynamicList, "dns",
+ translate("Use custom DNS servers"))
+
+dns:depends("peerdns", "")
+dns.datatype = "ipaddr"
+dns.cast = "string"
metric = section:taboption("advanced", Value, "metric",
metric.placeholder = "0"
metric.datatype = "uinteger"
-metric:depends("gateway", "1")
clientid = section:taboption("advanced", Value, "clientid",
translate("Client ID to send when requesting DHCP"))
-vendorclass = section:taboption("advanced", Value, "vendorclass",
+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"))