Skip to content

Commit

Permalink
Server Port Strategy Hotfix
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Michael Harrity committed Sep 7, 2021
1 parent 8a919a9 commit 6f7b9e2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,11 @@ def configure_iptables(self, remove=False):
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" %
Expand Down

0 comments on commit 6f7b9e2

Please sign in to comment.