]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
hints: fix names inside home.arpa.
authorVladimír Čunát <vladimir.cunat@nic.cz>
Sat, 10 Jun 2023 08:34:12 +0000 (10:34 +0200)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Thu, 15 Jun 2023 15:14:44 +0000 (15:14 +0000)
Reported on https://forum.turris.cz/t/knot-resolver-with-local-fqdn-hostnames/19034/8

I write it as three comparisons, as it seems like a simple way of
still running only a single comparison in the typical case of QNAME
not falling under .arpa.

Tested just quickly, manually.  This chunk of code already is replaced
for kresd >= 6.0.0.

NEWS
modules/hints/hints.c

diff --git a/NEWS b/NEWS
index c9a1c73be2b6c054790a30ac95d84ecd6d881adb..5eaa0ffd97edd0c3f8c2770e4b46dfd27282c6e9 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,7 @@ Bugfixes
 --------
 - fix unusual timestamp format in debug dumps of records (!1386)
 - adjust linker options; it should help less common platforms (!1384)
+- hints module: fix names inside home.arpa. (!1406)
 
 
 Knot Resolver 5.6.0 (2023-01-26)
index 34c08b9ff2ae33115870492fc38ebcaadbd55926..a3f2f3002e4ce88cc187cc82eafd9a412f02540b 100644 (file)
@@ -152,7 +152,11 @@ static int query(kr_layer_t *ctx, knot_pkt_t *pkt)
        }
        /* FIXME: putting directly into packet breaks ordering in case the hint
         * is applied after a CNAME jump. */
-       if (knot_dname_in_bailiwick(qry->sname, (const uint8_t *)"\4arpa\0") >= 0) {
+       const bool is_rev =
+               knot_dname_in_bailiwick(qry->sname, (const uint8_t *)"\4arpa\0") > 0 &&
+               (knot_dname_in_bailiwick(qry->sname, (const uint8_t *)"\7in-addr\4arpa\0") > 0
+                || knot_dname_in_bailiwick(qry->sname, (const uint8_t *)"\3ip6\4arpa\0") > 0);
+       if (is_rev) {
                if (satisfy_reverse(data, pkt, qry) != 0)
                        return ctx->state;
        } else {