netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zhikui Chen <zhikui.chen@rus.uni-stuttgart.de>
To: netdev@oss.sgi.com, majordomo@oss.sgi.com
Subject: An issue on one network development.
Date: Fri, 20 Aug 2004 19:17:57 +0200	[thread overview]
Message-ID: <41263245.8050305@rus.uni-stuttgart.de> (raw)

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.

             reply	other threads:[~2004-08-20 17:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-20 17:17 Zhikui Chen [this message]
2004-08-20 23:32 ` An issue on one network development Arnaldo Carvalho de Melo
2004-08-20 23:35   ` Arnaldo Carvalho de Melo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=41263245.8050305@rus.uni-stuttgart.de \
    --to=zhikui.chen@rus.uni-stuttgart.de \
    --cc=majordomo@oss.sgi.com \
    --cc=netdev@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).