09806e67a847fb968bd83285370eaaac1ce926ed
[project/luci.git] / applications / luci-fw / luasrc / model / cbi / luci_fw / miniportfw.lua
1 --[[
2 LuCI - Lua Configuration Interface
3
4 Copyright 2008 Steven Barth <steven@midlink.org>
5
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
9
10         http://www.apache.org/licenses/LICENSE-2.0
11
12 $Id$
13 ]]--
14 require("luci.sys")
15 m = Map("firewall", translate("fw_portfw"), translate("fw_portfw1"))
16
17
18 s = m:section(TypedSection, "redirect", "")
19 s:depends("src", "wan")
20 s.defaults.src = "wan"
21
22 s.template  = "cbi/tblsection"
23 s.addremove = true
24 s.anonymous = true
25
26 name = s:option(Value, "_name", translate("name"), translate("cbi_optional"))
27 name.size = 10
28
29 proto = s:option(ListValue, "proto", translate("protocol"))
30 proto:value("tcp", "TCP")
31 proto:value("udp", "UDP")
32
33 dport = s:option(Value, "src_dport")
34 dport.size = 5
35
36 to = s:option(Value, "dest_ip")
37 for i, dataset in ipairs(luci.sys.net.arptable()) do
38         to:value(dataset["IP address"])
39 end
40
41 toport = s:option(Value, "dest_port")
42 toport.size = 5
43
44 return m