ronysebastian / nhin-d

Automatically exported from code.google.com/p/nhin-d
0 stars 0 forks source link

Java DNS server does not properly truncate UDP replies. #182

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Stand up an instance of the Java RI DNS server.
2. Use a UDP query to request a certificate that will generate a reply larger 
than the 512 bytes.
3. The UDP reply is not properly truncate.

What is the expected output? What do you see instead?

A proper DNS server will terminate the UDP reply appropriately to indicate that 
reply is truncated.  Most DNS resolvers will respond to the by sending a TCP 
request.  Due to the invalid reply of the Java DNS server when UDP message are 
too large, resolvers cannot interpret the truncated message correctly and will 
note execute a TCP request.

What version of the product are you using? On what operating system?

This occurs will all versions of the Java DNS server on all operating systems.

Original issue reported on code.google.com by gm2...@cerner.com on 3 Apr 2012 at 1:56

GoogleCodeExporter commented 9 years ago
Easy fix. I just changed:
byte[] writeBytes = response.toWire();
to:
byte[] writeBytes = response.toWire(512);
In UDPServer.java. The xbill library handles setting the TC flag if the data is 
greater than the size passed in.

xbill doesn't support only UDP queries so no unit test (yet). Tested and 
confirmed it's now setting the TC flag when needed.

Original comment by tsn...@gmail.com on 14 Apr 2012 at 3:08

Attachments:

GoogleCodeExporter commented 9 years ago
Patch applied/committed and all tests run successfully.  Needs validation 
testing.

Original comment by gm2...@cerner.com on 16 Apr 2012 at 2:32

GoogleCodeExporter commented 9 years ago
Verified with dig.

Original comment by gm2...@cerner.com on 20 Nov 2012 at 3:36