Opened 2 years ago

Last modified 8 months ago

#27920 new defect

"Resolve destination buffer too small" is unclear

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


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 (5)

comment:1 Changed 2 years ago by dgoulet

No, SOCKS4 is not supported.

comment:2 Changed 21 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
1547745542 DEBUG torsocks[26790]: Resolving 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 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:
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             

 * 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.                                                                                               
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;

comment:3 Changed 16 months ago by gaba

Owner: dgoulet deleted
Status: newassigned

removing dgoulet from ownership in torsocks component

comment:4 Changed 10 months ago by cypherpunks

Torsocks 2.3.0 all ipv6 enabled domains fail with torsocks

torsocks composer update
 The "" file could not be downloaded: php_network_getaddresses: getaddrinfo failed: Non-recoverable failure in name resolution  
1576805196 ERROR torsocks[6848]: [socks5] Resolve destination buffer too small (in socks5_recv_resolve_reply() at socks5.c:701)

comment:5 Changed 8 months ago by teor

Status: assignednew

Change tickets that are assigned to nobody to "new".

Note: See TracTickets for help on using tickets.