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.
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;
}