From 6b6e08b48ca8b75ce42d9bcec4475b68edcd7c43 Mon Sep 17 00:00:00 2001 From: Tom Thorogood Date: Fri, 30 Nov 2018 22:50:24 +1030 Subject: [PATCH] Stop compressing names in RT records (#847) * Stop compressing names in RT records Although RFC 1183 allows names in the RT record to be compressed with: "The concrete encoding is identical to the MX RR." RFC 3597 specifically prohibits compressing names in any record not defined in RFC 1035. * Add comment to RT struct regarding compression --- types.go | 2 +- zmsg.go | 2 +- ztypes.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/types.go b/types.go index 26309725..c8658b34 100644 --- a/types.go +++ b/types.go @@ -353,7 +353,7 @@ func (rr *X25) String() string { type RT struct { Hdr RR_Header Preference uint16 - Host string `dns:"cdomain-name"` + Host string `dns:"domain-name"` // RFC 3597 prohibits compressing records not defined in RFC 1035. } func (rr *RT) String() string { diff --git a/zmsg.go b/zmsg.go index 057e5e6a..27887a77 100644 --- a/zmsg.go +++ b/zmsg.go @@ -1070,7 +1070,7 @@ func (rr *RT) pack(msg []byte, off int, compression map[string]int, compress boo if err != nil { return off, err } - off, err = PackDomainName(rr.Host, msg, off, compression, compress) + off, err = PackDomainName(rr.Host, msg, off, compression, false) if err != nil { return off, err } diff --git a/ztypes.go b/ztypes.go index a527d08a..71662b7b 100644 --- a/ztypes.go +++ b/ztypes.go @@ -525,7 +525,7 @@ func (rr *RRSIG) len(off int, compression map[string]struct{}) int { func (rr *RT) len(off int, compression map[string]struct{}) int { l := rr.Hdr.len(off, compression) l += 2 // Preference - l += domainNameLen(rr.Host, off+l, compression, true) + l += domainNameLen(rr.Host, off+l, compression, false) return l } func (rr *SMIMEA) len(off int, compression map[string]struct{}) int {