Re: dnscache and oversized answers

"Matthew Dempsky" <[email protected]>
Newsgroups gmane.network.djbdns
Message-ID <[email protected]>
On Thu, Oct 9, 2008 at 1:50 PM, Dean Anderson <[email protected]> wrote:
> I recommend against using this patch, as is.  Having the recursor fall
> back to TCP in this case doesn't fix the problem, since the oversize
> response (now obtained via TCP) must still be sent to the client via
> UDP.  So its a waste to fall back to TCP, here; and there is also no
> reason to think the oversized packet, while technically a violation of
> spec, is actually incorrect.

The patch below changes dns_transmit library to accept UDP packets up
to 4096 bytes in length.  Also included is an example of dnsq
successfully retrieving xo.net's over-sized MX record response.
dnscache uses the same routines to send queries to authoritative
services, so it will work as well.  It will still correctly truncate
responses over 512 bytes when sending them to stub resolvers over UDP.

$ ./dnsq mx xo.net nameserver.concentric.net
15 xo.net:
538 bytes, 1+8+4+12 records, response, authoritative, noerror
query: 15 xo.net
answer: xo.net 900 MX 10 revenge.xo.com
answer: xo.net 900 MX 20 tremendous.xo.com
answer: xo.net 900 MX 30 irresistable.xo.com
answer: xo.net 900 MX 40 hood.xo.com
answer: xo.net 900 MX 50 safeguard.xo.com
answer: xo.net 900 MX 60 defiance.xo.com
answer: xo.net 900 MX 70 indignant.xo.com
answer: xo.net 900 MX 80 triumph.xo.com
authority: xo.net 10800 NS nameserver2.concentric.net
authority: xo.net 10800 NS nameserver3.concentric.net
authority: xo.net 10800 NS nameserver.concentric.net
authority: xo.net 10800 NS nameserver1.concentric.net
additional: revenge.xo.com 10800 A 207.155.248.205
additional: tremendous.xo.com 10800 A 207.155.249.233
additional: irresistable.xo.com 10800 A 207.155.248.53
additional: hood.xo.com 10800 A 207.155.252.74
additional: safeguard.xo.com 10800 A 207.155.253.198
additional: defiance.xo.com 10800 A 207.155.252.110
additional: indignant.xo.com 10800 A 207.155.249.193
additional: triumph.xo.com 10800 A 207.155.249.187
additional: nameserver.concentric.net 10800 A 207.155.249.180
additional: nameserver1.concentric.net 10800 A 207.88.20.30
additional: nameserver2.concentric.net 10800 A 207.155.253.180
additional: nameserver3.concentric.net 10800 A 207.88.20.82


--- dns_transmit.c.orig	2008-10-10 16:59:03.000000000 -0700
+++ dns_transmit.c	2008-10-10 16:59:11.000000000 -0700
@@ -240,7 +240,7 @@

 int dns_transmit_get(struct dns_transmit *d,const iopause_fd *x,const
struct taia *when)
 {
-  char udpbuf[513];
+  char udpbuf[4097];
   unsigned char ch;
   int r;
   int fd;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.