[v9_9] skip unnecesary also-notify data

3713.	[bug]		Save memory by not storing "also-notify" addresses
			in zone objects that are configured not to send
			notify requests. [RT #35195]

(cherry picked from commit e45d0508c3)
This commit is contained in:
Evan Hunt
2014-03-14 10:57:51 -07:00
parent 5ca8e16412
commit 52cbef6c95
5 changed files with 130 additions and 3 deletions
+4
View File
@@ -118,6 +118,10 @@
support before running can now use a common
"testcrypto.sh" script to do so. [RT #35213]
3713. [bug] Save memory by not storing "also-notify" addresses
in zone objects that are configured not to send
notify requests. [RT #35195]
--- 9.9.5 released ---
--- 9.9.5rc2 released ---
+6 -1
View File
@@ -1082,7 +1082,12 @@ ns_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
obj = NULL;
result = ns_config_get(maps, "also-notify", &obj);
if (result == ISC_R_SUCCESS) {
if (result == ISC_R_SUCCESS &&
(notifytype == dns_notifytype_yes ||
notifytype == dns_notifytype_explicit ||
(notifytype == dns_notifytype_masteronly &&
ztype == dns_zone_master)))
{
isc_uint32_t addrcount;
addrs = NULL;
keynames = NULL;
+87
View File
@@ -0,0 +1,87 @@
/*
* Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC")
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
view one {
notify master-only;
# also-notify inconsistent with master-only notify option
zone "slave" {
type slave;
masters { 1.2.3.4; };
also-notify { 5.6.7.8; };
};
# OK
zone "master" {
type master;
file "filename";
also-notify { 5.6.7.8; };
};
};
view two {
notify no;
# also-notify inconsistent with notify option at the view level
zone "slave" {
type slave;
masters { 1.2.3.4; };
also-notify { 5.6.7.8; };
};
# OK
zone "master" {
type master;
file "filename";
notify yes;
also-notify { 5.6.7.8; };
};
};
view three {
# also-notify inconsistent with notify option at the zone level
zone "slave" {
type slave;
masters { 1.2.3.4; };
notify no;
also-notify { 5.6.7.8; };
};
# OK
zone "master" {
type master;
file "filename";
also-notify { 5.6.7.8; };
};
};
view four {
also-notify { 5.6.7.8; };
# OK
zone "slave" {
type slave;
masters { 1.2.3.4; };
notify master-only;
};
# OK
zone "master" {
type master;
file "filename";
notify no;
};
};
+7
View File
@@ -59,6 +59,13 @@ $CHECKCONF -z hint-nofile.conf > /dev/null 2>&1 && ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
echo "I: checking that named-checkconf warns of notify inconsistencies"
ret=0
warnings=`$CHECKCONF notify.conf 2>&1 | grep "'notify' is disabled" | wc -l`
[ $warnings -eq 3 ] || ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
echo "I: checking named-checkconf dnssec warnings"
ret=0
$CHECKCONF dnssec.1 2>&1 | grep 'validation yes.*enable no' > /dev/null || ret=1
+26 -2
View File
@@ -1524,12 +1524,36 @@ check_zoneconf(const cfg_obj_t *zconfig, const cfg_obj_t *voptions,
}
/*
* Master & slave zones must have a "also-notify" field.
* Master & slave zones may have an "also-notify" field, but
* shouldn't if notify is disabled.
*/
if (ztype == MASTERZONE || ztype == SLAVEZONE ) {
isc_boolean_t donotify = ISC_TRUE;
obj = NULL;
tresult = cfg_map_get(zoptions, "notify", &obj);
if (tresult != ISC_R_SUCCESS && voptions != NULL)
tresult = cfg_map_get(voptions, "notify", &obj);
if (tresult != ISC_R_SUCCESS && goptions != NULL)
tresult = cfg_map_get(goptions, "notify", &obj);
if (tresult == ISC_R_SUCCESS) {
if (cfg_obj_isboolean(obj))
donotify = cfg_obj_asboolean(obj);
else {
const char *notifystr = cfg_obj_asstring(obj);
if (ztype != MASTERZONE &&
strcasecmp(notifystr, "master-only") == 0)
donotify = ISC_FALSE;
}
}
obj = NULL;
tresult = cfg_map_get(zoptions, "also-notify", &obj);
if (tresult == ISC_R_SUCCESS) {
if (tresult == ISC_R_SUCCESS && !donotify) {
cfg_obj_log(zoptions, logctx, ISC_LOG_WARNING,
"zone '%s': 'also-notify' set but "
"'notify' is disabled", znamestr);
} else if (tresult == ISC_R_SUCCESS) {
isc_uint32_t count;
tresult = validate_masters(obj, config, &count,
logctx, mctx);