From 1ed8b0e7b40304368f0466b03b33c3c40becfc3c Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Mon, 7 Apr 2025 10:57:27 +0900 Subject: dirmngr: Fix libdns with 127.0.0.1. * dirmngr/dns.c (dns_so_check): Ifdef-out Linux specific code. Remove retrying udp_connect_retry when ECONNREFUSED. -- Fixes-commit: bcdbf8b8ebe9d61160e0b007dabe1b6462ffbc93 GnuPG-bug-id: 4021 Signed-off-by: NIIBE Yutaka --- dirmngr/dns.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dirmngr/dns.c b/dirmngr/dns.c index f023e7395..5c7bb08d8 100644 --- a/dirmngr/dns.c +++ b/dirmngr/dns.c @@ -7749,18 +7749,18 @@ retry: error = dns_connect(so->udp, (struct sockaddr *)&so->remote, dns_sa_len(&so->remote)); dns_trace_sys_connect(so->trace, so->udp, SOCK_DGRAM, (struct sockaddr *)&so->remote, error); - /* Linux returns EINVAL when address was bound to - localhost and it's external IP address now. */ +#if __linux + /* Linux returns EINVAL when address was once bound to + localhost and the socket is reused for an external + IP address now. */ if (error == EINVAL) { struct sockaddr unspec_addr; memset (&unspec_addr, 0, sizeof unspec_addr); unspec_addr.sa_family = AF_UNSPEC; connect(so->udp, &unspec_addr, sizeof unspec_addr); goto udp_connect_retry; - } else if (error == ECONNREFUSED) - /* Error for previous socket operation may - be reserved(?) asynchronously. */ - goto udp_connect_retry; + } +#endif if (error) goto error; -- cgit v1.2.3