Opened 8 months ago

Last modified 4 months ago

#27920 new defect

"Resolve destination buffer too small" is unclear

Reported by: traumschule Owned by: dgoulet
Priority: Medium Milestone:
Component: Core Tor/Torsocks Version:
Severity: Normal Keywords:
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

Does torsocks support socks4?

I tried to torify cpan and ran into:

$ torsocks cpan instal ...
...
Running make test
PERL_DL_NONLAZY=1 "/usr/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/01_load.t .......... 1/1 IO::Socket::IP v0.38 used as base class
t/01_load.t .......... ok   
t/02_new.t ........... ok   
t/03_connect.t ....... 1538348508 ERROR torsocks[8443]: [socks5] Resolve destination buffer too small (in socks5_recv_resolve_reply() at socks5.c:707)
t/03_connect.t ....... 1/? 
#   Failed test 'Socks 4 connect'
#   at t/03_connect.t line 22.
# Non-recoverable failure in name resolution
Can't call method "version" on an undefined value at t/03_connect.t line 23.
# Tests were run but no plan was declared and done_testing() was not seen.
# Looks like your test exited with 22 just after 1.

Related: #25599, #26339

Child Tickets

Change History (2)

comment:1 Changed 6 months ago by dgoulet

No, SOCKS4 is not supported.

comment:2 Changed 4 months ago by traumschule

Summary: torsocks fails to open socks 4 connection: [socks5] Resolve destination buffer too small (in socks5_recv_resolve_reply() at socks5.c:707)"Resolve destination buffer too small" is unclear

Sometimes Resolve destination buffer too small means tor-resolve failed because of a (temporary) connection issue. The message is not clear and the user wants to know if the connection failed or if there's indeed no record for that address to assess if retrying is worthwhile. Could torsocks try harder?

$ torsocks -d curl torproject.org
...
1547745542 DEBUG torsocks[26790]: Resolving torproject.org on the Tor network (in tsocks_tor_resolve() at torsocks.c:545)
1547745542 DEBUG torsocks[26790]: Setting up a connection to the Tor network on fd 3 (in setup_tor_connection() at torsocks.c:368)
1547745542 DEBUG torsocks[26790]: Socks5 sending method ver: 5, nmethods 0x01, methods 0x00 (in socks5_send_method() at socks5.c:229)
1547745542 DEBUG torsocks[26790]: Socks5 received method ver: 5, method 0x00 (in socks5_recv_method() at socks5.c:262)
1547745542 DEBUG torsocks[26790]: [socks5] Resolve for torproject.org sent successfully (in socks5_send_resolve_request() at socks5.c:633)
1547745542 ERROR torsocks[26790]: [socks5] Resolve destination buffer too small (in socks5_recv_resolve_reply() at socks5.c:701)
curl: (6) Could not resolve host: torproject.org
1547745542 DEBUG torsocks[26790]: [onion] Destroying onion pool containing 0 entry (in onion_pool_destroy() at onion.c:148)

$ torsocks --version
Torsocks 2.3.0                     

https://gitweb.torproject.org/torsocks.git/tree/src/common/socks5.c#n637

/*                                                                                                                                          
 * Receive a Tor resolve reply on the given connection. The ip address pointer                                                              
 * is populated with the replied value or else untouched on error.                                                                          
 *                                                                                                                                          
 * Return 0 on success else a negative value.                                                                                               
 */
ATTR_HIDDEN
int socks5_recv_resolve_reply(struct connection *conn, void *addr,
                size_t addrlen)
{

...

        if (addrlen < recv_len) {
                ERR("[socks5] Resolve destination buffer too small");
                ret = -EINVAL;
                goto error;
        }
Note: See TracTickets for help on using tickets.