aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/route.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-12-06 17:04:13 -0500
committerDavid S. Miller <davem@davemloft.net>2011-12-06 17:04:13 -0500
commit87a115783eca7a424eef599d6f10a499f85f59c8 (patch)
tree4b80b4d2ea9a61253f89570f63da1ab9a356dfa4 /net/ipv6/route.c
parent8f0315190dec88bf035d50e4fd1db89859b414f6 (diff)
ipv6: Move xfrm_lookup() call down into icmp6_dst_alloc().
And return error pointers. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/route.c')
-rw-r--r--net/ipv6/route.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index f0b582b26209..d98cf41edf2a 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1068,8 +1068,9 @@ static DEFINE_SPINLOCK(icmp6_dst_lock);
1068 1068
1069struct dst_entry *icmp6_dst_alloc(struct net_device *dev, 1069struct dst_entry *icmp6_dst_alloc(struct net_device *dev,
1070 struct neighbour *neigh, 1070 struct neighbour *neigh,
1071 const struct in6_addr *addr) 1071 struct flowi6 *fl6)
1072{ 1072{
1073 struct dst_entry *dst;
1073 struct rt6_info *rt; 1074 struct rt6_info *rt;
1074 struct inet6_dev *idev = in6_dev_get(dev); 1075 struct inet6_dev *idev = in6_dev_get(dev);
1075 struct net *net = dev_net(dev); 1076 struct net *net = dev_net(dev);
@@ -1080,13 +1081,14 @@ struct dst_entry *icmp6_dst_alloc(struct net_device *dev,
1080 rt = ip6_dst_alloc(&net->ipv6.ip6_dst_ops, dev, 0); 1081 rt = ip6_dst_alloc(&net->ipv6.ip6_dst_ops, dev, 0);
1081 if (unlikely(!rt)) { 1082 if (unlikely(!rt)) {
1082 in6_dev_put(idev); 1083 in6_dev_put(idev);
1084 dst = ERR_PTR(-ENOMEM);
1083 goto out; 1085 goto out;
1084 } 1086 }
1085 1087
1086 if (neigh) 1088 if (neigh)
1087 neigh_hold(neigh); 1089 neigh_hold(neigh);
1088 else { 1090 else {
1089 neigh = __neigh_lookup_errno(&nd_tbl, addr, dev); 1091 neigh = __neigh_lookup_errno(&nd_tbl, &fl6->daddr, dev);
1090 if (IS_ERR(neigh)) 1092 if (IS_ERR(neigh))
1091 neigh = NULL; 1093 neigh = NULL;
1092 } 1094 }
@@ -1095,7 +1097,7 @@ struct dst_entry *icmp6_dst_alloc(struct net_device *dev,
1095 rt->dst.output = ip6_output; 1097 rt->dst.output = ip6_output;
1096 dst_set_neighbour(&rt->dst, neigh); 1098 dst_set_neighbour(&rt->dst, neigh);
1097 atomic_set(&rt->dst.__refcnt, 1); 1099 atomic_set(&rt->dst.__refcnt, 1);
1098 rt->rt6i_dst.addr = *addr; 1100 rt->rt6i_dst.addr = fl6->daddr;
1099 rt->rt6i_dst.plen = 128; 1101 rt->rt6i_dst.plen = 128;
1100 rt->rt6i_idev = idev; 1102 rt->rt6i_idev = idev;
1101 dst_metric_set(&rt->dst, RTAX_HOPLIMIT, 255); 1103 dst_metric_set(&rt->dst, RTAX_HOPLIMIT, 255);
@@ -1107,8 +1109,10 @@ struct dst_entry *icmp6_dst_alloc(struct net_device *dev,
1107 1109
1108 fib6_force_start_gc(net); 1110 fib6_force_start_gc(net);
1109 1111
1112 dst = xfrm_lookup(net, &rt->dst, flowi6_to_flowi(fl6), NULL, 0);
1113
1110out: 1114out:
1111 return &rt->dst; 1115 return dst;
1112} 1116}
1113 1117
1114int icmp6_dst_gc(void) 1118int icmp6_dst_gc(void)