1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-30 22:43:12 +03:00

nscd: Do not rebuild getaddrinfo (bug 30709)

The nscd daemon caches hosts data from NSS modules verbatim, without
filtering protocol families or sorting them (otherwise separate caches
would be needed for certain ai_flags combinations).  The cache
implementation is complete separate from the getaddrinfo code.  This
means that rebuilding getaddrinfo is not needed.  The only function
actually used is __bump_nl_timestamp from check_pf.c, and this change
moves it into nscd/connections.c.

Tested on x86_64-linux-gnu with -fexceptions, built with
build-many-glibcs.py.  I also backported this patch into a distribution
that still supports nscd and verified manually that caching still works.

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
This commit is contained in:
Florian Weimer
2023-08-11 10:10:16 +02:00
parent 881546979d
commit 039ff51ac7
6 changed files with 13 additions and 80 deletions

View File

@ -66,25 +66,10 @@ static struct cached_data *cache;
__libc_lock_define_initialized (static, lock);
#if IS_IN (nscd)
static uint32_t nl_timestamp;
uint32_t
__bump_nl_timestamp (void)
{
if (atomic_fetch_add_relaxed (&nl_timestamp, 1) + 1 == 0)
atomic_fetch_add_relaxed (&nl_timestamp, 1);
return nl_timestamp;
}
#endif
static inline uint32_t
get_nl_timestamp (void)
{
#if IS_IN (nscd)
return nl_timestamp;
#elif defined USE_NSCD
#if defined USE_NSCD
return __nscd_get_nl_timestamp ();
#else
return 0;