Update doc for Truncate (#1173)
Follow up after #1171, update the docs about TC and use the MinMsgSize constant for 512 in the code. Signed-off-by: Miek Gieben <miek@miek.nl>
This commit is contained in:
parent
5579226123
commit
ef286f8f39
|
@ -9,7 +9,8 @@ package dns
|
|||
// requested buffer size.
|
||||
//
|
||||
// The TC bit will be set if any records were excluded from the message.
|
||||
// This indicates to that the client should retry over TCP.
|
||||
// If the TC bit is already set on the message it will be retained.
|
||||
// TC indicates that the client should retry over TCP.
|
||||
//
|
||||
// According to RFC 2181, the TC bit should only be set if not all of the
|
||||
// "required" RRs can be included in the response. Unfortunately, we have
|
||||
|
@ -28,11 +29,11 @@ func (dns *Msg) Truncate(size int) {
|
|||
}
|
||||
|
||||
// RFC 6891 mandates that the payload size in an OPT record
|
||||
// less than 512 bytes must be treated as equal to 512 bytes.
|
||||
// less than 512 (MinMsgSize) bytes must be treated as equal to 512 bytes.
|
||||
//
|
||||
// For ease of use, we impose that restriction here.
|
||||
if size < 512 {
|
||||
size = 512
|
||||
if size < MinMsgSize {
|
||||
size = MinMsgSize
|
||||
}
|
||||
|
||||
l := msgLenWithCompressionMap(dns, nil) // uncompressed length
|
||||
|
|
Loading…
Reference in New Issue