I have a DNS domain with 3 TXT records:
$ORIGIN example.com. @ IN TXT "thing one veryveryveryveryveryverylong" @ IN TXT "thing two veryveryveryveryveryverylong" @ IN TXT "thing three veryveryveryveryveryverylong"
When I do a DNS query (
dig example.com. txt) the reply fits in a UDP packet because the payload is less than 512 bytes (resulting in a packet less than 576 bytes).
However I know that if the reply is long enough, it will be truncated and the DNS client will have to repeat the request using TCP, which has longer length limits.
How can I calculate whether or not I have exceeded the length limit without generating the DNS records and doing a query?
I assume that the formula is something like:
N: the number of TXT records on that label. P: the number of bytes in all the TXT records. S: the total number of text segments (TXT records can have multiple text segments per record) UDP is required if N*a + P*b + S*c is more than 512
What are the values of a, b, and c?
(or am I going in the wrong direction?)