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

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


The following commit(s) were added to refs/heads/10.1.x by this push:
     new 85d19f484a Allow DNS search_default_domains mode 2 (#13178)
85d19f484a is described below

commit 85d19f484a53e3fe357be4a1b26e830763a827e3
Author: Brian Neradt <[email protected]>
AuthorDate: Tue May 26 07:21:58 2026 -0500

    Allow DNS search_default_domains mode 2 (#13178)
    
    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
    
    Co-authored-by: bneradt <[email protected]>
---
 src/records/CMakeLists.txt              |  2 +-
 src/records/RecordsConfig.cc            |  2 +-
 src/records/unit_tests/test_RecUtils.cc | 40 +++++++++++++++++++++++++++++++++
 3 files changed, 42 insertions(+), 2 deletions(-)

diff --git a/src/records/CMakeLists.txt b/src/records/CMakeLists.txt
index a06cdf74df..f898c818c9 100644
--- a/src/records/CMakeLists.txt
+++ b/src/records/CMakeLists.txt
@@ -40,7 +40,7 @@ target_link_libraries(
 )
 
 if(BUILD_TESTING)
-  add_executable(test_records unit_tests/unit_test_main.cc 
unit_tests/test_RecHttp.cc)
+  add_executable(test_records unit_tests/unit_test_main.cc 
unit_tests/test_RecHttp.cc unit_tests/test_RecUtils.cc)
   target_link_libraries(test_records PRIVATE records catch2::catch2 ts::tscore 
libswoc::libswoc)
   add_test(NAME test_records COMMAND test_records)
 
diff --git a/src/records/RecordsConfig.cc b/src/records/RecordsConfig.cc
index faf1e5aad0..21f3387716 100644
--- a/src/records/RecordsConfig.cc
+++ b/src/records/RecordsConfig.cc
@@ -899,7 +899,7 @@ static const RecordElement RecordsConfig[] =
   ,
   {RECT_CONFIG, "proxy.config.dns.retries", RECD_INT, "5", RECU_RESTART_TS, 
RR_NULL, RECC_NULL, "[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
new file mode 100644
index 0000000000..03740334f9
--- /dev/null
+++ b/src/records/unit_tests/test_RecUtils.cc
@@ -0,0 +1,40 @@
+/** @file
+
+   Catch-based tests for RecUtils.cc
+
+  @section license License
+
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+ */
+
+#include "catch.hpp"
+
+#include "../P_RecUtils.h"
+#include "records/RecordsConfig.h"
+
+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