tcp: validate the IP address while checking TCP connection