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

Recursive lookup of CNAME value #11364

Open
gliwka opened this issue Jun 3, 2021 · 6 comments
Open

Recursive lookup of CNAME value #11364

gliwka opened this issue Jun 3, 2021 · 6 comments

Comments

@gliwka
Copy link

gliwka commented Jun 3, 2021

Let's suppose I have the following DNS zone:

subdomain.example.com. 3600 IN CNAME cname.example.org
subdomain.example.com. 3600 IN MX mx.example.org

I now want to make a recursive query (starting from the root zone) and lookup the values for MX and CNAME in this zone.

Looking up the MX value using resolveAll() works fine - it returns the MX record containing hostname and priority ("mx.example.org").

Which API can I use to accomplish the same thing for the CNAME value? If I use the resolveAll() API with a CNAME question, it always follows cname.example.org and tries to resolve that instead of returning it.

@gliwka gliwka changed the title Recursive lookup of CNAME value not possible Recursive lookup of CNAME value Jun 3, 2021
@trustin
Copy link
Member

trustin commented Jun 5, 2021

If I understood correctly, if you try to send a DNS query for CNAME subdomain.example.com, you expect it to return CNAME cname.example.org, right? I guess in that case you can use DnsNameResolver.query() which never follows any redirection.

@gliwka
Copy link
Author

gliwka commented Jun 7, 2021

This doesn't work for recursive lookups. The authoritative name server for subdomain.example.com is not yet known to me, so I cant query it directly. That's why I'm currently using resolveAll() to benefit from the recursive lookup - this works for all record classes except CNAME. I'm using netty as a recursive resolver.

What do you think about a new resolveAll() method with the option to disable following the CNAME? Would you be willing to accept a PR for this usecase?

@NiteshKant
Copy link
Member

What do you think about a new resolveAll() method with the option to disable following the CNAME?

A special method that is a special case to skip CNAME resolve seems less preferable than a generic way to stop resolutions, perhaps at each step. Anyways, happy to review if you have a PR

@trustin
Copy link
Member

trustin commented Jun 22, 2021

@gliwka I see. I agree with @NiteshKant on accepting some Predicate that determines when to stop. Thanks for exploring this option. 🙇

@mrniko
Copy link

mrniko commented Nov 23, 2022

Hello All. Is there any solution for this issue?

@shivam2146
Copy link

@NiteshKant / @trustin Any solution/workaround for this issue?

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

No branches or pull requests

5 participants