Check that the ip is in a network, rather than naive string comparison.