d2iq-archive / mesos-dns

DNS-based service discovery for Mesos.
https://mesosphere.github.com/mesos-dns
Apache License 2.0
483 stars 137 forks source link

Forwarded truncated DNS responses get extra truncated #457

Closed timcharper closed 8 years ago

timcharper commented 8 years ago

With the targeted version of miekg dns client, if the DNS server for which mesos-dns is forwarding requests returns a response with the truncated bit set, then the dns client returns a response with effectively no answers. The truncation is happening here:

https://github.com/mesosphere/mesos-dns/blob/3564f1eb20a5d77e068d38b6fcebe60fbb1b7ef3/vendor/github.com/miekg/dns/msg.go#L1703

This effectively means that if a Forwarded DNS server responds with truncated messages, then mesos-dns returns no answers.

Ideally, mesos-dns should forward on the response as much as possible, indicating that the response was truncated.

timcharper commented 8 years ago

A workaround can be seen in my fork: https://github.com/vivint-smarthome/mesos-dns

jdef commented 8 years ago

Thanks @timcharper. Aside from the miekg dns client upgrade, looks like the related mesos-dns changes are here https://github.com/vivint-smarthome/mesos-dns/commit/66562b7f3ade6bdf1a812f83ed9076d09ddb79f5

timcharper commented 8 years ago

@jdef you bet. I should mention there are issues with my change. It does not appropriately forward the Truncated bit (I've confirmed with wireshark). Its better, but flawed in that regard. I'll need to do some additional hunting to fix it further.

I'm unsure how my workaround will affect DNS caching. It's not important in my specific use case, I don't care if I get a truncated DNS record in any of my clients. However, it might affect others negatively.