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
14 m = Map("luci_fw", translate("fw_fw"), translate("fw_fw1"))
16 s = m:section(TypedSection, "rule", "")
20 chain = s:option(ListValue, "chain")
21 chain:value("forward", "Forward")
22 chain:value("input", "Input")
23 chain:value("output", "Output")
24 chain:value("prerouting", "Prerouting")
25 chain:value("postrouting", "Postrouting")
27 iface = s:option(ListValue, "iface")
30 oface = s:option(ListValue, "oface")
33 luci.model.uci.foreach("network", "interface",
35 if section[".name"] ~= "loopback" then
36 iface:value(section[".name"])
37 oface:value(section[".name"])
41 proto = s:option(ListValue, "proto", translate("protocol"))
44 proto:value("tcp", "TCP")
45 proto:value("udp", "UDP")
47 s:option(Value, "source").optional = true
48 s:option(Value, "destination").optional = true
49 s:option(Value, "mac").optional = true
51 sport = s:option(Value, "sport")
53 sport:depends("proto", "tcp")
54 sport:depends("proto", "udp")
56 dport = s:option(Value, "dport")
58 dport:depends("proto", "tcp")
59 dport:depends("proto", "udp")
61 tosrc = s:option(Value, "tosrc")
63 tosrc:depends("jump", "SNAT")
65 tosrc = s:option(Value, "todest")
67 tosrc:depends("jump", "DNAT")
69 jump = s:option(ListValue, "jump")
72 jump:value("ACCEPT", translate("fw_accept"))
73 jump:value("REJECT", translate("fw_reject"))
74 jump:value("DROP", translate("fw_drop"))
75 jump:value("LOG", translate("fw_log"))
76 jump:value("DNAT", translate("fw_dnat"))
77 jump:value("MASQUERADE", translate("fw_masq"))
78 jump:value("SNAT", translate("fw_snat"))
81 add = s:option(Value, "command")