netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ipv4: fix a bug in strict route gateway comparation.
@ 2011-11-08  8:44 Li Wei
  2011-11-08 17:07 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Li Wei @ 2011-11-08  8:44 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev

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

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

* Re: [PATCH] ipv4: fix a bug in strict route gateway comparation.
  2011-11-08  8:44 [PATCH] ipv4: fix a bug in strict route gateway comparation Li Wei
@ 2011-11-08 17:07 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2011-11-08 17:07 UTC (permalink / raw)
  To: lw; +Cc: netdev

From: Li Wei <lw@cn.fujitsu.com>
Date: Tue, 08 Nov 2011 16:44:40 +0800

> 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>

Same comments as the other patch, add whatever logic is necessary to
compute the destination address such that we don't need to add back
an rt->rt_dst reference here.

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

end of thread, other threads:[~2011-11-08 17:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-08  8:44 [PATCH] ipv4: fix a bug in strict route gateway comparation Li Wei
2011-11-08 17:07 ` 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).