diff options
author | David S. Miller <davem@davemloft.net> | 2011-03-01 16:19:07 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-03-01 16:19:07 -0500 |
commit | 68d0c6d34d586a893292d4fb633a3bf8c547b222 (patch) | |
tree | b6d812307621873cf16000171563c1f68b5bc255 /net/ipv6/udp.c | |
parent | 903ab86d195cca295379699299c5fc10beba31c7 (diff) |
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: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/udp.c')
-rw-r--r-- | net/ipv6/udp.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index a419a787eb69..d86d7f67a597 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c | |||
@@ -1125,18 +1125,11 @@ do_udp_sendmsg: | |||
1125 | 1125 | ||
1126 | security_sk_classify_flow(sk, &fl); | 1126 | security_sk_classify_flow(sk, &fl); |
1127 | 1127 | ||
1128 | err = ip6_sk_dst_lookup(sk, &dst, &fl); | 1128 | dst = ip6_sk_dst_lookup_flow(sk, &fl, final_p, true); |
1129 | if (err) | 1129 | if (IS_ERR(dst)) { |
1130 | err = PTR_ERR(dst); | ||
1131 | dst = NULL; | ||
1130 | goto out; | 1132 | goto out; |
1131 | if (final_p) | ||
1132 | ipv6_addr_copy(&fl.fl6_dst, final_p); | ||
1133 | |||
1134 | err = __xfrm_lookup(sock_net(sk), &dst, &fl, sk, XFRM_LOOKUP_WAIT); | ||
1135 | if (err < 0) { | ||
1136 | if (err == -EREMOTE) | ||
1137 | err = ip6_dst_blackhole(sk, &dst, &fl); | ||
1138 | if (err < 0) | ||
1139 | goto out; | ||
1140 | } | 1133 | } |
1141 | 1134 | ||
1142 | if (hlimit < 0) { | 1135 | if (hlimit < 0) { |