Skip to content

Sleep based on fixed point in time to avoid time drift when replaying packets#915

Open
Sup3rGeo wants to merge 1 commit intoappneta:masterfrom
Sup3rGeo:724-fix-drift
Open

Sleep based on fixed point in time to avoid time drift when replaying packets#915
Sup3rGeo wants to merge 1 commit intoappneta:masterfrom
Sup3rGeo:724-fix-drift

Conversation

@Sup3rGeo
Copy link

@Sup3rGeo Sup3rGeo commented Mar 12, 2025

Fixes #724

This is missing the respective changes in send_dual_packets and probably a test. Maybe @fklassen could fill in the last pieces?


Create packets (1 second apart):

randpkt -t udp -c 100001 test100000.pcap

Command:

sudo tcpreplay -i lo -K --multiplier=20000 /home/xxx/test100000.pcap

Without fixes (5.26 seconds):

Actual: 100001 packets (251812433 bytes) sent in 5.26 seconds
Rated: 47836517.5 Bps, 382.69 Mbps, 18997.07 pps
Flows: 94438 flows, 17940.27 fps, 99807 flow packets, 0 non-flow
Statistics for network device: lo
    Successful packets:    100001
    Failed packets:      0
    Truncated packets:     0
    Retried packets (ENOBUFS): 0
    Retried packets (EAGAIN): 0

With fixes (5.00 seconds):

Actual: 100001 packets (251812433 bytes) sent in 5.00 seconds
Rated: 50362486.6 Bps, 402.89 Mbps, 20000.20 pps
Flows: 94438 flows, 18887.60 fps, 99807 unique flow packets, 0 unique non-flow packets
Statistics for network device: lo
    Successful packets:    100001
    Failed packets:      0
    Truncated packets:     0
    Retried packets (ENOBUFS): 0
    Retried packets (EAGAIN): 0

@fklassen
Copy link
Member

fklassen commented Jul 4, 2025

I haven't seen this issue before. Thanks for pointing it out.

This PR appears to introduce a timestamp for every packet, which will have an incredible impact on performance. I'll shelve for now, and will see if it is possible to have a large magnifier without introducing this issue.

@fklassen fklassen added the shelved Will not be addressed in foreseeable future label Jul 4, 2025
@ruben-TC
Copy link

ruben-TC commented Sep 10, 2025

@Sup3rGeo Thank you.
I tested and am now using your fix, it works great for me (replaying video data where real time sync is top priority).
I also experienced lag (for a large 10min playback it would get up to 1min out of sync), now it's replaying in real time no delay at all!

Also thank you to the team for this tool, it works very well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

shelved Will not be addressed in foreseeable future

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Packets send date drift

3 participants