GT1 forwarding server: issue with how program is running in previous stages

After I added a flag to my program for gt1 I see the tests for previous stage yc9 is failing. After debugging I found that stage yc9 is also passing the resolver flag and when my program queries the resolver with the give message resolver gives wrong response hence my program returns the wrong response.
Wierd enough I added an if to force skipping the resolver flag for that state but I don’t get it why it’s failing.

Adding this line to check if we are in the yc9 stage and not using the resolver fixed the issue:

Here are my logs that show the resolver response is empty.

[tester::#YC9] Querying the following in the same request (Messages with >> prefix are part of this log)
[tester::#YC9] >> ;abc.longassdomainname.com.   IN       A
[tester::#YC9] >> ;def.longassdomainname.com.   IN       A
[tester::#YC9] Sending Request: (Messages with >>> prefix are part of this log)
[tester::#YC9] >>> ;; opcode: QUERY, status: NOERROR, id: 35874
[tester::#YC9] >>> ;; flags: rd; QUERY: 2, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
[tester::#YC9] >>>
[tester::#YC9] >>> ;; QUESTION SECTION:
[tester::#YC9] >>> ;abc.longassdomainname.com.  IN       A
[tester::#YC9] >>> ;def.longassdomainname.com.  IN       A
[tester::#YC9] >>>
[your_program] Received 53 bytes from 127.0.0.1:39444
[your_program] incoming dns Message: {Header:{Id:35874 QueryResponse:false Opcode:0 AuthoritativeAnswer:false TruncatedMessage:false RecursionDesired:true RecursionAvailable:false Reserved:0 ResponseCode:0 QuestionCount:2 AnswerCount:0 AuthorityCount:0 AdditionalCount:0} Questions:[{Name:[abc longassdomainname com] Type:1 Class:1} {Name:[def longassdomainname com] Type:1 Class:1}] Answers:[]}
[your_program] resolving using the address
[your_program] Resolver response: {Header:{Id:35874 QueryResponse:true Opcode:0 AuthoritativeAnswer:false TruncatedMessage:false RecursionDesired:true RecursionAvailable:false Reserved:0 ResponseCode:0 QuestionCount:0 AnswerCount:0 AuthorityCount:0 AdditionalCount:0} Questions:[] Answers:[]}
[your_program] Own response: {Header:{Id:35874 QueryResponse:true Opcode:0 AuthoritativeAnswer:false TruncatedMessage:false RecursionDesired:true RecursionAvailable:false Reserved:0 ResponseCode:0 QuestionCount:2 AnswerCount:2 AuthorityCount:0 AdditionalCount:0} Questions:[{Name:[abc longassdomainname com] Type:1 Class:1} {Name:[def longassdomainname com] Type:1 Class:1}] Answers:[]}
[tester::#YC9] Received Response: (Messages with >>> prefix are part of this log)
[tester::#YC9] >>> ;; opcode: QUERY, status: NOERROR, id: 35874
[tester::#YC9] >>> ;; flags: qr rd ra; QUERY: 2, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
[tester::#YC9] >>>
[tester::#YC9] >>> ;; QUESTION SECTION:
[tester::#YC9] >>> ;abc.longassdomainname.com.  IN       A
[tester::#YC9] >>> ;def.longassdomainname.com.  IN       A
[tester::#YC9] >>>
[tester::#YC9] Expected answer section to have 2 entries got 0
[tester::#YC9] Test failed
[tester::#YC9] Terminating program
[tester::#YC9] Shutting down DNS resolver server...
[tester::#YC9] Program terminated successfully

Could you help me understand if my code should call the resolver for stage yc9 or not? I thought maybe after the forwarding server there is a new test case for yc9 and I’m failing but this seems like the old test case requiring the old behavior.
Thanks.

Could you help me understand if my code should call the resolver for stage yc9 or not?

@Glyphack Yes, your code should call the resolver if resolverAddr has been set.

Note there’re two questions in the request:

But forwarding the request with two questions to the resolver won’t work. According to the stage intructions:

Here are few assumptions you can make about the DNS server you are forwarding the requests to

  • It will only respond when there is only one question in the question section. If you send multiple questions in the question section, it will not respond at all. So when you receive multiple questions in the question section you will need to split it into two DNS packets and then send them to this resolver then merge the response in a single packet.

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