ipv4: Elide use of rt->rt_dst in ip_forward()
authorDavid S. Miller <davem@davemloft.net>
Thu, 12 May 2011 23:34:30 +0000 (19:34 -0400)
committerDavid S. Miller <davem@davemloft.net>
Thu, 12 May 2011 23:34:30 +0000 (19:34 -0400)
No matter what kind of header mangling occurs due to IP options
processing, rt->rt_dst will always equal iph->daddr in the packet.

So we can safely use iph->daddr instead of rt->rt_dst here.

Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/ip_forward.c

index 99461f09320f6d7350ac2a91e5c49062617f2c15..fcbc0c8f12617e8cd19316f8d24bbde4d5dec52f 100644 (file)
@@ -84,7 +84,7 @@ int ip_forward(struct sk_buff *skb)
 
        rt = skb_rtable(skb);
 
-       if (opt->is_strictroute && rt->rt_dst != rt->rt_gateway)
+       if (opt->is_strictroute && iph->daddr != rt->rt_gateway)
                goto sr_failed;
 
        if (unlikely(skb->len > dst_mtu(&rt->dst) && !skb_is_gso(skb) &&