netdev.vger.kernel.org archive mirror
 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] ipv4: fix a bug in strict route gateway comparation.
Date: Tue, 08 Nov 2011 16:44:40 +0800	[thread overview]
Message-ID: <4EB8EBF8.1080508@cn.fujitsu.com> (raw)

Since commit def57687 (ipv4: Elide use of rt->rt_dst in ip_forward())
we use iph->daddr for strict route gateway comparation, Unfortunately
skb_rtable(skb) has been updated in ip_options_rcv_srr() for the
nexthop in SRR option but iph->daddr *not* updated, So rt->rt_dst is
not equals to iph->daddr, We should use the updated rt->rt_dst instead.

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

diff --git a/net/ipv4/ip_forward.c b/net/ipv4/ip_forward.c
index 3b34d1c..99461f0 100644
--- a/net/ipv4/ip_forward.c
+++ b/net/ipv4/ip_forward.c
@@ -84,7 +84,7 @@ int ip_forward(struct sk_buff *skb)
 
 	rt = skb_rtable(skb);
 
-	if (opt->is_strictroute && ip_hdr(skb)->daddr != rt->rt_gateway)
+	if (opt->is_strictroute && rt->rt_dst != rt->rt_gateway)
 		goto sr_failed;
 
 	if (unlikely(skb->len > dst_mtu(&rt->dst) && !skb_is_gso(skb) &&
-- 
1.7.3.2

             reply	other threads:[~2011-11-08  8:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-08  8:44 Li Wei [this message]
2011-11-08 17:07 ` [PATCH] ipv4: fix a bug in strict route gateway comparation 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=4EB8EBF8.1080508@cn.fujitsu.com \
    --to=lw@cn.fujitsu.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).