This is an automated email from the ASF dual-hosted git repository.

cmcfarlen pushed a commit to branch 10.2.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit b8a53296b92a8307a7540fa7d6ca4f5ba06d6b86
Author: Brian Neradt <[email protected]>
AuthorDate: Tue May 19 16:29:14 2026 -0500

    Allow DNS search_default_domains mode 2 (#13176)
    
    proxy.config.dns.search_default_domains documents mode 2, and the
    DNS runtime accepts it, but the record validation range rejected the
    value through config updates.
    
    This expands the record validation range to include 2 and adds a
    records unit test that keeps the documented values accepted while
    still rejecting values outside the range.
    
    Fixes: #13175
    (cherry picked from commit 1a169833292f0994a5e2203a770dad23ac3ed637)
---
 src/records/RecordsConfig.cc            |  2 +-
 src/records/unit_tests/test_RecUtils.cc | 14 ++++++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/records/RecordsConfig.cc b/src/records/RecordsConfig.cc
index 818124c0c1..c83d1bce8d 100644
--- a/src/records/RecordsConfig.cc
+++ b/src/records/RecordsConfig.cc
@@ -919,7 +919,7 @@ static constexpr RecordElement RecordsConfig[] =
   ,
   {RECT_CONFIG, "proxy.config.dns.retries", RECD_INT, "5", RECU_RESTART_TS, 
RR_NULL, RECC_INT, "[0-9]", RECA_NULL}
   ,
-  {RECT_CONFIG, "proxy.config.dns.search_default_domains", RECD_INT, "0", 
RECU_DYNAMIC, RR_NULL, RECC_INT, "[0-1]", RECA_NULL}
+  {RECT_CONFIG, "proxy.config.dns.search_default_domains", RECD_INT, "0", 
RECU_DYNAMIC, RR_NULL, RECC_INT, "[0-2]", RECA_NULL}
   ,
   {RECT_CONFIG, "proxy.config.dns.failover_number", RECD_INT, "5", 
RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL}
   ,
diff --git a/src/records/unit_tests/test_RecUtils.cc 
b/src/records/unit_tests/test_RecUtils.cc
index 30acc44a4b..68f772ad7b 100644
--- a/src/records/unit_tests/test_RecUtils.cc
+++ b/src/records/unit_tests/test_RecUtils.cc
@@ -24,6 +24,7 @@
 #include <catch2/catch_test_macros.hpp>
 
 #include "../P_RecUtils.h"
+#include "records/RecordsConfig.h"
 
 TEST_CASE("recordRangeCheck via RecordValidityCheck", "[librecords][RecUtils]")
 {
@@ -199,3 +200,16 @@ TEST_CASE("recordRangeCheck via RecordValidityCheck", 
"[librecords][RecUtils]")
     REQUIRE(RecordValidityCheck("-9223372036854775807", RECC_INT, 
"[-9223372036854775808-0]")); // INT64_MIN + 1
   }
 }
+
+TEST_CASE("search_default_domains accepts documented values", 
"[librecords][RecUtils]")
+{
+  const auto *record = 
GetRecordElementByName("proxy.config.dns.search_default_domains");
+
+  REQUIRE(record != nullptr);
+  REQUIRE(record->check == RECC_INT);
+  REQUIRE(record->regex != nullptr);
+  REQUIRE(RecordValidityCheck("0", record->check, record->regex));
+  REQUIRE(RecordValidityCheck("1", record->check, record->regex));
+  REQUIRE(RecordValidityCheck("2", record->check, record->regex));
+  REQUIRE_FALSE(RecordValidityCheck("3", record->check, record->regex));
+}

Reply via email to