appneta / tcpreplay

Pcap editing and replay tools for *NIX and Windows - Users please download source from
http://tcpreplay.appneta.com/wiki/installation.html#downloads
1.15k stars 268 forks source link

[Bug] tcpreplay exits after the 1st packet send failure #751

Closed idogoshen closed 1 year ago

idogoshen commented 1 year ago

Description tcpreplay exits after the 1st packet send failure and does not continue replaying the next packets this is a behavior change from former versions that used to count the failure but continue replaying

To Reproduce replay pcap with 3 packets in which the 2nd packet is too long and cannot be sent pkt_too_long.pcap.gz

_tcpreplay -i eth0 -t pkt_too_long.pcap Warning in interface.c:get_interface_list() line 93: May need to run as root to get access to all network interfaces. Warning in send_packets.c:send_packets() line 486: Unable to send packet: Error with PFPACKET send() [2]: Message too long (errno = 90) Actual: 1 packets (105 bytes) sent in 0.000060 seconds Rated: 1750000.0 Bps, 14.00 Mbps, 16666.66 pps Flows: 2 flows, 33333.33 fps, 2 flow packets, 0 non-flow Statistics for network device: eth0 Successful packets: 1 Failed packets: 1 Truncated packets: 0 Retried packets (ENOBUFS): 0 Retried packets (EAGAIN): 0

Expected behavior 2 successful packet Successful packets: 2 Failed packets: 1

System : OS: Ubuntu 22.04.1

_tcpreplay -V Warning in interface.c:get_interface_list() line 93: May need to run as root to get access to all network interfaces. tcpreplay version: 4.3.4 (build git:v4.3.4) (debug) 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.10.1 64 bit packet counters: enabled Verbose printing via tcpdump: enabled Packet editing: disabled Fragroute engine: disabled Injection method: PFPACKET send() Not compiled with netmap

Additional context It used to work in 4.2.6

_cgs@u18cg5b9:~$ tcpreplay -V 2>&1 | grep version tcpreplay version: 4.2.6 (build git:v4.2.6)

_cgs@u18c_g5b9:~$ tcpreplay -i eth0 -t pkt_too_long.pcap Warning in interface.c:get_interface_list() line 94: May need to run as root to get access to all network interfaces. Warning in send_packets.c:send_packets() line 637: Unable to send packet: Error with PFPACKET send() [2]: Message too long (errno = 90) Actual: 3 packets (3004 bytes) sent in 0.000157 seconds Rated: 19133757.9 Bps, 153.07 Mbps, 19108.28 pps Flows: 2 flows, 12738.85 fps, 3 flow packets, 0 non-flow Statistics for network device: eth0 Successful packets: 2 Failed packets: 1 Truncated packets: 0 Retried packets (ENOBUFS): 0 Retried packets (EAGAIN): 0

Looks like it broke by adding break on each sendpacket failure https://github.com/appneta/tcpreplay/commit/8ce5ff676fccbc57e38081eac2f1d32f9c934a6b#diff-9090d8b99ade533bb5645fa56979270c7af557bd23ad6b323a809057d1b1a0e3R645 That seem to required some tuning on what error to break or if to continue

fklassen commented 1 year ago

Fixed in PR #761 and destined for 4.4.3.