*port++ = 0;
*sa_buf = str2sockaddr_random(mesh, host, port);
*sa = sa_buf;
- free(host);
- goto check_socket;
+
+ if(sa_buf->sa.sa_family != AF_UNKNOWN) {
+ free(host);
+ goto check_socket;
+ }
}
free(host);
err = getaddrinfo(address, port, &hint, &ai);
if(err || !ai) {
- logger(NULL, MESHLINK_DEBUG, "Unknown type address %s port %s", address, port);
result.sa.sa_family = AF_UNKNOWN;
- result.unknown.address = xstrdup(address);
- result.unknown.port = xstrdup(port);
+ result.unknown.address = NULL;
+ result.unknown.port = NULL;
return result;
}