Skip to content

Commit

Permalink
expose dns id in json model (#586)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmachard authored Feb 1, 2024
1 parent b5181bc commit d3d42e3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion dnsutils/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ type DNS struct {
Type string `json:"-" msgpack:"-"`
Payload []byte `json:"-" msgpack:"-"`
Length int `json:"length" msgpack:"-"`
ID int `json:"-" msgpack:"-"`
ID int `json:"id" msgpack:"id"`
Opcode int `json:"opcode" msgpack:"opcode"`
Rcode string `json:"rcode" msgpack:"rcode"`
Qname string `json:"qname" msgpack:"qname"`
Expand Down Expand Up @@ -251,6 +251,7 @@ func (dm *DNSMessage) Init() {
}

dm.DNS = DNS{
ID: 0,
Type: "-",
MalformedPacket: false,
Rcode: "-",
Expand Down
2 changes: 2 additions & 0 deletions dnsutils/message_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ func TestDnsMessage_Json_Reference(t *testing.T) {
"tcp-reassembled": false
},
"dns": {
"id": 0,
"length": 0,
"opcode": 0,
"rcode": "-",
Expand Down Expand Up @@ -231,6 +232,7 @@ func TestDnsMessage_JsonFlatten_Reference(t *testing.T) {
"dns.flags.tc": false,
"dns.length": 0,
"dns.malformed-packet": false,
"dns.id": 0,
"dns.opcode": 0,
"dns.qname": "-",
"dns.qtype": "-",
Expand Down

0 comments on commit d3d42e3

Please sign in to comment.