length ip logic check