Skip to content

Commit

Permalink
wip: resolve
Browse files Browse the repository at this point in the history
  • Loading branch information
m-schmoock committed Oct 7, 2021
1 parent afd6e41 commit 30e9c00
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion connectd/connectd.c
Expand Up @@ -788,6 +788,8 @@ static void try_connect_one_addr(struct connecting *connect)
bool use_proxy = connect->daemon->always_use_proxy;
const struct wireaddr_internal *addr = &connect->addrs[connect->addrnum];
struct io_conn *conn;
struct addrinfo hints, *ais; //, *aii;
int gai_err;

/* In case we fail without a connection, make destroy_io_conn happy */
connect->conn = NULL;
Expand Down Expand Up @@ -836,7 +838,28 @@ static void try_connect_one_addr(struct connecting *connect)
af = AF_INET6;
break;
case ADDR_TYPE_DNS:
// TODO: resolve with getaddrinfo and set af
/* Resolve with getaddrinfo */
memset(&hints, 0, sizeof(hints));
hints.ai_socktype = SOCK_STREAM;
hints.ai_family = AF_UNSPEC;
hints.ai_protocol = 0;
hints.ai_flags = AI_ADDRCONFIG;
gai_err = getaddrinfo((char *)addr->u.wireaddr.addr,
tal_fmt(tmpctx, "%d",
addr->u.wireaddr.port),
&hints, &ais);
if (gai_err != 0)
status_failed(STATUS_FAIL_INTERNAL_ERROR,
gai_strerror(gai_err));
/*for (aii = ais; aii; aii = aii->ai_next) {
if (aii->ai_family == AF_INET6 || aii->ai_family == AF_INET) {
memcpy(&ai, aii, sizeof(struct addrinfo));
freeaddrinfo(ais);
return ai;
}
}
freeaddrinfo(ais);*/
// TODO: handle no suitable ai_family found
break;
}
}
Expand Down

0 comments on commit 30e9c00

Please sign in to comment.