DNS packet size question.

Barry Margolin barmar at genuity.net
Wed Jun 14 17:42:52 UTC 2000


In article <593F7F3472A5D211B99B0008C7EAA08A03FD4713 at eseis02nok>,
 <petri.j.laine at nokia.com> wrote:
>I'm planning to write a modified resolver. Why do I need to do that, is that
>gethostbyname() blocks until it gets response from DNS and we cannot use it
>in our case.

I think I've heard of some existing asynchronous versions of
gethostbyname(), so you may not need to reinvent the wheel.

One way you may be able to do this is by multi-threading your application.
I think many systems have gethostbyname_r(), which is re-entrant and can be
used in another thread while the main thread continues.

>I looked trough some source code of the functions that gethostbyname uses
>and it seemed that if DNS packet size exceeds the maximum size of an UDP
>datagram, it gets truncated. In that case res_send() uses a stream socket
>(if RES_IGNTC option not set?). That would be one problem in my
>implementation, because I would like to keep the implementation very simple
>and only to use datagram sockets.
>
>So, is it common that DNS reply packets gets too big to fit in one UDP
>datagram?

No, it's not common.  In fact, in BIND 4, a caching server would never use
TCP when performing recursive queries, so queries would often fail if they
needed to use TCP.  So most DNS administrators have arranged things so that
a single name won't have so many A records that they exceed the UDP packet
size (this is why all the root servers were renamed into the
ROOT-SERVERS.NET domain -- DNS's compression mechanism allowed them all to
fit).

>If it is, my second question is;
>
>Is it possible to define DNS queries that the DNS replys would have a
>minimum number of information - I only need one IP address per domain name
>and also I don't have any use for aliases.

Nope.

-- 
Barry Margolin, barmar at genuity.net
Genuity, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.



More information about the bind-users mailing list