Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions connectd/connectd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1134,7 +1134,14 @@ static void try_connect_one_addr(struct connecting *connect)
hints.ai_socktype = SOCK_STREAM;
hints.ai_family = AF_UNSPEC;
hints.ai_protocol = 0;
/* AI_ADDRCONFIG speeds up connects on single-stack hosts by
* pruning unreachable address families. Skip on macOS/BSD
* where it opens temporary probe sockets that confuse our
* fd-leak checker. */
#ifndef __APPLE__
hints.ai_flags = AI_ADDRCONFIG;
#endif

gai_err = getaddrinfo((char *)addr->u.wireaddr.wireaddr.addr,
tal_fmt(tmpctx, "%d",
addr->u.wireaddr.wireaddr.port),
Expand Down
7 changes: 7 additions & 0 deletions tests/test_gossip.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,13 @@ def test_announce_and_connect_via_dns(node_factory, bitcoind):
- --disable-dns is needed so the first node does not announce 127.0.0.1 itself.
- 'dev-allow-localhost' must not be set, so it does not resolve localhost anyway.
"""
# localhost.localdomain is not present in /etc/hosts on macOS by default.
# See https://github.com/ElementsProject/lightning/issues/9012
try:
socket.getaddrinfo('localhost.localdomain', 12345, 0, socket.SOCK_STREAM)
except socket.gaierror:
pytest.skip("localhost.localdomain not resolvable; add '127.0.0.1 localhost.localdomain' to /etc/hosts")

opts1 = {'disable-dns': None,
'announce-addr': ['dns:localhost.localdomain:12345'], # announce dns
'bind-addr': ['127.0.0.1:12345', '[::1]:12345']} # and bind local IPs
Expand Down
Loading