-
Notifications
You must be signed in to change notification settings - Fork 7
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
Support CNAMEs, including out-of-zone #4
base: master
Are you sure you want to change the base?
Conversation
|
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.
Can you move the ANY query support to a separate PR?
That functionality touches the same line as CNAME support does:
The part of this change that implements |
Of course the merge conflict would also be trivial. Regardless, I'd prefer to keep unrelated features in separate commits, which means separate PRs. But if you don't want to, thats fine - I'll review both in one PR. I will need to research ANY behavior to make sure it's compliant. It's kind of an old DNS feature that has been widely deprecated. I'm not as familiar with it is as CNAME, and I think it has some peculiar edge case behavior. This PR also has me thinking that perhaps instead of extending the records plugin as is, we should follow the advice in the README, and refactor records to leverage the file plugin package ...
Doing so may be harder now, but easier down the road, as the natural trend would be to try to bring records further into functional parity with file. |
17d8eb8
to
61cf6e2
Compare
@chrisohaver I've addressed all comments, can you re-review? Thanks! |
Add support for CNAMEs both inside and outside of the zones set by this plugin. CNAME support is robust against excessive stack depth and loops. Includes tests for all changes. Signed-off-by: Dan Fuhry <[email protected]>
A few more fixes this morning. I realized that matching on the plugin's origins is not ideal behavior when the origins are set to At first I tried simply removing the zone match:
This means the plugin would go upstream unconditionally. This works under normal circumstances, but it breaks the loop detection and recursion depth, which are both tracked in local state. So I refactored such that when a CNAME is encountered, the plugin first tries to resolve the CNAME locally within its own records. Only if that doesn't work will it go upstream. In combination with #6 which adds fallthrough support, this means we can use a configuration like:
If |
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.
Thanks for contributing. I need to check on SERVFAIL response for too-long chains, but looks good otherwise.
It does irk me a bit the amount of duplicated logic between records and file. And I cant help but wonder if efforts would be better spent adjusting the file plugin meet the needs to both records and file users, and deprecating records.
} | ||
if len(cnameStack) > maxCnameStackDepth { | ||
log.Errorf("maximum CNAME stack depth of %d exceeded", maxCnameStackDepth) | ||
goto servfail |
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.
Not sure if servfail is right answer here. It could be, but I think a response with a dangling cname might be preferable to a servfail. Not sure, need to check RFCs/other implementations.
Add support for CNAMEs both inside and outside of the zones set by this plugin.
CNAME support is robust against excessive stack depth and loops.
Includes tests for all changes.
Signed-off-by: Dan Fuhry [email protected]