public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Martin Liska <marxin@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc] nscd: Fix netlink cache invalidation if epoll is used [BZ #29415]
Date: Mon, 29 Aug 2022 19:55:55 +0000 (GMT)	[thread overview]
Message-ID: <20220829195555.D58BB385736A@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=02ca25fef2785974011e9c5beecc99b900b69fd7

commit 02ca25fef2785974011e9c5beecc99b900b69fd7
Author: Fabian Vogt <fvogt@suse.de>
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 <fvogt@suse.de>

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

                 reply	other threads:[~2022-08-29 19:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220829195555.D58BB385736A@sourceware.org \
    --to=marxin@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).