Bz/fix freebsd

Fix issues. Tested with freeBSD 9.2 and 10.
Kind of. `AI_V4MAPPED` is defined, but for unknown reason it is not allowed in `getaddrinfo`.