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
This commit is contained in:
Tom Thorogood 2018-11-30 22:50:24 +10:30 committed by GitHub
parent 8d24af5fb5
commit 6b6e08b48c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View File

@ -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 {

View File

@ -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
}

View File

@ -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 {