Add IPv6 support

Patch from google code by Kentaro Aoki