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
15 m = Map("firewall", translate("fw_portfw"), translate("fw_portfw1"))
18 s = m:section(TypedSection, "redirect", "")
22 name = s:option(Value, "_name", translate("name"))
26 iface = s:option(ListValue, "src", translate("fw_zone"))
28 luci.model.uci.cursor():foreach("firewall", "zone",
30 iface:value(section.name)
33 s:option(Value, "src_ip").optional = true
34 s:option(Value, "src_mac").optional = true
36 sport = s:option(Value, "src_port")
38 sport:depends("proto", "tcp")
39 sport:depends("proto", "udp")
40 sport:depends("proto", "tcpudp")
42 proto = s:option(ListValue, "proto", translate("protocol"))
45 proto:value("tcp", "TCP")
46 proto:value("udp", "UDP")
47 proto:value("tcpudp", "TCP+UDP")
49 dport = s:option(Value, "src_dport")
52 dport:depends("proto", "tcp")
53 dport:depends("proto", "udp")
54 dport:depends("proto", "tcpudp")
56 to = s:option(Value, "dest_ip")
57 for i, dataset in ipairs(luci.sys.net.arptable()) do
58 to:value(dataset["IP address"])
61 toport = s:option(Value, "dest_port")
62 toport.optional = true