diff options
Diffstat (limited to 'net/ipv6/inet6_connection_sock.c')
-rw-r--r-- | net/ipv6/inet6_connection_sock.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c index 861d252bd1ba..e46305d1815a 100644 --- a/net/ipv6/inet6_connection_sock.c +++ b/net/ipv6/inet6_connection_sock.c | |||
@@ -54,6 +54,38 @@ int inet6_csk_bind_conflict(const struct sock *sk, | |||
54 | 54 | ||
55 | EXPORT_SYMBOL_GPL(inet6_csk_bind_conflict); | 55 | EXPORT_SYMBOL_GPL(inet6_csk_bind_conflict); |
56 | 56 | ||
57 | struct dst_entry *inet6_csk_route_req(struct sock *sk, | ||
58 | const struct request_sock *req) | ||
59 | { | ||
60 | struct inet6_request_sock *treq = inet6_rsk(req); | ||
61 | struct ipv6_pinfo *np = inet6_sk(sk); | ||
62 | struct in6_addr *final_p, final; | ||
63 | struct dst_entry *dst; | ||
64 | struct flowi fl; | ||
65 | |||
66 | memset(&fl, 0, sizeof(fl)); | ||
67 | fl.proto = IPPROTO_TCP; | ||
68 | ipv6_addr_copy(&fl.fl6_dst, &treq->rmt_addr); | ||
69 | final_p = fl6_update_dst(&fl, np->opt, &final); | ||
70 | ipv6_addr_copy(&fl.fl6_src, &treq->loc_addr); | ||
71 | fl.oif = sk->sk_bound_dev_if; | ||
72 | fl.mark = sk->sk_mark; | ||
73 | fl.fl_ip_dport = inet_rsk(req)->rmt_port; | ||
74 | fl.fl_ip_sport = inet_rsk(req)->loc_port; | ||
75 | security_req_classify_flow(req, &fl); | ||
76 | |||
77 | if (ip6_dst_lookup(sk, &dst, &fl)) | ||
78 | return NULL; | ||
79 | |||
80 | if (final_p) | ||
81 | ipv6_addr_copy(&fl.fl6_dst, final_p); | ||
82 | |||
83 | if ((xfrm_lookup(sock_net(sk), &dst, &fl, sk, 0)) < 0) | ||
84 | return NULL; | ||
85 | |||
86 | return dst; | ||
87 | } | ||
88 | |||
57 | /* | 89 | /* |
58 | * request_sock (formerly open request) hash tables. | 90 | * request_sock (formerly open request) hash tables. |
59 | */ | 91 | */ |