diff options
author | Nick Mathewson <nickm@torproject.org> | 2017-09-27 11:23:09 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-09-27 11:23:09 -0400 |
commit | 5418aa84eec9f08af7ab7b68cbc9145750ad0a1b (patch) | |
tree | 099a1ffb16668a77773986ff87f29a206d3bed5d /src/test/test_socks.c | |
parent | 04f7873babeecddae05186002d26f2be506c1ec1 (diff) | |
download | tor-5418aa84eec9f08af7ab7b68cbc9145750ad0a1b.tar.gz tor-5418aa84eec9f08af7ab7b68cbc9145750ad0a1b.zip |
socks5 unit tests: add check for ipv6 address type.
Diffstat (limited to 'src/test/test_socks.c')
-rw-r--r-- | src/test/test_socks.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/test_socks.c b/src/test/test_socks.c index f39d845bc5..fbc5407896 100644 --- a/src/test/test_socks.c +++ b/src/test/test_socks.c @@ -204,6 +204,24 @@ test_socks_5_supported_commands(void *ptr) tt_int_op(0,OP_EQ, buf_datalen(buf)); socks_request_clear(socks); + /* SOCKS 5 Send CONNECT [01] to one of the ipv6 addresses for + torproject.org:80 */ + ADD_DATA(buf, "\x05\x01\x00"); + ADD_DATA(buf, "\x05\x01\x00\x04" + "\x20\x02\x41\xb8\x02\x02\x0d\xeb\x02\x13\x21\xff\xfe\x20\x14\x26" + "\x00\x50"); + tt_int_op(fetch_from_buf_socks(buf, socks, get_options()->TestSocks, + get_options()->SafeSocks),OP_EQ, 1); + tt_int_op(5,OP_EQ, socks->socks_version); + tt_int_op(2,OP_EQ, socks->replylen); + tt_int_op(5,OP_EQ, socks->reply[0]); + tt_int_op(0,OP_EQ, socks->reply[1]); + tt_str_op("[2002:41b8:202:deb:213:21ff:fe20:1426]",OP_EQ, socks->address); + tt_int_op(80,OP_EQ, socks->port); + + tt_int_op(0,OP_EQ, buf_datalen(buf)); + socks_request_clear(socks); + /* SOCKS 5 Send CONNECT [01] to FQDN torproject.org:4369 */ ADD_DATA(buf, "\x05\x01\x00"); ADD_DATA(buf, "\x05\x01\x00\x03\x0Etorproject.org\x11\x11"); |