diff options
author | Scott Kuhl <kuhl@mtu.edu> | 2020-10-20 23:38:27 -0400 |
---|---|---|
committer | Scott Kuhl <kuhl@mtu.edu> | 2020-10-21 17:47:07 -0400 |
commit | 6d86e44fb4b67f4d4c2b4453e44c97c11a754c33 (patch) | |
tree | 2146c19e3ee1d6b11fef2622bc182436649b7561 /tests | |
parent | ebf87d8f3b5d3a4165f91ec44381bcbf0c3825d3 (diff) |
IPv6 support in nft method.
This works for me but needs testing by others. Remember to specify a
::0/0 subnet or similar to route IPv6 through sshuttle.
I'm adding this to nft before nat since it is not sshuttle's default
method on Linux. Documentation updates may be required too.
This patch uses the ipaddress module, but that appears to be included
since Python 3.3.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/client/test_methods_nat.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/client/test_methods_nat.py b/tests/client/test_methods_nat.py index 11a901b..a9d2a25 100644 --- a/tests/client/test_methods_nat.py +++ b/tests/client/test_methods_nat.py @@ -18,12 +18,22 @@ def test_get_supported_features(): def test_get_tcp_dstip(): sock = Mock() + sock.family = AF_INET sock.getsockopt.return_value = struct.pack( '!HHBBBB', socket.ntohs(AF_INET), 1024, 127, 0, 0, 1) method = get_method('nat') assert method.get_tcp_dstip(sock) == ('127.0.0.1', 1024) assert sock.mock_calls == [call.getsockopt(0, 80, 16)] + sock = Mock() + sock.family = AF_INET6 + sock.getsockopt.return_value = struct.pack( + '!HH4xBBBBBBBBBBBBBBBB', socket.ntohs(AF_INET6), + 1024, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1) + method = get_method('nft') + assert method.get_tcp_dstip(sock) == ('::1', 1024) + assert sock.mock_calls == [call.getsockopt(41, 80, 64)] + def test_recv_udp(): sock = Mock() |