daemon/worker: allow large responses for outbound over TCP
This was previously fixed in e25358d4, but broken in the rewrite. The answer buffer size must be a maximum size, otherwise payloads larger than configured UDP buffer size can't be transmitted over TCP.
The source of the problem is that the buffer size used for all message exchanges will be only as large as the buffer size specified in the client query (or net.bufsize
config). So for example if client asks with buffer size 1536, resolver will accept at most 1536 bytes long responses from the authoritative servers. Some messages
An example query that has problems is A algebras.org
when you configure net.bufsize(1536)
, the authoritative response for one of the DNSKEYs is over 5K (kdig @2001:470:8:bc2::1 algebras.org A +dnssec +tcp
), so it doesn't fit in the 1536 bufsize, and so the resolver will receive a truncated response back. It will then retry over TCP, but without resizing the packet, so it will time out after a few a few seconds and return SERVFAIL to client.
This restores the previous patch to increase size for answers to outgoing responses over TCP to maximum allowed size.
cc @anb @vendemiat