diff options
-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); |