From 2f01b72f1d2672d58fb658c3b04ef8b62a1bb6ed Mon Sep 17 00:00:00 2001 From: Praveen Kumar Date: Fri, 9 Jun 2023 12:00:11 +0530 Subject: [PATCH] service/dns: Compress dns message Recently we observed, dns messages from our dns service is not compress which sometime makes message size more than 512B and some client tools fails to process it. In this PR, message compression is used to reduce the length of DNS messages by removing duplicated information. - https://spathis.medium.com/how-dns-got-its-messages-on-diet-c49568b234a2 Without this PR if we query `dig secure-feeds-production-us-east-1-761931097553.s3.us-east-1.amazonaws.com` then message size is 803B and with this PR now it is 242B. - Issue: https://github.com/crc-org/crc/issues/3643 Signed-off-by: Praveen Kumar --- pkg/services/dns/dns.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/services/dns/dns.go b/pkg/services/dns/dns.go index 23e6b2b75..484f035ec 100644 --- a/pkg/services/dns/dns.go +++ b/pkg/services/dns/dns.go @@ -23,6 +23,7 @@ func (h *dnsHandler) handle(w dns.ResponseWriter, r *dns.Msg) { m := new(dns.Msg) m.SetReply(r) m.RecursionAvailable = true + m.Compress = true h.addAnswers(m) if err := w.WriteMsg(m); err != nil { log.Error(err)