public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v2] nscd: Fix netlink cache invalidation if epoll is used [BZ #29415]
@ 2022-07-27  9:44 Fabian Vogt via Libc-alpha
  2022-07-27 18:22 ` DJ Delorie
  0 siblings, 1 reply; 2+ messages in thread
From: Fabian Vogt via Libc-alpha @ 2022-07-27  9:44 UTC (permalink / raw)
  To: libc-alpha; +Cc: schwab

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>
---
 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
-- 
2.36.1




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] nscd: Fix netlink cache invalidation if epoll is used [BZ #29415]
  2022-07-27  9:44 [PATCH v2] nscd: Fix netlink cache invalidation if epoll is used [BZ #29415] Fabian Vogt via Libc-alpha
@ 2022-07-27 18:22 ` DJ Delorie
  0 siblings, 0 replies; 2+ messages in thread
From: DJ Delorie @ 2022-07-27 18:22 UTC (permalink / raw)
  To: Fabian Vogt; +Cc: libc-alpha


LGTM.
Reviewed-by: DJ Delorie <dj@redhat.com>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-07-27 18:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-27  9:44 [PATCH v2] nscd: Fix netlink cache invalidation if epoll is used [BZ #29415] Fabian Vogt via Libc-alpha
2022-07-27 18:22 ` DJ Delorie

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).