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.16k stars 268 forks source link

tcpreplay hangs and flood the interface when sending packets to a disconnected bonding interface #722

Closed ManofWax closed 1 year ago

ManofWax commented 2 years ago

Describe the bug When running tcpreplay on a bonding interface that as the underling phisical interface disconnected (NO-CARRIER) tcpreplay "hangs" and sends the first packet on the pcap as fast as it could.

To Reproduce Make a bonding interface using a phisical interface without any cable connected:

ip link add bond0 type bond
ip link set bond0 type bond mode balance-rr
ip link set enp0s31f6 master bond0
ip link set bond0 up

The phisical interface has no cable connected:

# ip link
2: enp0s31f6: <NO-CARRIER,BROADCAST,MULTICAST,SLAVE,UP> mtu 1500 qdisc fq_codel master bond0 state DOWN mode DEFAULT group default qlen 1000
    link/ether 90:2e:16:25:1e:60 brd ff:ff:ff:ff:ff:ff
10: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
    link/ether 90:2e:16:25:1e:60 brd ff:ff:ff:ff:ff:ff

Run tcpreplay against the bonding interface:

sudo tcpreplay -i bond0 test_ping.pcap 
^C User interrupt...
sendpacket_abort
Warning in send_packets.c:send_packets() line 644:
Unable to send packet: 

tcpreplay hangs and floods the interface sending the first packet as fast as he could.

Running tcpreplay against the phisical interface works fine:

sudo tcpreplay -i enp0s31f6 test_ping.pcap 
Actual: 2 packets (196 bytes) sent in 0.000029 seconds
Rated: 6758620.6 Bps, 54.06 Mbps, 68965.51 pps
Statistics for network device: enp0s31f6
    Successful packets:        2
    Failed packets:            0
    Truncated packets:         0
    Retried packets (ENOBUFS): 0
    Retried packets (EAGAIN):  0

Expected behavior I was expecting the same behaviour both on bond0 and enp0s31f6

fklassen commented 1 year ago

Unable to reproduce the issue.

$ sudo src/tcpreplay -i bond0 ~/git/tcpreplay-pcaps/ping.pcap  
Actual: 16 packets (1568 bytes) sent in 7.04 seconds
Rated: 222.5 Bps, 0.001 Mbps, 2.27 pps
Flows: 2 flows, 0.28 fps, 16 flow packets, 0 non-flow
Statistics for network device: bond0
    Successful packets:        16
    Failed packets:            0
    Truncated packets:         0
    Retried packets (ENOBUFS): 0
    Retried packets (EAGAIN):  0
$ uname -a    
Linux buster-fkk 4.19.0-20-amd64 #1 SMP Debian 4.19.235-1 (2022-03-17) x86_64 GNU/Linux
fklassen commented 1 year ago

Closing. I suspect an old kernel bug caused the original issue. Feel free to reopen using the bug form, and include all information required to reproduce.