]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
fallback: allow to disable in views:
authorVladimír Čunát <vladimir.cunat@nic.cz>
Thu, 21 Aug 2025 12:26:09 +0000 (14:26 +0200)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Thu, 21 Aug 2025 14:11:57 +0000 (16:11 +0200)
Including config and docs for this.

daemon/lua/kres-gen-33.lua
doc/user/config-views.rst
lib/rplan.h
modules/fallback/fallback.lua
python/knot_resolver/datamodel/templates/macros/view_macros.lua.j2
python/knot_resolver/datamodel/view_schema.py

index 6a5482884aba7e63ac77137c0935ab656120e4b5..bae7c9f6ec10ebb5a1d7b62702065380706e8f3a 100644 (file)
@@ -142,6 +142,7 @@ struct kr_qflags {
        _Bool PKT_IS_SANE : 1;
        _Bool DNS64_DISABLE : 1;
        _Bool PASSTHRU_LEGACY : 1;
+       _Bool FALLBACK_DISABLE : 1;
 };
 typedef struct ranked_rr_array_entry {
        uint32_t qry_uid;
index f8de1fe2a40a4a1d4d240b0b1b515065161c4dbb..b9e46c51daa19a840a52450cbc302eab9a2b0d42 100644 (file)
@@ -92,10 +92,15 @@ Actions
       .. option:: minimize: true|false
 
          Send minimum amount of information in recursive queries to enhance privacy.
+         Enabled by default.
 
       .. option:: dns64: true|false
 
-         Enable/disable DNS64.
+         Disable DNS64 if enabled globally.
+
+      .. option:: fallback: true|false
+
+         Disable fallback on resolution failure, if enabled globally.
 
       .. option:: price-factor: <float>
 
index 16dffd2d4a96b586b5ff1847e999f3d752736169..779d6d250a280857df57d4373c82f2fa113bf880 100644 (file)
@@ -59,6 +59,7 @@ struct kr_qflags {
                                  * some basic aspects of the packet are OK, e.g. QNAME. */
        bool DNS64_DISABLE : 1;  /**< Don't do any DNS64 stuff (meant for view:addr). */
        bool PASSTHRU_LEGACY : 1;/**< Ignore local-data overrides/blocks for this kr_request. */
+       bool FALLBACK_DISABLE : 1;/**< Don't attempt fallback.  Meant for views.  */
 };
 
 /** Combine flags together.  This means set union for simple flags. */
index 5d445ba937de89bac4ab6a9469e38741f40d581b..5bea06d21d70a719f924e51ed49a5958a55a1cc0 100644 (file)
@@ -33,6 +33,8 @@ M.layer.produce = function (state, req, pkt)
        if not M.data_src or state == kres.FAIL or state == kres.DONE then return state end
 
        local qry = req:current()
+       if qry.flags.FALLBACK_DISABLE then return state end
+
        -- Don't do anything for priming, prefetching, etc.
        -- TODO: not all cases detected ATM.
        if qry.flags.NO_CACHE then return state end
index 2f1a796461b7f97646b0ebd2e661c1851ac1134d..c727eb2be15bbb08c574b0957e3d145d6e89fccc 100644 (file)
@@ -12,6 +12,9 @@
 {% if not options.dns64 -%}
 "DNS64_DISABLE",
 {%- endif %}
+{% if not options.fallback -%}
+"FALLBACK_DISABLE",
+{%- endif %}
 {%- endmacro %}
 
 {% macro view_answer(answer) -%}
index 6d94b02af57420c7d40d24f87f9950cf852ce0ff..fc9de6c74d1f377794c30ff9435ef9f5e4680c04 100644 (file)
@@ -12,11 +12,13 @@ class ViewOptionsSchema(ConfigSchema):
     minimize: Send minimum amount of information in recursive queries to enhance privacy.
     dns64: Enable/disable DNS64.
     price_factor: Multiplies rate-limiting and defer prices of operations, use 0 to whitelist.
+    fallback: Enable/disable fallback on resolution failure.
     """
 
     minimize: bool = True
     dns64: bool = True
     price_factor: FloatNonNegative = FloatNonNegative(1.0)
+    fallback: bool = True
 
 
 class ViewSchema(ConfigSchema):