Fix concatening string to tuple. Allow for forwarding a single port.

This commit is contained in:
Antoine POPINEAU 2018-04-29 14:48:25 +02:00 committed by Brian May
parent 6ec42adbf4
commit 1f5ed9c66e

View File

@ -40,8 +40,10 @@ class Method(BaseMethod):
for _, swidth, sexclude, snet, fport, lport \
in sorted(subnets, key=subnet_weight, reverse=True):
tcp_ports = ('ip', 'protocol', 'tcp')
if fport:
tcp_ports = tcp_ports + ('dport { %d-%d }' % (fport, lport))
if fport and fport != lport:
tcp_ports = tcp_ports + ('tcp', 'dport', '{ %d-%d }' % (fport, lport))
elif fport and fport == lport:
tcp_ports = tcp_ports + ('tcp', 'dport', '%d' % (fport))
if sexclude:
_nft('add rule', chain, *(tcp_ports + (