2008-07-16 10:08:28 +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$
|
|
|
|
]]--
|
|
|
|
require("luci.sys")
|
2008-08-04 23:36:33 +00:00
|
|
|
m = Map("firewall", translate("fw_portfw"), translate("fw_portfw1"))
|
2008-07-16 10:08:28 +00:00
|
|
|
|
|
|
|
|
2008-08-04 23:36:33 +00:00
|
|
|
s = m:section(TypedSection, "redirect", "")
|
|
|
|
s:depends("src", "wan")
|
|
|
|
s.defaults.src = "wan"
|
2008-07-16 10:08:28 +00:00
|
|
|
|
|
|
|
s.template = "cbi/tblsection"
|
|
|
|
s.addremove = true
|
|
|
|
s.anonymous = true
|
|
|
|
|
2008-08-04 23:36:33 +00:00
|
|
|
name = s:option(Value, "_name", translate("name"), translate("cbi_optional"))
|
|
|
|
name.size = 10
|
2008-07-16 10:08:28 +00:00
|
|
|
|
2008-08-27 12:29:59 +00:00
|
|
|
proto = s:option(ListValue, "proto", translate("protocol"))
|
2008-07-16 10:08:28 +00:00
|
|
|
proto:value("tcp", "TCP")
|
|
|
|
proto:value("udp", "UDP")
|
2008-09-02 11:27:00 +00:00
|
|
|
proto:value("tcpudp", "TCP+UDP")
|
2008-07-16 10:08:28 +00:00
|
|
|
|
2008-08-04 23:36:33 +00:00
|
|
|
dport = s:option(Value, "src_dport")
|
|
|
|
dport.size = 5
|
2008-07-16 10:08:28 +00:00
|
|
|
|
2008-08-04 23:36:33 +00:00
|
|
|
to = s:option(Value, "dest_ip")
|
|
|
|
for i, dataset in ipairs(luci.sys.net.arptable()) do
|
|
|
|
to:value(dataset["IP address"])
|
|
|
|
end
|
|
|
|
|
|
|
|
toport = s:option(Value, "dest_port")
|
|
|
|
toport.size = 5
|
2008-07-16 10:08:28 +00:00
|
|
|
|
|
|
|
return m
|