2 LuCI - Lua Configuration Interface
4 Copyright 2008 Steven Barth <steven@midlink.org>
5 Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
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 m = Map("network", translate("interfaces"), translate("a_n_ifaces1"))
18 s = m:section(NamedSection, arg[1], "interface")
21 p = s:option(ListValue, "proto", translate("protocol"))
22 p:value("static", translate("static"))
23 p:value("dhcp", "DHCP")
24 p:value("pppoe", "PPPoE")
25 p:value("pptp", "PPTP")
28 br = s:option(Flag, "type", translate("a_n_i_bridge"), translate("a_n_i_bridge1"))
32 ifname = s:option(Value, "ifname", translate("interface"))
34 for i,d in ipairs(luci.sys.net.devices()) do
41 ipaddr = s:option(Value, "ipaddr", translate("ipaddress"))
43 ipaddr:depends("proto", "static")
45 nm = s:option(Value, "netmask", translate("netmask"))
47 nm:depends("proto", "static")
48 nm:value("255.255.255.0")
49 nm:value("255.255.0.0")
52 gw = s:option(Value, "gateway", translate("gateway"))
53 gw:depends("proto", "static")
56 bcast = s:option(Value, "bcast", translate("broadcast"))
57 bcast:depends("proto", "static")
60 ip6addr = s:option(Value, "ip6addr", translate("ip6address"), translate("cidr6"))
61 ip6addr.optional = true
62 ip6addr:depends("proto", "static")
64 ip6gw = s:option(Value, "ip6gw", translate("gateway6"))
65 ip6gw:depends("proto", "static")
68 dns = s:option(Value, "dns", translate("dnsserver"))
69 dns:depends("proto", "static")
72 mtu = s:option(Value, "mtu", "MTU")
76 mac = s:option(Value, "macaddr", translate("macaddress"))
79 user = s:option(Value, "username", translate("username"))
81 user:depends("proto", "pptp")
82 user:depends("proto", "ppoe")
84 pass = s:option(Value, "password", translate("password"))
86 pass:depends("proto", "pptp")
87 pass:depends("proto", "ppoe")
89 ka = s:option(Value, "keepalive")
91 ka:depends("proto", "pptp")
92 ka:depends("proto", "ppoe")
94 demand = s:option(Value, "demand")
96 demand:depends("proto", "pptp")
97 demand:depends("proto", "ppoe")
99 srv = s:option(Value, "server")
100 srv:depends("proto", "pptp")
106 s2 = m:section(TypedSection, "alias", translate("aliases"))
109 s2:depends("interface", arg[1])
110 s2.defaults.interface = arg[1]
113 s2.defaults.proto = "static"
115 ipaddr = s2:option(Value, "ipaddr", translate("ipaddress"))
116 ipaddr.rmempty = true
118 nm = s2:option(Value, "netmask", translate("netmask"))
120 nm:value("255.255.255.0")
121 nm:value("255.255.0.0")
122 nm:value("255.0.0.0")
124 gw = s2:option(Value, "gateway", translate("gateway"))
127 bcast = s2:option(Value, "bcast", translate("broadcast"))
128 bcast.optional = true
130 ip6addr = s2:option(Value, "ip6addr", translate("ip6address"), translate("cidr6"))
131 ip6addr.optional = true
133 ip6gw = s2:option(Value, "ip6gw", translate("gateway6"))
134 ip6gw.optional = true
136 dns = s2:option(Value, "dns", translate("dnsserver"))