From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2178) id BC7183882052; Thu, 13 Jun 2024 16:56:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BC7183882052 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1718297807; bh=ofe5eRW77jgU1GY8m2NSbfxxKokyJPnrSyPl4LnicLE=; h=From:To:Subject:Date:From; b=K0Tb9cy4xoq9vJVg3TCBATg9dFLk7IzZ+zXivnPLUEsSfcwfT5ZZfQNdJUj0dlgQk ZQW6Ss7Bpz1D6KfII/YRFHsxmd9bKDlXQlZAjapirPiLnNCjk3KlmG1HC3NfICFSr4 mwFP4oKf3U45EARzKWFHaky+Mds1er8WGcEBbWcg= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Florian Weimer To: glibc-cvs@sourceware.org Subject: [glibc] resolv: Track single-request fallback via _res._flags (bug 31476) X-Act-Checkin: glibc X-Git-Author: Florian Weimer X-Git-Refname: refs/heads/master X-Git-Oldrev: 29807a271edca3e47195bda0c69ae45e245551a9 X-Git-Newrev: 868ab8923a2ec977faafec97ecafac0c3159c1b2 Message-Id: <20240613165647.BC7183882052@sourceware.org> Date: Thu, 13 Jun 2024 16:56:47 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=868ab8923a2ec977faafec97ecafac0c3159c1b2 commit 868ab8923a2ec977faafec97ecafac0c3159c1b2 Author: Florian Weimer Date: Thu Jun 13 18:56:30 2024 +0200 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 Diff: --- resolv/res_send.c | 12 +++++++----- resolv/resolv-internal.h | 2 ++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/resolv/res_send.c b/resolv/res_send.c index fb0217204a..ea7cf192b2 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