netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ipv4: Fix wrong order of ip_rt_get_source() and update iph->daddr.
@ 2012-02-10  6:48 Li Wei
  2012-02-10  7:04 ` Eric Dumazet
  2012-02-10  7:15 ` [PATCH v2] " Li Wei
  0 siblings, 2 replies; 6+ messages in thread
From: Li Wei @ 2012-02-10  6:48 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev


Need to update iph->daddr before ip_rt_get_source(), otherwise
we may get a wrong src.

Signed-off-by: Li Wei <lw@cn.fujitsu.com>
---
 net/ipv4/ip_options.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/ipv4/ip_options.c b/net/ipv4/ip_options.c
index 1e60f76..42dd1a9 100644
--- a/net/ipv4/ip_options.c
+++ b/net/ipv4/ip_options.c
@@ -573,8 +573,8 @@ void ip_forward_options(struct sk_buff *skb)
 		}
 		if (srrptr + 3 <= srrspace) {
 			opt->is_changed = 1;
-			ip_rt_get_source(&optptr[srrptr-1], skb, rt);
 			ip_hdr(skb)->daddr = opt->nexthop;
+			ip_rt_get_source(&optptr[srrptr-1], skb, rt);
 			optptr[2] = srrptr+4;
 		} else if (net_ratelimit())
 			printk(KERN_CRIT "ip_forward(): Argh! Destination lost!\n");
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] ipv4: Fix wrong order of ip_rt_get_source() and update iph->daddr.
  2012-02-10  6:48 [PATCH] ipv4: Fix wrong order of ip_rt_get_source() and update iph->daddr Li Wei
@ 2012-02-10  7:04 ` Eric Dumazet
  2012-02-10  7:08   ` Li Wei
  2012-02-10  7:34   ` Li Wei
  2012-02-10  7:15 ` [PATCH v2] " Li Wei
  1 sibling, 2 replies; 6+ messages in thread
From: Eric Dumazet @ 2012-02-10  7:04 UTC (permalink / raw)
  To: Li Wei; +Cc: David S. Miller, netdev

Le vendredi 10 février 2012 à 14:48 +0800, Li Wei a écrit :
> Need to update iph->daddr before ip_rt_get_source(), otherwise
> we may get a wrong src.
> 

It would be nice that patch submitters try to pinpoint bug origin in
changelog, to ease patch review and stable submissions.

Is it coming from ac8a48106be49c422575ddc7531b776f8eb49610 (ipv4: Save
nexthop address of LSRR/SSRR option to IPCB.) added in 3.2, or is it
something needing a backport in some other way in old kernels ?

Thanks !

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ipv4: Fix wrong order of ip_rt_get_source() and update iph->daddr.
  2012-02-10  7:04 ` Eric Dumazet
@ 2012-02-10  7:08   ` Li Wei
  2012-02-10  7:34   ` Li Wei
  1 sibling, 0 replies; 6+ messages in thread
From: Li Wei @ 2012-02-10  7:08 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David S. Miller, netdev

Eric Dumazet 写道:
> Le vendredi 10 février 2012 à 14:48 +0800, Li Wei a écrit :
>> Need to update iph->daddr before ip_rt_get_source(), otherwise
>> we may get a wrong src.
>>
> 
> It would be nice that patch submitters try to pinpoint bug origin in
> changelog, to ease patch review and stable submissions.
> 
> Is it coming from ac8a48106be49c422575ddc7531b776f8eb49610 (ipv4: Save
> nexthop address of LSRR/SSRR option to IPCB.) added in 3.2, or is it
> something needing a backport in some other way in old kernels ?

As you said, it is coming from ac8a48106be49c422575ddc7531b776f8eb49610 
(ipv4: Save nexthop address of LSRR/SSRR option to IPCB.).

I'll modify the changelog and post a v2.

Thanks!

> 
> Thanks !
> 
> 
> 
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2] ipv4: Fix wrong order of ip_rt_get_source() and update iph->daddr.
  2012-02-10  6:48 [PATCH] ipv4: Fix wrong order of ip_rt_get_source() and update iph->daddr Li Wei
  2012-02-10  7:04 ` Eric Dumazet
@ 2012-02-10  7:15 ` Li Wei
  2012-02-10 20:12   ` David Miller
  1 sibling, 1 reply; 6+ messages in thread
From: Li Wei @ 2012-02-10  7:15 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev

This patch fix a bug which introduced by commit ac8a4810 (ipv4: Save
nexthop address of LSRR/SSRR option to IPCB.).In that patch, we saved
the nexthop of SRR in ip_option->nexthop and update iph->daddr until
we get to ip_forward_options(), but we need to update it before 
ip_rt_get_source(), otherwise we may get a wrong src.

Signed-off-by: Li Wei <lw@cn.fujitsu.com>
---
 net/ipv4/ip_options.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/ipv4/ip_options.c b/net/ipv4/ip_options.c
index 1e60f76..42dd1a9 100644
--- a/net/ipv4/ip_options.c
+++ b/net/ipv4/ip_options.c
@@ -573,8 +573,8 @@ void ip_forward_options(struct sk_buff *skb)
 		}
 		if (srrptr + 3 <= srrspace) {
 			opt->is_changed = 1;
-			ip_rt_get_source(&optptr[srrptr-1], skb, rt);
 			ip_hdr(skb)->daddr = opt->nexthop;
+			ip_rt_get_source(&optptr[srrptr-1], skb, rt);
 			optptr[2] = srrptr+4;
 		} else if (net_ratelimit())
 			printk(KERN_CRIT "ip_forward(): Argh! Destination lost!\n");
-- 1.7.1 

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] ipv4: Fix wrong order of ip_rt_get_source() and update iph->daddr.
  2012-02-10  7:04 ` Eric Dumazet
  2012-02-10  7:08   ` Li Wei
@ 2012-02-10  7:34   ` Li Wei
  1 sibling, 0 replies; 6+ messages in thread
From: Li Wei @ 2012-02-10  7:34 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David S. Miller, netdev

Eric Dumazet wrote:
> Le vendredi 10 février 2012 à 14:48 +0800, Li Wei a écrit :
>> Need to update iph->daddr before ip_rt_get_source(), otherwise
>> we may get a wrong src.
>>
> 
> It would be nice that patch submitters try to pinpoint bug origin in
> changelog, to ease patch review and stable submissions.
> 
> Is it coming from ac8a48106be49c422575ddc7531b776f8eb49610 (ipv4: Save
> nexthop address of LSRR/SSRR option to IPCB.) added in 3.2, or is it
> something needing a backport in some other way in old kernels ?
> 

As you said, it is coming from ac8a48106be49c422575ddc7531b776f8eb49610 
(ipv4: Save nexthop address of LSRR/SSRR option to IPCB.).

I'll modify the changelog and post a v2.

Thanks!


> Thanks !
> 
> 
> 
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] ipv4: Fix wrong order of ip_rt_get_source() and update iph->daddr.
  2012-02-10  7:15 ` [PATCH v2] " Li Wei
@ 2012-02-10 20:12   ` David Miller
  0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2012-02-10 20:12 UTC (permalink / raw)
  To: lw; +Cc: netdev

From: Li Wei <lw@cn.fujitsu.com>
Date: Fri, 10 Feb 2012 15:15:25 +0800

> This patch fix a bug which introduced by commit ac8a4810 (ipv4: Save
> nexthop address of LSRR/SSRR option to IPCB.).In that patch, we saved
> the nexthop of SRR in ip_option->nexthop and update iph->daddr until
> we get to ip_forward_options(), but we need to update it before 
> ip_rt_get_source(), otherwise we may get a wrong src.
> 
> Signed-off-by: Li Wei <lw@cn.fujitsu.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-02-10 20:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-10  6:48 [PATCH] ipv4: Fix wrong order of ip_rt_get_source() and update iph->daddr Li Wei
2012-02-10  7:04 ` Eric Dumazet
2012-02-10  7:08   ` Li Wei
2012-02-10  7:34   ` Li Wei
2012-02-10  7:15 ` [PATCH v2] " Li Wei
2012-02-10 20:12   ` 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).