2 LuCI - Lua Configuration Interface
4 Copyright 2009 Steven Barth <steven@midlink.org>
5 Copyright 2009 Jo-Philipp Wich <xm@subsignal.org>
7 Licensed under the Apache License, Version 2.0 (the "License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
11 http://www.apache.org/licenses/LICENSE-2.0
16 local nw = require "luci.model.network"
18 local has_ipv6 = nw:has_ipv6()
20 m = Map("network", "Local Network")
24 s = m:section(NamedSection, "lan", "interface", "Network Settings")
27 s:tab("general", translate("General Settings"))
29 ipaddr = s:taboption("general", Value, "ipaddr", translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Address"))
31 nm = s:taboption("general", Value, "netmask", translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Netmask"))
32 nm:value("255.255.255.0")
33 nm:value("255.255.0.0")
38 s:tab("expert", translate("Expert Settings"))
40 mac = s:taboption("expert", Value, "macaddr", translate("<abbr title=\"Media Access Control\">MAC</abbr>-Address"))
42 mtu = s:taboption("expert", Value, "mtu", "MTU")
45 dns = s:taboption("expert", Value, "dns", translate("<abbr title=\"Domain Name System\">DNS</abbr>-Server"))
46 dns:depends("peerdns", "")
49 gw = s:taboption("expert", Value, "gateway", translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Gateway"))
50 bcast = s:taboption("expert", Value, "bcast", translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Broadcast"))
54 ip6addr = s:taboption("expert", Value, "ip6addr", translate("<abbr title=\"Internet Protocol Version 6\">IPv6</abbr>-Address"), translate("<abbr title=\"Classless Inter-Domain Routing\">CIDR</abbr>-Notation: address/prefix"))
55 ip6gw = s:taboption("expert", Value, "ip6gw", translate("<abbr title=\"Internet Protocol Version 6\">IPv6</abbr>-Gateway"))
59 stp = s:taboption("expert", Flag, "stp", translate("Enable <abbr title=\"Spanning Tree Protocol\">STP</abbr>"),
60 translate("Enables the Spanning Tree Protocol on this bridge"))
62 ifname_multi = s:taboption("expert", MultiValue, "ifname_multi", translate("Interface"))
63 ifname_multi.template = "cbi/network_ifacelist"
64 ifname_multi.nobridges = true
65 ifname_multi.widget = "checkbox"
67 function ifname_multi.cfgvalue(self, s)
68 return self.map.uci:get("network", s, "ifname")
71 function ifname_multi.write(self, s, val)
72 local n = nw:get_network(s)
73 if n then n:ifname(val) end
76 for _, d in ipairs(nw:get_interfaces()) do
77 if not d:is_bridge() then
78 ifname_multi:value(d:name())
85 s = m2:section(TypedSection, "dhcp", "DHCP")
90 s:tab("general", translate("General Settings"))
92 s:depends("interface", "lan")
94 enable = s:taboption("general", ListValue, "ignore", "Automatic address assignment for network devices", "")
95 enable:value(0, translate("enable"))
96 enable:value(1, translate("disable"))
99 s:tab("expert", translate("Expert Settings"))
100 start = s:taboption("expert", Value, "start", translate("First leased address"))
101 limit = s:taboption("expert", Value, "limit", translate("Number of leased addresses"), "")
102 time = s:taboption("expert", Value, "leasetime", "Lease Time")
103 local dd = s:taboption("expert", Flag, "dynamicdhcp", "Also generate addresses for unknown devices")