-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Exchange() transparently uncompresses message without compress flag set #216
Comments
As you said on twitter, probably always setting Compress = true is best. |
Can we check if the received message was compressed and only set compressed flag in this case? |
I wonder if I should make this the default in msg.Unpack or putting it in Exchange only... |
Yes, you can see if you followed compression pointers... But this info is buried deep inside the function and not exported. Setting it in Unpack might mess with dynamic update packets. I'll set it in exchange and friends |
See compression branch which should fix this. |
@miekg Wouldn't it be cleaner to only set it if the message was compressed? People might not want to compress the messages. At least @armon had some concerns about always compressing: hashicorp/consul#971 (comment) |
[ Quoting [email protected] in "Re: [dns] Exchange() transparently ..." ]
yes, but a lot more work and ugly refactoring. Question: why are these messages send to? Why not just set compression there |
but concerns, or actual corruption?
|
Those comments say not much at all. Coming back to my question, why can't you set compression yourself? I do the same in SkyDNS. |
@miekg Sure it's possible but I'm not a consul maintainer. Guess it would make sense to fix your dnsrouter and document that Exchange might return a message which is too big to be sent to a client unless compressed, then do the ugly refactoring sometime in the future. |
Don't think this is a transitive property of the dns message. I don't store (in the message) if it came via UDP or TCP. This should be set on a per-connection basis. |
We recently ran into this issue where it was originally compressed before unpacking and then when re-packed it was not compressed. If the original message was compressed, I think it makes sense for Though... we are also just setting compress on every single message now after running into this problem. |
[ Quoting [email protected] in "Re: [dns] Exchange() transparently ..." ]
But msg.Truncated and msg.Compress are 2 entirely different things. Truncated /Miek Miek Gieben |
Setting |
Closing as there hasn't been any activity for a while and it doesn't look like there is anything outstanding. |
I don't think this should be closed, as the original issue has not been fixed. |
@hermansc If you've read through this issue and have something to add please do so. |
Sorry, I just came here from hashicorp/consul#854 (comment) and since we're still having issues in Consul and this wasn't fixed I thought I'd let you know. |
@hermansc No worries. For my 2¢ (and not necessarily @miekg's), there's nothing to do here, or at least nothing that doesn't involve deprecating |
Hi,
if you use Exchange() to get compressed DNS response which still fits in 512 byte, you end up with a Msg larger than 512 and without compress flag set. That means if you write this message somewhere, it won't get compressed and you end up with a invalid message (udp, no EDNS, >512 bytes). Haven't test it but I think https://github.com/miekg/dnsrouter/blob/master/server.go#L119 should be affected as well.
This probably only affects stub resolvers not supporting EDNS, most notably netgo.
The text was updated successfully, but these errors were encountered: