This can be determined from the flow flags instead.
Signed-off-by: David S. Miller <davem@davemloft.net>
/* Flags for xfrm_lookup flags argument. */
enum {
- XFRM_LOOKUP_WAIT = 1 << 0,
- XFRM_LOOKUP_ICMP = 1 << 1,
+ XFRM_LOOKUP_ICMP = 1 << 0,
};
struct flowi;
err = __dn_route_output_key(pprt, fl, flags & MSG_TRYHARD);
if (err == 0 && fl->proto) {
- err = xfrm_lookup(&init_net, pprt, fl, sk,
- (flags & MSG_DONTWAIT) ? 0 : XFRM_LOOKUP_WAIT);
+ if (!(flags & MSG_DONTWAIT))
+ fl->flags |= FLOWI_FLAG_CAN_SLEEP;
+ err = xfrm_lookup(&init_net, pprt, fl, sk, 0);
}
return err;
}
flp->fl4_src = (*rp)->rt_src;
if (!flp->fl4_dst)
flp->fl4_dst = (*rp)->rt_dst;
- err = __xfrm_lookup(net, (struct dst_entry **)rp, flp, sk,
- ((flp->flags & FLOWI_FLAG_CAN_SLEEP) ?
- XFRM_LOOKUP_WAIT : 0));
+ err = __xfrm_lookup(net, (struct dst_entry **)rp, flp, sk, 0);
if (err == -EREMOTE)
err = ipv4_dst_blackhole(net, rp, flp);
ipv6_addr_copy(&fl->fl6_dst, final_dst);
if (can_sleep) {
fl->flags |= FLOWI_FLAG_CAN_SLEEP;
- err = __xfrm_lookup(sock_net(sk), &dst, fl, sk, XFRM_LOOKUP_WAIT);
+ err = __xfrm_lookup(sock_net(sk), &dst, fl, sk, 0);
if (err == -EREMOTE)
err = ip6_dst_blackhole(sk, &dst, fl);
if (err)
ipv6_addr_copy(&fl->fl6_dst, final_dst);
if (can_sleep) {
fl->flags |= FLOWI_FLAG_CAN_SLEEP;
- err = __xfrm_lookup(sock_net(sk), &dst, fl, sk, XFRM_LOOKUP_WAIT);
+ err = __xfrm_lookup(sock_net(sk), &dst, fl, sk, 0);
if (err == -EREMOTE)
err = ip6_dst_blackhole(sk, &dst, fl);
if (err)
XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTNOSTATES);
return -EREMOTE;
}
- if (flags & XFRM_LOOKUP_WAIT) {
+ if (fl->flags & FLOWI_FLAG_CAN_SLEEP) {
DECLARE_WAITQUEUE(wait, current);
add_wait_queue(&net->xfrm.km_waitq, &wait);