gmc: Check if IP is valid