@@ -270,10 +270,8 @@ static const struct xfrm_if_cb *xfrm_if_get_cb(void)
270270 return rcu_dereference (xfrm_if_cb );
271271}
272272
273- struct dst_entry * __xfrm_dst_lookup (struct net * net , int tos , int oif ,
274- const xfrm_address_t * saddr ,
275- const xfrm_address_t * daddr ,
276- int family , u32 mark )
273+ struct dst_entry * __xfrm_dst_lookup (int family ,
274+ const struct xfrm_dst_lookup_params * params )
277275{
278276 const struct xfrm_policy_afinfo * afinfo ;
279277 struct dst_entry * dst ;
@@ -282,7 +280,7 @@ struct dst_entry *__xfrm_dst_lookup(struct net *net, int tos, int oif,
282280 if (unlikely (afinfo == NULL ))
283281 return ERR_PTR (- EAFNOSUPPORT );
284282
285- dst = afinfo -> dst_lookup (net , tos , oif , saddr , daddr , mark );
283+ dst = afinfo -> dst_lookup (params );
286284
287285 rcu_read_unlock ();
288286
@@ -296,6 +294,7 @@ static inline struct dst_entry *xfrm_dst_lookup(struct xfrm_state *x,
296294 xfrm_address_t * prev_daddr ,
297295 int family , u32 mark )
298296{
297+ struct xfrm_dst_lookup_params params ;
299298 struct net * net = xs_net (x );
300299 xfrm_address_t * saddr = & x -> props .saddr ;
301300 xfrm_address_t * daddr = & x -> id .daddr ;
@@ -310,7 +309,14 @@ static inline struct dst_entry *xfrm_dst_lookup(struct xfrm_state *x,
310309 daddr = x -> coaddr ;
311310 }
312311
313- dst = __xfrm_dst_lookup (net , tos , oif , saddr , daddr , family , mark );
312+ params .net = net ;
313+ params .saddr = saddr ;
314+ params .daddr = daddr ;
315+ params .tos = tos ;
316+ params .oif = oif ;
317+ params .mark = mark ;
318+
319+ dst = __xfrm_dst_lookup (family , & params );
314320
315321 if (!IS_ERR (dst )) {
316322 if (prev_saddr != saddr )
@@ -2432,15 +2438,15 @@ int __xfrm_sk_clone_policy(struct sock *sk, const struct sock *osk)
24322438}
24332439
24342440static int
2435- xfrm_get_saddr (struct net * net , int oif , xfrm_address_t * local ,
2436- xfrm_address_t * remote , unsigned short family , u32 mark )
2441+ xfrm_get_saddr (unsigned short family , xfrm_address_t * saddr ,
2442+ const struct xfrm_dst_lookup_params * params )
24372443{
24382444 int err ;
24392445 const struct xfrm_policy_afinfo * afinfo = xfrm_policy_get_afinfo (family );
24402446
24412447 if (unlikely (afinfo == NULL ))
24422448 return - EINVAL ;
2443- err = afinfo -> get_saddr (net , oif , local , remote , mark );
2449+ err = afinfo -> get_saddr (saddr , params );
24442450 rcu_read_unlock ();
24452451 return err ;
24462452}
@@ -2469,9 +2475,14 @@ xfrm_tmpl_resolve_one(struct xfrm_policy *policy, const struct flowi *fl,
24692475 remote = & tmpl -> id .daddr ;
24702476 local = & tmpl -> saddr ;
24712477 if (xfrm_addr_any (local , tmpl -> encap_family )) {
2472- error = xfrm_get_saddr (net , fl -> flowi_oif ,
2473- & tmp , remote ,
2474- tmpl -> encap_family , 0 );
2478+ struct xfrm_dst_lookup_params params ;
2479+
2480+ memset (& params , 0 , sizeof (params ));
2481+ params .net = net ;
2482+ params .oif = fl -> flowi_oif ;
2483+ params .daddr = remote ;
2484+ error = xfrm_get_saddr (tmpl -> encap_family , & tmp ,
2485+ & params );
24752486 if (error )
24762487 goto fail ;
24772488 local = & tmp ;
0 commit comments