首页 > 解决方案 > 使用 tcpreplay 时尽管数据包失败仍继续

问题描述

我正在尝试使用tcpreplay来发送 pcap 文件的内容。它拒绝发送一些数据包,因为它们太长了。但是,它不会继续处理下一个数据包,而是停止:

 $ tcpreplay -i p4p1 multi.pcap
Warning: May need to run as root to get access to all network interfaces.
Warning: Unable to send packet: Error with PF_PACKET send() [444]: Message too long (errno = 90)
Actual: 443 packets (63852 bytes) sent in 0.203486 seconds
Rated: 313790.6 Bps, 2.51 Mbps, 2177.05 pps
Flows: 115 flows, 565.14 fps, 405 flow packets, 39 non-flow
Statistics for network device: p4p1
        Successful packets:        443
        Failed packets:            1
        Truncated packets:         0
        Retried packets (ENOBUFS): 0
        Retried packets (EAGAIN):  0

我想跳过失败的数据包并发送其余的。

标签: tcpreplay

解决方案


我在处理几个文件时遇到了同样的问题,尤其是流式传输。例子:

~# tcpreplay -i eth1 -t -K facebook_audio2b.pcapng
File Cache is enabled
Warning: Unable to send packet: Error with PF_PACKET send() [1611]: Message
too long (errno = 90)
Actual: 1610 packets (382007 bytes) sent in 0.021233 seconds
Rated: 17991192.9 Bps, 143.92 Mbps, 75825.36 pps
Flows: 71 flows, 3343.85 fps, 94008 flow packets, 84 non-flow
Statistics for network device: eth1
        Successful packets:        1610
        Failed packets:            1
        Truncated packets:         0
        Retried packets (ENOBUFS): 0
        Retried packets (EAGAIN):  0

我所以我在 [link] 上关注了 Tcpreplay 网站上的常见问题解答。(https://tcpreplay.appneta.com/wiki/faq.html#packet-length-8892-is-greater-then-mtu-skipping-packet) 说的是:

如果数据包大于 MTU,或者,您可以指定tcpreplay-edit --mtu-trunc选项 - 数据包将被截断为 MTU 大小,校验和将被固定然后发送。请注意,这可能会影响性能。

它在下一次运行中对我有用:

~# tcpreplay-edit --mtu-trunc -i eth1 -t -K facebook_audio2b.pcapng
File Cache is enabled
Actual: 94092 packets (14586277 bytes) sent in 0.847842 seconds
Rated: 17204003.8 Bps, 137.63 Mbps, 110978.22 pps
Flows: 71 flows, 83.74 fps, 94008 flow packets, 84 non-flow
Statistics for network device: eth1
        Successful packets:        94092
        Failed packets:            0
        Truncated packets:         0
        Retried packets (ENOBUFS): 0
        Retried packets (EAGAIN):  0

Ps.:对不起,我的英语


推荐阅读