Move compress=false out of packDataDomainNames into caller (#849)

This makes packDataDomainNames more consistent with PackDomainName where
it will only be called with compress = true for `dns:"cdomain-name"`.
This commit is contained in:
Tom Thorogood 2018-11-30 18:19:06 +10:30 committed by Miek Gieben
parent 778aa4f83d
commit 6ade5b5fff
3 changed files with 3 additions and 3 deletions

View File

@ -106,7 +106,7 @@ return off, err
case `dns:"nsec"`:
o("off, err = packDataNsec(rr.%s, msg, off)\n")
case `dns:"domain-name"`:
o("off, err = packDataDomainNames(rr.%s, msg, off, compression, compress)\n")
o("off, err = packDataDomainNames(rr.%s, msg, off, compression, false)\n")
default:
log.Fatalln(name, st.Field(i).Name(), st.Tag(i))
}

View File

@ -624,7 +624,7 @@ func unpackDataDomainNames(msg []byte, off, end int) ([]string, int, error) {
func packDataDomainNames(names []string, msg []byte, off int, compression map[string]int, compress bool) (int, error) {
var err error
for j := 0; j < len(names); j++ {
off, err = PackDomainName(names[j], msg, off, compression, false && compress)
off, err = PackDomainName(names[j], msg, off, compression, compress)
if err != nil {
return len(msg), err
}

View File

@ -438,7 +438,7 @@ func (rr *HIP) pack(msg []byte, off int, compression map[string]int, compress bo
if err != nil {
return off, err
}
off, err = packDataDomainNames(rr.RendezvousServers, msg, off, compression, compress)
off, err = packDataDomainNames(rr.RendezvousServers, msg, off, compression, false)
if err != nil {
return off, err
}