From: Eric Dumazet <[email protected]> On Mon, 2012-09-03 at 09:47 +0200, Florian Westphal wrote: > Eric Dumazet <[email protected]> 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 <[email protected]> --- 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); ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ E1000-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/e1000-devel To learn more about Intel® Ethernet, visit http://communities.intel.com/community/wired
