From owner-freebsd-bugs@FreeBSD.ORG Tue Aug 27 17:00:00 2013 Return-Path: Delivered-To: freebsd-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id B2204BA for ; Tue, 27 Aug 2013 17:00:00 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 92CF324CE for ; Tue, 27 Aug 2013 17:00:00 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.7/8.14.7) with ESMTP id r7RH00Rh036649 for ; Tue, 27 Aug 2013 17:00:00 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.7/8.14.7/Submit) id r7RH00Y6036648; Tue, 27 Aug 2013 17:00:00 GMT (envelope-from gnats) Resent-Date: Tue, 27 Aug 2013 17:00:00 GMT Resent-Message-Id: <201308271700.r7RH00Y6036648@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, "Oleg A. Mamontov" Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 83DD3C5A for ; Tue, 27 Aug 2013 16:50:39 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from oldred.freebsd.org (oldred.freebsd.org [8.8.178.121]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 729B62465 for ; Tue, 27 Aug 2013 16:50:39 +0000 (UTC) Received: from oldred.freebsd.org ([127.0.1.6]) by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id r7RGoce7019013 for ; Tue, 27 Aug 2013 16:50:38 GMT (envelope-from nobody@oldred.freebsd.org) Received: (from nobody@localhost) by oldred.freebsd.org (8.14.5/8.14.5/Submit) id r7RGocIu019008; Tue, 27 Aug 2013 16:50:38 GMT (envelope-from nobody) Message-Id: <201308271650.r7RGocIu019008@oldred.freebsd.org> Date: Tue, 27 Aug 2013 16:50:38 GMT From: "Oleg A. Mamontov" To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Subject: bin/181586: nscd negative responses X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Aug 2013 17:00:00 -0000 >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: