dhcp/0021-Load-leases-DB-in-non-replay-mode-only.patch

52 lines
1.5 KiB
Diff
Raw Normal View History

From e2de752020ea51428bbaaa7358f08632c42aa89d Mon Sep 17 00:00:00 2001
From: Pavel Zhukov <pzhukov@redhat.com>
Date: Thu, 21 Feb 2019 10:44:06 +0100
Subject: [PATCH 21/26] Load leases DB in non-replay mode only
Cc: pzhukov@redhat.com
---
server/confpars.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
2018-09-24 13:01:32 +00:00
diff --git a/server/confpars.c b/server/confpars.c
index 2743979..db21a0b 100644
2018-09-24 13:01:32 +00:00
--- 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:
@@ -171,9 +176,11 @@ isc_result_t read_conf_file (const char *filename, struct group *group,
2018-09-24 13:01:32 +00:00
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
+ noreplay:
if (status != ISC_R_SUCCESS || cfile == NULL)
return status;
@@ -182,9 +189,6 @@ isc_result_t read_conf_file (const char *filename, struct group *group,
2018-09-24 13:01:32 +00:00
else
status = conf_file_subparse (cfile, group, group_type);
end_parse (&cfile);
-#if defined (TRACING)
- dfree (dbuf, MDL);
-#endif
return status;
}
--
2.14.5