Fix: fix localhost resolution address

Every DNS resolving call now will query the local host table (usually
/etc/hosts) before trying through Tor. Thus this fixes the issue of
localhost resolution.

If the application tries to connect to localhost, it is refused since it
might be a TCP DNS query to a local DNS server.

Adds a test for localhost resolution with getaddrinfo().

Fixes #14

Signed-off-by: David Goulet <dgoulet@ev0ke.net>
Fix: reject IPv6 socket creation

Since Tor does not yet handle IPv6 DNS resolution or traffic, simply
reject any socket creation with AF_INET6 type.

Signed-off-by: David Goulet <dgoulet@ev0ke.net>
Fix: set loopback check in host byte order

Signed-off-by: David Goulet <dgoulet@ev0ke.net>
Fix: put utils_is_ipv4_local static inline

Also remove the assert() since 0.0.0.0 is valid :)

Signed-off-by: David Goulet <dgoulet@ev0ke.net>
Fix: check if address is local after onion lookup

Make the .onion address lookup before we check if the address is local
(in the loopback network range). By default, onion cookies are in that
range (127.42.42.x).

Signed-off-by: David Goulet <dgoulet@ev0ke.net>
Fix: change non TCP socket warning to debug

A fat comment is added to explain why this is done. :)

CC: adrelanos <adrelanos@riseup.net>
Signed-off-by: David Goulet <dgoulet@ev0ke.net>
Fix: bad include and duplicate syscall values

First, for the unistd.h include, remove the i386 and s390/x defined to
include asm-generic/unistd.h since this header is x64 specific! If some
syscall's values are missing, they will be nullified and handled
accordingly.

The second issue is that we set different bad values to an unknown
syscall value so we don't end up with duplicates in the torsocks syscall
wrapper switch case.

Fixes #18

Signed-off-by: David Goulet <dgoulet@ev0ke.net>