]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
small refactor for `max-query-restart` in `check.c`
authorColin Vidal <colin@isc.org>
Wed, 19 Nov 2025 11:32:09 +0000 (12:32 +0100)
committerEvan Hunt <each@isc.org>
Wed, 7 Jan 2026 07:01:59 +0000 (07:01 +0000)
Use the `check_range_uint32()` function in `check.c` to test the
boundaries of `max-query-restart` instead of custom code.

lib/isccfg/check.c

index ca726b737f830443cc024122fe111df652a444e9..4e690b9d994e4597e186595964f1a54c631e1dcf 100644 (file)
@@ -1999,19 +1999,7 @@ check_options(const cfg_obj_t *options, const cfg_obj_t *config,
                }
        }
 
-       obj = NULL;
-       (void)cfg_map_get(options, "max-query-restarts", &obj);
-       if (obj != NULL) {
-               uint32_t restarts = cfg_obj_asuint32(obj);
-               if (restarts == 0 || restarts > 255) {
-                       cfg_obj_log(obj, ISC_LOG_ERROR,
-                                   "'max-query-restarts' is out of "
-                                   "range 1..255)");
-                       if (result == ISC_R_SUCCESS) {
-                               result = ISC_R_RANGE;
-                       }
-               }
-       }
+       check_range_uint32(options, &result, "max-query-restarts", 1, 255);
 
        obj = NULL;
        (void)cfg_map_get(options, "prefetch", &obj);