Commit 2c42758c authored by David S. Miller's avatar David S. Miller

dccp: Use cork flow in dccp_v4_connect()

Since this is invoked from inet_stream_connect() the socket is locked
and therefore this usage is safe.
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1ab7b6ac
...@@ -45,7 +45,7 @@ int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) ...@@ -45,7 +45,7 @@ int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
struct dccp_sock *dp = dccp_sk(sk); struct dccp_sock *dp = dccp_sk(sk);
__be16 orig_sport, orig_dport; __be16 orig_sport, orig_dport;
__be32 daddr, nexthop; __be32 daddr, nexthop;
struct flowi4 fl4; struct flowi4 *fl4;
struct rtable *rt; struct rtable *rt;
int err; int err;
struct ip_options_rcu *inet_opt; struct ip_options_rcu *inet_opt;
...@@ -70,7 +70,8 @@ int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) ...@@ -70,7 +70,8 @@ int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
orig_sport = inet->inet_sport; orig_sport = inet->inet_sport;
orig_dport = usin->sin_port; orig_dport = usin->sin_port;
rt = ip_route_connect(&fl4, nexthop, inet->inet_saddr, fl4 = &inet->cork.fl.u.ip4;
rt = ip_route_connect(fl4, nexthop, inet->inet_saddr,
RT_CONN_FLAGS(sk), sk->sk_bound_dev_if, RT_CONN_FLAGS(sk), sk->sk_bound_dev_if,
IPPROTO_DCCP, IPPROTO_DCCP,
orig_sport, orig_dport, sk, true); orig_sport, orig_dport, sk, true);
...@@ -83,10 +84,10 @@ int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) ...@@ -83,10 +84,10 @@ int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
} }
if (inet_opt == NULL || !inet_opt->opt.srr) if (inet_opt == NULL || !inet_opt->opt.srr)
daddr = fl4.daddr; daddr = fl4->daddr;
if (inet->inet_saddr == 0) if (inet->inet_saddr == 0)
inet->inet_saddr = fl4.saddr; inet->inet_saddr = fl4->saddr;
inet->inet_rcv_saddr = inet->inet_saddr; inet->inet_rcv_saddr = inet->inet_saddr;
inet->inet_dport = usin->sin_port; inet->inet_dport = usin->sin_port;
...@@ -106,7 +107,7 @@ int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) ...@@ -106,7 +107,7 @@ int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
if (err != 0) if (err != 0)
goto failure; goto failure;
rt = ip_route_newports(&fl4, rt, orig_sport, orig_dport, rt = ip_route_newports(fl4, rt, orig_sport, orig_dport,
inet->inet_sport, inet->inet_dport, sk); inet->inet_sport, inet->inet_dport, sk);
if (IS_ERR(rt)) { if (IS_ERR(rt)) {
rt = NULL; rt = NULL;
......
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