DNS packet size question.

petri.j.laine at nokia.com petri.j.laine at nokia.com
Wed Jun 14 06:31:02 UTC 2000


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 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?

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.

Thanks,
Petri




> -----Original Message-----
> From: EXT Cricket Liu [mailto:cricket at acmebw.com]
> Sent: 13. June 2000 23:41
> To: bind-users at isc.org
> Subject: Re: DNS packet size question.
> 
> 
> > > What is the normal DNS packet size for a query and a response?
> > 
> > There is no "normal" size. The minimum size of a DNS 
> message that only
> > has headers (no questions, answers or anything else) is 96 
> bytes. The
> > size of the question, answer, authority and additional data sections
> > will vary tremendously depending upon the type of data 
> being queried (A
> > vs PTR vs "*") and how/where the question gets processed.
> 
> Are you sure that 96 bytes is right?  I think 12 bytes (96
> bits) is more like the size of the header.
> 
> cricket
> 
> Acme Byte & Wire
> cricket at acmebw.com
> www.acmebw.com
> 
> Attend the next Internet Software Consortium/Acme Byte & Wire
> DNS and BIND class!  See www.acmebw.com/training.htm for
> the schedule and to register for upcoming classes.
> 
> 
> 



More information about the bind-users mailing list