Summary: | sys-libs/glibc - nscd won't cache DNS results if the hostname resolves to multiple IP addresses | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Dima Ryazanov <dima> |
Component: | [OLD] Core system | Assignee: | Gentoo Toolchain Maintainers <toolchain> |
Status: | RESOLVED UPSTREAM | ||
Severity: | normal | CC: | cgw |
Priority: | High | ||
Version: | 2006.0 | ||
Hardware: | x86 | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- |
Description
Dima Ryazanov
2007-10-18 06:22:45 UTC
nscd won't cache anything if I run this code: struct addrinfo hint = {0}; hint.ai_family = PF_INET; getaddrinfo(argv[1], NULL, &hint, &result); But it works fine if I remove "hint.ai_family = PF_INET". KDE always sets ai_family, though. I wanted to debug getaddrinfo and nscd, but can't figure out how to do it. I reinstalled glibc like this: USE="debug -glibc-omitfp" FEATURES="noclean nostrip" emerge -av glibc But that didn't give me any debugging info. How do I do this? unfortunately, i dont think any combination of CFLAGS/LDFLAGS/USE/FEATURES will get you a debuggable nscd. glibc forces all of its network daemons to be built as PIEs which keeps you from being able to debug them. glibc also will fail to straight up compile if you try to build with -O0. you'd have to do something like: tar xf glibc-2.7.tar.bz2 nano glibc-2.7/nscd/Makefile <remove -fpie and -pie from cflags/linking> mkdir build cd build CFLAGS='-O1 -g -ggdb -pipe' ../glibc-2.7/configure --prefix=/usr make now if you could force nscd to statically link, that'd make debugging much easier, otherwise you'd have to execute the local ldso + library paths + nscd to get it to run. or relink nscd with local rpaths. it's all quite messy. you should retest with glibc-2.8 Have you retested with glibc-2.8? Hi, I'd like to reopen this bug. I am running glibc-2.13-r2 and confirm the results of the wireshark test described above. For names which resolve to a single IP (www.gentoo.org) the DNS result is cached by nscd and subsequent lookups do not trigger a request to the DNS server. But for names which resolve to multiple IPs (www.google.com) the nscd does not cache results, and every access results in another hit on the DNS server, which somewhat limits the usefulness of nscd. *** Bug 366925 has been marked as a duplicate of this bug. *** by design. file a bug upstream, although they'll probably close it too. nscd/hstcache.c: /* If the record contains more than one IP address (used for load balancing etc) don't cache the entry. This is something the current cache handling cannot handle and it is more than questionable whether it is worthwhile complicating the cache handling just for handling such a special case. */ |