Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions dns/dnsmessage/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,8 @@ type Header struct {
Truncated bool
RecursionDesired bool
RecursionAvailable bool
AuthenticData bool
CheckingDisabled bool
RCode RCode
}

Expand All @@ -338,6 +340,12 @@ func (m *Header) pack() (id uint16, bits uint16) {
if m.Response {
bits |= headerBitQR
}
if m.AuthenticData {
bits |= headerBitAD
}
if m.CheckingDisabled {
bits |= headerBitCD
}
return
}

Expand Down Expand Up @@ -379,6 +387,8 @@ const (
headerBitTC = 1 << 9 // truncated
headerBitRD = 1 << 8 // recursion desired
headerBitRA = 1 << 7 // recursion available
headerBitAD = 1 << 5 // authentic data
headerBitCD = 1 << 4 // checking disabled
)

var sectionNames = map[section]string{
Expand Down Expand Up @@ -456,6 +466,8 @@ func (h *header) header() Header {
Truncated: (h.bits & headerBitTC) != 0,
RecursionDesired: (h.bits & headerBitRD) != 0,
RecursionAvailable: (h.bits & headerBitRA) != 0,
AuthenticData: (h.bits & headerBitAD) != 0,
CheckingDisabled: (h.bits & headerBitCD) != 0,
RCode: RCode(h.bits & 0xF),
}
}
Expand Down