[ldns-users] Resolver to use TCP if UDP > bufsize

Wolfgang Nagele wolfgang.nagele at ausregistry.com.au
Thu Jan 17 08:54:05 UTC 2013

Hi all,

I have a case where we are sending large DNS packets that exceed 4096 bytes using 'ldns_resolver_send_pkt()'. I noticed that it will not realize that it exceeds the UDP bufsize and fallback to TCP but rather sends the message using UDP which will result in a FORMERR from BIND.

As far as I can see in the code there is no way in the resolver to make it behave this way. Am I missing something?

At this point I have implemented a check in our code that will set 'usevc()' for packets that exceed the bufsize. That brings me to another question - is there no better way to get the size of my packet than this?

uint8_t *wire = NULL;
size_t size;
ldns_pkt2wire(&wire, pkt, &size);


Wolfgang Nagele
Senior Systems and Network Administrator
AusRegistry Pty Ltd
Level 8, 10 Queens Road
Melbourne, Victoria, Australia, 3004
Phone +61 3 9090 1756
Email: wolfgang.nagele at ausregistry.com.au
Web: www.ausregistry.com.au

The information contained in this communication is intended for the named recipients only. It is subject to copyright and may contain legally privileged and confidential information and if you are not an intended recipient you must not use, copy, distribute or take any action in reliance on it. If you have received this communication in error, please delete all copies from your system and notify us immediately.

More information about the ldns-users mailing list