dissect-wireshark: Add support for dissecting of Ethernet frames (ethertype=0x8624)

Change-Id: I1cc8898076bd3f4d615045514907095c6a5f9149
Refs: #3092
This commit is contained in:
Alexander Afanasyev committed 2015-08-14 21:53:10 -07:00
1 parent 357c205aa6
commit 7f43c53c2a
4 files changed
+25 -4

No files matched your search

+9
View File
@@ -96,3 +96,12 @@ Expected result of the dissection:
packet 6.
- data packet is properly dissected after a partial reconstruction of WebSocket
conversation at packet 12.
### 7. Ethernet
Trace file: `ethernet.pcap`
Trace summary: Short capture, containing an NDN interest multicasted directly in Ethernet frame.
Expected result of the dissection:
- interest packet is dissected from packet 6.
Binary file not shown.
+2
View File
@@ -15,6 +15,8 @@ supported in the following cases:
- NDN packets are encapsulated in IPv4/IPv6 TCP/HTTP WebSocket packets with source or
destination port 9696.
- NDN packets are encapsulated in Ethernet frames with EtherType 0x8624.
## Available dissection features
- When UDP packet is fragmented, the dissection is performed after the full IP reassembly.
+14 -4
View File
@@ -263,13 +263,21 @@ function getBlock(tvb, offset)
return block
end
function canBeValidNdnPacket(block)
if ((block.type == 5 or block.type == 6) and block.length <= 8800) then
return true
else
return false
end
end
function findNdnPacket(tvb)
offset = 0
while offset + 2 < tvb:len() do
local block = getBlock(tvb, offset)
if ((block.type == 5 or block.type == 6) and block.length <= 8800) then
if canBeValidNdnPacket(block) then
return block
end
@@ -368,7 +376,7 @@ function ndn.dissector(tvb, pInfo, root) -- Tvb, Pinfo, TreeItem
if (nBytesLeft > 0) then
ok, block = pcall(getBlock, tvb, tvb:len() - nBytesLeft)
if (not ok) then
if (not ok or not canBeValidNdnPacket(block)) then
break
end
end
@@ -376,7 +384,7 @@ function ndn.dissector(tvb, pInfo, root) -- Tvb, Pinfo, TreeItem
pInfo.cols.protocol = tostring(pInfo.cols.protocol) .. " (" .. ndn.name .. ")"
if (nBytesLeft > 0 and block.size > nBytesLeft) then
if (nBytesLeft > 0 and block ~= nil and block.size ~= nil and block.size > nBytesLeft) then
pInfo.desegment_offset = tvb:len() - nBytesLeft
-- Originally, I set desegment_len to the exact lenght, but it mysteriously didn't work for TCP
@@ -396,5 +404,7 @@ local websocketDissectorTable = DissectorTable.get("ws.port")
-- websocketDissectorTable:add("9696", ndn)
websocketDissectorTable:add("1-65535", ndn)
-- print("ndn.lua is successfully loaded")
local ethernetDissectorTable = DissectorTable.get("ethertype")
ethernetDissectorTable:add(0x8624, ndn)
io.stderr:write("ndn.lua is successfully loaded\n")