]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Add new 'notify-cds' configuration option
authorMatthijs Mekking <matthijs@isc.org>
Tue, 28 Oct 2025 09:59:04 +0000 (10:59 +0100)
committerMatthijs Mekking <matthijs@isc.org>
Fri, 19 Dec 2025 13:08:15 +0000 (14:08 +0100)
Add a new configuration option to enable/disable sending NOTIFY(CDS)
messages.

12 files changed:
bin/include/defaultconfig.h
bin/named/server.c
bin/named/zoneconf.c
bin/tests/system/checkconf/bad-notifycdstype.conf [new file with mode: 0644]
bin/tests/system/checkconf/good.conf.j2
doc/misc/mirror.zoneopt
doc/misc/options
doc/misc/primary.zoneopt
doc/misc/secondary.zoneopt
lib/dns/include/dns/zone.h
lib/dns/zone.c
lib/isccfg/namedconf.c

index 8e247572607db24f2225bd15d01e83a732cb07a0..9ecd96588e583f15111c1c9100513652e70236d2 100644 (file)
@@ -215,6 +215,7 @@ options {\n\
        min-transfer-rate-in 10240 5;\n\
        multi-master no;\n\
        notify yes;\n\
+       notify-cds no;\n\
        notify-defer 0;\n\
        notify-delay 5;\n\
        notify-to-soa no;\n\
index 1cabf96e728765d94050c939e2c737109bf4c37c..7e43ef6c11eb70b762b71873934f5cb444368c29 100644 (file)
@@ -1845,7 +1845,8 @@ dns64_reverse(dns_view_t *view, isc_mem_t *mctx, isc_netaddr_t *na,
                dns_zone_setqueryonacl(zone, view->queryonacl);
        }
        dns_zone_setcheckdstype(zone, dns_checkdstype_no);
-       dns_zone_setnotifytype(zone, dns_notifytype_no);
+       dns_zone_setnotifytype(zone, dns_rdatatype_soa, dns_notifytype_no);
+       dns_zone_setnotifytype(zone, dns_rdatatype_cds, dns_notifytype_no);
        dns_zone_setoption(zone, DNS_ZONEOPT_NOCHECKNS, true);
        setquerystats(zone, mctx, dns_zonestat_none);
        CHECK(dns_view_addzone(view, zone));
@@ -3220,7 +3221,8 @@ create_empty_zone(dns_zone_t *pzone, dns_name_t *name, dns_view_t *view,
        dns_zone_setoption(zone, DNS_ZONEOPT_NOCHECKNS, true);
        dns_zone_setoption(zone, DNS_ZONEOPT_ZONEVERSION, false);
        dns_zone_setcheckdstype(zone, dns_checkdstype_no);
-       dns_zone_setnotifytype(zone, dns_notifytype_no);
+       dns_zone_setnotifytype(zone, dns_rdatatype_soa, dns_notifytype_no);
+       dns_zone_setnotifytype(zone, dns_rdatatype_cds, dns_notifytype_no);
        dns_zone_setautomatic(zone, true);
        if (view->queryacl != NULL) {
                dns_zone_setqueryacl(zone, view->queryacl);
@@ -3319,7 +3321,10 @@ create_ipv4only_zone(dns_zone_t *pzone, dns_view_t *view,
                dns_zone_setstats(zone, named_g_server->zonestats);
                dns_zone_setdbtype(zone, dbtypec, dbtype);
                dns_zone_setcheckdstype(zone, dns_checkdstype_no);
-               dns_zone_setnotifytype(zone, dns_notifytype_no);
+               dns_zone_setnotifytype(zone, dns_rdatatype_soa,
+                                      dns_notifytype_no);
+               dns_zone_setnotifytype(zone, dns_rdatatype_cds,
+                                      dns_notifytype_no);
                dns_zone_setautomatic(zone, true);
                dns_zone_setoption(zone, DNS_ZONEOPT_NOCHECKNS, true);
        } else {
@@ -6394,7 +6399,8 @@ add_keydata_zone(dns_view_t *view, const char *directory, isc_mem_t *mctx) {
        dns_acl_detach(&none);
 
        dns_zone_setcheckdstype(zone, dns_checkdstype_no);
-       dns_zone_setnotifytype(zone, dns_notifytype_no);
+       dns_zone_setnotifytype(zone, dns_rdatatype_soa, dns_notifytype_no);
+       dns_zone_setnotifytype(zone, dns_rdatatype_cds, dns_notifytype_no);
        dns_zone_setoption(zone, DNS_ZONEOPT_NOCHECKNS, true);
        dns_zone_setjournalsize(zone, 0);
 
index 1d9ab722cf2af0acb51527df8801c3245b8dc978..1af25b8adc161ef36ba7af2fbdc273702e6f37a3 100644 (file)
@@ -1209,9 +1209,20 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
                notifytype = process_notifytype(notifytype, ztype, zname,
                                                nodefault);
                if (raw != NULL) {
-                       dns_zone_setnotifytype(raw, dns_notifytype_no);
+                       dns_zone_setnotifytype(raw, dns_rdatatype_soa,
+                                              dns_notifytype_no);
                }
-               dns_zone_setnotifytype(zone, notifytype);
+               dns_zone_setnotifytype(zone, dns_rdatatype_soa, notifytype);
+
+               obj = NULL;
+               result = named_config_get(maps, "notify-cds", &obj);
+               INSIST(result == ISC_R_SUCCESS && obj != NULL);
+               if (raw != NULL) {
+                       dns_zone_setnotifytype(raw, dns_rdatatype_cds,
+                                              dns_notifytype_no);
+               }
+               dns_zone_setnotifytype(zone, dns_rdatatype_cds,
+                                      cfg_obj_asboolean(obj));
 
                obj = NULL;
                result = named_config_get(maps, "also-notify", &obj);
@@ -1473,7 +1484,10 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
                        }
                }
        } else if (ztype == dns_zone_redirect) {
-               dns_zone_setnotifytype(zone, dns_notifytype_no);
+               dns_zone_setnotifytype(zone, dns_rdatatype_soa,
+                                      dns_notifytype_no);
+               dns_zone_setnotifytype(zone, dns_rdatatype_cds,
+                                      dns_notifytype_no);
 
                obj = NULL;
                result = named_config_get(maps, "max-journal-size", &obj);
diff --git a/bin/tests/system/checkconf/bad-notifycdstype.conf b/bin/tests/system/checkconf/bad-notifycdstype.conf
new file mode 100644 (file)
index 0000000..6dc6ff9
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
+ *
+ * SPDX-License-Identifier: MPL-2.0
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0.  If a copy of the MPL was not distributed with this
+ * file, you can obtain one at https://mozilla.org/MPL/2.0/.
+ *
+ * See the COPYRIGHT file distributed with this work for additional
+ * information regarding copyright ownership.
+ */
+
+/*
+ * Bad notify-cds type
+ */
+
+zone dummy {
+       type primary;
+       file "xxxx";
+       notify-cds explicit;
+};
index fc33cb6503ca4e1af742d6e2b73c8ce5b6d52ca5..2f98e67bf973cd5e2038600f2f5096f9e6eb449b 100644 (file)
@@ -194,6 +194,7 @@ view "fourth" {
                        1.2.3.5;
                };
                dnssec-policy "test";
+               notify-cds no;
                parental-source 10.10.10.10;
        };
        zone "dnssec-default" {
@@ -203,6 +204,7 @@ view "fourth" {
                        "parents";
                };
                dnssec-policy "default";
+               notify-cds yes;
        };
        zone "dnssec-inherit" {
                type primary;
index 346f093d335a8988a5e0b0c9aacfa9625465060c..2cdf57f2af96ede00c98f48b9733ac3389b1f3e0 100644 (file)
@@ -29,6 +29,7 @@ zone <string> [ <class> ] {
        min-transfer-rate-in <integer> <integer>;
        multi-master <boolean>;
        notify ( explicit | master-only | primary-only | <boolean> );
+       notify-cds <boolean>;
        notify-defer <integer>;
        notify-delay <integer>;
        notify-source ( <ipv4_address> | * );
index 39b7d2f4a96212a73c1fc83e737cf4882420596c..2f1f03ec98309fa75dd23080c7a0e9149c16bf71 100644 (file)
@@ -210,6 +210,7 @@ options {
        no-case-compress { <address_match_element>; ... };
        nocookie-udp-size <integer>;
        notify ( explicit | master-only | primary-only | <boolean> );
+       notify-cds <boolean>;
        notify-defer <integer>;
        notify-delay <integer>;
        notify-rate <integer>;
@@ -415,6 +416,7 @@ template <string> {
        min-transfer-rate-in <integer> <integer>;
        multi-master <boolean>;
        notify ( explicit | master-only | primary-only | <boolean> );
+       notify-cds <boolean>;
        notify-defer <integer>;
        notify-delay <integer>;
        notify-source ( <ipv4_address> | * );
@@ -586,6 +588,7 @@ view <string> [ <class> ] {
        no-case-compress { <address_match_element>; ... };
        nocookie-udp-size <integer>;
        notify ( explicit | master-only | primary-only | <boolean> );
+       notify-cds <boolean>;
        notify-defer <integer>;
        notify-delay <integer>;
        notify-source ( <ipv4_address> | * );
index dfebff879b77fd548a81f613d9160a95c216ff7d..a5e26bee89ca22a0630f5cea76b1fb80fb71c157 100644 (file)
@@ -44,6 +44,7 @@ zone <string> [ <class> ] {
        max-types-per-name <integer>;
        max-zone-ttl ( unlimited | <duration> ); // deprecated
        notify ( explicit | master-only | primary-only | <boolean> );
+       notify-cds <boolean>;
        notify-defer <integer>;
        notify-delay <integer>;
        notify-source ( <ipv4_address> | * );
index cbbd5fea528c50a8904a8743ae965cc80a686fb6..cc1d28a9849d38b6159f308a8719915a0d3562a5 100644 (file)
@@ -41,6 +41,7 @@ zone <string> [ <class> ] {
        min-transfer-rate-in <integer> <integer>;
        multi-master <boolean>;
        notify ( explicit | master-only | primary-only | <boolean> );
+       notify-cds <boolean>;
        notify-defer <integer>;
        notify-delay <integer>;
        notify-source ( <ipv4_address> | * );
index 04aa03dd92ae5d2db8488600f0d9a6d864fbea6e..ef95a57243b75e360956b31f59dcf63f707fc17c 100644 (file)
@@ -1541,9 +1541,10 @@ dns_zone_getrequesttransporttype(dns_zone_t *zone);
  */
 
 void
-dns_zone_setnotifytype(dns_zone_t *zone, dns_notifytype_t notifytype);
+dns_zone_setnotifytype(dns_zone_t *zone, dns_rdatatype_t type,
+                      dns_notifytype_t notifytype);
 /*%<
- * Sets zone notify method to "notifytype"
+ * Sets zone notify(type) method to "notifytype"
  */
 
 void
index f555d0d9d2d6fa538a53807c9c88ac4d4db99799..bc8873ee69b01b239aceec9b8c1b1bb16ebc732d 100644 (file)
@@ -1251,6 +1251,9 @@ dns__zone_free(dns_zone_t *zone) {
        if (zone->notifysoa.notify_acl != NULL) {
                dns_acl_detach(&zone->notifysoa.notify_acl);
        }
+       if (zone->notifycds.notify_acl != NULL) {
+               dns_acl_detach(&zone->notifycds.notify_acl);
+       }
        if (zone->query_acl != NULL) {
                dns_acl_detach(&zone->query_acl);
        }
@@ -1363,11 +1366,23 @@ dns_zone_getclass(dns_zone_t *zone) {
 }
 
 void
-dns_zone_setnotifytype(dns_zone_t *zone, dns_notifytype_t notifytype) {
+dns_zone_setnotifytype(dns_zone_t *zone, dns_rdatatype_t type,
+                      dns_notifytype_t notifytype) {
        REQUIRE(DNS_ZONE_VALID(zone));
 
        LOCK_ZONE(zone);
-       zone->notifysoa.notifytype = notifytype;
+       switch (type) {
+       case dns_rdatatype_soa:
+               zone->notifysoa.notifytype = notifytype;
+               break;
+       case dns_rdatatype_cds:
+               INSIST(notifytype == dns_notifytype_no ||
+                      notifytype == dns_notifytype_yes);
+               zone->notifycds.notifytype = notifytype;
+               break;
+       default:
+               UNREACHABLE();
+       }
        UNLOCK_ZONE(zone);
 }
 
@@ -6337,6 +6352,7 @@ dns_zone_setnotifysrc4(dns_zone_t *zone, const isc_sockaddr_t *notifysrc) {
 
        LOCK_ZONE(zone);
        zone->notifysoa.notifysrc4 = *notifysrc;
+       zone->notifycds.notifysrc4 = *notifysrc;
        UNLOCK_ZONE(zone);
 }
 
@@ -6347,6 +6363,7 @@ dns_zone_getnotifysrc4(dns_zone_t *zone, isc_sockaddr_t *notifysrc) {
 
        LOCK_ZONE(zone);
        *notifysrc = zone->notifysoa.notifysrc4;
+       *notifysrc = zone->notifycds.notifysrc4;
        UNLOCK_ZONE(zone);
 }
 
@@ -6357,6 +6374,7 @@ dns_zone_setnotifysrc6(dns_zone_t *zone, const isc_sockaddr_t *notifysrc) {
 
        LOCK_ZONE(zone);
        zone->notifysoa.notifysrc6 = *notifysrc;
+       zone->notifycds.notifysrc6 = *notifysrc;
        UNLOCK_ZONE(zone);
 }
 
@@ -6367,6 +6385,7 @@ dns_zone_getnotifysrc6(dns_zone_t *zone, isc_sockaddr_t *notifysrc) {
 
        LOCK_ZONE(zone);
        *notifysrc = zone->notifysoa.notifysrc6;
+       *notifysrc = zone->notifycds.notifysrc6;
        UNLOCK_ZONE(zone);
 }
 
@@ -14607,6 +14626,7 @@ zone_shutdown(void *arg) {
        checkds_cancel(zone);
 
        dns_notify_cancel(&zone->notifysoa);
+       dns_notify_cancel(&zone->notifycds);
 
        forward_cancel(zone);
 
@@ -15107,11 +15127,11 @@ void
 dns_zone_setnotifyacl(dns_zone_t *zone, dns_acl_t *acl) {
        REQUIRE(DNS_ZONE_VALID(zone));
 
+       dns_zone_clearnotifyacl(zone);
+
        LOCK_ZONE(zone);
-       if (zone->notifysoa.notify_acl != NULL) {
-               dns_acl_detach(&zone->notifysoa.notify_acl);
-       }
        dns_acl_attach(acl, &zone->notifysoa.notify_acl);
+       dns_acl_attach(acl, &zone->notifycds.notify_acl);
        UNLOCK_ZONE(zone);
 }
 
@@ -15240,6 +15260,9 @@ dns_zone_clearnotifyacl(dns_zone_t *zone) {
        if (zone->notifysoa.notify_acl != NULL) {
                dns_acl_detach(&zone->notifysoa.notify_acl);
        }
+       if (zone->notifycds.notify_acl != NULL) {
+               dns_acl_detach(&zone->notifycds.notify_acl);
+       }
        UNLOCK_ZONE(zone);
 }
 
index 90fc49a74e2f0d8608974394f10fa288ab87f7a0..f50c20d31ece360b913160ac0553303d273f63ad 100644 (file)
@@ -2685,6 +2685,8 @@ static cfg_clausedef_t zone_clauses[] = {
          CFG_ZONE_SECONDARY | CFG_ZONE_MIRROR | CFG_ZONE_STUB, NULL },
        { "notify", &cfg_type_notifytype,
          CFG_ZONE_PRIMARY | CFG_ZONE_SECONDARY | CFG_ZONE_MIRROR, NULL },
+       { "notify-cds", &cfg_type_boolean,
+         CFG_ZONE_PRIMARY | CFG_ZONE_SECONDARY | CFG_ZONE_MIRROR, NULL },
        { "notify-defer", &cfg_type_uint32,
          CFG_ZONE_PRIMARY | CFG_ZONE_SECONDARY | CFG_ZONE_MIRROR, NULL },
        { "notify-delay", &cfg_type_uint32,