From: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
To: Nj A <nj_a83@yahoo.fr>
Cc: netdev@vger.kernel.org, kaber@trash.net, davem@davemloft.net
Subject: Re: Re : Re : Re : Bug in using inet_lookup ()
Date: Thu, 15 Nov 2007 19:45:27 +0300 [thread overview]
Message-ID: <20071115164525.GA12632@2ka.mipt.ru> (raw)
In-Reply-To: <910163.76878.qm@web26108.mail.ukl.yahoo.com>
On Thu, Nov 15, 2007 at 05:29:52PM +0100, Nj A (nj_a83@yahoo.fr) wrote:
> Hello all,
> No bugs are due to the inet_lookup call now using the following:
> if ((s_skb = alloc_skb (MAX_TCP_HEADER + 15, GFP_ATOMIC)) == NULL)
> {
> printk ("%s: Unable to allocate memory \n", __FUNCTION__);
> err = -ENOMEM;
> }
> dev = s_skb->dev;
>
> if (!dev)
> printk ("%s: no device attached to s_skb\n", __FUNCTION__);
> goto process_dev;
>
> sk = inet_lookup (&tcp_hashinfo, src, p_src, dst, p_dst, inet_iif (s_skb));
>
> bh_lock_sock (sk);
> process_dev:
> spin_lock (&tmp_lock);
> new_dev = list_entry (&tmp, struct net_device, todo_list);
> spin_unlock (&tmp_lock);
> if (!new_dev)
> printk ("%s: no device attached to new_dev \n", __FUNCTION__);
> s_skb->dev = new_dev;
>
> ...
> bh_unlock_sock (sk);
> ...
>
> However, I am not having the right results. I checked with an established socket and expected to see that the socket is established (which is the case) but got the wrong state when testing on (sk->sk_state) and the socket seems in the TIME_WAIT / CLOSE state.
>
> May be I am corrupting the search by manually attaching a device to the skb?
> Any idea please?
Well, your code will oops just like before - you provide empty skb to
the inet_iif(), which is wrong. Actually you will not even reach that
point, since your code will exit after skb->dev check.
Try simple inet_lookup(&tcp_hashinfo, src, p_src, dst, p_dst, 0).
It does work.
--
Evgeniy Polyakov
prev parent reply other threads:[~2007-11-15 16:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-15 16:29 Re : Re : Re : Bug in using inet_lookup () Nj A
2007-11-15 16:45 ` Evgeniy Polyakov [this message]
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=20071115164525.GA12632@2ka.mipt.ru \
--to=johnpol@2ka.mipt.ru \
--cc=davem@davemloft.net \
--cc=kaber@trash.net \
--cc=netdev@vger.kernel.org \
--cc=nj_a83@yahoo.fr \
/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 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.