Skip to content
Open
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
10 changes: 9 additions & 1 deletion src/dns.c
Original file line number Diff line number Diff line change
Expand Up @@ -6596,6 +6596,11 @@ int dns_so_check(struct dns_socket *so) {
case DNS_SO_UDP_INIT:
so->state++;
case DNS_SO_UDP_CONN:
#if __linux
/* work-around for https://github.com/wahern/dns/issues/19 */
if (so->stat.udp.sent.count)
connect(so->udp, &(struct sockaddr){.sa_family = AF_UNSPEC}, sizeof(struct sockaddr));
#endif
if (0 != connect(so->udp, (struct sockaddr *)&so->remote, dns_sa_len(&so->remote)))
goto soerr;

Expand Down Expand Up @@ -7537,8 +7542,11 @@ static int dns_res_exec(struct dns_resolver *R) {
if (dns_so_elapsed(&R->so) >= dns_resconf_timeout(R->resconf))
dgoto(R->sp, DNS_R_FOREACH_A);

if ((error = dns_so_check(&R->so)))
error = dns_so_check(&R->so);
if (error == EAGAIN)
goto error;
if (error)
dgoto(R->sp, DNS_R_FOREACH_A);

if (!dns_p_setptr(&F->answer, dns_so_fetch(&R->so, &error)))
goto error;
Expand Down