mDNS: when a reply do not repeat the questions, set authoritative flag #1292
+73
−26
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Both mDNS and LLMNR work fine, except whan it receives a request from a Linux machine: we found that an mDNS server must set the authoritative flag, and also that it shall not repeat the Questions from the requester.
Other OSs like Windows are more forgiving.
Set a new variable
xSet.uxSkipCount
as soon as the full name in Questions has been parsed. Why: because the Questions section will become theAnswers
section, containing:Name: 'full_name.local', Type A, Class IN, TTL, Addr length, Address.
Or the name followed by 16 or 28 bytes.
When replying to an mDNS request, do not include the Questions section: 'xSet.usQuestions' will become zero.
With thanks to @ActoryOu : mDNS sets the authoritative flag when replying. See PR Set MDNS AA bit while answering MDNS request. #1223
Do not handle type A when IPv4 is not enabled
Do not handle type AAAA when IPv6 is not enabled
Make sure that 'pxNewBuffer' will be released just before exiting the function
DNS_ParseDNSReply()
Test Steps
I tested while enabling either
ipconfigUSE_MDNS
oripconfigUSE_LLMNR
. The former replies with an Answers section only, the latter repeats the questions and then sends the Answers.Checklist:
Related Issue
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.