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("Traffic Redirection"),
18 translate("Traffic redirection allows you to change the " ..
19 "destination address of forwarded packets."))
22 s = m:section(NamedSection, arg[1], "redirect", "")
26 back = s:option(DummyValue, "_overview", translate("Overview"))
28 back.titleref = luci.dispatcher.build_url("admin", "network", "firewall", "redirect")
30 name = s:option(Value, "_name", translate("Name"))
34 iface = s:option(ListValue, "src", translate("Source zone"))
36 luci.model.uci.cursor():foreach("firewall", "zone",
38 iface:value(section.name)
41 s:option(Value, "src_ip", translate("Source IP address")).optional = true
42 s:option(Value, "src_mac", translate("Source MAC-address")).optional = true
44 sport = s:option(Value, "src_port", translate("Source port"),
45 translate("Match incoming traffic originating from the given " ..
46 "source port or port range on the client host"))
48 sport:depends("proto", "tcp")
49 sport:depends("proto", "udp")
50 sport:depends("proto", "tcpudp")
52 proto = s:option(ListValue, "proto", translate("Protocol"))
55 proto:value("tcp", "TCP")
56 proto:value("udp", "UDP")
57 proto:value("tcpudp", "TCP+UDP")
59 dport = s:option(Value, "src_dport", translate("External port"),
60 translate("Match incoming traffic directed at the given " ..
61 "destination port or port range on this host"))
63 dport:depends("proto", "tcp")
64 dport:depends("proto", "udp")
65 dport:depends("proto", "tcpudp")
67 to = s:option(Value, "dest_ip", translate("Internal IP address"),
68 translate("Redirect matched incoming traffic to the specified " ..
70 for i, dataset in ipairs(luci.sys.net.arptable()) do
71 to:value(dataset["IP address"])
74 toport = s:option(Value, "dest_port", translate("Internal port (optional)"),
75 translate("Redirect matched incoming traffic to the given port on " ..
77 toport.optional = true