diff options
author | Brian May <brian@linuxpenguins.xyz> | 2015-12-15 13:30:34 +1100 |
---|---|---|
committer | Brian May <brian@linuxpenguins.xyz> | 2015-12-15 13:30:34 +1100 |
commit | b207d1d0d632b60e6fa57315c8aa5489ef56e277 (patch) | |
tree | 8808fbefa2b9ffb2c805179ce2c7ad47fc0b6781 | |
parent | 56e3b22820fe9f2128d67927abe2c4236c5ade89 (diff) |
Fixes for --auto-nets
-rw-r--r-- | sshuttle/client.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/sshuttle/client.py b/sshuttle/client.py index 95a133b..5ccd2b1 100644 --- a/sshuttle/client.py +++ b/sshuttle/client.py @@ -445,9 +445,18 @@ def _main(tcp_listener, udp_listener, fw, ssh_cmd, remotename, def onroutes(routestr): if auto_nets: - for line in routestr.strip().split('\n'): - (family, ip, width) = line.split(',', 2) - fw.auto_nets.append((int(family), ip, int(width))) + for line in routestr.strip().split(b'\n'): + (family, ip, width) = line.split(b',', 2) + family = int(family) + width = int(width) + ip = ip.decode("ASCII") + if family == socket.AF_INET6 and tcp_listener.v6 is None: + debug2("Ignored auto net %d/%s/%d\n" % (family, ip, width)) + if family == socket.AF_INET and tcp_listener.v4 is None: + debug2("Ignored auto net %d/%s/%d\n" % (family, ip, width)) + else: + debug2("Adding auto net %d/%s/%d\n" % (family, ip, width)) + fw.auto_nets.append((family, ip, width)) # we definitely want to do this *after* starting ssh, or we might end # up intercepting the ssh connection! |