@@ -1068,8 +1068,9 @@ static DEFINE_SPINLOCK(icmp6_dst_lock);
10681068
10691069struct dst_entry * icmp6_dst_alloc (struct net_device * dev ,
10701070 struct neighbour * neigh ,
1071- const struct in6_addr * addr )
1071+ struct flowi6 * fl6 )
10721072{
1073+ struct dst_entry * dst ;
10731074 struct rt6_info * rt ;
10741075 struct inet6_dev * idev = in6_dev_get (dev );
10751076 struct net * net = dev_net (dev );
@@ -1080,13 +1081,14 @@ struct dst_entry *icmp6_dst_alloc(struct net_device *dev,
10801081 rt = ip6_dst_alloc (& net -> ipv6 .ip6_dst_ops , dev , 0 );
10811082 if (unlikely (!rt )) {
10821083 in6_dev_put (idev );
1084+ dst = ERR_PTR (- ENOMEM );
10831085 goto out ;
10841086 }
10851087
10861088 if (neigh )
10871089 neigh_hold (neigh );
10881090 else {
1089- neigh = __neigh_lookup_errno (& nd_tbl , addr , dev );
1091+ neigh = __neigh_lookup_errno (& nd_tbl , & fl6 -> daddr , dev );
10901092 if (IS_ERR (neigh ))
10911093 neigh = NULL ;
10921094 }
@@ -1095,7 +1097,7 @@ struct dst_entry *icmp6_dst_alloc(struct net_device *dev,
10951097 rt -> dst .output = ip6_output ;
10961098 dst_set_neighbour (& rt -> dst , neigh );
10971099 atomic_set (& rt -> dst .__refcnt , 1 );
1098- rt -> rt6i_dst .addr = * addr ;
1100+ rt -> rt6i_dst .addr = fl6 -> daddr ;
10991101 rt -> rt6i_dst .plen = 128 ;
11001102 rt -> rt6i_idev = idev ;
11011103 dst_metric_set (& rt -> dst , RTAX_HOPLIMIT , 255 );
@@ -1107,8 +1109,10 @@ struct dst_entry *icmp6_dst_alloc(struct net_device *dev,
11071109
11081110 fib6_force_start_gc (net );
11091111
1112+ dst = xfrm_lookup (net , & rt -> dst , flowi6_to_flowi (fl6 ), NULL , 0 );
1113+
11101114out :
1111- return & rt -> dst ;
1115+ return dst ;
11121116}
11131117
11141118int icmp6_dst_gc (void )
0 commit comments