转:http://blog.csdn.net/nerdx/article/details/12613029
-
-
1.1 static inline void ip_select_ident_more(struct iphdr *iph, struct dst_entry *dst, struct sock *sk, int more)
-
{
-
if (iph->frag_off & htons(IP_DF)) {
-
if (sk && inet_sk(sk)->daddr) {
-
iph->id = htons(inet_sk(sk)->id);
-
inet_sk(sk)->id += 1 + more;
-
} else
-
iph->id = 0;
-
} else
-
__ip_select_ident(iph, dst, more);
-
}
-
-
-
-
-
1.2 void __ip_select_ident(struct iphdr *iph, struct dst_entry *dst, int more)
-
{
-
struct rtable *rt = (struct rtable *) dst;
-
-
if (rt) {
-
if (rt->peer == NULL)
-
rt_bind_peer(rt, 1);
-
-
if (rt->peer) {
-
iph->id = htons(inet_getid(rt->peer, more));
-
return;
-
}
-
} else
-
printk(KERN_DEBUG "rt_bind_peer(0) @%p\n", NET_CALLER(iph));
-
-
ip_select_fb_ident(iph);
-
}
-
-
-
1.3 static inline __u16 inet_getid(struct inet_peer *p, int more)
-
{
-
__u16 id;
-
-
spin_lock_bh(&inet_peer_idlock);
-
id = p->ip_id_count;
-
p->ip_id_count += 1 + more;
-
spin_unlock_bh(&inet_peer_idlock);
-
return id;
-
}
-
阅读(548) | 评论(0) | 转发(0) |