Ensure hostnames are converted to IP for comparison.

Also switch to using getaddrinfo for IPv6 compliance
vs gethostbyname.

Change-Id: I1a194eae514a65bff56488571c05457bfa660c02
Closes-Bug: 1267667
Merge "Ensure hostnames are converted to IP for comparison."