--[[ LuCI - Lua Configuration Interface Copyright 2009 Steven Barth Copyright 2009 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. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 $Id$ ]]-- local nw = require "luci.model.network" local has_ipv6 = nw:has_ipv6() m = Map("network", "Local Network") nw.init(m.uci) s = m:section(NamedSection, "lan", "interface", "Network Settings") s.addremove = false s:tab("general", translate("General Settings")) ipaddr = s:taboption("general", Value, "ipaddr", translate("IPv4-Address")) nm = s:taboption("general", Value, "netmask", translate("IPv4-Netmask")) nm:value("255.255.255.0") nm:value("255.255.0.0") nm:value("255.0.0.0") s:tab("expert", translate("Expert Settings")) mac = s:taboption("expert", Value, "macaddr", translate("MAC-Address")) mtu = s:taboption("expert", Value, "mtu", "MTU") mtu.isinteger = true dns = s:taboption("expert", Value, "dns", translate("DNS-Server")) dns:depends("peerdns", "") gw = s:taboption("expert", Value, "gateway", translate("IPv4-Gateway")) bcast = s:taboption("expert", Value, "bcast", translate("IPv4-Broadcast")) if has_ipv6 then ip6addr = s:taboption("expert", Value, "ip6addr", translate("IPv6-Address"), translate("CIDR-Notation: address/prefix")) ip6gw = s:taboption("expert", Value, "ip6gw", translate("IPv6-Gateway")) end stp = s:taboption("expert", Flag, "stp", translate("Enable STP"), translate("Enables the Spanning Tree Protocol on this bridge")) ifname_multi = s:taboption("expert", MultiValue, "ifname_multi", translate("Interface")) ifname_multi.template = "cbi/network_ifacelist" ifname_multi.nobridges = true ifname_multi.widget = "checkbox" function ifname_multi.cfgvalue(self, s) return self.map.uci:get("network", s, "ifname") end function ifname_multi.write(self, s, val) local n = nw:get_network(s) if n then n:ifname(val) end end for _, d in ipairs(nw:get_interfaces()) do if not d:is_bridge() then ifname_multi:value(d:name()) end end m2 = Map("dhcp") s = m2:section(TypedSection, "dhcp", "DHCP") s.anonymous = true s.addremove = false s.dynamic = false s:tab("general", translate("General Settings")) s:depends("interface", "lan") enable = s:taboption("general", ListValue, "ignore", "Automatic address assignment for network devices", "") enable:value(0, translate("enable")) enable:value(1, translate("disable")) s:tab("expert", translate("Expert Settings")) start = s:taboption("expert", Value, "start", translate("First leased address")) limit = s:taboption("expert", Value, "limit", translate("Number of leased addresses"), "") time = s:taboption("expert", Value, "leasetime", "Lease Time") return m, m2