Florian Westphal d503b30bd6 netfilter: tproxy: do not assign timewait sockets to skb->sk
Assigning a socket in timewait state to skb->sk can trigger
kernel oops, e.g. in nfnetlink_log, which does:

if (skb->sk) {
        read_lock_bh(&skb->sk->sk_callback_lock);
        if (skb->sk->sk_socket && skb->sk->sk_socket->file) ...

in the timewait case, accessing sk->sk_callback_lock and sk->sk_socket
is invalid.

Either all of these spots will need to add a test for sk->sk_state != TCP_TIME_WAIT,
or xt_TPROXY must not assign a timewait socket to skb->sk.

This does the latter.

If a TW socket is found, assign the tproxy nfmark, but skip the skb->sk assignment,
thus mimicking behaviour of a '-m socket .. -j MARK/ACCEPT' re-routing rule.

The 'SYN to TW socket' case is left unchanged -- we try to redirect to the
listener socket.

Cc: Balazs Scheidler <bazsi@balabit.hu>
Cc: KOVACS Krisztian <hidden@balabit.hu>
Signed-off-by: Florian Westphal <fwestphal@astaro.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
2011-02-17 11:32:38 +01:00
..
2010-09-23 14:33:39 -07:00
2011-01-10 13:33:17 -08:00
2010-11-29 09:45:15 -08:00
2010-12-31 10:47:46 -08:00
2010-06-03 03:21:52 -07:00
2010-11-10 12:12:00 -08:00
2009-03-21 19:06:54 -07:00
2010-10-27 11:37:32 -07:00
2010-10-25 13:09:44 -07:00
2009-11-04 05:06:25 -08:00
2010-11-24 11:16:42 -08:00
2010-12-19 21:59:35 -08:00
2010-09-23 14:33:39 -07:00
2010-10-25 13:09:45 -07:00
2010-12-12 22:08:17 -08:00
2008-06-11 21:00:38 -07:00
2010-10-27 11:37:32 -07:00
2010-09-23 14:33:39 -07:00
2010-06-03 03:21:52 -07:00
2009-12-26 20:46:28 -08:00
2010-06-03 03:21:52 -07:00
2010-12-02 13:27:33 -08:00
2010-10-25 14:18:27 -07:00
2009-01-06 11:38:15 -07:00
2009-03-21 19:06:50 -07:00
2009-07-26 19:11:14 -07:00
2010-11-24 11:16:43 -08:00
2010-12-02 13:27:33 -08:00
2008-07-05 21:25:39 -07:00
2010-11-10 12:12:00 -08:00
2009-10-07 16:39:43 -04:00
2010-11-28 11:12:20 -08:00