summaryrefslogtreecommitdiffstats
path: root/awall/modules/notrack.lua
blob: 4b302fb437ecbb4b279ebd069352a86432f51c65 (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
--[[
Connection tracking bypass module for Alpine Wall
Copyright (C) 2012 Kaarle Ritvanen
Licensed under the terms of GPL2
]]--


module(..., package.seeall)

require 'awall.model'
require 'awall.util'

local model = awall.model


local NoTrackRule = model.class(model.Rule)

function NoTrackRule:init(...)
   model.Rule.init(self, unpack(arg))
   for i, dir in ipairs({'in', 'out'}) do
      if awall.util.contains(self[dir], model.fwzone) then
	 self:error('Connection tracking bypass rules not allowed for firewall zone')
      end
   end
end

function NoTrackRule:defaultzones() return {nil} end

function NoTrackRule:checkzoneoptfrag(ofrag)
   if ofrag.out then
      self:error('Cannot specify outbound interface for connection tracking bypass rule')
   end
end

function NoTrackRule:table() return 'raw' end

function NoTrackRule:chain() return 'PREROUTING' end

function NoTrackRule:target()
   if self.action then return model.Rule.target(self) end
   return 'NOTRACK'
end


classes = {{'no-track', NoTrackRule}}

defrules = {}