I was trying to understand dig +bufsize. (Reading today's master code.)
- The dig manual says bufsize is rounded up to 0 if below.
See dighost.c's setup_lookup(). It has some code that if udpsize is 0, sets it to 4096. That appears to be the behavior but I didn't trace or debug it. I may have misunderstood the manual. When I set to 0 its behaviour is as if it is at least 2481 (I assume 4096).
- dighost.c add_opt() uses the dns_message_buildopt(). See lib/dns/message.c dns_message_buildopt() which has: /* * Set Maximum UDP buffer size. */ rdatalist->rdclass = udpsize; Am I reading this right? how can "rdclass" and udpsize be related? (If this correct, please add documentation.)
- Also see lib/ns/client.c process_opt() has: /* * Set the client's UDP buffer size. */ client->udpsize = opt->rdclass; I am trying to understand that udpsize/rdclass relationship. I think is a bug. See right after updsize gets reset to 512 because of this. Again the dig manual reads that bufsize (udpsize) can be less than 512. But if I set to 1, its behavior is as if is set to 512.