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.
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.
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 |
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
NXDOMAINresponses 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.