From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1851) id D58BB385736A; Mon, 29 Aug 2022 19:55:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D58BB385736A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1661802955; bh=+dBei08mgYMKLha2c0qa9bmTitC37wISXqyNDeX3YZw=; h=From:To:Subject:Date:From; b=Me8S3lyFKD665ZXKRyczGU3omUD71BgMF6NLZBHB1SBH8eeIUh6Dy+UVE2FQJtAZZ reyLPmjomuOieK47yI6p/qa5MGWiNANfqYjJQnEdbSwzBTf767vPjbRA+0XXYlv0Ll rUluoYgLVtfdLMSz3bd+kjTdfYHGpwMXdEc3DooE= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Martin Liska To: glibc-cvs@sourceware.org Subject: [glibc] nscd: Fix netlink cache invalidation if epoll is used [BZ #29415] X-Act-Checkin: glibc X-Git-Author: Fabian Vogt X-Git-Refname: refs/heads/master X-Git-Oldrev: ca6466e8be32369a658035d69542d47603e58a99 X-Git-Newrev: 02ca25fef2785974011e9c5beecc99b900b69fd7 Message-Id: <20220829195555.D58BB385736A@sourceware.org> Date: Mon, 29 Aug 2022 19:55:55 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=02ca25fef2785974011e9c5beecc99b900b69fd7 commit 02ca25fef2785974011e9c5beecc99b900b69fd7 Author: Fabian Vogt Date: Wed Jul 27 11:44:07 2022 +0200 nscd: Fix netlink cache invalidation if epoll is used [BZ #29415] Processes cache network interface information such as whether IPv4 or IPv6 are enabled. This is only checked again if the "netlink timestamp" provided by nscd changed, which is triggered by netlink socket activity. However, in the epoll handler for the netlink socket, it was missed to assign the new timestamp to the nscd database. The handler for plain poll did that properly, copy that over. This bug caused that e.g. processes which started before network configuration got unusuable addresses from getaddrinfo, like IPv6 only even though only IPv4 is available: https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1041 It's a bit hard to reproduce, so I verified this by checking the timestamp on calls to __check_pf manually. Without this patch it's stuck at 1, now it's increasing on network changes as expected. Signed-off-by: Fabian Vogt Diff: --- nscd/connections.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nscd/connections.c b/nscd/connections.c index 61d1674eb4..531d2e83df 100644 --- a/nscd/connections.c +++ b/nscd/connections.c @@ -2284,7 +2284,8 @@ main_loop_epoll (int efd) sizeof (buf))) != -1) ; - __bump_nl_timestamp (); + dbs[hstdb].head->extra_data[NSCD_HST_IDX_CONF_TIMESTAMP] + = __bump_nl_timestamp (); } # endif else