From 3fe33590315cd5ab2af1f1b49e5ac36c9c195991 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Wed, 14 Dec 2016 10:31:26 +1100 Subject: [PATCH] 4535. [bug] Address race condition in setting / testing of DNS_REQUEST_F_SENDING. [RT #43889] (cherry picked from commit 37a8db0ba480605665f59a8f29a1513913a20dbd) --- CHANGES | 3 +++ lib/dns/request.c | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 8467737d2f..ca46cdf3f1 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +4535. [bug] Address race condition in setting / testing of + DNS_REQUEST_F_SENDING. [RT #43889] + 4534. [bug] Only set RD, RA and CD in QUERY responses. [RT #43879] 4533. [bug] dns_client_update should terminate on prerequisite diff --git a/lib/dns/request.c b/lib/dns/request.c index 639ec5c8b8..4dc0e07d93 100644 --- a/lib/dns/request.c +++ b/lib/dns/request.c @@ -439,10 +439,11 @@ req_send(dns_request_t *request, isc_task_t *task, isc_sockaddr_t *address) { * as we do in resolver.c, but we prefer implementation simplicity * at this moment. */ + request->flags |= DNS_REQUEST_F_SENDING; result = isc_socket_sendto(sock, &r, task, req_senddone, request, address, NULL); - if (result == ISC_R_SUCCESS) - request->flags |= DNS_REQUEST_F_SENDING; + if (result != ISC_R_SUCCESS) + request->flags &= ~DNS_REQUEST_F_SENDING; return (result); }