转:http://blog.csdn.net/nerdx/article/details/12656597
-
-
-
-
-
-
1.1 void ipfrag_init(void)
-
{
-
-
ipfrag_hash_rnd = (u32) ((num_physpages ^ (num_physpages>>7)) ^
-
(jiffies ^ (jiffies >> 6)));
-
-
init_timer(&ipfrag_secret_timer);
-
ipfrag_secret_timer.function = ipfrag_secret_rebuild;
-
ipfrag_secret_timer.expires = jiffies + sysctl_ipfrag_secret_interval;
-
add_timer(&ipfrag_secret_timer);
-
}
-
-
-
-
-
-
-
-
-
1.2 struct sk_buff *ip_defrag(struct sk_buff *skb, u32 user)
-
{
-
struct iphdr *iph = skb->nh.iph;
-
struct ipq *qp;
-
struct net_device *dev;
-
-
IP_INC_STATS_BH(IPSTATS_MIB_REASMREQDS);
-
-
-
if (atomic_read(&ip_frag_mem) > sysctl_ipfrag_high_thresh)
-
ip_evictor();
-
-
dev = skb->dev;
-
-
if ((qp = ip_find(iph, user)) != NULL) {
-
struct sk_buff *ret = NULL;
-
-
spin_lock(&qp->lock);
-
-
ip_frag_queue(qp, skb);
-
-
if (qp->last_in == (FIRST_IN|LAST_IN) &&
-
qp->meat == qp->len)
-
ret = ip_frag_reasm(qp, dev);
-
-
spin_unlock(&qp->lock);
-
ipq_put(qp, NULL);
-
return ret;
-
}
-
-
IP_INC_STATS_BH(IPSTATS_MIB_REASMFAILS);
-
kfree_skb(skb);
-
return NULL;
-
}
-
阅读(679) | 评论(0) | 转发(0) |