All of lore.kernel.org
 help / color / mirror / Atom feed
* An issue on one network development.
@ 2004-08-20 17:17 Zhikui Chen
  2004-08-20 23:32 ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 3+ messages in thread
From: Zhikui Chen @ 2004-08-20 17:17 UTC (permalink / raw)
  To: netdev, majordomo

Dear all,

HELP!

I am writing a DCCP code in Linux kernel 2.6.6,  I met a problem, which 
bored me about two weeks. Hope you to give me some hints, thanks in 
advance. The problem is on structure sock in dccp_lookup_listen of 
dccp_lookup.

When dccp_rcv (similar to udp_rcv and TCP_*_rcv) called dccp_v4_lookup( 
similar to TCP_v4_lookup),  the dccp_v4_lookup will call 
dccp_v4_lookup_listen. Running is dead when the 7th line is implemented, 
I checked, problem is from sk=__sk_head(head).  And I also checked the 
printed value of __sk_head(head) is correct.
The other way, I changed the first line as struct sock *sk; (remove 
"=NULL"), running is dead here. I doubt the problem belongs to memory.

My dccp_v4_lookup is so that:
static inline struct sock *dccp_v4_lookup_listen(u32 daddr, u16 
dport,int dif)
{
   struct sock *sk = NULL;
   struct hlist_head *head;

  read_lock(&dccp_lhash_lock);
 head = &dccp_hash[ntohs(dport) & (DCCP_HTABLE_SIZE - 1)];
   if (!hlist_empty(head)) {
       struct inet_opt *inet = inet_sk(sk  = __sk_head(head));

       if (inet->num == ntohs(dport) && !(sk->sk_node.next &&
           (!inet->rcv_saddr || inet->rcv_saddr == daddr) &&
           (sk->sk_family == PF_INET || !ipv6_only_sock(sk)) &&
           !sk->sk_bound_dev_if)
           goto sherry_cache;
   printk("dccp_v4_lookup_listen: sk:%x\n",(__sk_head(head)));
       //sk = __dccp_v4_lookup_listen(head, daddr, ntohs(dport), dif);
   }
   if (sk) {
sherry_cache:
       sock_hold(sk);
   }
   read_unlock(&dccp_lhash_lock);
   return (sk);

}

Best regards,

Zhikui Chen
In stuttgart university.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-08-20 23:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-20 17:17 An issue on one network development Zhikui Chen
2004-08-20 23:32 ` Arnaldo Carvalho de Melo
2004-08-20 23:35   ` Arnaldo Carvalho de Melo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.