Hi all,

I've spent some time this past couple of weeks reading through the DNS resolver 
code in netdb and poring over RFCs that specify the protocol with a view to 
adding support for additional resource record queries. Things like TXT, SOA, 
and so forth. I'm using netdb from fpc 3.2.0 as the starting point. That code 
only supports querying DNS over UDP. Because TXT records can be up to 64k in 
size, they frequently get too big to fit inside a UDP packet. The RFCs mandate 
that resolvers must fall back to TCP in that case. That's the part I'm 
currently looking at.

The maximum size for a DNS response over TCP is 65,535 octets. The netdb code 
defines a type TPayload that's a 512 octet buffer for receiving DNS responses. 
That's the largest response possible over UDP. The simplest path forward for me 
is to extend that buffer from 512 octets to 65,535. While that increase in size 
would hardly register on most machines, I wonder whether it might be too much 
on some of the more memory-restricted platforms that FPC supports. DOS, for 
instance. I also see IFDEFs for Android in this code.

The alternative is to use different types for TCP queries, or to have the 
buffer allocated dynamically.

To restate the question, is 64k too much overhead for DNS queries? That 
overhead would be present on all queries, regardless of whether UDP or TCP was 
used.

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to