当前位置:编程学习 > 网站相关 >>

Warning: Unable to send packet: Error with PF_PACKET send() [11]: Message too long (errno = 90)

今天在使用tcpreplay重放流量时,发现有的数据包没有发送成功:
 
 
Warning: Unable to send packet: Error with PF_PACKET send() [215]: Message too long (errno = 90)  
Warning: Unable to send packet: Error with PF_PACKET send() [216]: Message too long (errno = 90)  
Warning: Unable to send packet: Error with PF_PACKET send() [218]: Message too long (errno = 90)  
Warning: Unable to send packet: Error with PF_PACKET send() [219]: Message too long (errno = 90)  
Warning: Unable to send packet: Error with PF_PACKET send() [234]: Message too long (errno = 90)  
Actual: 459 packets (386911 bytes) sent in 0.03 seconds.                Rated: 12897033.0 bps, 98.40 Mbps, 15300.00 pps  
Statistics for network device: eth0  
        Attempted packets:         235  
        Successful packets:        217  
        <span style="color:#ff0000;">Failed packets:            18</span>  
        Retried packets (ENOBUFS): 0  
        Retried packets (EAGAIN):  0  
Statistics for network device: eth0  
        Attempted packets:         224  
        Successful packets:        224  
        Failed packets:            0  
        Retried packets (ENOBUFS): 0  
        Retried packets (EAGAIN):  0  

 

从错误提示看出,应该是数据包太大了。我查看了一下发送的数据包:
 
10:20:39.019199 IP xyw-Eliot.local.http > xyw-Eliot.local.53720: Flags [.], seq 323602:326522, ack 1978, win 31, length 2920  
10:20:39.019298 IP xyw-Eliot.local.53720 > xyw-Eliot.local.http: Flags [.], ack 326522, win 543, length 0  
10:20:39.047511 IP xyw-Eliot.local.http > xyw-Eliot.local.53720: Flags [.], seq 326522:329442, ack 1978, win 31, length 2920  
10:20:39.047559 IP xyw-Eliot.local.53720 > xyw-Eliot.local.http: Flags [.], ack 329442, win 543, length 0  
10:20:39.047665 IP xyw-Eliot.local.http > xyw-Eliot.local.53720: Flags [.], seq 329442:330902, ack 1978, win 31, length 1460  
10:20:39.075783 IP xyw-Eliot.local.http > xyw-Eliot.local.53720: Flags [.], seq 330902:333822, ack 1978, win 31, length 2920  
10:20:39.075824 IP xyw-Eliot.local.53720 > xyw-Eliot.local.http: Flags [.], ack 333822, win 543, length 0  
10:20:39.104001 IP xyw-Eliot.local.http > xyw-Eliot.local.53720: Flags [.], seq 333822:336742, ack 1978, win 31, length 2920  
10:20:39.104049 IP xyw-Eliot.local.53720 > xyw-Eliot.local.http: Flags [.], ack 336742, win 543, length 0  
10:20:39.104322 IP xyw-Eliot.local.http > xyw-Eliot.local.53720: Flags [.], seq 336742:338202, ack 1978, win 31, length 1460  
10:20:39.132219 IP xyw-Eliot.local.http > xyw-Eliot.local.53720: Flags [.], seq 338202:339662, ack 1978, win 31, length 1460  

 

 
发现数据包长度已经超过1500(MTU默认为1500),所以问题的解决方法是修改系统的MTU值。
先说一下我的系统环境:ubuntu 12.04
 
linux系统修改MTU的方法比较简单,一个命令即可:
 
 
sudo ifconfig eth0 mtu 3000  

 

这是将网卡eth0的MTU值设置为3000,这样再重新放包,发现数据包被全部发送:
 
sending out eth0 eth0  
processing file: tcp_rewrite.pcap  
Actual: 459 packets (386911 bytes) sent in 0.04 seconds.                Rated: 9672775.0 bps, 73.80 Mbps, 11475.00 pps  
Statistics for network device: eth0  
        Attempted packets:         235  
        Successful packets:        235  
        Failed packets:            0  
        Retried packets (ENOBUFS): 0  
        Retried packets (EAGAIN):  0  
Statistics for network device: eth0  
        Attempted packets:         224  
        Successful packets:        224  
        Failed packets:            0  
        Retried packets (ENOBUFS): 0  
        Retried packets (EAGAIN):  0  

 

 
补充:综合编程 , 其他综合 ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,