Opened 5 years ago

Closed 4 years ago

#11205 closed defect (fixed)

[PATCH] gethostbyname2 needs to be supported in addition to gethostbyname

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

Description

Repost of the bug from the old bug repotring system: https://code.google.com/p/torsocks/issues/detail?id=60

On some systems, like FreeBSD, function gethostbyname2(3) is defined in addition to gethostbyname(3). Here is its signature:

struct hostent *
gethostbyname2(const char *name, int af);

If the process uses gethostbyname2 instead of gethostbyname for the name resolution, it doesn't go through SOCKS5 and connection fails.

Need to support it.

Particularly, mplayer configures itself to use gethostbyname2 on FreeBSD, and therefore by default doesn't work with libtorsocks.

Implemented gethost by name in case of tcp v4, v6 is not yet implemented.

Tested with the streams played by mplayer. DNS resolution works fine.

torsocks-1.2_1

Child Tickets

Attachments (1)

patch-yuri-gethostbyname2.patch (4.3 KB) - added by yurivict271 5 years ago.
patch

Download all attachments as: .zip

Change History (4)

Changed 5 years ago by yurivict271

patch

comment:1 Changed 5 years ago by yurivict271

Summary: gethostbyname2 needs to be supported in addition to gethostbyname[PATCH] gethostbyname2 needs to be supported in addition to gethostbyname

comment:2 Changed 5 years ago by ioerror

This seems like a reasonable patch to include for FreeBSD support. What version of FreeBSD has it been tested with?

comment:3 Changed 4 years ago by dgoulet

Resolution: fixed
Status: newclosed

This applies to the deprecated version of torsocks 1.x. Version 2.x supports it. Closing

Note: See TracTickets for help on using tickets.