This is a static, read-only archive of Wireshark Q&A. Older questions and answers from October 2017 and earlier can be found at osqa-ask.wireshark.org.
0

Is it possible to replace a PCAP's timestamps with the timestamps in an ERSPAN header?

asked Aug 25 '25

ERSPAN Type III headers contain hardware timestamps of when the packet actually traversed the capture device.

Wireshark correctly displays this timestamps, but is it possible to "rewrite" the PCAP timestamps with the ERSPAN timestamps?

We care far more about when a packet transited the ERSPAN source device than when it arrived at the packet capture endpoint.

Comments

User 2763 ( Aug 25 '25 )

2 Answers

0

answered Aug 26 '25

We care far more about when a packet transited the ERSPAN source device than when it arrived at the packet capture endpoint.

And somebody debugging issues with the ERSPAN mechanism might care about the time stamps when the ERSPAN packet is transmitted or received.

What might be useful 1) a mechanism in Wireshark by which a packet can change the displayed time stamps in the time stamp column and the frame part of the packet details and 2) per-protocol preferences to control whether a dissector should override the capture file timestamp or not.

(And what might be useful in libpcap is a way to receive the GRE packets from a machine using ERSPAN and de-encapulate them, so you just directly to an ERSPAN capture in tcpdump or Wireshark or....)

0

answered Aug 25 '25

updated Aug 26 '25

Looks like you could do it with a lua script.
WSDG 12.11.5.5. frameinfo.time:

12.11.5.5. frameinfo.time
Mode: Retrieve or assign.
The packet timestamp as an NSTime object.
Note: Set the FileHandler.time_precision to the appropriate wtap_file_tsprec value as well.

FileHandler and FrameInfo examples in Wiki/Lua/Examples A pcap FileShark script

Would take a pass to extract the timestamps and store to file or perhaps a lua table.
Then reopen the file in Frame mode and update the timestamps.

(sample capture erspan_type_III.cap attached to 13400: Improve CISCO ERSPAN Dissector)

Here is a script that reads a text file with list of packets to filter/keep:
using tshark with huge display filters
If the timestamps are stored in an ASCII file could read them in similar to reading packet list above.

(Timestamps more uniform in 5244: Add Dissector for ERSPAN Type-III Header pcap)

cc-by-sa Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.