Skip to content

Commit

Permalink
Merge pull request #4657 from karknu/karknu/dissector_peersharing
Browse files Browse the repository at this point in the history
Add Peer Sharing to Wireshark dissector
  • Loading branch information
coot authored Aug 25, 2023
2 parents 00d8ec3 + fb1c1da commit 829caf6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions ouroboros-network/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
### Non-breaking changes

* Less aggresive churning of established and known peers.
* Add peer sharing to wireshark dissector.

## 0.9.1.0 -- 2023-08-22

Expand Down
16 changes: 14 additions & 2 deletions ouroboros-network/wireshark-plugin/ouroboros_network.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ local conv_ids = {
[0x8004] = "TxSubmission Responder",
[0x0004] = "TxSubmission Initiator",
[0x8008] = "KeepAlive Responder",
[0x0008] = "KeepAlive Initiator"
[0x0008] = "KeepAlive Initiator",
[0x800a] = "Peer Sharing Responder",
[0x000a] = "Peer Sharing Initiator"
}
local on_conversation = ProtoField.uint16("ouroboros.conv", "Conversation", base.HEX, conv_ids, nil, "Conversation ids")

Expand Down Expand Up @@ -81,6 +83,14 @@ local keepalive_msg_codes = {

local on_keepalive_msg = ProtoField.uint8("ouroboros.keepalivemsg", "KeepAlive Message", base.DEC, keepalive_msg_codes, nil, "KeepAlive Message Types")

local peersharing_msg_codes = {
[0] = "MsgShareRequest",
[1] = "MsgSharePeers",
[2] = "MsgDone"
}

local on_peersharing_msg = ProtoField.uint8("ouroboros.peersharingmsg", "PeerSharing Message", base.DEC, peersharing_msg_codes, nil, "PeerSharing Message Types")


ouroboros.fields = {
on_transmission_time,
Expand All @@ -90,7 +100,8 @@ ouroboros.fields = {
on_chainsync_msg,
on_blockfetch_msg,
on_txsubmission_msg,
on_keepalive_msg
on_keepalive_msg,
on_peersharing_msg
}


Expand Down Expand Up @@ -151,6 +162,7 @@ dissectOuroboros = function (tvbuf, pktinfo, root, offset)
elseif convId == 3 then subtree:add(on_blockfetch_msg, tvbuf:range(offset + 9, 1))
elseif convId == 4 then subtree:add(on_txsubmission_msg, tvbuf:range(offset + 9, 1))
elseif convId == 8 then subtree:add(on_keepalive_msg, tvbuf:range(offset + 9, 1))
elseif convId == 10 then subtree:add(on_peersharing_msg, tvbuf:range(offset + 9, 1))
end

cbor:call(tvbuf(ON_HDR_LEN):tvb(), pktinfo, subtree)
Expand Down

0 comments on commit 829caf6

Please sign in to comment.