Skip to content

Commit

Permalink
service/dns: Compress dns message
Browse files Browse the repository at this point in the history
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: crc-org/crc#3643

Signed-off-by: Praveen Kumar <kumarpraveen.nitdgp@gmail.com>
  • Loading branch information
praveenkumar committed Jun 9, 2023
1 parent db793a5 commit 2f01b72
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions pkg/services/dns/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 2f01b72

Please sign in to comment.