Skip to content

Commit 1d16664

Browse files
committed
dns/dnsmessage: update SVCB packing to prohibit name compression
1 parent 6e243da commit 1d16664

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

dns/dnsmessage/svcb.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,14 @@ func (k SVCParamKey) GoString() string {
160160
return printUint16(uint16(k))
161161
}
162162

163-
func (r *SVCBResource) pack(msg []byte, compression map[string]uint16, compressionOff int) ([]byte, error) {
163+
func (r *SVCBResource) pack(msg []byte, _ map[string]uint16, _ int) ([]byte, error) {
164164
oldMsg := msg
165165
msg = packUint16(msg, r.Priority)
166-
msg, err := r.Target.pack(msg, compression, compressionOff)
166+
// https://datatracker.ietf.org/doc/html/rfc3597#section-4 prohibits name
167+
// compression for RR types that are not "well-known".
168+
// https://datatracker.ietf.org/doc/html/rfc9460#section-2.2 explicitly states that
169+
// compression of the Target is prohibited, following RFC 3597.
170+
msg, err := r.Target.pack(msg, nil, 0)
167171
if err != nil {
168172
return oldMsg, &nestedError{"SVCBResource.Target", err}
169173
}

0 commit comments

Comments
 (0)