simplified ipv4/ipv6 code