public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Li Wei <lw@cn•fujitsu.com>
To: "David S. Miller" <davem@davemloft•net>
Cc: netdev <netdev@vger•kernel.org>
Subject: [PATCH v2] ipv4: Fix wrong order of ip_rt_get_source() and update iph->daddr.
Date: Fri, 10 Feb 2012 15:15:25 +0800	[thread overview]
Message-ID: <4F34C40D.5010503@cn.fujitsu.com> (raw)
In-Reply-To: <4F34BDAD.8080608@cn.fujitsu.com>

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 

  parent reply	other threads:[~2012-02-10  7:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Li Wei [this message]
2012-02-10 20:12   ` [PATCH v2] " David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F34C40D.5010503@cn.fujitsu.com \
    --to=lw@cn$(echo .)fujitsu.com \
    --cc=davem@davemloft$(echo .)net \
    --cc=netdev@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox