ipv6: fill rt6i_gateway with nexthop address
Make sure rt6i_gateway contains nexthop information in all routes returned from lookup or when routes are directly attached to skb for generated ICMP packets. The effect of this patch should be a faster version of rt6_nexthop() and the consideration of local addresses as nexthop. Signed-off-by: Julian Anastasov <ja@ssi.bg> Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
96dc809514
commit
550bab42f8
@@ -851,7 +851,6 @@ static struct rt6_info *rt6_alloc_cow(struct rt6_info *ort,
|
||||
if (ort->rt6i_dst.plen != 128 &&
|
||||
ipv6_addr_equal(&ort->rt6i_dst.addr, daddr))
|
||||
rt->rt6i_flags |= RTF_ANYCAST;
|
||||
rt->rt6i_gateway = *daddr;
|
||||
}
|
||||
|
||||
rt->rt6i_flags |= RTF_CACHE;
|
||||
@@ -1338,6 +1337,7 @@ struct dst_entry *icmp6_dst_alloc(struct net_device *dev,
|
||||
rt->dst.flags |= DST_HOST;
|
||||
rt->dst.output = ip6_output;
|
||||
atomic_set(&rt->dst.__refcnt, 1);
|
||||
rt->rt6i_gateway = fl6->daddr;
|
||||
rt->rt6i_dst.addr = fl6->daddr;
|
||||
rt->rt6i_dst.plen = 128;
|
||||
rt->rt6i_idev = idev;
|
||||
@@ -1873,7 +1873,10 @@ static struct rt6_info *ip6_rt_copy(struct rt6_info *ort,
|
||||
in6_dev_hold(rt->rt6i_idev);
|
||||
rt->dst.lastuse = jiffies;
|
||||
|
||||
rt->rt6i_gateway = ort->rt6i_gateway;
|
||||
if (ort->rt6i_flags & RTF_GATEWAY)
|
||||
rt->rt6i_gateway = ort->rt6i_gateway;
|
||||
else
|
||||
rt->rt6i_gateway = *dest;
|
||||
rt->rt6i_flags = ort->rt6i_flags;
|
||||
if ((ort->rt6i_flags & (RTF_DEFAULT | RTF_ADDRCONF)) ==
|
||||
(RTF_DEFAULT | RTF_ADDRCONF))
|
||||
@@ -2160,6 +2163,7 @@ struct rt6_info *addrconf_dst_alloc(struct inet6_dev *idev,
|
||||
else
|
||||
rt->rt6i_flags |= RTF_LOCAL;
|
||||
|
||||
rt->rt6i_gateway = *addr;
|
||||
rt->rt6i_dst.addr = *addr;
|
||||
rt->rt6i_dst.plen = 128;
|
||||
rt->rt6i_table = fib6_get_table(net, RT6_TABLE_LOCAL);
|
||||
|
Reference in New Issue
Block a user