IPv6 compatibility for Tethys

Tethys does not work with IPv6 at the moment because it is hardcoded to
bind IPv4 sockets, and some of its networking code assumes all addresses
will be IPv4 addresses.

This patch introduces compatibility for IPv6 clients, however, problems
experienced with reverse DNS resolution of IPv6 client addresses means
that, for the moment, resolution is not performed on such clients.

Specifically, this patch fixes the following bugs:

* Populating in_addr structures manually instead of using getaddrinfo
* Using INET_ADDRSTRLEN in some places instead of INET6_ADDRSTRLEN
* Hardcoding AF_INET in some places without an AF_INET6 provision too
* CIDR matching & conversion code not supporting IPv6 addresses/networks
* Using the wrong variable type for network ports
* Using the wrong address family in some comparisons
* Not properly checking the return value of inet_pton()