Skip to content
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

plugin/file: fix local CNAME lookup #1866

Merged
merged 3 commits into from Jun 12, 2018
Merged

plugin/file: fix local CNAME lookup #1866

merged 3 commits into from Jun 12, 2018

Conversation

miekg
Copy link
Member

@miekg miekg commented Jun 9, 2018

Issue #1864 explains it will, when we serve the child zone as well we
should just recursive into ourself (upstream self). Thus relax the
IsSubDomain check in file/lookup.go and just query (even if the query
will hit a remote server).

I've looped over all other plugins that do something similar (CNAME
resolving) and they didn't do the IsSubDomain check; therefor I've
removed it from file as well.

Added test in file_upstream_test that shows this failed before but now
results in a reply.

No documentation changes are needed.

Fixes #1864

Issue #1864 explains it will, when we serve the child zone as well we
should just recursive into ourself (upstream self). Thus relax the
IsSubDomain check in file/lookup.go and just query (even if the query
will hit a remote server).

I've looped over all other plugins that do something similar (CNAME
resolving) and they didn't do the IsSubDomain check; therefor I've
removed it from *file* as well.

Added test in file_upstream_test that shows this failed before but now
results in a reply.

Fixes #1864
@corbot
Copy link

corbot bot commented Jun 9, 2018

Thank you for your contribution. I've just checked the OWNERS files to find a suitable reviewer. This search was successful and I've asked superq (via /OWNERS) for a review.

@corbot corbot bot requested a review from SuperQ June 9, 2018 08:02
@@ -380,7 +374,7 @@ func cnameForType(targets []dns.RR, origQtype uint16) []dns.RR {
func (z *Zone) externalLookup(state request.Request, target string, qtype uint16) []dns.RR {
m, e := z.Upstream.Lookup(state, target, qtype)
if e != nil {
// TODO(miek): debugMsg for this as well? Log?
// TODO(miek): Log, or return error here?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Increment an error counter here. 😄

We don't know if we had a valid reply. Check this.
@codecov-io
Copy link

codecov-io commented Jun 9, 2018

Codecov Report

Merging #1866 into master will increase coverage by 0.08%.
The diff coverage is 75%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1866      +/-   ##
==========================================
+ Coverage   54.41%   54.49%   +0.08%     
==========================================
  Files         189      189              
  Lines        9310     9307       -3     
==========================================
+ Hits         5066     5072       +6     
+ Misses       3851     3843       -8     
+ Partials      393      392       -1
Impacted Files Coverage Δ
plugin/backend_lookup.go 0% <ø> (ø) ⬆️
plugin/secondary/setup.go 54.83% <ø> (ø) ⬆️
plugin/file/lookup.go 90.08% <75%> (+0.81%) ⬆️
plugin/forward/connect.go 78.26% <0%> (+10.86%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 58d6991...e00ba59. Read the comment docs.

@miekg
Copy link
Member Author

miekg commented Jun 9, 2018 via email

@miekg miekg merged commit 26c41a0 into master Jun 12, 2018
@corbot corbot bot deleted the name-resolve branch June 12, 2018 13:54
fturib pushed a commit to fturib/coredns that referenced this pull request Jun 13, 2018
* plugin/file: fix local CNAME lookup

Issue coredns#1864 explains it will, when we serve the child zone as well we
should just recursive into ourself (upstream self). Thus relax the
IsSubDomain check in file/lookup.go and just query (even if the query
will hit a remote server).

I've looped over all other plugins that do something similar (CNAME
resolving) and they didn't do the IsSubDomain check; therefor I've
removed it from *file* as well.

Added test in file_upstream_test that shows this failed before but now
results in a reply.

Fixes coredns#1864

* self does not need to be exported

* Fix test

We don't know if we had a valid reply. Check this.
fturib pushed a commit to fturib/coredns that referenced this pull request Jun 13, 2018
* plugin/file: fix local CNAME lookup

Issue coredns#1864 explains it will, when we serve the child zone as well we
should just recursive into ourself (upstream self). Thus relax the
IsSubDomain check in file/lookup.go and just query (even if the query
will hit a remote server).

I've looped over all other plugins that do something similar (CNAME
resolving) and they didn't do the IsSubDomain check; therefor I've
removed it from *file* as well.

Added test in file_upstream_test that shows this failed before but now
results in a reply.

Fixes coredns#1864

* self does not need to be exported

* Fix test

We don't know if we had a valid reply. Check this.
Jason-ZW pushed a commit to rancher/coredns that referenced this pull request Apr 17, 2019
* plugin/file: fix local CNAME lookup

Issue coredns#1864 explains it will, when we serve the child zone as well we
should just recursive into ourself (upstream self). Thus relax the
IsSubDomain check in file/lookup.go and just query (even if the query
will hit a remote server).

I've looped over all other plugins that do something similar (CNAME
resolving) and they didn't do the IsSubDomain check; therefor I've
removed it from *file* as well.

Added test in file_upstream_test that shows this failed before but now
results in a reply.

Fixes coredns#1864

* self does not need to be exported

* Fix test

We don't know if we had a valid reply. Check this.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants