bug 571

backport ipv6 changes from 0.5.x to 0.2.x