5868 Make checks in inet_matchaddr() more robust