2 LuCI - Lua Configuration Interface
4 Copyright 2008 Steven Barth <steven@midlink.org>
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
10 http://www.apache.org/licenses/LICENSE-2.0
17 m = Map("firewall", translate("fw_redirect"), translate("fw_redirect_desc"))
20 s = m:section(NamedSection, arg[1], "redirect", "")
24 back = s:option(DummyValue, "_overview", translate("overview"))
26 back.titleref = luci.dispatcher.build_url("admin", "network", "firewall", "redirect")
28 name = s:option(Value, "_name", translate("name"))
32 iface = s:option(ListValue, "src", translate("fw_zone"))
34 luci.model.uci.cursor():foreach("firewall", "zone",
36 iface:value(section.name)
39 s:option(Value, "src_ip", translate("firewall_redirect_srcip")).optional = true
40 s:option(Value, "src_mac", translate("firewall_redirect_srcmac")).optional = true
42 sport = s:option(Value, "src_port", translate("firewall_redirect_srcport"))
43 sport:depends("proto", "tcp")
44 sport:depends("proto", "udp")
45 sport:depends("proto", "tcpudp")
47 proto = s:option(ListValue, "proto", translate("protocol"))
50 proto:value("tcp", "TCP")
51 proto:value("udp", "UDP")
52 proto:value("tcpudp", "TCP+UDP")
54 dport = s:option(Value, "src_dport", translate("firewall_redirect_srcdport"))
56 dport:depends("proto", "tcp")
57 dport:depends("proto", "udp")
58 dport:depends("proto", "tcpudp")
60 to = s:option(Value, "dest_ip", translate("firewall_redirect_destip"))
61 for i, dataset in ipairs(luci.sys.net.arptable()) do
62 to:value(dataset["IP address"])
65 toport = s:option(Value, "dest_port", translate("firewall_redirect_destport"))
66 toport.optional = true