modules/admin-full: Added support for IPv6 network configuration
[project/luci.git] / modules / admin-full / luasrc / model / cbi / admin_network / ifaces.lua
1 --[[
2 LuCI - Lua Configuration Interface
3
4 Copyright 2008 Steven Barth <steven@midlink.org>
5
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9
10         http://www.apache.org/licenses/LICENSE-2.0
11
12 $Id$
13 ]]--
14 m = Map("network", translate("interfaces"), translate("a_n_ifaces1"))
15
16 s = m:section(TypedSection, "interface", "")
17 s.addremove = true
18 s:exclude("loopback")
19 s:depends("proto", "static")
20 s:depends("proto", "dhcp")
21
22 p = s:option(ListValue, "proto", translate("protocol"))
23 p:value("static", translate("static"))
24 p:value("dhcp", "DHCP")
25 p.default = "static"
26
27 br = s:option(Flag, "type", translate("a_n_i_bridge"), translate("a_n_i_bridge1"))
28 br.enabled = "bridge"
29 br.rmempty = true
30
31 ifname = s:option(Value, "ifname", translate("interface"))
32 ifname.rmempty = true
33 for i,d in ipairs(luci.sys.net.devices()) do
34         if d ~= "lo" then
35                 ifname:value(d)
36         end
37 end
38
39 ipaddr = s:option(Value, "ipaddr", translate("ipaddress"))
40 ipaddr.rmempty = true
41 ipaddr:depends("proto", "static")
42
43 nm = s:option(Value, "netmask", translate("netmask"))
44 nm.rmempty = true
45 nm:depends("proto", "static")
46 nm:value("255.255.255.0")
47 nm:value("255.255.0.0")
48 nm:value("255.0.0.0")
49
50 gw = s:option(Value, "gateway", translate("gateway"))
51 gw:depends("proto", "static")
52 gw.rmempty = true
53
54 ip6addr = s:option(Value, "ip6addr", translate("ip6address"), translate("cidr6"))
55 ip6addr.rmempty = true
56 ip6addr:depends("proto", "static")
57
58 ip6gw = s:option(Value, "ip6gw", translate("gateway6"))
59 ip6gw:depends("proto", "static")
60 ip6gw.rmempty = true
61
62 dns = s:option(Value, "dns", translate("dnsserver"))
63 dns:depends("proto", "static")
64 dns.optional = true
65
66 mtu = s:option(Value, "mtu", "MTU")
67 mtu.optional = true
68 mtu.isinteger = true
69
70 mac = s:option(Value, "macaddr", translate("macaddress"))
71 mac.optional = true
72
73 return m