aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2024-06-13 18:56:30 +0200
committerAndreas K. Hüttel <dilfridge@gentoo.org>2024-10-03 11:42:31 +0200
commit10b2326c04c0564904ef5ba71a3ac4facd8425e2 (patch)
tree1248a4fe497db2d93654510ec8fca584f3bbb6b9
parentresolv: Do not wait for non-existing second DNS response after error (bug 30081) (diff)
downloadglibc-10b2326c04c0564904ef5ba71a3ac4facd8425e2.tar.gz
glibc-10b2326c04c0564904ef5ba71a3ac4facd8425e2.tar.bz2
glibc-10b2326c04c0564904ef5ba71a3ac4facd8425e2.zip
resolv: Track single-request fallback via _res._flags (bug 31476)
This avoids changing _res.options, which inteferes with change detection as part of automatic reloading of /etc/resolv.conf. Reviewed-by: DJ Delorie <dj@redhat.com> (cherry picked from commit 868ab8923a2ec977faafec97ecafac0c3159c1b2) (cherry picked from commit 51db012c9408d0ae08ea5f6dd8e663fb3a5a5dfd)
-rw-r--r--NEWS1
-rw-r--r--resolv/res_send.c12
-rw-r--r--resolv/resolv-internal.h2
3 files changed, 10 insertions, 5 deletions
diff --git a/NEWS b/NEWS
index 3f03e230f8..af1306edb0 100644
--- a/NEWS
+++ b/NEWS
@@ -55,6 +55,7 @@ The following bugs are resolved with this release:
[31372] dynamic-link: _dl_tlsdesc_dynamic doesn't preserve all caller-
saved registers
[31429] build: Glibc failed to build with -march=x86-64-v3
+ [31476] resolv: Track single-request fallback via _res._flags
[31501] dynamic-link: _dl_tlsdesc_dynamic_xsavec may clobber %rbx
[31612] libc: arc4random fails to fallback to /dev/urandom if
getrandom is not present
diff --git a/resolv/res_send.c b/resolv/res_send.c
index 3a4a20684f..9c77613f37 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -947,9 +947,11 @@ send_dg(res_state statp,
seconds /= statp->nscount;
if (seconds <= 0)
seconds = 1;
- bool single_request_reopen = (statp->options & RES_SNGLKUPREOP) != 0;
- bool single_request = (((statp->options & RES_SNGLKUP) != 0)
- | single_request_reopen);
+ bool single_request_reopen = ((statp->options & RES_SNGLKUPREOP)
+ || (statp->_flags & RES_F_SNGLKUPREOP));
+ bool single_request = ((statp->options & RES_SNGLKUP)
+ || (statp->_flags & RES_F_SNGLKUP)
+ || single_request_reopen);
int save_gotsomewhere = *gotsomewhere;
int retval;
@@ -1006,14 +1008,14 @@ send_dg(res_state statp,
have received the first answer. */
if (!single_request)
{
- statp->options |= RES_SNGLKUP;
+ statp->_flags |= RES_F_SNGLKUP;
single_request = true;
*gotsomewhere = save_gotsomewhere;
goto retry;
}
else if (!single_request_reopen)
{
- statp->options |= RES_SNGLKUPREOP;
+ statp->_flags |= RES_F_SNGLKUPREOP;
single_request_reopen = true;
*gotsomewhere = save_gotsomewhere;
__res_iclose (statp, false);
diff --git a/resolv/resolv-internal.h b/resolv/resolv-internal.h
index 24b164f6b5..944af3ee76 100644
--- a/resolv/resolv-internal.h
+++ b/resolv/resolv-internal.h
@@ -26,6 +26,8 @@
#define RES_F_VC 0x00000001 /* Socket is TCP. */
#define RES_F_CONN 0x00000002 /* Socket is connected. */
#define RES_F_EDNS0ERR 0x00000004 /* EDNS0 caused errors. */
+#define RES_F_SNGLKUP 0x00200000 /* Private version of RES_SNGLKUP. */
+#define RES_F_SNGLKUPREOP 0x00400000 /* Private version of RES_SNGLKUPREOP. */
/* The structure HEADER is normally aligned on a word boundary. In
some code, we need to access this structure when it may be aligned