Do not mmap leases file if not needed

This commit is contained in:
Pavel Zhukov 2018-08-30 11:24:36 +02:00
parent ccbd4a12c9
commit dee6f0c9de
2 changed files with 54 additions and 1 deletions

46
dhcp-noreplay.patch Normal file
View File

@ -0,0 +1,46 @@
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;
}

View File

@ -16,7 +16,7 @@
Summary: Dynamic host configuration protocol software
Name: dhcp
Version: 4.3.6
Release: 27%{?dist}
Release: 28%{?dist}
# NEVER CHANGE THE EPOCH on this package. The previous maintainer (prior to
# dcantrell maintaining the package) made incorrect use of the epoch and
# that's why it is at 12 now. It should have never been used, but it was.
@ -78,6 +78,7 @@ Patch41: dhcp-4.3.6-isc-util.patch
Patch42: dhcp-4.3.6-options_overflow.patch
Patch43: dhcp-4.3.6-reference_count_overflow.patch
Patch44: dhcp-iface_hwaddr_discovery.patch
Patch45: dhcp-noreplay.patch
BuildRequires: autoconf
BuildRequires: automake
@ -354,6 +355,9 @@ rm bind/bind.tar.gz
# https://bugzilla.redhat.com/1163379
%patch44 -p1 -b .xid-hwaddr
#ISC Bugs #48110
%patch45 -p1 -b .noreplay
# DHCLIENT_DEFAULT_PREFIX_LEN 64 -> 128
# https://bugzilla.gnome.org/show_bug.cgi?id=656610
sed -i -e 's|DHCLIENT_DEFAULT_PREFIX_LEN 64|DHCLIENT_DEFAULT_PREFIX_LEN 128|g' includes/site.h
@ -677,6 +681,9 @@ done
%endif
%changelog
* Thu Aug 30 2018 Pavel Zhukov <pzhukov@redhat.com> - 12:4.3.6-28
- Do not try to map leases file in memory if not in replay mode
* Fri Jul 13 2018 Petr Menšík <pemensik@redhat.com> - 12:4.3.6-27
- Update to bind 9.11.4