Use IPv4/v6 independent calls. Change safe_strcpy/cat to strlcpy/cat (this