diff options
author | vieira <vieira@yubo.be> | 2016-07-24 22:02:17 +0000 |
---|---|---|
committer | vieira <vieira@yubo.be> | 2016-07-24 22:02:17 +0000 |
commit | d2d5a375410cfd01569a0853a8bb944f272c6142 (patch) | |
tree | 33ae4772c4a49600ee3342632f175017d51d1697 | |
parent | e9be2deea00615e27424f071663b8f19fe25a515 (diff) |
AF_INET6 is different between BSDs and Linux
AF_INET is the same constant on Linux and BSD but AF_INET6
is different. As the client and server can be running on
different platforms we can not just set the socket family
to what comes in the wire.
-rw-r--r-- | sshuttle/server.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sshuttle/server.py b/sshuttle/server.py index ba11a99..f627eed 100644 --- a/sshuttle/server.py +++ b/sshuttle/server.py @@ -286,6 +286,12 @@ def main(latency_control, auto_hosts): def new_channel(channel, data): (family, dstip, dstport) = data.decode("ASCII").split(',', 2) family = int(family) + # AF_INET is the same constant on Linux and BSD but AF_INET6 + # is different. As the client and server can be running on + # different platforms we can not just set the socket family + # to what comes in the wire. + if family != socket.AF_INET: + family = socket.AF_INET6 dstport = int(dstport) outwrap = ssnet.connect_dst(family, dstip, dstport) handlers.append(Proxy(MuxWrapper(mux, channel), outwrap)) |