- 论坛徽章:
- 0
|
本帖最后由 hongming0823 于 2014-01-16 00:03 编辑
环境:
路由器A 将网络上的数据镜像到机器 B 中
B机器:
readhat 64位 ,内核2.6.39 , 网卡设置为混杂模式
下面为机器B,dev.c文件中修改信息
__netif_receive_skb(struct sk_buff *skb) //函数中
{
... //略
skb_tail = skb_tail_pointer(skb);
mac_header = skb_mac_header(skb);
network_header = skb_network_header(skb);
//处理Vlan问题
if (ntohs(((struct ethhdr*)mac_header)->h_proto) == ETH_P_8021Q){
if (ntohs(((struct vlan_ethhdr*)mac_header)->h_vlan_encapsulated_proto) == ETH_P_IP ){
iph=(struct iphdr *)(network_header+4); //IP包头
}
} else if (ntohs(((struct ethhdr*)mac_header)->h_proto) == ETH_P_IP){
iph=(struct iphdr *)network_header; //IP包头
}
iplen = __constant_ntohs(iph->tot_len); //ip包长度
byte_size = skb_tail - skb->data; //包的字节数
... //略
}
请教:
//包的字节数byte_size = skb_tail - skb->data 为40,为ip+tcp头
//此处ip头中字段tot_len的长度大于了MTU 1500
//iplen减去40字节头后,经tcp的seq/ack和前后报文分析,此处的iplen长度是正确的,由此可以推断是由2个以上的包组合成的大包。
//除去头40个字节,后面的部分打印均为类似\005\002\000\001\000\000\000\000\000\000\000\000\000\200\203\244\064 的东西。。
//求指教啊,为什么包的字节数会小于ip包的长度
重点:为什么会组包呀,如何不让它组包呀??不清楚是中间路由镜像到B的时候组的包,还是包进入到B以后在__netif_receive_skb之前组的包??
(另外,将路由A 数据镜像到另外一台32位机器上,所有的ip包均为1500,没有出现组包的现象)
这个纠结我好几多天了,真心求教啊!! |
|