Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1255864
  • 博文数量: 168
  • 博客积分: 3483
  • 博客等级: 中校
  • 技术积分: 1696
  • 用 户 组: 普通用户
  • 注册时间: 2006-02-06 13:17
文章分类

全部博文(168)

文章存档

2015年(6)

2014年(9)

2013年(47)

2012年(11)

2011年(13)

2010年(18)

2009年(11)

2008年(42)

2007年(11)

分类: 虚拟化

2012-12-08 10:14:55

看代码udp报文, L4头大小竟然也按tcp算, 使在 (dataSize)<(tcpHead-udpHead) 时 (headSize)>(skb->len), 
导致后面pskb_may_pull()中判断异常---丢包。(skb->len是实际报文[头+数据]大小,应该大于headSize)

补丁修正了udp时l4_hdr_size赋值,并在后面做了防御性修改 '= min(.,.);' 
ctx->l4_hdr_size =
compat_skb_tcp_header(skb)->doff * 4;
else if (iph->protocol == IPPROTO_UDP)
- /*
-  * Use TCP header size so that bytes to
-  * copied are more than the minimum
-  * required by the backend.
-  */

ctx->l4_hdr_size =
- sizeof(struct tcphdr);
+ sizeof(struct udphdr);
else
ctx->l4_hdr_size = 0;
} else {
/* for simplicity, don't copy L4 headers */
ctx->l4_hdr_size = 0;
}
- ctx->copy_size = ctx->eth_ip_hdr_size +
-                  ctx->l4_hdr_size;
+ /* make sure that copy size is not exceeding pkt len */
+ ctx->copy_size = min((ctx->eth_ip_hdr_size +
+                       ctx->l4_hdr_size), skb->len);







------------------
: NFSv4 client hang while database write load simulator running
阅读(4519) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~