summaryrefslogtreecommitdiffstats
path: root/acf/modules/awall.lua
diff options
context:
space:
mode:
Diffstat (limited to 'acf/modules/awall.lua')
-rw-r--r--acf/modules/awall.lua15
1 files changed, 2 insertions, 13 deletions
diff --git a/acf/modules/awall.lua b/acf/modules/awall.lua
index 7d147f4..0b73f9c 100644
--- a/acf/modules/awall.lua
+++ b/acf/modules/awall.lua
@@ -31,18 +31,7 @@ function Port:validate(txn, path, value)
if value < 0 or value > 65535 then error('Invalid port: '..value) end
end
-Range = class(M.String)
-function Range:validate(txn, path, value)
- local comps = stringy.split(value, '-')
- if #comps > 2 then error('Invalid range: '..value) end
- for _, v in ipairs(comps) do
- local num = tonumber(v)
- if not num then error('Invalid range: ' ..value) end
- M.to_field(self.type):validate(txn, path, num)
- end
-end
-
-PortRange = class(Range)
+PortRange = class(M.Range)
function PortRange:init() super(self, PortRange):init{type=Port} end
Direction = class(M.String)
@@ -108,7 +97,7 @@ FilterRule.dnat = IPv4Addr
FilterRule['no-track'] = M.Boolean{default=false}
NATRule = M.new(Rule)
-NATRule['to-addr'] = Range{type=IPv4Addr}
+NATRule['to-addr'] = M.Range{type=IPv4Addr}
NATRule['to-port'] = PortRange
MarkRule = M.new(Rule)