Skip to content

Commit 1a16983

Browse files
authored
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
1 parent c21bb60 commit 1a16983

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

src/records/RecordsConfig.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -923,7 +923,7 @@ static constexpr RecordElement RecordsConfig[] =
923923
,
924924
{RECT_CONFIG, "proxy.config.dns.retries", RECD_INT, "5", RECU_RESTART_TS, RR_NULL, RECC_INT, "[0-9]", RECA_NULL}
925925
,
926-
{RECT_CONFIG, "proxy.config.dns.search_default_domains", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_INT, "[0-1]", RECA_NULL}
926+
{RECT_CONFIG, "proxy.config.dns.search_default_domains", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_INT, "[0-2]", RECA_NULL}
927927
,
928928
{RECT_CONFIG, "proxy.config.dns.failover_number", RECD_INT, "5", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL}
929929
,

src/records/unit_tests/test_RecUtils.cc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <catch2/catch_test_macros.hpp>
2525

2626
#include "../P_RecUtils.h"
27+
#include "records/RecordsConfig.h"
2728

2829
TEST_CASE("recordRangeCheck via RecordValidityCheck", "[librecords][RecUtils]")
2930
{
@@ -199,3 +200,16 @@ TEST_CASE("recordRangeCheck via RecordValidityCheck", "[librecords][RecUtils]")
199200
REQUIRE(RecordValidityCheck("-9223372036854775807", RECC_INT, "[-9223372036854775808-0]")); // INT64_MIN + 1
200201
}
201202
}
203+
204+
TEST_CASE("search_default_domains accepts documented values", "[librecords][RecUtils]")
205+
{
206+
const auto *record = GetRecordElementByName("proxy.config.dns.search_default_domains");
207+
208+
REQUIRE(record != nullptr);
209+
REQUIRE(record->check == RECC_INT);
210+
REQUIRE(record->regex != nullptr);
211+
REQUIRE(RecordValidityCheck("0", record->check, record->regex));
212+
REQUIRE(RecordValidityCheck("1", record->check, record->regex));
213+
REQUIRE(RecordValidityCheck("2", record->check, record->regex));
214+
REQUIRE_FALSE(RecordValidityCheck("3", record->check, record->regex));
215+
}

0 commit comments

Comments
 (0)