modules/admin-full: Added conntrack network page
[project/luci.git] / modules / admin-full / luasrc / model / cbi / admin_network / conntrack.lua
1 --[[
2 LuCI - Lua Configuration Interface
3
4 Copyright 2008 Steven Barth <steven@midlink.org>
5 Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
6
7 Licensed under the Apache License, Version 2.0 (the "License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
10
11 http://www.apache.org/licenses/LICENSE-2.0
12
13 $Id$
14 ]]--
15
16 f = SimpleForm("conntrack", translate("a_n_conntrack"), translate("a_n_conntrack_desc"))
17 f.reset = false
18 f.submit = false
19
20 t = f:section(Table, luci.sys.net.conntrack())
21 l3 = t:option(DummyValue, "layer3", translate("network"))
22 function l3.cfgvalue(self, ...)
23 return DummyValue.cfgvalue(self, ...):upper()
24 end
25
26
27 l4 = t:option(DummyValue, "layer4", translate("protocol"))
28 function l4.cfgvalue(self, ...)
29 return DummyValue.cfgvalue(self, ...):upper()
30 end
31
32 s = t:option(DummyValue, "src", translate("source"))
33 function s.cfgvalue(self, section)
34 return "%s:%s" % { self.map:get(section, "src"),
35 self.map:get(section, "sport") or "*" }
36 end
37
38 d = t:option(DummyValue, "dst", translate("destination"))
39 function d.cfgvalue(self, section)
40 return "%s:%s" % { self.map:get(section, "dst"),
41 self.map:get(section, "dport") or "*" }
42 end
43
44 return f