Skip to content

Commit

Permalink
Set dnstap operation to UPDATE_QUERY/REPLY if opcode is equal to 5
Browse files Browse the repository at this point in the history
  • Loading branch information
dmachard committed Dec 28, 2021
1 parent 5adc5ca commit 9060155
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
8 changes: 8 additions & 0 deletions subprocessors/dnsreader.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,14 @@ func (d *DnsProcessor) Run(sendTo []chan dnsutils.DnsMessage) {
dm.DNS.Rcode = dnsutils.RcodeToString(dnsHeader.Rcode)
dm.DNS.Opcode = dnsHeader.Opcode

// update dnstap operation if the opcode is equal to 5 (dns update)
if dm.DNS.Opcode == 5 && dnsHeader.Qr == 1 {
dm.DnsTap.Operation = "UPDATE_QUERY"
}
if dm.DNS.Opcode == 5 && dnsHeader.Qr == 0 {
dm.DnsTap.Operation = "UPDATE_RESPONSE"
}

if dnsHeader.Qr == 1 {
dm.DNS.Flags.QR = true
}
Expand Down
9 changes: 9 additions & 0 deletions subprocessors/dnstapreader.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,15 @@ func (d *DnstapProcessor) Run(sendTo []chan dnsutils.DnsMessage) {
dm.DNS.Rcode = dnsutils.RcodeToString(dnsHeader.Rcode)
dm.DNS.Opcode = dnsHeader.Opcode

// update dnstap operation if the opcode is equal to 5 (dns update)
if dm.DNS.Opcode == 5 && op%2 == 1 {
dm.DnsTap.Operation = "UPDATE_QUERY"
}
if dm.DNS.Opcode == 5 && op%2 == 1 {
dm.DnsTap.Operation = "UPDATE_RESPONSE"
}

// set dns flags
if dnsHeader.Qr == 1 {
dm.DNS.Flags.QR = true
}
Expand Down

0 comments on commit 9060155

Please sign in to comment.