diff options
author | Antoine POPINEAU <antoine.popineau@appscho.com> | 2018-04-29 14:48:25 +0200 |
---|---|---|
committer | Brian May <brian@linuxpenguins.xyz> | 2018-04-30 07:40:58 +1000 |
commit | 1f5ed9c66ec810ce1d54607c98e1a5a4bbeea912 (patch) | |
tree | 6827dfbf8181d67edf4f0e6dda433adfa3e631d0 | |
parent | 6ec42adbf4fc7ed28e5f3c0a813779e61fa01b0f (diff) |
Fix concatening string to tuple. Allow for forwarding a single port.
-rw-r--r-- | sshuttle/methods/nft.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sshuttle/methods/nft.py b/sshuttle/methods/nft.py index cd28a5b..57572cd 100644 --- a/sshuttle/methods/nft.py +++ b/sshuttle/methods/nft.py @@ -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 + ( |