Full dual-stack IPv6 support

Hi Martin

This 'patch', as noted in the commit message, introduces full IPv6 support. Its tested on OSX, NetBSD, OpenBSD and Gentoo Linux. It handles systems without IPv6 support correctly (tested on Gentoo Linux).

Hope you'll like it :)

Felix