Hi together, i write a small lua script, that collects connection data via tshark lua api and store this in a csv file. I use this listener function:
All works fine. But it seems that the tap_ipv4.packet() gets called twice for IMCP redircet packets. ICMP echo/reply,TCP/UDP seems normal. I dont know if this is works as designed. Has someone else this problem? Here is the a example code:
and the Output from a simple capture file that contains 3 ICMP redirects
Platform Windows7 64bit (also tested with GNU/Debian Linux 8, same issue) Wireshark v1.12.8-0-g5b6e543 from master-1.12 asked 02 Nov ‘15, 12:51 C_N |
One Answer:
As far as I can see in the code (packet-icmp.c), I'd say: yes it works as designed. The ICMP dissector calls the IP dissector for the ICMP payload, which contains the IP header of the packet that triggered the ICMP redirect. You should see the same behavior for ICMP UNREACHABLE, TIMEEXEEDED, SOURCEQUENCH, REDIRECT. Possible Solution (if you want to look at the 'outer' ICMP frame only): Add a table (array/hash) to your code to remember that you've already processed a certain frame number and skip it the second time your tap is called for that frame. Please take a look at the code of @izopizo in the following question: The code stores the packet number in pkts and uses pinfo.visited. Regards answered 02 Nov '15, 16:25 Kurt Knochner ♦ |
Hi Kurt,
thanks for the quick help. Ok that behavior make sense.
I only need the connection information (srcIP, DstIP, Proto, and length in bytes).
Simply check, if the packet number was already processed works fine for me.
Here is a example:
good!
Hint: If a supplied answer resolves your question can you please “accept” it by clicking the checkmark icon next to it. This highlights good answers for the benefit of subsequent users with the same or similar questions. For extra points you can up vote the answer (thumb up).