This is an automated email from the ASF dual-hosted git repository.
bneradt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new 1a16983329 Allow DNS search_default_domains mode 2 (#13176)
1a16983329 is described below
commit 1a169833292f0994a5e2203a770dad23ac3ed637
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
---
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 7c8ab553d4..4586f039a2 100644
--- a/src/records/RecordsConfig.cc
+++ b/src/records/RecordsConfig.cc
@@ -923,7 +923,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));
+}