]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
Use max-query-restarts in iterative resolver
authorChristian Allred <christian@theallreds.net>
Mon, 5 Apr 2021 23:25:43 +0000 (16:25 -0700)
committerChristian Allred <christian@theallreds.net>
Mon, 5 Apr 2021 23:25:43 +0000 (16:25 -0700)
iterator/iter_utils.c
iterator/iterator.c
iterator/iterator.h

index 94fa18f63c7e9564bd8b07c994a37f664c230ffd..637acf736d0ca3acac278fede1bce84540a489f7 100644 (file)
@@ -176,6 +176,9 @@ iter_apply_cfg(struct iter_env* iter_env, struct config_file* cfg)
        }
        iter_env->supports_ipv6 = cfg->do_ip6;
        iter_env->supports_ipv4 = cfg->do_ip4;
+
+       iter_env->max_query_restarts = cfg->max_query_restarts;
+
        return 1;
 }
 
index 99d02011784256b11f057fbeb7e972210f9a6eb7..5163857fad8d4f936b8de40db50e72f261d0044d 100644 (file)
@@ -1237,7 +1237,7 @@ processInitRequest(struct module_qstate* qstate, struct iter_qstate* iq,
 
        /* We enforce a maximum number of query restarts. This is primarily a
         * cheap way to prevent CNAME loops. */
-       if(iq->query_restart_count > MAX_RESTART_COUNT) {
+       if(iq->query_restart_count > ie->max_query_restarts) {
                verbose(VERB_QUERY, "request has exceeded the maximum number"
                        " of query restarts with %d", iq->query_restart_count);
                errinf(qstate, "request has exceeded the maximum number "
index 342ac207e826b0fe77d852eba63f065849834366..d3ca716fca78ca5f369362659be67e2cbdae5ca0 100644 (file)
@@ -139,6 +139,9 @@ struct iter_env {
        lock_basic_type queries_ratelimit_lock;
        /** number of queries that have been ratelimited */
        size_t num_queries_ratelimited;
+
+       /** max number of query restarts to limit length of CNAME chain */
+       size_t max_query_restarts;
 };
 
 /**