Apply patch from 'Xavier Franquet' to fix ip(), so that it does not always validate both IP versions. Fixes #2944