MT#5967 Validate (man_)allowed_ip input.

Check for valid v4/v6 address and optional netmask.