* [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; 15+ 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] 15+ messages in thread
* Re: [PATCH] tcp_v4_send_reset: binding oif to iif in no sock case 2012-02-04 21:22 ` [PATCH] tcp_v4_send_reset: binding oif to iif in no sock case Shawn Lu @ 2012-02-04 21:26 ` David Miller 2012-02-04 21:30 ` Shawn Lu ` (2 more replies) 0 siblings, 3 replies; 15+ 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] 15+ 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-04 21:34 ` [PATCH] CodingStyle: Add net and drivers/net preferred commenting style Joe Perches 2012-02-05 1:52 ` [PATCH] tcp_v4_send_reset: binding oif to iif in no sock case Ben Greear 2 siblings, 0 replies; 15+ 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] 15+ messages in thread
* [PATCH] CodingStyle: Add net and drivers/net preferred commenting style 2012-02-04 21:26 ` David Miller 2012-02-04 21:30 ` Shawn Lu @ 2012-02-04 21:34 ` Joe Perches 2012-02-04 21:40 ` David Miller 2012-02-05 1:52 ` [PATCH] tcp_v4_send_reset: binding oif to iif in no sock case Ben Greear 2 siblings, 1 reply; 15+ messages in thread From: Joe Perches @ 2012-02-04 21:34 UTC (permalink / raw) To: David Miller; +Cc: shawn.lu, eric.dumazet, netdev, xiaoclu, Randy Dunlap Perhaps adding something to CodingStyle is useful? --- Documentation/CodingStyle | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle index 2b90d32..65e82e4 100644 --- a/Documentation/CodingStyle +++ b/Documentation/CodingStyle @@ -454,6 +454,14 @@ The preferred style for long (multi-line) comments is: * with beginning and ending almost-blank lines. */ +Unless the files are in net or drivers/net where David Miller +prefers the vertically shorter: + + /* This is the preferred style for multi-line + * comments in the net and drivers/net directories. + * Please use it consistently. + */ + It's also important to comment data, whether they are basic types or derived types. To this end, use just one data declaration per line (no commas for multiple data declarations). This leaves you room for a small comment on each ^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH] CodingStyle: Add net and drivers/net preferred commenting style 2012-02-04 21:34 ` [PATCH] CodingStyle: Add net and drivers/net preferred commenting style Joe Perches @ 2012-02-04 21:40 ` David Miller 2012-02-04 21:50 ` Joe Perches 0 siblings, 1 reply; 15+ messages in thread From: David Miller @ 2012-02-04 21:40 UTC (permalink / raw) To: joe; +Cc: shawn.lu, eric.dumazet, netdev, xiaoclu, rdunlap From: Joe Perches <joe@perches.com> Date: Sat, 04 Feb 2012 13:34:43 -0800 > Perhaps adding something to CodingStyle is useful? Come on, get real. ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] CodingStyle: Add net and drivers/net preferred commenting style 2012-02-04 21:40 ` David Miller @ 2012-02-04 21:50 ` Joe Perches 2012-02-04 21:53 ` David Miller 0 siblings, 1 reply; 15+ messages in thread From: Joe Perches @ 2012-02-04 21:50 UTC (permalink / raw) To: David Miller; +Cc: shawn.lu, eric.dumazet, netdev, xiaoclu, rdunlap On Sat, 2012-02-04 at 16:40 -0500, David Miller wrote: > From: Joe Perches <joe@perches.com> > Date: Sat, 04 Feb 2012 13:34:43 -0800 > > Perhaps adding something to CodingStyle is useful? > Come on, get real. ;) I'm trying to get you to understand that your commenting style is not what's in CodingStyle and that you are a bit of an outlier for using it. You can repeat it again and again on the list, but not everyone reads it. Notice I didn't sign it either, but I suppose checkpatch could always add something instead... cheers, Joe ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] CodingStyle: Add net and drivers/net preferred commenting style 2012-02-04 21:50 ` Joe Perches @ 2012-02-04 21:53 ` David Miller 2012-02-04 22:02 ` Joe Perches 0 siblings, 1 reply; 15+ messages in thread From: David Miller @ 2012-02-04 21:53 UTC (permalink / raw) To: joe; +Cc: shawn.lu, eric.dumazet, netdev, xiaoclu, rdunlap From: Joe Perches <joe@perches.com> Date: Sat, 04 Feb 2012 13:50:59 -0800 > On Sat, 2012-02-04 at 16:40 -0500, David Miller wrote: >> From: Joe Perches <joe@perches.com> >> Date: Sat, 04 Feb 2012 13:34:43 -0800 >> > Perhaps adding something to CodingStyle is useful? >> Come on, get real. > > ;) > > I'm trying to get you to understand that your > commenting style is not what's in CodingStyle > and that you are a bit of an outlier for using > it. So do you think my way is superior or inferior to the CodingStyle suggestion? Explain. If you think my way is better, then submit a patch to change it for everyone, not just networking. ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] CodingStyle: Add net and drivers/net preferred commenting style 2012-02-04 21:53 ` David Miller @ 2012-02-04 22:02 ` Joe Perches 0 siblings, 0 replies; 15+ messages in thread From: Joe Perches @ 2012-02-04 22:02 UTC (permalink / raw) To: David Miller; +Cc: shawn.lu, eric.dumazet, netdev, xiaoclu, rdunlap On Sat, 2012-02-04 at 16:53 -0500, David Miller wrote: > From: Joe Perches <joe@perches.com> > > I'm trying to get you to understand that your > > commenting style is not what's in CodingStyle > > and that you are a bit of an outlier for using > > it. > So do you think my way is superior or inferior to the CodingStyle > suggestion? I think it doesn't matter enough to care about it and I generally use relatively height limited screens (100x 50y or so). cheers, Joe ^ permalink raw reply [flat|nested] 15+ 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-04 21:34 ` [PATCH] CodingStyle: Add net and drivers/net preferred commenting style Joe Perches @ 2012-02-05 1:52 ` Ben Greear 2 siblings, 0 replies; 15+ 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] 15+ messages in thread
[parent not found: <RE: [PATCH] tcp_v4_send_reset: binding oif to iif in no sock case>]
* [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; 15+ 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] 15+ messages in thread
* 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 22:47 ` Shawn Lu 2012-02-04 21:49 ` Eric Dumazet 1 sibling, 1 reply; 15+ 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] 15+ 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; 15+ 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] 15+ messages in thread
* 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 1 sibling, 0 replies; 15+ 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] 15+ 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 ` Shawn Lu @ 2012-02-04 22:38 ` Shawn Lu 2012-02-04 23:20 ` David Miller 1 sibling, 1 reply; 15+ 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] 15+ 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; 15+ 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] 15+ messages in thread
end of thread, other threads:[~2012-02-05 1:52 UTC | newest] Thread overview: 15+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <RE: [PATCH] tcp: RST: binding oif to iif for tcp v4> 2012-02-04 21:22 ` [PATCH] tcp_v4_send_reset: binding oif to iif in no sock case Shawn Lu 2012-02-04 21:26 ` David Miller 2012-02-04 21:30 ` Shawn Lu 2012-02-04 21:34 ` [PATCH] CodingStyle: Add net and drivers/net preferred commenting style Joe Perches 2012-02-04 21:40 ` David Miller 2012-02-04 21:50 ` Joe Perches 2012-02-04 21:53 ` David Miller 2012-02-04 22:02 ` Joe Perches 2012-02-05 1:52 ` [PATCH] tcp_v4_send_reset: binding oif to iif in no sock case Ben Greear [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 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
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).