DNS Server | Rust | dns: buffer size too small

In the “Write question section” task tests have logs:

remote: [tester::#BF2] Running tests for Stage #BF2 (Write question section)
remote: [tester::#BF2] Starting DNS server on 127.0.0.1:2053
remote: [tester::#BF2] Running program
remote: [tester::#BF2] DNS resolver listening on 127.0.0.1:5354
remote: [tester::#BF2] Connecting to 127.0.0.1:2053 using UDP
remote: [your_program] Logs from your program will appear here!
remote: [tester::#BF2] Querying `A` record for codecrafters.io.
remote: [tester::#BF2] Sending Request: (Messages with >>> prefix are part of this log)
remote: [tester::#BF2] >>> ;; opcode: QUERY, status: NOERROR, id: 1234
remote: [your_program] Received 33 bytes from 127.0.0.1:60055
remote: [your_program] Send 33 bytes from 127.0.0.1:60055
remote: [tester::#BF2] >>> ;; flags: rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
remote: [tester::#BF2] >>> 
remote: [tester::#BF2] >>> ;; QUESTION SECTION:
remote: [tester::#BF2] >>> ;codecrafters.io.    IN       A
remote: [tester::#BF2] >>> 
remote: [your_program] Success send response to 127.0.0.1:60055
remote: [your_program] Received 33 bytes from 127.0.0.1:49118
remote: [your_program] Send 33 bytes from 127.0.0.1:49118
remote: [your_program] Success send response to 127.0.0.1:49118
remote: [tester::#BF2] dns: buffer size too small
remote: [tester::#BF2] Test failed
remote: [tester::#BF2] Terminating program
remote: [tester::#BF2] Shutting down DNS resolver server...
remote: [tester::#BF2] Program terminated successfully

Could somebody help with this issue dns: buffer size too small?

Hey @roman-barman, the issue is caused by an incorrect QDCOUNT value of 2, even when there is only one question.

So the bug is here:

Let me know if you’d like further clarification!

Hi @andy1li
Thank you!

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.