mirror of
https://github.com/golang/net.git
synced 2026-04-01 02:47:08 +09:00
dns/dnsmessage: update SVCB packing to prohibit name compression
This commit updates the dns/dnsmessage package to correctly handle SVCB record
packing by prohibiting name compression for the Target field.
It turns out the compression of names in RDATA is prohibited (see
https://datatracker.ietf.org/doc/html/rfc3597#section-4), except for well-known record
types (those defined in https://datatracker.ietf.org/doc/html/rfc1035).
The SVCB RFC actually explicitly calls that out
(https://datatracker.ietf.org/doc/html/rfc9460#section-2.2), so it was an oversight
in my part in https://go.dev/cl/710736.
Updates golang/go#43790
Change-Id: I287b034c9e01b49264e07e23293bacd830ab1832
GitHub-Last-Rev: 1d16664c57
GitHub-Pull-Request: golang/net#242
Reviewed-on: https://go-review.googlesource.com/c/net/+/713900
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Vinicius Fortuna <fortuna@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Sean Liao <sean@liao.dev>
Reviewed-by: Sean Liao <sean@liao.dev>
This commit is contained in:
committed by
Gopher Robot
parent
9be1ff2808
commit
dec9fe711e
@@ -160,10 +160,14 @@ func (k SVCParamKey) GoString() string {
|
||||
return printUint16(uint16(k))
|
||||
}
|
||||
|
||||
func (r *SVCBResource) pack(msg []byte, compression map[string]uint16, compressionOff int) ([]byte, error) {
|
||||
func (r *SVCBResource) pack(msg []byte, _ map[string]uint16, _ int) ([]byte, error) {
|
||||
oldMsg := msg
|
||||
msg = packUint16(msg, r.Priority)
|
||||
msg, err := r.Target.pack(msg, compression, compressionOff)
|
||||
// https://datatracker.ietf.org/doc/html/rfc3597#section-4 prohibits name
|
||||
// compression for RR types that are not "well-known".
|
||||
// https://datatracker.ietf.org/doc/html/rfc9460#section-2.2 explicitly states that
|
||||
// compression of the Target is prohibited, following RFC 3597.
|
||||
msg, err := r.Target.pack(msg, nil, 0)
|
||||
if err != nil {
|
||||
return oldMsg, &nestedError{"SVCBResource.Target", err}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user