Prevent query loops for misbehaving servers

If a TCP connection fails while attempting to send a query to a server, the fetch context will be restarted without marking the target server as a bad one. If this happens for a server which:

  • was already marked with the DNS_FETCHOPT_EDNS512 flag,
  • responds to EDNS queries with the UDP payload size set to 512 bytes,
  • does not send response packets larger than 512 bytes,

and the response for the query being sent is larger than 512 byes, then named will pointlessly alternate between sending UDP queries with EDNS UDP payload size set to 512 bytes (which are responded to with truncated answers) and TCP connections until the fetch context retry limit is reached. Prevent such query loops by marking the server as bad for a given fetch context if the advertised EDNS UDP payload size for that server gets reduced to 512 bytes and it is impossible to reach it using TCP.

See #1059 (closed)

Merge request reports