Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 Aug 2013 16:50:38 GMT
From:      "Oleg A. Mamontov" <oleg@mamontov.net>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   bin/181586: nscd negative responses
Message-ID:  <201308271650.r7RGocIu019008@oldred.freebsd.org>
Resent-Message-ID: <201308271700.r7RH00Y6036648@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help


>Number:         181586
>Category:       bin
>Synopsis:       nscd negative responses
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Aug 27 17:00:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Oleg A. Mamontov
>Release:        9.1-RELEASE-p4
>Organization:
>Environment:
FreeBSD lonerr.jail.local 9.1-RELEASE-p4 FreeBSD 9.1-RELEASE-p4 #0: Mon Jun 17 11:42:37 UTC 2013     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64
>Description:
nscd (8) daemon caches negative responses for infinite time.
Parameter 'negative-time-to-live' in /etc/nscd.conf doesn't correct this behavior.
>How-To-Repeat:
Try set 'negative-time-to-live hosts 1' in /etc/nscd.conf and 'hosts: files cache dns' in /etc/nsswitch.conf.
Restart nscd: '/etc/rc.d/nscd onerestart'.
Now we can see output of 'tcpdump udp and port 53' and repeat many times: 'ping -c1 some.nonexistent'.
Only first time there will be actual dns search (with expected negative response).


>Fix:
Supplied below corrects nscd behaviour on 9.1-RELEASE-p4 and HEAD:

--- usr.sbin/nscd/query.c.orig  2013-08-22 11:59:03.921956888 +0400
+++ usr.sbin/nscd/query.c   2013-08-22 12:00:01.515957178 +0400
@@ -743,9 +743,14 @@
                &read_response->data_size);

            if (read_response->error_code == -2) {
-               read_response->error_code = 0;
-               read_response->data = NULL;
-               read_response->data_size = 0;
+               read_response->data = malloc(
+                   read_response->data_size);
+               assert(read_response != NULL);
+               read_response->error_code = cache_read(neg_c_entry,
+                   read_request->cache_key,
+                   read_request->cache_key_size,
+                   read_response->data,
+                   &read_response->data_size);
            }
        }
        configuration_unlock_entry(qstate->config_entry, CELT_NEGATIVE);

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201308271650.r7RGocIu019008>