2008-06-08 15:36:57 +00:00
|
|
|
--[[
|
|
|
|
LuCI - Lua Configuration Interface
|
|
|
|
|
|
|
|
Copyright 2008 Steven Barth <steven@midlink.org>
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
$Id$
|
|
|
|
]]--
|
2008-06-09 10:10:29 +00:00
|
|
|
m = Map("luci_fw", translate("fw_fw"), translate("fw_fw1"))
|
2008-05-14 09:17:09 +00:00
|
|
|
|
2008-06-06 18:27:59 +00:00
|
|
|
s = m:section(TypedSection, "rule", "")
|
2008-05-14 09:17:09 +00:00
|
|
|
s.addremove = true
|
|
|
|
s.anonymous = true
|
|
|
|
|
2008-06-08 15:36:57 +00:00
|
|
|
chain = s:option(ListValue, "chain")
|
2008-05-14 09:17:09 +00:00
|
|
|
chain:value("forward", "Forward")
|
|
|
|
chain:value("input", "Input")
|
|
|
|
chain:value("output", "Output")
|
|
|
|
chain:value("prerouting", "Prerouting")
|
|
|
|
chain:value("postrouting", "Postrouting")
|
|
|
|
|
2008-06-08 15:36:57 +00:00
|
|
|
iface = s:option(ListValue, "iface")
|
2008-05-14 18:16:51 +00:00
|
|
|
iface.optional = true
|
|
|
|
|
2008-06-08 15:36:57 +00:00
|
|
|
oface = s:option(ListValue, "oface")
|
2008-05-14 18:16:51 +00:00
|
|
|
oface.optional = true
|
|
|
|
|
2008-06-05 19:16:38 +00:00
|
|
|
luci.model.uci.foreach("network", "interface",
|
|
|
|
function (section)
|
|
|
|
if section[".name"] ~= "loopback" then
|
|
|
|
iface:value(section[".name"])
|
|
|
|
oface:value(section[".name"])
|
|
|
|
end
|
|
|
|
end)
|
2008-05-14 09:17:09 +00:00
|
|
|
|
2008-06-09 10:10:29 +00:00
|
|
|
proto = s:option(ListValue, "proto", translate("protocol"))
|
2008-05-14 09:17:09 +00:00
|
|
|
proto.optional = true
|
|
|
|
proto:value("")
|
|
|
|
proto:value("tcp", "TCP")
|
|
|
|
proto:value("udp", "UDP")
|
|
|
|
|
2008-06-08 15:36:57 +00:00
|
|
|
s:option(Value, "source").optional = true
|
|
|
|
s:option(Value, "destination").optional = true
|
|
|
|
s:option(Value, "mac").optional = true
|
2008-05-14 09:17:09 +00:00
|
|
|
|
2008-06-08 15:36:57 +00:00
|
|
|
sport = s:option(Value, "sport")
|
2008-05-14 09:17:09 +00:00
|
|
|
sport.optional = true
|
|
|
|
sport:depends("proto", "tcp")
|
|
|
|
sport:depends("proto", "udp")
|
|
|
|
|
2008-06-08 15:36:57 +00:00
|
|
|
dport = s:option(Value, "dport")
|
2008-05-14 09:17:09 +00:00
|
|
|
dport.optional = true
|
|
|
|
dport:depends("proto", "tcp")
|
|
|
|
dport:depends("proto", "udp")
|
|
|
|
|
2008-06-08 15:36:57 +00:00
|
|
|
tosrc = s:option(Value, "tosrc")
|
2008-05-14 09:17:09 +00:00
|
|
|
tosrc.optional = true
|
|
|
|
tosrc:depends("jump", "SNAT")
|
|
|
|
|
2008-06-08 15:36:57 +00:00
|
|
|
tosrc = s:option(Value, "todest")
|
2008-05-14 09:17:09 +00:00
|
|
|
tosrc.optional = true
|
|
|
|
tosrc:depends("jump", "DNAT")
|
|
|
|
|
2008-06-08 15:36:57 +00:00
|
|
|
jump = s:option(ListValue, "jump")
|
2008-05-14 09:17:09 +00:00
|
|
|
jump.rmempty = true
|
|
|
|
jump:value("", "")
|
2008-06-08 15:36:57 +00:00
|
|
|
jump:value("ACCEPT", translate("fw_accept"))
|
|
|
|
jump:value("REJECT", translate("fw_reject"))
|
|
|
|
jump:value("DROP", translate("fw_drop"))
|
|
|
|
jump:value("LOG", translate("fw_log"))
|
|
|
|
jump:value("DNAT", translate("fw_dnat"))
|
|
|
|
jump:value("MASQUERADE", translate("fw_masq"))
|
|
|
|
jump:value("SNAT", translate("fw_snat"))
|
2008-05-14 09:17:09 +00:00
|
|
|
|
|
|
|
|
2008-06-08 15:36:57 +00:00
|
|
|
add = s:option(Value, "command")
|
2008-05-14 09:17:09 +00:00
|
|
|
add.size = 50
|
|
|
|
add.rmempty = true
|
|
|
|
|
|
|
|
return m
|