72f3d7e1d69c307fcf405cea639981ab7a245436
[project/luci.git] / applications / luci-fw / luasrc / model / cbi / luci_fw / portfw.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("luci_fw", translate("fw_portfw"), translate("fw_portfw1"))
16
17 s = m:section(TypedSection, "portfw", "")
18 s.template  = "cbi/tblsection"
19 s.addremove = true
20 s.anonymous = true
21
22 iface = s:option(ListValue, "iface", translate("interface"))
23 iface.default = "wan"
24 luci.model.uci.foreach("network", "interface",
25         function (section)
26                 if section[".name"] ~= "loopback" then
27                         iface:value(section[".name"])
28                 end
29         end)
30
31 proto = s:option(ListValue, "proto", translate("protocol"))
32 proto:value("tcp", "TCP")
33 proto:value("udp", "UDP")
34 proto:value("tcpudp", "TCP + UDP")
35
36 dport = s:option(Value, "dport")
37
38 to = s:option(Value, "to")
39
40 return m