Implemented trick to avoid processing the packet twice

This commit is contained in:
Luca Deri
2017-05-23 14:30:50 +02:00
parent 09c1765766
commit cf1402d64e
+9
View File
@@ -101,7 +101,16 @@ function slen(str)
end end
-- the dissector function callback -- the dissector function callback
local num_pkts = 0
function ndpi_proto.dissector(tvb, pinfo, tree) function ndpi_proto.dissector(tvb, pinfo, tree)
num_pkts = num_pkts + 1
-- Wireshark dissects the packet twice. We ignore the first
-- run as on that step the packet is still undecoded
-- The trick below avoids to process the packet twice
if(num_pkts < pinfo.number) then return end
local pktlen = tvb:len() local pktlen = tvb:len()
local eth_trailer = f_eth_trailer() local eth_trailer = f_eth_trailer()
local magic = tostring(tvb(pktlen-28,4)) local magic = tostring(tvb(pktlen-28,4))