aboutsummaryrefslogtreecommitdiffstats
path: root/test/mandatory/filter-limit.lua
blob: a2f2838e261b406b54a13fa3d72ee5bf187217b3 (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
util = require('awall.util')
json = require('cjson')

res = {}

function add(limit_type, base)
   for _, count in ipairs{1, 30} do
     for _, limit in ipairs{
        count, {count=count, log=false}, {count=count, log='none'}
     } do
        for _, log in ipairs{false, true, 'none'} do
           for _, action in ipairs{false, 'pass'} do
	      if not (count == 30 and log and action) then
	         table.insert(
	            res,
		    util.update(
		       util.copy(base or {}),
		       {
		          [limit_type..'-limit']=limit,
		          log=log or nil,
		          action=action or nil
		       }
		    )
                 )
             end
	   end
	 end
      end
   end
end

add('conn')
add('flow')
add('flow', {['in']='A', out='_fw', ['no-track']=true})

print(json.encode{filter=res})