Skip to contentSkip to conversation

ipv4: fix a bug in strict route gateway comparation.

PATCH In review Li Wei 2 participants 2 messages Nov 8, 2011

Subsystems (3)
lore
Share & tools
lore

Li Wei

author
#0 lore raw

PATCH 1/1 ipv4: fix a bug in strict route gateway comparation.

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.

---
 net/ipv4/ip_forward.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
net/ipv4/ip_forward.c +1 -1
index 3b34d1c..99461f0 100644
@@ -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) &&
Signature · 1 line
1.7.3.2
maintainer
#1 lore raw

From: Li Wei <[email protected]>
Date: Tue, 08 Nov 2011 16:44:40 +0800

Quoted 7 lines

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.

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.