Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] tcpreplay stop to generate unique-ip with --unique-ip option after some cycles #566

Closed
Polexy opened this issue Aug 7, 2019 · 1 comment

Comments

@Polexy
Copy link

Polexy commented Aug 7, 2019

Describe the bug
I have pcap with only one udp packet.
I playing it like:

tcpreplay -i ens7 -p 30000 -K -l 0 --unique-ip my.pcap

after ~ 11 minutes / 16 million cycles i see tcpreplay start to generate 2 same packets, after 38 million packets tcpreplay start to generate 4 same packets and etc.

12:58:15.045217 IP 7.190.152.209.1947 > 12.67.16.142.51802: UDP, length 22
12:58:15.045250 IP 7.190.152.209.1947 > 12.67.16.142.51802: UDP, length 22
12:58:15.045284 IP 7.190.152.208.1947 > 12.67.16.143.51802: UDP, length 22
12:58:15.045316 IP 7.190.152.208.1947 > 12.67.16.143.51802: UDP, length 22

i take pcap with 2 different packets and tried to play it on same speed(30k pps) and i see this situation start after ~38 million packets ~22min.
so, this bug reproduced after ~ 16-17 million cycles.

To Reproduce
Steps to reproduce the behavior:

  1. Find/Create pcap with one udp packet
  2. Play this pcap. (For example tcpreplay -i ens7 -p 30000 -K -l 0 --unique-ip my.pcap)
  3. After ~16-17 million cyclyes on speed 30000 pps ~10-12min - look to packets(i used tcpdump)

Expected behavior
I thought tcpreplay can generate ~2 milliard unique packets. ( (255^4)/2 -because every cycle: dst.ip +1, src.ip -1)

System :
Ubuntu 16.04.6 LTS
tcpreplay version: 4.3.1 (build git:v4.3.1)
Copyright 2013-2018 by Fred Klassen - AppNeta
Copyright 2000-2012 by Aaron Turner
The entire Tcpreplay Suite is licensed under the GPLv3
Cache file supported: 04
Not compiled with libdnet.
Compiled against libpcap: 1.7.4
64 bit packet counters: enabled
Verbose printing via tcpdump: enabled
Packet editing: disabled
Fragroute engine: disabled
Default injection method: PF_PACKET send()
Optional injection method: netmap

fklassen added a commit that referenced this issue Jun 3, 2020
At very high iteration counts '--unique-ip' calculation
(which support floating point e.g. 0.75) has accuracy
issues. Corrected by converting to integer earlier,
and multiplying numerator/denominator by 1000.
fklassen added a commit that referenced this issue Jun 3, 2020
@fklassen
Copy link
Member

fklassen commented Jun 3, 2020

Thanks for the detailed report. It was very helpful in reproducing the issue. Fixed in PR #600

@fklassen fklassen closed this as completed Jun 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants