Use ip_parse() and ipv6_parse() and variants in more places.