-
Notifications
You must be signed in to change notification settings - Fork 3.2k
dnsproxy: Fix bug where DNS request timed out too soon #31999
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
dnsproxy: Fix bug where DNS request timed out too soon #31999
Conversation
8b9bb6d
to
fd87f5b
Compare
/test |
Putting back into draft. Local testing revealed that seems to be an issue in |
This pulls in cilium/dns#11 which fixes a bug where the `SharedClient` logic did not respect the `c.Client.Timeout` field. Signed-off-by: Sebastian Wicki <sebastian@isovalent.com>
This fixes a bug where DNS requests would timeout after 2 seconds, instead of the intended 10 seconds. This resulted in a `Timeout waiting for response to forwarded proxied DNS lookup` error message whenever the response took longer than 2 seconds. The `dns.Client` used by the proxy is [already configured][1] to use `ProxyForwardTimeout` value of 10 seconds, which would apply also to the `dns.Client.DialTimeout`, if it was not for the custom `net.Dialer` we use in Cilium. The logic in [dns.Client.getTimeoutForRequest][2] overwrites the request timeout with the timeout from the custom `Dialer`. Therefore, the intended `ProxyForwardTimeout` 10 second timeout value was overwritten with the much shorter `net.Dialer.Timeout` value of two seconds. This commit fixes that issue by using `ProxyForwardTimeout` for the `net.Dialer` too. Fixes: cf3cc16 ("fqdn: dnsproxy: fix forwarding of the original security identity for TCP") [1]: https://github.com/cilium/cilium/blob/50943dbc02496c42a4375947a988fc233417e163/pkg/fqdn/dnsproxy/proxy.go#L1042 [2]: https://github.com/cilium/cilium/blob/94f6553f5b79383b561e8630bdf40bd824769ede/vendor/github.com/cilium/dns/client.go#L405 Reported-by: Andrii Iuspin <andrii.iuspin@isovalent.com> Signed-off-by: Sebastian Wicki <sebastian@isovalent.com>
fd87f5b
to
2256e10
Compare
Fixed the bug in In manual testing, DNS timeouts now actually take 10 seconds again (where as without either commits, they time out after 2 seconds):
|
/test |
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.
LGTM, thanks! 💯
I need a review from a current |
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.
Looks good for vendor changes ✔️
This fixes a bug where DNS requests would timeout after 2 seconds, instead of the intended 10 seconds. This resulted in a
Timeout waiting for response to forwarded proxied DNS lookup
log message whenver the response took longer than 2 seconds.The
dns.Client
used by the proxy is already configured to useProxyForwardTimeout
value of 10 seconds, which would apply also to thedns.Client.DialTimeout
, if it was not for the customnet.Dialer
we use in Cilium. The logic in dns.Client.getTimeoutForRequest overwrites the request timeout with the timeout from the customDialer
. Therefore, the intendedProxyForwardTimeout
10 second timeout value was overwritten with the much shorternet.Dialer.Timeout
value of two seconds. This commit fixes that issue by usingProxyForwardTimeout
for thenet.Dialer
too.Fixes: cf3cc16 ("fqdn: dnsproxy: fix forwarding of the original security identity for TCP")
Reported-by: @ayuspin
Backporting because the above commit was backported all the way to v1.11.