[PATCH] gethostbyname2 needs to be supported in addition to gethostbyname
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.