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
17 m = Map("network", translate("interfaces"), translate("a_n_ifaces1"))
19 s = m:section(NamedSection, arg[1], "interface", translate("interfaces"))
22 p = s:option(ListValue, "proto", translate("protocol"))
23 p:value("static", translate("static"))
24 p:value("dhcp", "DHCP")
25 p:value("pppoe", "PPPoE")
26 p:value("pptp", "PPTP")
29 br = s:option(Flag, "type", translate("a_n_i_bridge"), translate("a_n_i_bridge1"))
33 ifname = s:option(Value, "ifname", translate("interface"))
35 for i,d in ipairs(luci.sys.net.devices()) do
42 ipaddr = s:option(Value, "ipaddr", translate("ipaddress"))
44 ipaddr:depends("proto", "static")
46 nm = s:option(Value, "netmask", translate("netmask"))
48 nm:depends("proto", "static")
49 nm:value("255.255.255.0")
50 nm:value("255.255.0.0")
53 gw = s:option(Value, "gateway", translate("gateway"))
54 gw:depends("proto", "static")
57 bcast = s:option(Value, "bcast", translate("broadcast"))
58 bcast:depends("proto", "static")
61 ip6addr = s:option(Value, "ip6addr", translate("ip6address"), translate("cidr6"))
62 ip6addr.optional = true
63 ip6addr:depends("proto", "static")
65 ip6gw = s:option(Value, "ip6gw", translate("gateway6"))
66 ip6gw:depends("proto", "static")
69 dns = s:option(Value, "dns", translate("dnsserver"))
70 dns:depends("proto", "static")
73 mtu = s:option(Value, "mtu", "MTU")
77 mac = s:option(Value, "macaddr", translate("macaddress"))
80 user = s:option(Value, "username", translate("username"))
82 user:depends("proto", "pptp")
83 user:depends("proto", "ppoe")
85 pass = s:option(Value, "password", translate("password"))
87 pass:depends("proto", "pptp")
88 pass:depends("proto", "ppoe")
90 ka = s:option(Value, "keepalive")
92 ka:depends("proto", "pptp")
93 ka:depends("proto", "ppoe")
95 demand = s:option(Value, "demand")
97 demand:depends("proto", "pptp")
98 demand:depends("proto", "ppoe")
100 srv = s:option(Value, "server")
101 srv:depends("proto", "pptp")
107 s2 = m:section(TypedSection, "alias", translate("aliases"))
110 s2:depends("interface", arg[1])
111 s2.defaults.interface = arg[1]
114 s2.defaults.proto = "static"
116 ipaddr = s2:option(Value, "ipaddr", translate("ipaddress"))
117 ipaddr.rmempty = true
119 nm = s2:option(Value, "netmask", translate("netmask"))
121 nm:value("255.255.255.0")
122 nm:value("255.255.0.0")
123 nm:value("255.0.0.0")
125 gw = s2:option(Value, "gateway", translate("gateway"))
128 bcast = s2:option(Value, "bcast", translate("broadcast"))
129 bcast.optional = true
131 ip6addr = s2:option(Value, "ip6addr", translate("ip6address"), translate("cidr6"))
132 ip6addr.optional = true
134 ip6gw = s2:option(Value, "ip6gw", translate("gateway6"))
135 ip6gw.optional = true
137 dns = s2:option(Value, "dns", translate("dnsserver"))