// 为分片确定正确的ipq结构
// 通过5元组定位ipq,成功后,递增ipq引用计数,返回ipq
// 定位5元组
// 1.<id, 源ip, 目的ip, l4协议> 可通过ip报文获取
// 2.user 通过ip_defrag给出,指出重组是由谁发起的,最常见的时IP_DEFRAG_LOCAL_DELIVER,当重组的入口分包要传递给本地时
// ipq中所有分片最迟完成重组的时间为30HZ
1.1 static inline struct ipq *ip_find(struct iphdr *iph, u32 user)
{
//定位4元组
__u16 id = iph->id;
__u32 saddr = iph->saddr;
__u32 daddr = iph->daddr;
__u8 protocol = iph->protocol;
//对4元组进行hash
unsigned int hash = ipqhashfn(id, saddr, daddr, protocol);
struct ipq *qp;
read_lock(&ipfrag_lock);
//选择正确的bucket
for(qp = ipq_hash[hash]; qp; qp = qp->next) {
if(qp->id == id &&
qp->saddr == saddr &&
qp->daddr == daddr &&
qp->protocol == protocol &&
qp->user == user) {
atomic_inc(&qp->refcnt);
read_unlock(&ipfrag_lock);
return q
网络子系统54_ip协议分片重组_定位ipq
最新推荐文章于 2014-02-27 16:58:35 发布