Commit 68d0c6d3 authored by David S. Miller's avatar David S. Miller

ipv6: Consolidate route lookup sequences.

Route lookups follow a general pattern in the ipv6 code wherein
we first find the non-IPSEC route, potentially override the
flow destination address due to ipv6 options settings, and then
finally make an IPSEC search using either xfrm_lookup() or
__xfrm_lookup().

__xfrm_lookup() is used when we want to generate a blackhole route
if the key manager needs to resolve the IPSEC rules (in this case
-EREMOTE is returned and the original 'dst' is left unchanged).

Otherwise plain xfrm_lookup() is used and when asynchronous IPSEC
resolution is necessary, we simply fail the lookup completely.

All of these cases are encapsulated into two routines,
ip6_dst_lookup_flow and ip6_sk_dst_lookup_flow.  The latter of which
handles unconnected UDP datagram sockets.
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 903ab86d
...@@ -512,12 +512,17 @@ extern void ip6_flush_pending_frames(struct sock *sk); ...@@ -512,12 +512,17 @@ extern void ip6_flush_pending_frames(struct sock *sk);
extern int ip6_dst_lookup(struct sock *sk, extern int ip6_dst_lookup(struct sock *sk,
struct dst_entry **dst, struct dst_entry **dst,
struct flowi *fl); struct flowi *fl);
extern struct dst_entry * ip6_dst_lookup_flow(struct sock *sk,
struct flowi *fl,
const struct in6_addr *final_dst,
bool want_blackhole);
extern struct dst_entry * ip6_sk_dst_lookup_flow(struct sock *sk,
struct flowi *fl,
const struct in6_addr *final_dst,
bool want_blackhole);
extern int ip6_dst_blackhole(struct sock *sk, extern int ip6_dst_blackhole(struct sock *sk,
struct dst_entry **dst, struct dst_entry **dst,
struct flowi *fl); struct flowi *fl);
extern int ip6_sk_dst_lookup(struct sock *sk,
struct dst_entry **dst,
struct flowi *fl);
/* /*
* skb processing functions * skb processing functions
......
...@@ -162,15 +162,9 @@ static void dccp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, ...@@ -162,15 +162,9 @@ static void dccp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
fl.fl_ip_sport = inet->inet_sport; fl.fl_ip_sport = inet->inet_sport;
security_sk_classify_flow(sk, &fl); security_sk_classify_flow(sk, &fl);
err = ip6_dst_lookup(sk, &dst, &fl); dst = ip6_dst_lookup_flow(sk, &fl, NULL, false);
if (err) { if (IS_ERR(dst)) {
sk->sk_err_soft = -err; sk->sk_err_soft = -PTR_ERR(dst);
goto out;
}
err = xfrm_lookup(net, &dst, &fl, sk, 0);
if (err < 0) {
sk->sk_err_soft = -err;
goto out; goto out;
} }
} else } else
...@@ -267,16 +261,12 @@ static int dccp_v6_send_response(struct sock *sk, struct request_sock *req, ...@@ -267,16 +261,12 @@ static int dccp_v6_send_response(struct sock *sk, struct request_sock *req,
final_p = fl6_update_dst(&fl, opt, &final); final_p = fl6_update_dst(&fl, opt, &final);
err = ip6_dst_lookup(sk, &dst, &fl); dst = ip6_dst_lookup_flow(sk, &fl, final_p, false);
if (err) if (IS_ERR(dst)) {
goto done; err = PTR_ERR(dst);
dst = NULL;
if (final_p)
ipv6_addr_copy(&fl.fl6_dst, final_p);
err = xfrm_lookup(sock_net(sk), &dst, &fl, sk, 0);
if (err < 0)
goto done; goto done;
}
skb = dccp_make_response(sk, dst, req); skb = dccp_make_response(sk, dst, req);
if (skb != NULL) { if (skb != NULL) {
...@@ -338,15 +328,14 @@ static void dccp_v6_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb) ...@@ -338,15 +328,14 @@ static void dccp_v6_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb)
security_skb_classify_flow(rxskb, &fl); security_skb_classify_flow(rxskb, &fl);
/* sk = NULL, but it is safe for now. RST socket required. */ /* sk = NULL, but it is safe for now. RST socket required. */
if (!ip6_dst_lookup(ctl_sk, &dst, &fl)) { dst = ip6_dst_lookup_flow(ctl_sk, &fl, NULL, false);
if (xfrm_lookup(net, &dst, &fl, NULL, 0) >= 0) { if (!IS_ERR(dst)) {
skb_dst_set(skb, dst); skb_dst_set(skb, dst);
ip6_xmit(ctl_sk, skb, &fl, NULL); ip6_xmit(ctl_sk, skb, &fl, NULL);
DCCP_INC_STATS_BH(DCCP_MIB_OUTSEGS); DCCP_INC_STATS_BH(DCCP_MIB_OUTSEGS);
DCCP_INC_STATS_BH(DCCP_MIB_OUTRSTS); DCCP_INC_STATS_BH(DCCP_MIB_OUTRSTS);
return; return;
} }
}
kfree_skb(skb); kfree_skb(skb);
} }
...@@ -550,13 +539,8 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk, ...@@ -550,13 +539,8 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk,
fl.fl_ip_sport = inet_rsk(req)->loc_port; fl.fl_ip_sport = inet_rsk(req)->loc_port;
security_sk_classify_flow(sk, &fl); security_sk_classify_flow(sk, &fl);
if (ip6_dst_lookup(sk, &dst, &fl)) dst = ip6_dst_lookup_flow(sk, &fl, final_p, false);
goto out; if (IS_ERR(dst))
if (final_p)
ipv6_addr_copy(&fl.fl6_dst, final_p);
if ((xfrm_lookup(sock_net(sk), &dst, &fl, sk, 0)) < 0)
goto out; goto out;
} }
...@@ -979,18 +963,9 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr, ...@@ -979,18 +963,9 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
final_p = fl6_update_dst(&fl, np->opt, &final); final_p = fl6_update_dst(&fl, np->opt, &final);
err = ip6_dst_lookup(sk, &dst, &fl); dst = ip6_dst_lookup_flow(sk, &fl, final_p, true);
if (err) if (IS_ERR(dst)) {
goto failure; err = PTR_ERR(dst);
if (final_p)
ipv6_addr_copy(&fl.fl6_dst, final_p);
err = __xfrm_lookup(sock_net(sk), &dst, &fl, sk, XFRM_LOOKUP_WAIT);
if (err < 0) {
if (err == -EREMOTE)
err = ip6_dst_blackhole(sk, &dst, &fl);
if (err < 0)
goto failure; goto failure;
} }
......
...@@ -644,9 +644,8 @@ EXPORT_SYMBOL(inet6_unregister_protosw); ...@@ -644,9 +644,8 @@ EXPORT_SYMBOL(inet6_unregister_protosw);
int inet6_sk_rebuild_header(struct sock *sk) int inet6_sk_rebuild_header(struct sock *sk)
{ {
int err;
struct dst_entry *dst;
struct ipv6_pinfo *np = inet6_sk(sk); struct ipv6_pinfo *np = inet6_sk(sk);
struct dst_entry *dst;
dst = __sk_dst_check(sk, np->dst_cookie); dst = __sk_dst_check(sk, np->dst_cookie);
...@@ -668,17 +667,11 @@ int inet6_sk_rebuild_header(struct sock *sk) ...@@ -668,17 +667,11 @@ int inet6_sk_rebuild_header(struct sock *sk)
final_p = fl6_update_dst(&fl, np->opt, &final); final_p = fl6_update_dst(&fl, np->opt, &final);
err = ip6_dst_lookup(sk, &dst, &fl); dst = ip6_dst_lookup_flow(sk, &fl, final_p, false);
if (err) { if (IS_ERR(dst)) {
sk->sk_route_caps = 0; sk->sk_route_caps = 0;
return err; sk->sk_err_soft = -PTR_ERR(dst);
} return PTR_ERR(dst);
if (final_p)
ipv6_addr_copy(&fl.fl6_dst, final_p);
if ((err = xfrm_lookup(sock_net(sk), &dst, &fl, sk, 0)) < 0) {
sk->sk_err_soft = -err;
return err;
} }
__ip6_dst_store(sk, dst, NULL, NULL); __ip6_dst_store(sk, dst, NULL, NULL);
......
...@@ -162,17 +162,10 @@ int ip6_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) ...@@ -162,17 +162,10 @@ int ip6_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
opt = flowlabel ? flowlabel->opt : np->opt; opt = flowlabel ? flowlabel->opt : np->opt;
final_p = fl6_update_dst(&fl, opt, &final); final_p = fl6_update_dst(&fl, opt, &final);
err = ip6_dst_lookup(sk, &dst, &fl); dst = ip6_dst_lookup_flow(sk, &fl, final_p, true);
if (err) err = 0;
goto out; if (IS_ERR(dst)) {
if (final_p) err = PTR_ERR(dst);
ipv6_addr_copy(&fl.fl6_dst, final_p);
err = __xfrm_lookup(sock_net(sk), &dst, &fl, sk, XFRM_LOOKUP_WAIT);
if (err < 0) {
if (err == -EREMOTE)
err = ip6_dst_blackhole(sk, &dst, &fl);
if (err < 0)
goto out; goto out;
} }
......
...@@ -74,13 +74,8 @@ struct dst_entry *inet6_csk_route_req(struct sock *sk, ...@@ -74,13 +74,8 @@ struct dst_entry *inet6_csk_route_req(struct sock *sk,
fl.fl_ip_sport = inet_rsk(req)->loc_port; fl.fl_ip_sport = inet_rsk(req)->loc_port;
security_req_classify_flow(req, &fl); security_req_classify_flow(req, &fl);
if (ip6_dst_lookup(sk, &dst, &fl)) dst = ip6_dst_lookup_flow(sk, &fl, final_p, false);
return NULL; if (IS_ERR(dst))
if (final_p)
ipv6_addr_copy(&fl.fl6_dst, final_p);
if ((xfrm_lookup(sock_net(sk), &dst, &fl, sk, 0)) < 0)
return NULL; return NULL;
return dst; return dst;
...@@ -234,21 +229,13 @@ int inet6_csk_xmit(struct sk_buff *skb) ...@@ -234,21 +229,13 @@ int inet6_csk_xmit(struct sk_buff *skb)
dst = __inet6_csk_dst_check(sk, np->dst_cookie); dst = __inet6_csk_dst_check(sk, np->dst_cookie);
if (dst == NULL) { if (dst == NULL) {
int err = ip6_dst_lookup(sk, &dst, &fl); dst = ip6_dst_lookup_flow(sk, &fl, final_p, false);
if (err) {
sk->sk_err_soft = -err;
kfree_skb(skb);
return err;
}
if (final_p)
ipv6_addr_copy(&fl.fl6_dst, final_p);
if ((err = xfrm_lookup(sock_net(sk), &dst, &fl, sk, 0)) < 0) { if (IS_ERR(dst)) {
sk->sk_err_soft = -PTR_ERR(dst);
sk->sk_route_caps = 0; sk->sk_route_caps = 0;
kfree_skb(skb); kfree_skb(skb);
return err; return PTR_ERR(dst);
} }
__inet6_csk_dst_store(sk, dst, NULL, NULL); __inet6_csk_dst_store(sk, dst, NULL, NULL);
......
...@@ -1002,29 +1002,87 @@ int ip6_dst_lookup(struct sock *sk, struct dst_entry **dst, struct flowi *fl) ...@@ -1002,29 +1002,87 @@ int ip6_dst_lookup(struct sock *sk, struct dst_entry **dst, struct flowi *fl)
EXPORT_SYMBOL_GPL(ip6_dst_lookup); EXPORT_SYMBOL_GPL(ip6_dst_lookup);
/** /**
* ip6_sk_dst_lookup - perform socket cached route lookup on flow * ip6_dst_lookup_flow - perform route lookup on flow with ipsec
* @sk: socket which provides route info
* @fl: flow to lookup
* @final_dst: final destination address for ipsec lookup
* @want_blackhole: IPSEC blackhole handling desired
*
* This function performs a route lookup on the given flow.
*
* It returns a valid dst pointer on success, or a pointer encoded
* error code.
*/
struct dst_entry *ip6_dst_lookup_flow(struct sock *sk, struct flowi *fl,
const struct in6_addr *final_dst,
bool want_blackhole)
{
struct dst_entry *dst = NULL;
int err;
err = ip6_dst_lookup_tail(sk, &dst, fl);
if (err)
return ERR_PTR(err);
if (final_dst)
ipv6_addr_copy(&fl->fl6_dst, final_dst);
if (want_blackhole) {
err = __xfrm_lookup(sock_net(sk), &dst, fl, sk, XFRM_LOOKUP_WAIT);
if (err == -EREMOTE)
err = ip6_dst_blackhole(sk, &dst, fl);
if (err)
return ERR_PTR(err);
} else {
err = xfrm_lookup(sock_net(sk), &dst, fl, sk, 0);
if (err)
return ERR_PTR(err);
}
return dst;
}
EXPORT_SYMBOL_GPL(ip6_dst_lookup_flow);
/**
* ip6_sk_dst_lookup_flow - perform socket cached route lookup on flow
* @sk: socket which provides the dst cache and route info * @sk: socket which provides the dst cache and route info
* @dst: pointer to dst_entry * for result
* @fl: flow to lookup * @fl: flow to lookup
* @final_dst: final destination address for ipsec lookup
* @want_blackhole: IPSEC blackhole handling desired
* *
* This function performs a route lookup on the given flow with the * This function performs a route lookup on the given flow with the
* possibility of using the cached route in the socket if it is valid. * possibility of using the cached route in the socket if it is valid.
* It will take the socket dst lock when operating on the dst cache. * It will take the socket dst lock when operating on the dst cache.
* As a result, this function can only be used in process context. * As a result, this function can only be used in process context.
* *
* It returns zero on success, or a standard errno code on error. * It returns a valid dst pointer on success, or a pointer encoded
* error code.
*/ */
int ip6_sk_dst_lookup(struct sock *sk, struct dst_entry **dst, struct flowi *fl) struct dst_entry *ip6_sk_dst_lookup_flow(struct sock *sk, struct flowi *fl,
const struct in6_addr *final_dst,
bool want_blackhole)
{ {
*dst = NULL; struct dst_entry *dst = sk_dst_check(sk, inet6_sk(sk)->dst_cookie);
if (sk) { int err;
*dst = sk_dst_check(sk, inet6_sk(sk)->dst_cookie);
*dst = ip6_sk_dst_check(sk, *dst, fl);
}
return ip6_dst_lookup_tail(sk, dst, fl); dst = ip6_sk_dst_check(sk, dst, fl);
err = ip6_dst_lookup_tail(sk, &dst, fl);
if (err)
return ERR_PTR(err);
if (final_dst)
ipv6_addr_copy(&fl->fl6_dst, final_dst);
if (want_blackhole) {
err = __xfrm_lookup(sock_net(sk), &dst, fl, sk, XFRM_LOOKUP_WAIT);
if (err == -EREMOTE)
err = ip6_dst_blackhole(sk, &dst, fl);
if (err)
return ERR_PTR(err);
} else {
err = xfrm_lookup(sock_net(sk), &dst, fl, sk, 0);
if (err)
return ERR_PTR(err);
}
return dst;
} }
EXPORT_SYMBOL_GPL(ip6_sk_dst_lookup); EXPORT_SYMBOL_GPL(ip6_sk_dst_lookup_flow);
static inline int ip6_ufo_append_data(struct sock *sk, static inline int ip6_ufo_append_data(struct sock *sk,
int getfrag(void *from, char *to, int offset, int len, int getfrag(void *from, char *to, int offset, int len,
......
...@@ -856,20 +856,11 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk, ...@@ -856,20 +856,11 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk,
fl.oif = np->mcast_oif; fl.oif = np->mcast_oif;
security_sk_classify_flow(sk, &fl); security_sk_classify_flow(sk, &fl);
err = ip6_dst_lookup(sk, &dst, &fl); dst = ip6_dst_lookup_flow(sk, &fl, final_p, true);
if (err) if (IS_ERR(dst)) {
goto out; err = PTR_ERR(dst);
if (final_p)
ipv6_addr_copy(&fl.fl6_dst, final_p);
err = __xfrm_lookup(sock_net(sk), &dst, &fl, sk, XFRM_LOOKUP_WAIT);
if (err < 0) {
if (err == -EREMOTE)
err = ip6_dst_blackhole(sk, &dst, &fl);
if (err < 0)
goto out; goto out;
} }
if (hlimit < 0) { if (hlimit < 0) {
if (ipv6_addr_is_multicast(&fl.fl6_dst)) if (ipv6_addr_is_multicast(&fl.fl6_dst))
hlimit = np->mcast_hops; hlimit = np->mcast_hops;
......
...@@ -243,12 +243,9 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb) ...@@ -243,12 +243,9 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)
fl.fl_ip_dport = inet_rsk(req)->rmt_port; fl.fl_ip_dport = inet_rsk(req)->rmt_port;
fl.fl_ip_sport = inet_sk(sk)->inet_sport; fl.fl_ip_sport = inet_sk(sk)->inet_sport;
security_req_classify_flow(req, &fl); security_req_classify_flow(req, &fl);
if (ip6_dst_lookup(sk, &dst, &fl))
goto out_free;
if (final_p) dst = ip6_dst_lookup_flow(sk, &fl, final_p, false);
ipv6_addr_copy(&fl.fl6_dst, final_p); if (IS_ERR(dst))
if ((xfrm_lookup(sock_net(sk), &dst, &fl, sk, 0)) < 0)
goto out_free; goto out_free;
} }
......
...@@ -255,17 +255,9 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, ...@@ -255,17 +255,9 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
security_sk_classify_flow(sk, &fl); security_sk_classify_flow(sk, &fl);
err = ip6_dst_lookup(sk, &dst, &fl); dst = ip6_dst_lookup_flow(sk, &fl, final_p, true);
if (err) if (IS_ERR(dst)) {
goto failure; err = PTR_ERR(dst);
if (final_p)
ipv6_addr_copy(&fl.fl6_dst, final_p);
err = __xfrm_lookup(sock_net(sk), &dst, &fl, sk, XFRM_LOOKUP_WAIT);
if (err < 0) {
if (err == -EREMOTE)
err = ip6_dst_blackhole(sk, &dst, &fl);
if (err < 0)
goto failure; goto failure;
} }
...@@ -385,7 +377,7 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, ...@@ -385,7 +377,7 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
np = inet6_sk(sk); np = inet6_sk(sk);
if (type == ICMPV6_PKT_TOOBIG) { if (type == ICMPV6_PKT_TOOBIG) {
struct dst_entry *dst = NULL; struct dst_entry *dst;
if (sock_owned_by_user(sk)) if (sock_owned_by_user(sk))
goto out; goto out;
...@@ -413,13 +405,9 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, ...@@ -413,13 +405,9 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
fl.fl_ip_sport = inet->inet_sport; fl.fl_ip_sport = inet->inet_sport;
security_skb_classify_flow(skb, &fl); security_skb_classify_flow(skb, &fl);
if ((err = ip6_dst_lookup(sk, &dst, &fl))) { dst = ip6_dst_lookup_flow(sk, &fl, NULL, false);
sk->sk_err_soft = -err; if (IS_ERR(dst)) {
goto out; sk->sk_err_soft = -PTR_ERR(dst);
}
if ((err = xfrm_lookup(net, &dst, &fl, sk, 0)) < 0) {
sk->sk_err_soft = -err;
goto out; goto out;
} }
...@@ -496,7 +484,7 @@ static int tcp_v6_send_synack(struct sock *sk, struct request_sock *req, ...@@ -496,7 +484,7 @@ static int tcp_v6_send_synack(struct sock *sk, struct request_sock *req,
struct in6_addr * final_p, final; struct in6_addr * final_p, final;
struct flowi fl; struct flowi fl;
struct dst_entry *dst; struct dst_entry *dst;
int err = -1; int err;
memset(&fl, 0, sizeof(fl)); memset(&fl, 0, sizeof(fl));
fl.proto = IPPROTO_TCP; fl.proto = IPPROTO_TCP;
...@@ -512,15 +500,13 @@ static int tcp_v6_send_synack(struct sock *sk, struct request_sock *req, ...@@ -512,15 +500,13 @@ static int tcp_v6_send_synack(struct sock *sk, struct request_sock *req,
opt = np->opt; opt = np->opt;
final_p = fl6_update_dst(&fl, opt, &final); final_p = fl6_update_dst(&fl, opt, &final);
err = ip6_dst_lookup(sk, &dst, &fl); dst = ip6_dst_lookup_flow(sk, &fl, final_p, false);
if (err) if (IS_ERR(dst)) {
goto done; err = PTR_ERR(dst);
if (final_p)
ipv6_addr_copy(&fl.fl6_dst, final_p);
if ((err = xfrm_lookup(sock_net(sk), &dst, &fl, sk, 0)) < 0)
goto done; goto done;
}
skb = tcp_make_synack(sk, dst, req, rvp); skb = tcp_make_synack(sk, dst, req, rvp);
err = -ENOMEM;
if (skb) { if (skb) {
__tcp_v6_send_check(skb, &treq->loc_addr, &treq->rmt_addr); __tcp_v6_send_check(skb, &treq->loc_addr, &treq->rmt_addr);
...@@ -1079,8 +1065,8 @@ static void tcp_v6_send_response(struct sk_buff *skb, u32 seq, u32 ack, u32 win, ...@@ -1079,8 +1065,8 @@ static void tcp_v6_send_response(struct sk_buff *skb, u32 seq, u32 ack, u32 win,
* Underlying function will use this to retrieve the network * Underlying function will use this to retrieve the network
* namespace * namespace
*/ */
if (!ip6_dst_lookup(ctl_sk, &dst, &fl)) { dst = ip6_dst_lookup_flow(ctl_sk, &fl, NULL, false);
if (xfrm_lookup(net, &dst, &fl, NULL, 0) >= 0) { if (!IS_ERR(dst)) {
skb_dst_set(buff, dst); skb_dst_set(buff, dst);
ip6_xmit(ctl_sk, buff, &fl, NULL); ip6_xmit(ctl_sk, buff, &fl, NULL);
TCP_INC_STATS_BH(net, TCP_MIB_OUTSEGS); TCP_INC_STATS_BH(net, TCP_MIB_OUTSEGS);
...@@ -1088,7 +1074,6 @@ static void tcp_v6_send_response(struct sk_buff *skb, u32 seq, u32 ack, u32 win, ...@@ -1088,7 +1074,6 @@ static void tcp_v6_send_response(struct sk_buff *skb, u32 seq, u32 ack, u32 win,
TCP_INC_STATS_BH(net, TCP_MIB_OUTRSTS); TCP_INC_STATS_BH(net, TCP_MIB_OUTRSTS);
return; return;
} }
}
kfree_skb(buff); kfree_skb(buff);
} }
......
...@@ -1125,17 +1125,10 @@ int udpv6_sendmsg(struct kiocb *iocb, struct sock *sk, ...@@ -1125,17 +1125,10 @@ int udpv6_sendmsg(struct kiocb *iocb, struct sock *sk,
security_sk_classify_flow(sk, &fl); security_sk_classify_flow(sk, &fl);
err = ip6_sk_dst_lookup(sk, &dst, &fl); dst = ip6_sk_dst_lookup_flow(sk, &fl, final_p, true);
if (err) if (IS_ERR(dst)) {
goto out; err = PTR_ERR(dst);
if (final_p) dst = NULL;
ipv6_addr_copy(&fl.fl6_dst, final_p);
err = __xfrm_lookup(sock_net(sk), &dst, &fl, sk, XFRM_LOOKUP_WAIT);
if (err < 0) {
if (err == -EREMOTE)
err = ip6_dst_blackhole(sk, &dst, &fl);
if (err < 0)
goto out; goto out;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment