-
Notifications
You must be signed in to change notification settings - Fork 921
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
Consider a trailing dot when resolve DNS with search domains #5963
Conversation
Motivation: There was a report from LY internally where DNS resolver warns for `NXDomain`. ``` java.util.concurrent.CompletionException: java.lang.IllegalArgumentException: Empty label is not a legal name at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:315) ... at com.linecorp.armeria.internal.client.dns.SearchDomainDnsResolver.resolve0(SearchDomainDnsResolver.java:99) at com.linecorp.armeria.internal.client.dns.SearchDomainDnsResolver.resolve(SearchDomainDnsResolver.java:88) at com.linecorp.armeria.internal.client.dns.HostsFileDnsResolver.resolve(HostsFileDnsResolver.java:130) at com.linecorp.armeria.internal.client.dns.DefaultDnsResolver.resolveOne(DefaultDnsResolver.java:89) at com.linecorp.armeria.internal.client.dns.DefaultDnsResolver.resolve(DefaultDnsResolver.java:81) at com.linecorp.armeria.client.endpoint.dns.DnsEndpointGroup.sendQueries(DnsEndpointGroup.java:155) at com.linecorp.armeria.client.endpoint.dns.DnsEndpointGroup.lambda$sendQueries$3(DnsEndpointGroup.java:173) ... Caused by: java.lang.IllegalArgumentException: Empty label is not a legal name at java.base/java.net.IDN.toASCIIInternal(IDN.java:284) at java.base/java.net.IDN.toASCII(IDN.java:123) at java.base/java.net.IDN.toASCII(IDN.java:152) at com.linecorp.armeria.internal.client.dns.DnsQuestionWithoutTrailingDot.<init>(DnsQuestionWithoutTrailingDot.java:53) at com.linecorp.armeria.internal.client.dns.DnsQuestionWithoutTrailingDot.of(DnsQuestionWithoutTrailingDot.java:48) at com.linecorp.armeria.internal.client.dns.SearchDomainDnsResolver$SearchDomainQuestionContext.newQuestion(SearchDomainDnsResolver.java:190) at com.linecorp.armeria.internal.client.dns.SearchDomainDnsResolver$SearchDomainQuestionContext.nextQuestion0(SearchDomainDnsResolver.java:177) at com.linecorp.armeria.internal.client.dns.SearchDomainDnsResolver$SearchDomainQuestionContext.nextQuestion(SearchDomainDnsResolver.java:150) at com.linecorp.armeria.internal.client.dns.SearchDomainDnsResolver.lambda$resolve0$1(SearchDomainDnsResolver.java:103) ... 19 common frames omitted ``` The NX domain has with a trailing dot and search domains starts with `.`. As a result, `example.com..search.domain` was made and rejected by `java.net.IDN` Modifications: - Remove a leading dot from the normalized search domains. - Infix a dot when a hostname does not have a trailing dot. Result: DNS resolver now correctly adds search domains for hostnames with trailing dots.
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.
👍 👍 👍
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.
👍 👍
… into trailing-dot-searchdomain
- Stop to send queries with search domains when it was resovled. - Fix a bug where the original hostname was sent as the last query when the number of dots in a hostname >= `ndots`. - Explicitly set `ResolvedAddressTypes.IPV4_ONLY` to avoid flakyness.
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.
Still looks good 👍
Motivation:
There was a report from LY internally where DNS resolver warned for
NXDomain
unexpectedly.The NX domain has a trailing dot and search domains start with a dot (
.
).As a result,
example.com..search.domain
was made and rejected byjava.net.IDN
Modifications:
Result:
DNS resolver now correctly adds search domains for hostnames with trailing dots.