]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
resolved: when we get a packet failure from a server, don't downgrade UDP to TCP...
authorLennart Poettering <lennart@poettering.net>
Fri, 8 Jan 2016 01:46:59 +0000 (02:46 +0100)
committerLennart Poettering <lennart@poettering.net>
Mon, 11 Jan 2016 18:40:00 +0000 (19:40 +0100)
Under the assumption that packet failures (i.e. FORMERR, SERVFAIL, NOTIMP) are caused by packet contents, not used
transport, we shouldn't switch between UDP and TCP when we get them, but only downgrade the higher levels down to UDP.

src/resolve/resolved-dns-server.c

index 0de6c8cec0eb255345cb697750bc3274ce4c98e3..1600e7c292c35f77574f4279fbc52ebf11942332 100644 (file)
@@ -277,6 +277,14 @@ void dns_server_packet_failed(DnsServer *s, DnsServerFeatureLevel level) {
         if (s->possible_feature_level != level)
                 return;
 
+        /* Invoked whenever we get a FORMERR, SERVFAIL or NOTIMP rcode from a server. This is an immediate trigger for
+         * us to go one feature level down. Except when we are already at TCP or UDP level, in which case there's no
+         * point in changing, under the assumption that packet failures are caused by packet contents, not by used
+         * transport. */
+
+        if (s->possible_feature_level <= DNS_SERVER_FEATURE_LEVEL_UDP)
+                return;
+
         s->n_failed_attempts  = (unsigned) -1;
 }