Skip to content

Commit c5ef8a5

Browse files
committed
Add CD bit support
1 parent 52e39ab commit c5ef8a5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

dns/dnsmessage/message.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ type Header struct {
318318
RecursionDesired bool
319319
RecursionAvailable bool
320320
AuthenticData bool
321+
CheckingDisabled bool
321322
RCode RCode
322323
}
323324

@@ -342,6 +343,9 @@ func (m *Header) pack() (id uint16, bits uint16) {
342343
if m.AuthenticData {
343344
bits |= headerBitAD
344345
}
346+
if m.CheckingDisabled {
347+
bits |= headerBitCD
348+
}
345349
return
346350
}
347351

@@ -384,6 +388,7 @@ const (
384388
headerBitRD = 1 << 8 // recursion desired
385389
headerBitRA = 1 << 7 // recursion available
386390
headerBitAD = 1 << 5 // authentic data
391+
headerBitCD = 1 << 4 // checking disabled
387392
)
388393

389394
var sectionNames = map[section]string{
@@ -462,6 +467,7 @@ func (h *header) header() Header {
462467
RecursionDesired: (h.bits & headerBitRD) != 0,
463468
RecursionAvailable: (h.bits & headerBitRA) != 0,
464469
AuthenticData: (h.bits & headerBitAD) != 0,
470+
CheckingDisabled: (h.bits & headerBitCD) != 0,
465471
RCode: RCode(h.bits & 0xF),
466472
}
467473
}

0 commit comments

Comments
 (0)