summaryrefslogtreecommitdiffstats
path: root/applications/luci-firewall/luasrc/model/cbi/luci_fw/miniportfw.lua
blob: 44b15f2c77fa3e38e1eb80026217a0e0e409eb87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
--[[
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")
m = Map("firewall", translate("Port forwarding"),
	translate("Port forwarding allows to provide network services in " ..
		"the internal network to an external network."))


s = m:section(TypedSection, "redirect", "")
s:depends("src", "wan")
s.defaults.src = "wan"

s.template  = "cbi/tblsection"
s.addremove = true
s.anonymous = true

name = s:option(Value, "_name", translate("Name"), translate("(optional)"))
name.size = 10

proto = s:option(ListValue, "proto", translate("Protocol"))
proto:value("tcp", "TCP")
proto:value("udp", "UDP")
proto:value("tcpudp", "TCP+UDP")

dport = s:option(Value, "src_dport", translate("External port"))
dport.size = 5

to = s:option(Value, "dest_ip", translate("Internal IP address"))
for i, dataset in ipairs(luci.sys.net.arptable()) do
	to:value(dataset["IP address"])
end

toport = s:option(Value, "dest_port", translate("Internal port"),
	translate("(optional)"))
toport.size = 5

return m