diff options
author | David S. Miller <davem@davemloft.net> | 2011-05-18 18:32:03 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-05-18 18:32:03 -0400 |
commit | 6bd023f3dddfc7c5f660089598c10e1f4167083b (patch) | |
tree | 925a7a31d3db434cfda8679cb46e466697ef8bdd /net/ipv4 | |
parent | 6882f933ccee5c3a86443ffc7621ce888b93ab6b (diff) |
ipv4: Make caller provide flowi4 key to inet_csk_route_req().
This way the caller can get at the fully resolved fl4->{daddr,saddr}
etc.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/inet_connection_sock.c | 10 | ||||
-rw-r--r-- | net/ipv4/tcp_ipv4.c | 6 |
2 files changed, 9 insertions, 7 deletions
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index 3a2ba5632dff..61fac4cabc78 100644 --- a/net/ipv4/inet_connection_sock.c +++ b/net/ipv4/inet_connection_sock.c | |||
@@ -350,24 +350,24 @@ void inet_csk_reset_keepalive_timer(struct sock *sk, unsigned long len) | |||
350 | EXPORT_SYMBOL(inet_csk_reset_keepalive_timer); | 350 | EXPORT_SYMBOL(inet_csk_reset_keepalive_timer); |
351 | 351 | ||
352 | struct dst_entry *inet_csk_route_req(struct sock *sk, | 352 | struct dst_entry *inet_csk_route_req(struct sock *sk, |
353 | struct flowi4 *fl4, | ||
353 | const struct request_sock *req) | 354 | const struct request_sock *req) |
354 | { | 355 | { |
355 | struct rtable *rt; | 356 | struct rtable *rt; |
356 | const struct inet_request_sock *ireq = inet_rsk(req); | 357 | const struct inet_request_sock *ireq = inet_rsk(req); |
357 | struct ip_options_rcu *opt = inet_rsk(req)->opt; | 358 | struct ip_options_rcu *opt = inet_rsk(req)->opt; |
358 | struct net *net = sock_net(sk); | 359 | struct net *net = sock_net(sk); |
359 | struct flowi4 fl4; | ||
360 | 360 | ||
361 | flowi4_init_output(&fl4, sk->sk_bound_dev_if, sk->sk_mark, | 361 | flowi4_init_output(fl4, sk->sk_bound_dev_if, sk->sk_mark, |
362 | RT_CONN_FLAGS(sk), RT_SCOPE_UNIVERSE, | 362 | RT_CONN_FLAGS(sk), RT_SCOPE_UNIVERSE, |
363 | sk->sk_protocol, inet_sk_flowi_flags(sk), | 363 | sk->sk_protocol, inet_sk_flowi_flags(sk), |
364 | (opt && opt->opt.srr) ? opt->opt.faddr : ireq->rmt_addr, | 364 | (opt && opt->opt.srr) ? opt->opt.faddr : ireq->rmt_addr, |
365 | ireq->loc_addr, ireq->rmt_port, inet_sk(sk)->inet_sport); | 365 | ireq->loc_addr, ireq->rmt_port, inet_sk(sk)->inet_sport); |
366 | security_req_classify_flow(req, flowi4_to_flowi(&fl4)); | 366 | security_req_classify_flow(req, flowi4_to_flowi(fl4)); |
367 | rt = ip_route_output_flow(net, &fl4, sk); | 367 | rt = ip_route_output_flow(net, fl4, sk); |
368 | if (IS_ERR(rt)) | 368 | if (IS_ERR(rt)) |
369 | goto no_route; | 369 | goto no_route; |
370 | if (opt && opt->opt.is_strictroute && fl4.daddr != rt->rt_gateway) | 370 | if (opt && opt->opt.is_strictroute && fl4->daddr != rt->rt_gateway) |
371 | goto route_err; | 371 | goto route_err; |
372 | return &rt->dst; | 372 | return &rt->dst; |
373 | 373 | ||
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index f67fb34e16e5..7e0bc604ebd2 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -769,11 +769,12 @@ static int tcp_v4_send_synack(struct sock *sk, struct dst_entry *dst, | |||
769 | struct request_values *rvp) | 769 | struct request_values *rvp) |
770 | { | 770 | { |
771 | const struct inet_request_sock *ireq = inet_rsk(req); | 771 | const struct inet_request_sock *ireq = inet_rsk(req); |
772 | struct flowi4 fl4; | ||
772 | int err = -1; | 773 | int err = -1; |
773 | struct sk_buff * skb; | 774 | struct sk_buff * skb; |
774 | 775 | ||
775 | /* First, grab a route. */ | 776 | /* First, grab a route. */ |
776 | if (!dst && (dst = inet_csk_route_req(sk, req)) == NULL) | 777 | if (!dst && (dst = inet_csk_route_req(sk, &fl4, req)) == NULL) |
777 | return -1; | 778 | return -1; |
778 | 779 | ||
779 | skb = tcp_make_synack(sk, dst, req, rvp); | 780 | skb = tcp_make_synack(sk, dst, req, rvp); |
@@ -1338,6 +1339,7 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb) | |||
1338 | req->cookie_ts = tmp_opt.tstamp_ok; | 1339 | req->cookie_ts = tmp_opt.tstamp_ok; |
1339 | } else if (!isn) { | 1340 | } else if (!isn) { |
1340 | struct inet_peer *peer = NULL; | 1341 | struct inet_peer *peer = NULL; |
1342 | struct flowi4 fl4; | ||
1341 | 1343 | ||
1342 | /* VJ's idea. We save last timestamp seen | 1344 | /* VJ's idea. We save last timestamp seen |
1343 | * from the destination in peer table, when entering | 1345 | * from the destination in peer table, when entering |
@@ -1350,7 +1352,7 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb) | |||
1350 | */ | 1352 | */ |
1351 | if (tmp_opt.saw_tstamp && | 1353 | if (tmp_opt.saw_tstamp && |
1352 | tcp_death_row.sysctl_tw_recycle && | 1354 | tcp_death_row.sysctl_tw_recycle && |
1353 | (dst = inet_csk_route_req(sk, req)) != NULL && | 1355 | (dst = inet_csk_route_req(sk, &fl4, req)) != NULL && |
1354 | (peer = rt_get_peer((struct rtable *)dst)) != NULL && | 1356 | (peer = rt_get_peer((struct rtable *)dst)) != NULL && |
1355 | peer->daddr.addr.a4 == saddr) { | 1357 | peer->daddr.addr.a4 == saddr) { |
1356 | inet_peer_refcheck(peer); | 1358 | inet_peer_refcheck(peer); |