-
Notifications
You must be signed in to change notification settings - Fork 882
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle DNS queries of type MX #2041
Conversation
Signed-off-by: Deep Debroy <ddebroy@docker.com>
Addresses #2026 |
Do we need a unit-test for this? |
Codecov Report
@@ Coverage Diff @@
## master #2041 +/- ##
========================================
Coverage ? 40.4%
========================================
Files ? 138
Lines ? 22141
Branches ? 0
========================================
Hits ? 8947
Misses ? 11880
Partials ? 1314
Continue to review full report at Codecov.
|
@thaJeztah good point. I was indeed looking for unit-tests around the resolver to add something for this but could not find anything. If there is a suite already, let me know. Otherwise we will need something like |
Yes, I noticed the same (no |
return nil, nil | ||
} | ||
|
||
// We were able to resolve the name. Respond with an empty list with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see this comment but not sure how is it implemented below? does it mean that is enough to just reply with the same records?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are able to resolve the hostname, for MX, we need to reply with a DNS msg with empty answers section (with status set to default RcodeSuccess). createRespMsg
generates the DNS msg with empty answers section and status set to RcodeSuccess. This is very similar to what we are doing down below in handleIPQuery
for ipv6 AAAA querries that resolve to a ipv4 address.
I have added the unit test for resolver. |
Signed-off-by: Deep Debroy <ddebroy@docker.com>
LGTM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
The Docker embedded server was not handling DNS queries of type MX for containers. They were instead being passed down to the host leading to
NXDOMAIN
responses not compliant with SMTP RFC 5321 (in case someone wanted to host a mail server in a container and deliver emails to the server). This PR adds support to respond to MX queries in a way compliant with RFC 5321 for containers.Note that providing a full mechanism for starting a mail server in a container/service and registering MX RRs within the Docker resolver is beyond the scope of this PR.