diff options
-rw-r--r-- | awall/model.lua | 7 | ||||
-rw-r--r-- | awall/modules/filter.lua | 4 |
2 files changed, 8 insertions, 3 deletions
diff --git a/awall/model.lua b/awall/model.lua index bdf5d35..6b9a7db 100644 --- a/awall/model.lua +++ b/awall/model.lua @@ -30,6 +30,13 @@ function ConfigObject:init(context, location) end function ConfigObject:create(cls, params) + if type(cls) == 'string' then + local name = cls + cls = awall.classmap[cls] + if not cls then + self:error('Support for '..name..' objects not installed') + end + end return cls.morph(params, self.context, self.location) end diff --git a/awall/modules/filter.lua b/awall/modules/filter.lua index 07d5df9..bd6b35e 100644 --- a/awall/modules/filter.lua +++ b/awall/modules/filter.lua @@ -69,9 +69,7 @@ function Filter:trules() dnat[attr] = self[attr] end - if not awall.classmap.dnat then self:error('NAT module not installed') end - - awall.util.extend(res, self:create(awall.classmap.dnat, dnat):trules()) + awall.util.extend(res, self:create('dnat', dnat):trules()) end awall.util.extend(res, model.Rule.trules(self)) |