]> git.ipfire.org Git - thirdparty/ldns.git/commitdiff
ldns-testns match wildcard qname's
authorWillem Toorop <willem@nlnetlabs.nl>
Sat, 3 Jun 2023 13:08:41 +0000 (15:08 +0200)
committerWillem Toorop <willem@nlnetlabs.nl>
Sat, 3 Jun 2023 13:09:04 +0000 (15:09 +0200)
Currently only in combination with copy_query (for simulating delegations)

examples/ldns-testpkts.c

index c67a82594c5d000517d50d3d7322d9dda716d1b5..033b96013784adb014d0ae6b0bc42bb6150044c7 100644 (file)
@@ -764,9 +764,13 @@ find_match(struct entry* entries, ldns_pkt* query_pkt,
                        continue;
                }
                if(p->match_qname) {
-                       if(!get_owner(query_pkt) || !get_owner(reply) ||
-                               ldns_dname_compare(
-                               get_owner(query_pkt), get_owner(reply)) != 0) {
+                       if (!get_owner(query_pkt) || !get_owner(reply)
+                       || (  !p->copy_query
+                          &&  ldns_dname_compare( get_owner(query_pkt)
+                                                , get_owner(reply)))
+                       || (   p->copy_query
+                          && !ldns_dname_match_wildcard( get_owner(query_pkt)
+                                                       , get_owner(reply)))) {
                                verbose(3, "bad qname\n");
                                continue;
                        }