From 6f7b9e2c310a9228fedd643b9f2ba59e1c5e9f46 Mon Sep 17 00:00:00 2001 From: Michael Harrity Date: Tue, 7 Sep 2021 04:57:47 -0700 Subject: [PATCH] Server Port Strategy Hotfix For backwards compatibility, the engine was sometimes called using an int for the server port directly. This would cause an error, so casting to str() solves that without needing to change anything. --- engine.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/engine.py b/engine.py index 7eab106..76e97f4 100644 --- a/engine.py +++ b/engine.py @@ -222,10 +222,11 @@ class Engine(): cmds = [] for proto in ["tcp", "udp"]: # Need to change the match rule if multiple ports are specified - # Don't need to do any checking on the port since the iptables command can error, closing the engine # Default match policy is the protocol match_policy = proto - if any(x in self.server_port for x in [":", ","]): + # Don't need to do any checking on the port since the iptables command can error, closing the engine + # Change server port to str for backwards compatibility calling engine directly with an int + if any(x in str(self.server_port) for x in [":", ","]): match_policy = "multiport" cmds += ["iptables -%s %s -p %s --match %s --%s %s -j NFQUEUE --queue-num %d" %