diff options
author | Julian Anastasov <ja@ssi.bg> | 2013-10-20 08:43:04 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-11-04 07:31:05 -0500 |
commit | 044d6efb797bfa1131bfb510102505ba41bfec52 (patch) | |
tree | c184240bec3b579c6e7cdad661dc8b83e8b88149 /net/ipv6/route.c | |
parent | 208a6152b633a33722cc53bca47c46b79e88a2ad (diff) |
ipv6: fill rt6i_gateway with nexthop address
[ Upstream commit 550bab42f83308c9d6ab04a980cc4333cef1c8fa ]
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/ipv6/route.c')
-rw-r--r-- | net/ipv6/route.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index bacce6c08644..225de3ec8351 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -848,7 +848,6 @@ static struct rt6_info *rt6_alloc_cow(struct rt6_info *ort, | |||
848 | if (ort->rt6i_dst.plen != 128 && | 848 | if (ort->rt6i_dst.plen != 128 && |
849 | ipv6_addr_equal(&ort->rt6i_dst.addr, daddr)) | 849 | ipv6_addr_equal(&ort->rt6i_dst.addr, daddr)) |
850 | rt->rt6i_flags |= RTF_ANYCAST; | 850 | rt->rt6i_flags |= RTF_ANYCAST; |
851 | rt->rt6i_gateway = *daddr; | ||
852 | } | 851 | } |
853 | 852 | ||
854 | rt->rt6i_flags |= RTF_CACHE; | 853 | rt->rt6i_flags |= RTF_CACHE; |
@@ -1245,6 +1244,7 @@ struct dst_entry *icmp6_dst_alloc(struct net_device *dev, | |||
1245 | rt->dst.flags |= DST_HOST; | 1244 | rt->dst.flags |= DST_HOST; |
1246 | rt->dst.output = ip6_output; | 1245 | rt->dst.output = ip6_output; |
1247 | atomic_set(&rt->dst.__refcnt, 1); | 1246 | atomic_set(&rt->dst.__refcnt, 1); |
1247 | rt->rt6i_gateway = fl6->daddr; | ||
1248 | rt->rt6i_dst.addr = fl6->daddr; | 1248 | rt->rt6i_dst.addr = fl6->daddr; |
1249 | rt->rt6i_dst.plen = 128; | 1249 | rt->rt6i_dst.plen = 128; |
1250 | rt->rt6i_idev = idev; | 1250 | rt->rt6i_idev = idev; |
@@ -1801,7 +1801,10 @@ static struct rt6_info *ip6_rt_copy(struct rt6_info *ort, | |||
1801 | in6_dev_hold(rt->rt6i_idev); | 1801 | in6_dev_hold(rt->rt6i_idev); |
1802 | rt->dst.lastuse = jiffies; | 1802 | rt->dst.lastuse = jiffies; |
1803 | 1803 | ||
1804 | rt->rt6i_gateway = ort->rt6i_gateway; | 1804 | if (ort->rt6i_flags & RTF_GATEWAY) |
1805 | rt->rt6i_gateway = ort->rt6i_gateway; | ||
1806 | else | ||
1807 | rt->rt6i_gateway = *dest; | ||
1805 | rt->rt6i_flags = ort->rt6i_flags; | 1808 | rt->rt6i_flags = ort->rt6i_flags; |
1806 | if ((ort->rt6i_flags & (RTF_DEFAULT | RTF_ADDRCONF)) == | 1809 | if ((ort->rt6i_flags & (RTF_DEFAULT | RTF_ADDRCONF)) == |
1807 | (RTF_DEFAULT | RTF_ADDRCONF)) | 1810 | (RTF_DEFAULT | RTF_ADDRCONF)) |
@@ -2088,6 +2091,7 @@ struct rt6_info *addrconf_dst_alloc(struct inet6_dev *idev, | |||
2088 | else | 2091 | else |
2089 | rt->rt6i_flags |= RTF_LOCAL; | 2092 | rt->rt6i_flags |= RTF_LOCAL; |
2090 | 2093 | ||
2094 | rt->rt6i_gateway = *addr; | ||
2091 | rt->rt6i_dst.addr = *addr; | 2095 | rt->rt6i_dst.addr = *addr; |
2092 | rt->rt6i_dst.plen = 128; | 2096 | rt->rt6i_dst.plen = 128; |
2093 | rt->rt6i_table = fib6_get_table(net, RT6_TABLE_LOCAL); | 2097 | rt->rt6i_table = fib6_get_table(net, RT6_TABLE_LOCAL); |