* [PATCH] tcp_v4_send_reset: binding oif to iif in no sock case [not found] <RE: [PATCH] tcp_v4_send_reset: binding oif to iif in no sock case> @ 2012-02-04 21:44 ` Shawn Lu 2012-02-04 21:47 ` David Miller 2012-02-04 21:49 ` Eric Dumazet 2012-02-04 22:38 ` Shawn Lu 1 sibling, 2 replies; 10+ messages in thread From: Shawn Lu @ 2012-02-04 21:44 UTC (permalink / raw) To: davem; +Cc: eric.dumazet, netdev, xiaoclu Binding RST packet outgoing interface to incoming interface for tcp v4 when there is no socket associate with it. This has few benefits: 1. tcp_v6_send_reset already did that. 2. This helps tcp connect with SO_BINDTODEVICE set. When connection is lost, we still able to sending out RST using same interface. 3. we are sending reply, it is most likely to be succeed if iif is used Signed-off-by: Shawn Lu <shawn.lu@ericsson.com> --- V3: reformat comments as suggested net/ipv4/tcp_ipv4.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 90e4793..4d6f81c 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -676,6 +676,11 @@ static void tcp_v4_send_reset(struct sock *sk, struct sk_buff *skb) arg.iov[0].iov_len, IPPROTO_TCP, 0); arg.csumoffset = offsetof(struct tcphdr, check) / 2; arg.flags = (sk && inet_sk(sk)->transparent) ? IP_REPLY_ARG_NOSRCCHECK : 0; + /* When socket is gone, all binding information is lost. + * routing might fail in this case. using iif for oif to + * make sure we can deliver it + */ + arg.bound_dev_if = sk ? sk->sk_bound_dev_if : inet_iif(skb); net = dev_net(skb_dst(skb)->dev); arg.tos = ip_hdr(skb)->tos; -- 1.7.0.4 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] tcp_v4_send_reset: binding oif to iif in no sock case 2012-02-04 21:44 ` [PATCH] tcp_v4_send_reset: binding oif to iif in no sock case Shawn Lu @ 2012-02-04 21:47 ` David Miller 2012-02-04 22:47 ` Shawn Lu 2012-02-04 21:49 ` Eric Dumazet 1 sibling, 1 reply; 10+ messages in thread From: David Miller @ 2012-02-04 21:47 UTC (permalink / raw) To: shawn.lu; +Cc: eric.dumazet, netdev, xiaoclu From: Shawn Lu <shawn.lu@ericsson.com> Date: Sat, 4 Feb 2012 13:44:57 -0800 > Binding RST packet outgoing interface to incoming interface > for tcp v4 when there is no socket associate with it. > This has few benefits: > 1. tcp_v6_send_reset already did that. > 2. This helps tcp connect with SO_BINDTODEVICE set. When > connection is lost, we still able to sending out RST using > same interface. > 3. we are sending reply, it is most likely to be succeed > if iif is used > > Signed-off-by: Shawn Lu <shawn.lu@ericsson.com> Sigh... Thanks for giving Eric not credit whatsoever for his contributions and feedback for this fix. :-/ ^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [PATCH] tcp_v4_send_reset: binding oif to iif in no sock case 2012-02-04 21:47 ` David Miller @ 2012-02-04 22:47 ` Shawn Lu 0 siblings, 0 replies; 10+ messages in thread From: Shawn Lu @ 2012-02-04 22:47 UTC (permalink / raw) To: David Miller Cc: eric.dumazet@gmail.com, netdev@vger.kernel.org, xiaoclu@gmail.com Hi,David: I do appreciate Eric's helpand contribution in this fix. I am a newer here. I just don't know how I can give credit to him. I thought That you will put "Acked-by: Eric Dumazet <eric.dumazet@gmail.com>" to Credit his contribution. Thanks! Shawn Lu > -----Original Message----- > From: David Miller [mailto:davem@davemloft.net] > Sent: Saturday, February 04, 2012 1:47 PM > To: Shawn Lu > Cc: eric.dumazet@gmail.com; netdev@vger.kernel.org; xiaoclu@gmail.com > Subject: Re: [PATCH] tcp_v4_send_reset: binding oif to iif in > no sock case > > From: Shawn Lu <shawn.lu@ericsson.com> > Date: Sat, 4 Feb 2012 13:44:57 -0800 > > > Binding RST packet outgoing interface to incoming interface > for tcp v4 > > when there is no socket associate with it. > > This has few benefits: > > 1. tcp_v6_send_reset already did that. > > 2. This helps tcp connect with SO_BINDTODEVICE set. When > connection is > > lost, we still able to sending out RST using same interface. > > 3. we are sending reply, it is most likely to be succeed if iif is > > used > > > > Signed-off-by: Shawn Lu <shawn.lu@ericsson.com> > > Sigh... > > Thanks for giving Eric not credit whatsoever for his > contributions and feedback for this fix. :-/ > ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] tcp_v4_send_reset: binding oif to iif in no sock case 2012-02-04 21:44 ` [PATCH] tcp_v4_send_reset: binding oif to iif in no sock case Shawn Lu 2012-02-04 21:47 ` David Miller @ 2012-02-04 21:49 ` Eric Dumazet 1 sibling, 0 replies; 10+ messages in thread From: Eric Dumazet @ 2012-02-04 21:49 UTC (permalink / raw) To: Shawn Lu; +Cc: davem, netdev, xiaoclu Le samedi 04 février 2012 à 13:44 -0800, Shawn Lu a écrit : > Binding RST packet outgoing interface to incoming interface > for tcp v4 when there is no socket associate with it. > This has few benefits: > 1. tcp_v6_send_reset already did that. > 2. This helps tcp connect with SO_BINDTODEVICE set. When > connection is lost, we still able to sending out RST using > same interface. > 3. we are sending reply, it is most likely to be succeed > if iif is used > > Signed-off-by: Shawn Lu <shawn.lu@ericsson.com> > --- > V3: reformat comments as suggested > net/ipv4/tcp_ipv4.c | 5 +++++ > 1 files changed, 5 insertions(+), 0 deletions(-) > > diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c > index 90e4793..4d6f81c 100644 > --- a/net/ipv4/tcp_ipv4.c > +++ b/net/ipv4/tcp_ipv4.c > @@ -676,6 +676,11 @@ static void tcp_v4_send_reset(struct sock *sk, struct sk_buff *skb) > arg.iov[0].iov_len, IPPROTO_TCP, 0); > arg.csumoffset = offsetof(struct tcphdr, check) / 2; > arg.flags = (sk && inet_sk(sk)->transparent) ? IP_REPLY_ARG_NOSRCCHECK : 0; > + /* When socket is gone, all binding information is lost. > + * routing might fail in this case. using iif for oif to > + * make sure we can deliver it > + */ > + arg.bound_dev_if = sk ? sk->sk_bound_dev_if : inet_iif(skb); > > net = dev_net(skb_dst(skb)->dev); > arg.tos = ip_hdr(skb)->tos; Acked-by: Eric Dumazet <eric.dumazet@gmail.com> ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] tcp_v4_send_reset: binding oif to iif in no sock case [not found] <RE: [PATCH] tcp_v4_send_reset: binding oif to iif in no sock case> 2012-02-04 21:44 ` [PATCH] tcp_v4_send_reset: binding oif to iif in no sock case Shawn Lu @ 2012-02-04 22:38 ` Shawn Lu 2012-02-04 23:20 ` David Miller 1 sibling, 1 reply; 10+ messages in thread From: Shawn Lu @ 2012-02-04 22:38 UTC (permalink / raw) To: davem; +Cc: eric.dumazet, netdev, xiaoclu Binding RST packet outgoing interface to incoming interface for tcp v4 when there is no socket associate with it. when sk is not NULL, using sk->sk_bound_dev_if instead. (suggested by Eric Dumazet). This has few benefits: 1. tcp_v6_send_reset already did that. 2. This helps tcp connect with SO_BINDTODEVICE set. When connection is lost, we still able to sending out RST using same interface. 3. we are sending reply, it is most likely to be succeed if iif is used Signed-off-by: Shawn Lu <shawn.lu@ericsson.com> Acked-by: Eric Dumazet <eric.dumazet@gmail.com> --- V4: change log. Thanks for Eric Dumazet to take care of "sk is not NULL" case. He also provide code for this fix. net/ipv4/tcp_ipv4.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 90e4793..4d6f81c 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -676,6 +676,11 @@ static void tcp_v4_send_reset(struct sock *sk, struct sk_buff *skb) arg.iov[0].iov_len, IPPROTO_TCP, 0); arg.csumoffset = offsetof(struct tcphdr, check) / 2; arg.flags = (sk && inet_sk(sk)->transparent) ? IP_REPLY_ARG_NOSRCCHECK : 0; + /* When socket is gone, all binding information is lost. + * routing might fail in this case. using iif for oif to + * make sure we can deliver it + */ + arg.bound_dev_if = sk ? sk->sk_bound_dev_if : inet_iif(skb); net = dev_net(skb_dst(skb)->dev); arg.tos = ip_hdr(skb)->tos; -- 1.7.0.4 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] tcp_v4_send_reset: binding oif to iif in no sock case 2012-02-04 22:38 ` Shawn Lu @ 2012-02-04 23:20 ` David Miller 0 siblings, 0 replies; 10+ messages in thread From: David Miller @ 2012-02-04 23:20 UTC (permalink / raw) To: shawn.lu; +Cc: eric.dumazet, netdev, xiaoclu From: Shawn Lu <shawn.lu@ericsson.com> Date: Sat, 4 Feb 2012 14:38:09 -0800 > Binding RST packet outgoing interface to incoming interface > for tcp v4 when there is no socket associate with it. > when sk is not NULL, using sk->sk_bound_dev_if instead. > (suggested by Eric Dumazet). > > This has few benefits: > 1. tcp_v6_send_reset already did that. > 2. This helps tcp connect with SO_BINDTODEVICE set. When > connection is lost, we still able to sending out RST using > same interface. > 3. we are sending reply, it is most likely to be succeed > if iif is used > > Signed-off-by: Shawn Lu <shawn.lu@ericsson.com> > Acked-by: Eric Dumazet <eric.dumazet@gmail.com> Applied and queued up for -stable, thanks. ^ permalink raw reply [flat|nested] 10+ messages in thread
[parent not found: <RE: [PATCH] tcp: RST: binding oif to iif for tcp v4>]
* [PATCH] tcp_v4_send_reset: binding oif to iif in no sock case [not found] <RE: [PATCH] tcp: RST: binding oif to iif for tcp v4> @ 2012-02-04 21:22 ` Shawn Lu 2012-02-04 21:26 ` David Miller 0 siblings, 1 reply; 10+ messages in thread From: Shawn Lu @ 2012-02-04 21:22 UTC (permalink / raw) To: eric.dumazet; +Cc: davem, netdev, xiaoclu Binding RST packet outgoing interface to incomming interface for tcp v4 when there is no socket associate with it. This has few benefits: 1. tcp_v6_send_reset already did that. 2. This helps tcp connect with SO_BINDTODEVICE set. When connection is lost, we still able to sending out RST using same interface. 3. we are send reply, it is most likely to be succeed if iif is used Signed-off-by: Shawn Lu <shawn.lu@ericsson.com> --- V2: amend as Eric Dumazet suggested net/ipv4/tcp_ipv4.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 90e4793..f2fde8d 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -676,6 +676,12 @@ static void tcp_v4_send_reset(struct sock *sk, struct sk_buff *skb) arg.iov[0].iov_len, IPPROTO_TCP, 0); arg.csumoffset = offsetof(struct tcphdr, check) / 2; arg.flags = (sk && inet_sk(sk)->transparent) ? IP_REPLY_ARG_NOSRCCHECK : 0; + /* + * When socket is gone, all binding information is lost. + * routing might fail in this case. using iif for oif to + * make sure we can deliver it + */ + arg.bound_dev_if = sk ? sk->sk_bound_dev_if : inet_iif(skb); net = dev_net(skb_dst(skb)->dev); arg.tos = ip_hdr(skb)->tos; -- 1.7.0.4 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] tcp_v4_send_reset: binding oif to iif in no sock case 2012-02-04 21:22 ` Shawn Lu @ 2012-02-04 21:26 ` David Miller 2012-02-04 21:30 ` Shawn Lu 2012-02-05 1:52 ` Ben Greear 0 siblings, 2 replies; 10+ messages in thread From: David Miller @ 2012-02-04 21:26 UTC (permalink / raw) To: shawn.lu; +Cc: eric.dumazet, netdev, xiaoclu From: Shawn Lu <shawn.lu@ericsson.com> Date: Sat, 4 Feb 2012 13:22:36 -0800 > + /* > + * When socket is gone, all binding information is lost. > + * routing might fail in this case. using iif for oif to > + * make sure we can deliver it > + */ Comment is poorly formatted, and I'm getting tired of teaching people /* That comments are formatted like * this. */ /* * Not like this. */ or do you have infinite vertical lines on your monitor so that this empty "/*" line has no impact on your screen real estate like it does for the rest of us? ^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [PATCH] tcp_v4_send_reset: binding oif to iif in no sock case 2012-02-04 21:26 ` David Miller @ 2012-02-04 21:30 ` Shawn Lu 2012-02-05 1:52 ` Ben Greear 1 sibling, 0 replies; 10+ messages in thread From: Shawn Lu @ 2012-02-04 21:30 UTC (permalink / raw) To: David Miller Cc: eric.dumazet@gmail.com, netdev@vger.kernel.org, xiaoclu@gmail.com Sorry, will resubmit with right format. > -----Original Message----- > From: David Miller [mailto:davem@davemloft.net] > Sent: Saturday, February 04, 2012 1:26 PM > To: Shawn Lu > Cc: eric.dumazet@gmail.com; netdev@vger.kernel.org; xiaoclu@gmail.com > Subject: Re: [PATCH] tcp_v4_send_reset: binding oif to iif in > no sock case > > From: Shawn Lu <shawn.lu@ericsson.com> > Date: Sat, 4 Feb 2012 13:22:36 -0800 > > > + /* > > + * When socket is gone, all binding information is lost. > > + * routing might fail in this case. using iif for oif to > > + * make sure we can deliver it > > + */ > > Comment is poorly formatted, and I'm getting tired of teaching people > > /* That comments are formatted like > * this. > */ > > /* > * Not like this. > */ > > or do you have infinite vertical lines on your monitor so > that this empty "/*" line has no impact on your screen real > estate like it does for the rest of us? > ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] tcp_v4_send_reset: binding oif to iif in no sock case 2012-02-04 21:26 ` David Miller 2012-02-04 21:30 ` Shawn Lu @ 2012-02-05 1:52 ` Ben Greear 1 sibling, 0 replies; 10+ messages in thread From: Ben Greear @ 2012-02-05 1:52 UTC (permalink / raw) To: David Miller; +Cc: shawn.lu, eric.dumazet, netdev, xiaoclu On 02/04/2012 01:26 PM, David Miller wrote: > From: Shawn Lu<shawn.lu@ericsson.com> > Date: Sat, 4 Feb 2012 13:22:36 -0800 > >> + /* >> + * When socket is gone, all binding information is lost. >> + * routing might fail in this case. using iif for oif to >> + * make sure we can deliver it >> + */ > > Comment is poorly formatted, and I'm getting tired of teaching > people > > /* That comments are formatted like > * this. > */ > > /* > * Not like this. > */ I agree with your taste in comments, but the linux style guide says basically the opposite. Maybe see if you can sneak a patch into the style guide? :) Thanks, Ben -- Ben Greear <greearb@candelatech.com> Candela Technologies Inc http://www.candelatech.com ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2012-02-05 1:52 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <RE: [PATCH] tcp_v4_send_reset: binding oif to iif in no sock case> 2012-02-04 21:44 ` [PATCH] tcp_v4_send_reset: binding oif to iif in no sock case Shawn Lu 2012-02-04 21:47 ` David Miller 2012-02-04 22:47 ` Shawn Lu 2012-02-04 21:49 ` Eric Dumazet 2012-02-04 22:38 ` Shawn Lu 2012-02-04 23:20 ` David Miller [not found] <RE: [PATCH] tcp: RST: binding oif to iif for tcp v4> 2012-02-04 21:22 ` Shawn Lu 2012-02-04 21:26 ` David Miller 2012-02-04 21:30 ` Shawn Lu 2012-02-05 1:52 ` Ben Greear
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).