diff mbox

ipv4: Fix wrong order of ip_rt_get_source() and update iph->daddr.

Message ID 4F34BDAD.8080608@cn.fujitsu.com
State Superseded, archived
Delegated to: David Miller
Headers show

Commit Message

Wei Li Feb. 10, 2012, 6:48 a.m. UTC
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(-)

Comments

Eric Dumazet Feb. 10, 2012, 7:04 a.m. UTC | #1
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 !


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Wei Li Feb. 10, 2012, 7:08 a.m. UTC | #2
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 !
> 
> 
> 
> 

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Wei Li Feb. 10, 2012, 7:34 a.m. UTC | #3
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 !
> 
> 
> 
> 

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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");