]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
tcp: incoming connections might use wrong route under synflood
authorDmitry Popov <dp@highloadlab.com>
Thu, 11 Apr 2013 08:55:07 +0000 (08:55 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 1 May 2013 16:41:07 +0000 (09:41 -0700)
commitd0d7ee05a623ba00e4ffc4a07e67c6649cac5cae
tree7d571a1cc16e32e4fba6f4011d8253883691ee42
parentf29e2461ef6daf7440d00b3ea5978f69f6c057cb
tcp: incoming connections might use wrong route under synflood

[ Upstream commit d66954a066158781ccf9c13c91d0316970fe57b6 ]

There is a bug in cookie_v4_check (net/ipv4/syncookies.c):
flowi4_init_output(&fl4, 0, sk->sk_mark, RT_CONN_FLAGS(sk),
   RT_SCOPE_UNIVERSE, IPPROTO_TCP,
   inet_sk_flowi_flags(sk),
   (opt && opt->srr) ? opt->faddr : ireq->rmt_addr,
   ireq->loc_addr, th->source, th->dest);

Here we do not respect sk->sk_bound_dev_if, therefore wrong dst_entry may be
taken. This dst_entry is used by new socket (get_cookie_sock ->
tcp_v4_syn_recv_sock), so its packets may take the wrong path.

Signed-off-by: Dmitry Popov <dp@highloadlab.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/ipv4/syncookies.c