[Bug] Packets slowly drift further and further randomly when played or sent using tcpreplay
anoopcc99 opened this issue · 2 comments
Describe the bug
take a time sensitive pcap file and send it interface using tcpreplay, the captured packets at the other end of interface seen does not honor the packet interval time difference, instead varies randomly.
transmit pcap file:
To Reproduce
Steps to reproduce the behavior:
- take any timestamp based pcap file
- send the pcap file using tcpreplay to the interface
- capture the incoming packets on other end on interface
- note the time drift
Expected behavior
I would expect the time drift to be constant or minimum.
System (please complete the following information):
- OS: "Ubuntu 22.04 LTS"
- OS version: "22.04 LTS (Jammy Jellyfish)"
- TcpReplay Version: 4.3.4
Met this issue before.
When we replay with the origin speed, tcpreplay sleeps according to the time gap between two package.
However, the overhead like sending package and waking up thread are ignored. These overheads are accumulated little by little which lead to the drift.
relative code is here. https://github.com/appneta/tcpreplay/blob/43693c4a92dda227a5134ae5e71a7247ae345323/src/send_packets.c#L468C23-L468C23
I think the graph is pretty good. Much of what you are seeing is the delay from when the packet was sent until it was copied and recorded for packet capture. Usually I expect around 200-400 usec before it leaves a NIC card, so I am pretty happy with this. I am especially impressed by the fact that it levels off after a just a few packets.
What hardware are you using? Is this a VM or docker? I expect that this is pretty good hardware if the results are this good.
I will close as not-a-bug.