diff options
author | Vladimír Čunát <vladimir.cunat@nic.cz> | 2023-06-10 10:34:12 +0200 |
---|---|---|
committer | Vladimír Čunát <vladimir.cunat@nic.cz> | 2023-06-15 17:14:44 +0200 |
commit | af59d6b7895b873c5e94bf41b8992a179b12fe75 (patch) | |
tree | 5acf13d33d958b723fa95dfa5577e0ccd9860606 /modules/hints/hints.c | |
parent | Merge !1405: stricter C warnings: fix and add them to defaults+CI (diff) | |
download | knot-resolver-af59d6b7895b873c5e94bf41b8992a179b12fe75.tar.xz knot-resolver-af59d6b7895b873c5e94bf41b8992a179b12fe75.zip |
hints: fix names inside home.arpa.
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.
Diffstat (limited to 'modules/hints/hints.c')
-rw-r--r-- | modules/hints/hints.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/hints/hints.c b/modules/hints/hints.c index 34c08b9f..a3f2f300 100644 --- a/modules/hints/hints.c +++ b/modules/hints/hints.c @@ -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 { |