From: Eric Dumazet <eric.dumazet@gmail.com>
To: Florian Westphal <fw@strlen.de>, David Miller <davem@davemloft.net>
Cc: Sami Farin <hvtaifwkbgefbaei@gmail.com>,
netdev@vger.kernel.org, e1000-devel@lists.sourceforge.net
Subject: Re: [PATCH v2] netfilter: take care of timewait sockets
Date: Mon, 03 Sep 2012 11:57:18 +0200 [thread overview]
Message-ID: <1346666238.2563.113.camel@edumazet-glaptop> (raw)
In-Reply-To: <20120903074718.GA14750@breakpoint.cc>
From: Eric Dumazet <edumazet@google.com>
On Mon, 2012-09-03 at 09:47 +0200, Florian Westphal wrote:
> Eric Dumazet <eric.dumazet@gmail.com> wrote:
> > Sami Farin reported crashes in xt_LOG because it assumes skb->sk is a
> > full blown socket.
> >
> > But with TCP early demux, we can have skb->sk pointing to a timewait
> > socket.
> >
> > Same fix is needed in netfnetlink_log
>
> Looks good, but IMHO it is very un-intuitive that
> skb->sk might be a pointer to an object that is not struct sock (or
> a compatible object).
Its kind of a compatible object, if all skb->sk users are aware of it.
You are totally right, this is messy, but TCP edemux is a layering
violation helping a bit performance...
sock_edemux() should also be fixed.
David, tell me if you prefer to change TCP demux to avoid timewait,
as I have no strong opinion.
[PATCH] net: sock_edemux() should take care of timewait sockets
sock_edemux() can handle either a regular socket or a timewait socket
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
net/core/sock.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/net/core/sock.c b/net/core/sock.c
index 8f67ced..7f64467 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1523,7 +1523,12 @@ EXPORT_SYMBOL(sock_rfree);
void sock_edemux(struct sk_buff *skb)
{
- sock_put(skb->sk);
+ struct sock *sk = skb->sk;
+
+ if (sk->sk_state == TCP_TIME_WAIT)
+ inet_twsk_put(inet_twsk(sk));
+ else
+ sock_put(sk);
}
EXPORT_SYMBOL(sock_edemux);
next prev parent reply other threads:[~2012-09-03 9:57 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-21 13:49 (ipt_log_packet, sb_add) 3.6.0-rc2 kernel panic - not syncing; Fatal exception in interrupt Sami Farin
2012-09-02 12:20 ` Sami Farin
2012-09-02 13:28 ` Florian Westphal
2012-09-02 13:45 ` Sami Farin
2012-09-02 22:53 ` Eric Dumazet
2012-09-02 23:37 ` Eric Dumazet
2012-09-02 23:48 ` [PATCH v2] netfilter: take care of timewait sockets Eric Dumazet
2012-09-03 7:47 ` Florian Westphal
2012-09-03 9:57 ` Eric Dumazet [this message]
2012-09-03 17:23 ` David Miller
2012-09-04 7:55 ` Eric Dumazet
2012-09-04 16:16 ` David Miller
2012-09-14 9:30 ` Sami Farin
2012-09-10 5:02 ` (ipt_log_packet, sb_add) 3.6.0-rc2 kernel panic - not syncing; Fatal exception in interrupt Jan Engelhardt
2012-09-10 6:00 ` Eric Dumazet
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=1346666238.2563.113.camel@edumazet-glaptop \
--to=eric.dumazet@gmail.com \
--cc=davem@davemloft.net \
--cc=e1000-devel@lists.sourceforge.net \
--cc=fw@strlen.de \
--cc=hvtaifwkbgefbaei@gmail.com \
--cc=netdev@vger.kernel.org \
/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