]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Remove rrset-order cyclic from the default config, with shim
authorAlessio Podda <alessio@isc.org>
Tue, 23 Dec 2025 15:38:53 +0000 (16:38 +0100)
committerAlessio Podda <alessio@isc.org>
Thu, 8 Jan 2026 13:43:04 +0000 (14:43 +0100)
Currently we add an rrset-order cyclic statement to the default config.
Since the rrset-order allows matching a subset of all names, it must
be implemented with a string comparison against a wildcard, and since
the statement applies per rrset, this can result in millions of
comparisons per second on a busy authoritative server.

This commit removes rrset-order from the default config, but adds back
a code shim in query_setorder to preserve the previous behaviour.

bin/include/defaultconfig.h
bin/named/server.c
lib/ns/query.c

index 8e247572607db24f2225bd15d01e83a732cb07a0..fb1ede220cc9b1ab3b38df8e6ab2cb1a888a2bfb 100644 (file)
@@ -79,7 +79,7 @@ options {\n\
        request-zoneversion false;\n\
        resolver-query-timeout 10;\n\
 #      responselog <boolean>;\n\
-       rrset-order { order cyclic; };\n\
+#      rrset-order { order cyclic; };\n\
        secroots-file \"named.secroots\";\n\
        send-cookie true;\n\
        serial-query-rate 20;\n\
index 6e1757cce084c9dd2aaced6bdae01481fef78388..09caf23d554a6658497e030e4caff6da771bd2c6 100644 (file)
@@ -4620,20 +4620,27 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
         *      Configure the views rrset-order.
         */
        {
-               const cfg_obj_t *rrsetorder = NULL;
-
-               (void)named_config_get(maps, "rrset-order", &rrsetorder);
-               dns_order_create(mctx, &order);
-               CFG_LIST_FOREACH(rrsetorder, element) {
-                       const cfg_obj_t *ent = cfg_listelt_value(element);
-
-                       CHECK(configure_order(order, ent));
-               }
+               /*
+                * Detach the old order
+                */
                if (view->order != NULL) {
                        dns_order_detach(&view->order);
                }
-               dns_order_attach(order, &view->order);
-               dns_order_detach(&order);
+
+               const cfg_obj_t *rrsetorder = NULL;
+               if (ISC_R_SUCCESS ==
+                   named_config_get(maps, "rrset-order", &rrsetorder))
+               {
+                       dns_order_create(mctx, &order);
+                       CFG_LIST_FOREACH(rrsetorder, element) {
+                               const cfg_obj_t *ent =
+                                       cfg_listelt_value(element);
+
+                               CHECK(configure_order(order, ent));
+                       }
+                       dns_order_attach(order, &view->order);
+                       dns_order_detach(&order);
+               }
        }
        /*
         * Copy the aclenv object.
index e704db3f30e3dbd9585f3d9b401bb48bc499e568..b23db80903bb745cc8fee3d785afaad0298e4432 100644 (file)
@@ -2212,6 +2212,15 @@ query_setorder(query_ctx_t *qctx, dns_name_t *name, dns_rdataset_t *rdataset) {
        if (order != NULL) {
                rdataset->attributes.order = dns_order_find(
                        order, name, rdataset->type, rdataset->rdclass);
+       } else {
+               /*
+                * For backward compatibility reasons, we need to behave as if
+                * rrset-order: cyclic was set when no order is configured.
+                *
+                * This was done through the default config, but it came at a
+                * speed penalty.
+                */
+               rdataset->attributes.order = dns_order_cyclic;
        }
 }