X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Thu, 23 Aug 2018 07:14:11 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Thu, 23 Aug 2018 07:14:11 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'pzhukov@redhat.com' RCPT:'' content-type: text/plain; charset="utf-8" Message-ID: <87zhxdlflq.fsf@pzhukov-workstation.usersys.redhat.com> Subject: PATCH: Do not ;load leases into memory if replay is not needed Date: Thu, 23 Aug 2018 09:14:09 +0200 X-Spam-Status: No, score=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS autolearn=disabled version=3.4.1 X-RT-Incoming-Encryption: Not encrypted From pzhukov@redhat.com Thu Aug 23 07:14:20 2018 X-Scanned-BY: MIMEDefang 2.78 on 10.11.54.3 Received: from mx.pao1.isc.org (mx.pao1.isc.org [149.20.64.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx.pao1.isc.org", Issuer "COMODO RSA Organization Validation Secure Server CA" (not verified)) by bugs.isc.org (Postfix) with ESMTPS id 3B6ABD78A16 for ; Thu, 23 Aug 2018 07:14:20 +0000 (UTC) Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx.pao1.isc.org (Postfix) with ESMTPS id BB6CA3AB001 for ; Thu, 23 Aug 2018 07:14:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5B8A54023ECC for ; Thu, 23 Aug 2018 07:14:11 +0000 (UTC) Received: from pzhukov-workstation.usersys.redhat.com (unknown [10.43.2.120]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EB47B10EE6D9 for ; Thu, 23 Aug 2018 07:14:10 +0000 (UTC) MIME-Version: 1.0 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on mx.pao1.isc.org From: "Pavel Zhukov" Return-Path: To: dhcp-bugs@isc.org Delivered-To: dhcp-confidential@bugs.isc.org X-Original-To: dhcp-confidential@bugs.isc.org X-RT-Original-Encoding: ascii X-RT-Interface: Email Content-Length: 1984 In current implementation dhcpd tries to dmalloc() memory for leases file if it's compiled with --enable-tracing (default) even if playpack is not enabled. There're two problems: 1) useless malloc consumes memory 2) dhcpd failed to start if leases files is greater that 3GB (i.e. server was flooded with DHCPREQUEST prior to shutdown/crash) Disabling of tracing is not really an option because software is shipped in binary form and not supposed to be recompiled by end user. diff --git a/server/confpars.c b/server/confpars.c index d79489b..c20d618 100644 --- a/server/confpars.c +++ b/server/confpars.c @@ -134,6 +134,11 @@ isc_result_t read_conf_file (const char *filename, struct group *group, cfile = (struct parse *)0; #if defined (TRACING) + // No need to dmalloc huge memory region if we're not going to re-play + if (!trace_playback()){ + status = new_parse(&cfile, file, NULL, 0, filename, 0); + goto noreplay; + }; flen = lseek (file, (off_t)0, SEEK_END); if (flen < 0) { boom: @@ -174,6 +179,7 @@ isc_result_t read_conf_file (const char *filename, struct group *group, #else status = new_parse(&cfile, file, NULL, 0, filename, 0); #endif + noreplay: if (status != ISC_R_SUCCESS || cfile == NULL) return status; diff --git a/server/confpars.c b/server/confpars.c index 3aecd05..5be4ab1 100644 --- a/server/confpars.c +++ b/server/confpars.c @@ -176,6 +176,7 @@ isc_result_t read_conf_file (const char *filename, struct group *group, if (trace_record ()) trace_write_packet (ttype, ulen + tflen + 1, dbuf, MDL); status = new_parse(&cfile, -1, fbuf, ulen, filename, 0); /* XXX */ + dfree(dbuf, MDL); #else status = new_parse(&cfile, file, NULL, 0, filename, 0); #endif @@ -188,9 +189,6 @@ isc_result_t read_conf_file (const char *filename, struct group *group, else status = conf_file_subparse (cfile, group, group_type); end_parse (&cfile); -#if defined (TRACING) - dfree (dbuf, MDL); -#endif return status; }