]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
resolved: don't return ANY transactions when looking for transactions
authorLennart Poettering <lennart@poettering.net>
Mon, 13 Feb 2017 19:34:39 +0000 (20:34 +0100)
committerLennart Poettering <lennart@poettering.net>
Mon, 13 Feb 2017 19:34:39 +0000 (20:34 +0100)
This reverts a part of 53fda2bb933694c9bdb1bbf1f5583e39673b74b2:

On classic DNS and LLMNR ANY requests may be replied to with any kind of
RR, and the reply does not have to be comprehensive: these protocols
simply define that if there's an RRset that can answer the question,
then at least one should be sent as reply, but not necessarily all. This
means it's not safe to "merge" transactions for arbitrary RR types into
ANY requests, as the reply might not answer the specific question.

As the merging is primarily an optimization, let's undo this for now.
This logic may be readded later, in a way that only applies to mDNS.

Also, there's an OOM problem with this chunk: dns_resource_key_new()
might fail due to OOM and this is not handled. (This is easily removed
though, by using DNS_RESOURCE_KEY_CONST()).

src/resolve/resolved-dns-scope.c

index 750409eebf8bd2233034b5a12b9602a6d7746a34..7a26edbaf7262948cc0d51ebdf646bad23681d59 100644 (file)
@@ -793,15 +793,8 @@ DnsTransaction *dns_scope_find_transaction(DnsScope *scope, DnsResourceKey *key,
         /* Try to find an ongoing transaction that is a equal to the
          * specified question */
         t = hashmap_get(scope->transactions_by_key, key);
-        if (!t) {
-                DnsResourceKey *key_any;
-
-                key_any = dns_resource_key_new(DNS_CLASS_IN, DNS_TYPE_ANY, dns_resource_key_name(key));
-                t = hashmap_get(scope->transactions_by_key, key_any);
-                key_any = dns_resource_key_unref(key_any);
-                if (!t)
-                        return NULL;
-        }
+        if (!t)
+                return NULL;
 
         /* Refuse reusing transactions that completed based on cached
          * data instead of a real packet, if that's requested. */