]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/meta-ti-glsdk.git/blob - recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.9/0027-tcp_v4_send_reset-binding-oif-to-iif-in-no-sock-case.patch
linux-ti33x-psp 3.2: update to 3.2.9 and add 2 patches from PSP tree
[glsdk/meta-ti-glsdk.git] / recipes-kernel / linux / linux-ti33x-psp-3.2 / 3.2.9 / 0027-tcp_v4_send_reset-binding-oif-to-iif-in-no-sock-case.patch
1 From 017d762758b89e117b10c21a8490b16e93cf487b Mon Sep 17 00:00:00 2001
2 From: Shawn Lu <shawn.lu@ericsson.com>
3 Date: Sat, 4 Feb 2012 12:38:09 +0000
4 Subject: [PATCH 27/73] tcp_v4_send_reset: binding oif to iif in no sock case
6 [ Upstream commit e2446eaab5585555a38ea0df4e01ff313dbb4ac9 ]
8 Binding RST packet outgoing interface to incoming interface
9 for tcp v4 when there is no socket associate with it.
10 when sk is not NULL, using sk->sk_bound_dev_if instead.
11 (suggested by Eric Dumazet).
13 This has few benefits:
14 1. tcp_v6_send_reset already did that.
15 2. This helps tcp connect with SO_BINDTODEVICE set. When
16 connection is lost, we still able to sending out RST using
17 same interface.
18 3. we are sending reply, it is most likely to be succeed
19 if iif is used
21 Signed-off-by: Shawn Lu <shawn.lu@ericsson.com>
22 Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
23 Signed-off-by: David S. Miller <davem@davemloft.net>
24 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
25 ---
26  net/ipv4/tcp_ipv4.c |    5 +++++
27  1 files changed, 5 insertions(+), 0 deletions(-)
29 diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
30 index c89e354..eb90aa8 100644
31 --- a/net/ipv4/tcp_ipv4.c
32 +++ b/net/ipv4/tcp_ipv4.c
33 @@ -650,6 +650,11 @@ static void tcp_v4_send_reset(struct sock *sk, struct sk_buff *skb)
34                                       arg.iov[0].iov_len, IPPROTO_TCP, 0);
35         arg.csumoffset = offsetof(struct tcphdr, check) / 2;
36         arg.flags = (sk && inet_sk(sk)->transparent) ? IP_REPLY_ARG_NOSRCCHECK : 0;
37 +       /* When socket is gone, all binding information is lost.
38 +        * routing might fail in this case. using iif for oif to
39 +        * make sure we can deliver it
40 +        */
41 +       arg.bound_dev_if = sk ? sk->sk_bound_dev_if : inet_iif(skb);
42  
43         net = dev_net(skb_dst(skb)->dev);
44         arg.tos = ip_hdr(skb)->tos;
45 -- 
46 1.7.7.4