Hostmasks: add IPv6 support; bug fix