]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
nscd: Fix netlink cache invalidation if epoll is used [BZ #29415]
authorFabian Vogt <fvogt@suse.de>
Wed, 27 Jul 2022 09:44:07 +0000 (11:44 +0200)
committerFlorian Weimer <fweimer@redhat.com>
Tue, 6 Sep 2022 15:16:54 +0000 (17:16 +0200)
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>
(cherry picked from commit 02ca25fef2785974011e9c5beecc99b900b69fd7)

NEWS
nscd/connections.c

diff --git a/NEWS b/NEWS
index 1a16fc30a90bcbec5aad82d0bf9e1802eba50806..cabd3f0b5edea4fbca5890a1df21678ed72fa240 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -46,6 +46,7 @@ The following bugs are resolved with this release:
   [29214] nptl: pthread_setcanceltype fails to set type
   [29225] network: Mistyped define statement in socket/sys/socket.h in
     line 184
+  [29415] nscd: Fix netlink cache invalidation if epoll is used
   [29446] _dlopen now ignores dl_caller argument in static mode
   [29490] alpha: New __brk_call implementation is broken
   [29528] elf: Call __libc_early_init for reused namespaces
index 61d1674eb49a2eb48e3534662e675ff5b1936f6a..531d2e83df4fa417ff26a3cf14144f30895927f2 100644 (file)
@@ -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