diff options
author | David S. Miller <davem@davemloft.net> | 2011-05-06 19:11:19 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-05-08 16:18:54 -0400 |
commit | da905bd1d5a6480d206f4b3dc61243f95adfae2c (patch) | |
tree | 4446793e7431afc784f10776516da033d603a542 /net/ipv4/tcp_ipv4.c | |
parent | 2c42758cf6683e9c1657d20dcf2a7edd323d98ca (diff) |
tcp: Use cork flow in tcp_v4_connect()
Since this is invoked from inet_stream_connect() the socket is locked
and therefore this usage is safe.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_ipv4.c')
-rw-r--r-- | net/ipv4/tcp_ipv4.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index f3d16d8918c7..a71217156856 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -151,7 +151,7 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
151 | struct tcp_sock *tp = tcp_sk(sk); | 151 | struct tcp_sock *tp = tcp_sk(sk); |
152 | __be16 orig_sport, orig_dport; | 152 | __be16 orig_sport, orig_dport; |
153 | __be32 daddr, nexthop; | 153 | __be32 daddr, nexthop; |
154 | struct flowi4 fl4; | 154 | struct flowi4 *fl4; |
155 | struct rtable *rt; | 155 | struct rtable *rt; |
156 | int err; | 156 | int err; |
157 | struct ip_options_rcu *inet_opt; | 157 | struct ip_options_rcu *inet_opt; |
@@ -173,7 +173,8 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
173 | 173 | ||
174 | orig_sport = inet->inet_sport; | 174 | orig_sport = inet->inet_sport; |
175 | orig_dport = usin->sin_port; | 175 | orig_dport = usin->sin_port; |
176 | rt = ip_route_connect(&fl4, nexthop, inet->inet_saddr, | 176 | fl4 = &inet->cork.fl.u.ip4; |
177 | rt = ip_route_connect(fl4, nexthop, inet->inet_saddr, | ||
177 | RT_CONN_FLAGS(sk), sk->sk_bound_dev_if, | 178 | RT_CONN_FLAGS(sk), sk->sk_bound_dev_if, |
178 | IPPROTO_TCP, | 179 | IPPROTO_TCP, |
179 | orig_sport, orig_dport, sk, true); | 180 | orig_sport, orig_dport, sk, true); |
@@ -190,10 +191,10 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
190 | } | 191 | } |
191 | 192 | ||
192 | if (!inet_opt || !inet_opt->opt.srr) | 193 | if (!inet_opt || !inet_opt->opt.srr) |
193 | daddr = fl4.daddr; | 194 | daddr = fl4->daddr; |
194 | 195 | ||
195 | if (!inet->inet_saddr) | 196 | if (!inet->inet_saddr) |
196 | inet->inet_saddr = fl4.saddr; | 197 | inet->inet_saddr = fl4->saddr; |
197 | inet->inet_rcv_saddr = inet->inet_saddr; | 198 | inet->inet_rcv_saddr = inet->inet_saddr; |
198 | 199 | ||
199 | if (tp->rx_opt.ts_recent_stamp && inet->inet_daddr != daddr) { | 200 | if (tp->rx_opt.ts_recent_stamp && inet->inet_daddr != daddr) { |
@@ -204,7 +205,7 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
204 | } | 205 | } |
205 | 206 | ||
206 | if (tcp_death_row.sysctl_tw_recycle && | 207 | if (tcp_death_row.sysctl_tw_recycle && |
207 | !tp->rx_opt.ts_recent_stamp && fl4.daddr == daddr) { | 208 | !tp->rx_opt.ts_recent_stamp && fl4->daddr == daddr) { |
208 | struct inet_peer *peer = rt_get_peer(rt); | 209 | struct inet_peer *peer = rt_get_peer(rt); |
209 | /* | 210 | /* |
210 | * VJ's idea. We save last timestamp seen from | 211 | * VJ's idea. We save last timestamp seen from |
@@ -240,7 +241,7 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
240 | if (err) | 241 | if (err) |
241 | goto failure; | 242 | goto failure; |
242 | 243 | ||
243 | rt = ip_route_newports(&fl4, rt, orig_sport, orig_dport, | 244 | rt = ip_route_newports(fl4, rt, orig_sport, orig_dport, |
244 | inet->inet_sport, inet->inet_dport, sk); | 245 | inet->inet_sport, inet->inet_dport, sk); |
245 | if (IS_ERR(rt)) { | 246 | if (IS_ERR(rt)) { |
246 | err = PTR_ERR(rt); | 247 | err = PTR_ERR(rt); |