Skip to content

[Bug] looping inflates some packet counters #749

@infrastation

Description

@infrastation

Describe the bug
Some of the statistics become incorrect when the loop counter is greater than the default one.

To Reproduce
Steps to reproduce the behavior:

  1. Run tcpreplay with a file that includes both flow and non-flow packets without the -l flag and note the counters.
  2. Run tcpreplay again with two loops and note that "successful packets" are twice as high, whereas "flow packets" and "non-flow" are 4 times (2*2) as high.
  3. Run tcpreplay again with three loops and note that "successful packets" are three times as high, whereas "flow packets" and "non-flow" are 9 times (3*3) as high.
  4. ...and so on

Expected behavior
The counters are proportional to the number of loops rather than the square of the number of loops.

Screenshots

# tcpreplay --mbps 1 -i eth0 isakmp4500.pcap 
Warning: isakmp4500.pcap was captured using a snaplen of 1536 bytes.  This may mean you have truncated packets.
Actual: 35 packets (6246 bytes) sent in 0.049980 seconds
Rated: 124969.9 Bps, 0.999 Mbps, 700.28 pps
Flows: 4 flows, 80.03 fps, 27 flow packets, 8 non-flow
Statistics for network device: eth0
	Successful packets:        35
	Failed packets:            0
	Truncated packets:         0
	Retried packets (ENOBUFS): 0
	Retried packets (EAGAIN):  0

# tcpreplay -l 2 --mbps 1 -i eth0 isakmp4500.pcap 
Warning: isakmp4500.pcap was captured using a snaplen of 1536 bytes.  This may mean you have truncated packets.
Warning: isakmp4500.pcap was captured using a snaplen of 1536 bytes.  This may mean you have truncated packets.
Actual: 70 packets (12492 bytes) sent in 0.099940 seconds
Rated: 124994.9 Bps, 0.999 Mbps, 700.42 pps
Flows: 4 flows, 40.02 fps, 108 flow packets, 32 non-flow
Statistics for network device: eth0
	Successful packets:        70
	Failed packets:            0
	Truncated packets:         0
	Retried packets (ENOBUFS): 0
	Retried packets (EAGAIN):  0

# tcpreplay -l 3 --mbps 1 -i eth0 isakmp4500.pcap 
Warning: isakmp4500.pcap was captured using a snaplen of 1536 bytes.  This may mean you have truncated packets.
Warning: isakmp4500.pcap was captured using a snaplen of 1536 bytes.  This may mean you have truncated packets.
Warning: isakmp4500.pcap was captured using a snaplen of 1536 bytes.  This may mean you have truncated packets.
Actual: 105 packets (18738 bytes) sent in 0.149910 seconds
Rated: 124994.9 Bps, 0.999 Mbps, 700.42 pps
Flows: 4 flows, 26.68 fps, 243 flow packets, 72 non-flow
Statistics for network device: eth0
	Successful packets:        105
	Failed packets:            0
	Truncated packets:         0
	Retried packets (ENOBUFS): 0
	Retried packets (EAGAIN):  0

# tcpreplay -l 4 --mbps 1 -i eth0 isakmp4500.pcap 
Warning: isakmp4500.pcap was captured using a snaplen of 1536 bytes.  This may mean you have truncated packets.
Warning: isakmp4500.pcap was captured using a snaplen of 1536 bytes.  This may mean you have truncated packets.
Warning: isakmp4500.pcap was captured using a snaplen of 1536 bytes.  This may mean you have truncated packets.
Warning: isakmp4500.pcap was captured using a snaplen of 1536 bytes.  This may mean you have truncated packets.
Actual: 140 packets (24984 bytes) sent in 0.199878 seconds
Rated: 124996.2 Bps, 0.999 Mbps, 700.42 pps
Flows: 4 flows, 20.01 fps, 432 flow packets, 128 non-flow
Statistics for network device: eth0
	Successful packets:        140
	Failed packets:            0
	Truncated packets:         0
	Retried packets (ENOBUFS): 0
	Retried packets (EAGAIN):  0

System:

  • OS: Ubuntu Linux 22.04 AMD64
  • Tcpreplay master branch at commit 76644c2

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions