nscd with IPv4 addresses
Stephan Kulow
coolo@kde.org
Tue Sep 11 04:24:00 GMT 2001
Hi!
I played around glibc from CVS and found nscd wasn't caching the DNS requests.
Looking around I found this in the strace output. The client expects 32
(12+4+16) bytes data while it only gets 16 - so it closes the socket and
looks up it on it's own.
The remaining tupel is for IPv6 addresses, that the daemon doesn't send. I
think the code in the daemon is obvious I think, so my suggested fix for this
problem is attached.
Greetings, Stephan
connect(4, {sin_family=AF_UNIX, path="/var/run/.nscd_socket"}, 110) = 0
write(4, "\2\0\0\0\4\0\0\0\f\0\0\0", 12) = 12
write(4, "www.kde.org\0", 12) = 12
read(4, "\330\243\26@\1\0\0\0\f\0\0\0\0\0\0\0\2\0\0\0\4\0\0\0\1"..., 32) = 32
readv(4, [{"www.kde.org\0", 12}, {"", 0}, {"\325\313:$", 4},
{"\4\0\0\0\374\372\377\277 \0\0\0\201\323\21@", 16}], 4) = 16
close(4)
Index: nscd_gethst_r.c
===================================================================
RCS file: /cvs/glibc/libc/nscd/nscd_gethst_r.c,v
retrieving revision 1.15
diff -u -u -r1.15 nscd_gethst_r.c
--- nscd_gethst_r.c 2001/07/06 04:55:37 1.15
+++ nscd_gethst_r.c 2001/09/11 10:59:25
@@ -219,10 +219,6 @@
vec[2].iov_base = cp;
vec[2].iov_len = hst_resp.h_addr_list_cnt * INADDRSZ;
- ignore = alloca (hst_resp.h_addr_list_cnt * IN6ADDRSZ);
- vec[3].iov_base = ignore;
- vec[3].iov_len = hst_resp.h_addr_list_cnt * IN6ADDRSZ;
-
for (cnt = 0; cnt < hst_resp.h_addr_list_cnt; ++cnt)
{
resultbuf->h_addr_list[cnt] = cp;
@@ -232,9 +228,9 @@
resultbuf->h_addrtype = AF_INET;
resultbuf->h_length = INADDRSZ;
- total_len += hst_resp.h_addr_list_cnt * (INADDRSZ + IN6ADDRSZ);
+ total_len += hst_resp.h_addr_list_cnt * (INADDRSZ);
- n = 4;
+ n = 3;
}
else
{
More information about the Libc-alpha
mailing list