]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Add keepwarm to recordcache config
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 1 Apr 2026 08:30:01 +0000 (10:30 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Mon, 27 Jul 2026 10:22:09 +0000 (12:22 +0200)
Signed-off-by: Otto Moerbeek <otto.moerbeek@open-xchange.com>
pdns/recursordist/rec-rust-lib/generate.py
pdns/recursordist/rec-rust-lib/rust-bridge-in.rs
pdns/recursordist/rec-rust-lib/rust/src/bridge.rs
pdns/recursordist/rec-rust-lib/table.py

index f9acf90f61ac57ea91ec1c024bc675600b9ae5ff..03fd5f8d2114bcf0d8643f73ad8f40dc8c63c502 100644 (file)
@@ -119,10 +119,10 @@ class LType(Enum):
     ListSubnets = auto()
     ListTrustAnchors = auto()
     ListZoneToCaches = auto()
+    ListQNameAndQTypes = auto()
     String = auto()
     Uint64 = auto()
 
-
 listOfStringTypes = (LType.ListSocketAddresses, LType.ListStrings, LType.ListSubnets, LType.ListAddressAndInterfaces)
 listOfStructuredTypes = (
     LType.ListAuthZones,
@@ -141,6 +141,7 @@ listOfStructuredTypes = (
     LType.ListIncomingWSConfigs,
     LType.ListOutgoingTLSConfigurations,
     LType.ListOpenTelemetryTraceConditions,
+    LType.ListQNameAndQTypes,
 )
 
 
@@ -219,6 +220,8 @@ def get_newdoc_typename(typ):
         return "Sequence of `OpenTelemetryTraceCondition`_"
     if typ == LType.ListAddressAndInterfaces:
         return "Sequence of address or address@interface_"
+    if typ == LType.ListQNameAndQTypes:
+        return "Sequence of `QNameAndQType`_"
     return "Unknown2" + str(typ)
 
 
index 821b7a7d9eb1525250f0b37b17a8039c484c5ae0..edf470cc62ce1ecc3abffd791c5bf188f813015c 100644 (file)
@@ -384,6 +384,15 @@ struct OpenTelemetryTraceCondition {
     traceid_only: bool,
 }
 
+#[derive(Deserialize, Serialize, Clone, Debug, PartialEq)]
+#[serde(deny_unknown_fields)]
+struct QNameAndQType {
+    #[serde(default, skip_serializing_if = "crate::is_default")]
+    qname: String,
+    #[serde(default = "crate::def_qnameandqtype_qtype", skip_serializing_if = "crate::def_value_equals_qnameqtype_qtype")]
+    qtype: String,
+}
+
 // Two structs used to generated YAML based on a vector of name to value mappings
 // Cannot use Enum as CXX has only very basic Enum support
 struct Value {
index 8ef35850705abb624d434191938cc3db26a28973..e84561ebc1faedce1ec8f9676a5156893d13d47b 100644 (file)
@@ -897,6 +897,18 @@ impl OpenTelemetryTraceCondition {
     }
 }
 
+impl QNameAndQType {
+    pub fn validate(&self, field: &str) -> Result<(), ValidationError> {
+        if self.qname.is_empty() {
+            let msg = format!("{}: value may not be empty", field);
+            return Err(ValidationError { msg });
+        }
+        validate_qtype(&(field.to_string() + ".qtype"), &self.qtype)?;
+        Ok(())
+    }
+}
+
+
 #[allow(clippy::ptr_arg)] //# Avoids creating a rust::Slice object on the C++ side.
 pub fn validate_auth_zones(field: &str, vec: &Vec<AuthZone>) -> Result<(), ValidationError> {
     validate_vec(field, vec, |field, element| element.validate(field))
@@ -1423,6 +1435,14 @@ pub fn def_value_equals_pb_strategy(value: &String) -> bool {
     &def_pb_strategy() == value
 }
 
+pub fn def_qnameandqtype_qtype() -> String {
+    String::from("A")
+}
+
+pub fn def_value_equals_qnameqtype_qtype(value: &String) -> bool {
+    &def_qnameandqtype_qtype() == value
+}
+
 pub fn validate_dnssec(dnssec: &recsettings::Dnssec) -> Result<(), ValidationError> {
     let val = dnssec.validation.as_str();
     match val {
index f0c88473f20576021c95d3b489e803d1da5a0e70..04bb2835bbf4132440f5388782d0d3794c60a4af 100644 (file)
@@ -3690,4 +3690,17 @@ A DoT connection is matched against the subnets lists (using the remote IP) and
         "versionadded": "5.4.0",
         "runtime": ["reload-lua-config", "reload-yaml"],
     },
+    {
+        "name": "keepwarm",
+        "section": "recordcache",
+        "type": LType.ListQNameAndQTypes,
+        "default": "",
+        "help": "Sequence of QNameAndQType",
+        "doc": """
+        List of names to keep warm in the cache
+        """,
+        "skip-old": "No equivalent old style setting",
+        "versionadded": "5.5.0",
+        "runtime": ["reload-lua-config", "reload-yaml"],
+    },
 ]