diff options
author | Neal Cardwell <ncardwell@google.com> | 2012-06-28 08:34:20 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-06-28 20:53:50 -0400 |
commit | 9494218fbae2f88bd3f9b887714734abfdf38bab (patch) | |
tree | b92ee490d2b399412c49ed6b193c747b36683499 /net | |
parent | 3840a06e6046aaee95f33a120499d2dc8c054b9d (diff) |
tcp: use inet6_csk_route_req() in tcp_v6_send_synack()
With the recent change (earlier in this patch series) to set
flowi6_oif to treq->iif in inet6_csk_route_req(), the dst lookup in
these two functions is now identical, so tcp_v6_send_synack() can now
just call inet6_csk_route_req(), to reduce code duplication and keep
things closer to the IPv4 side, which is structured this way.
Signed-off-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv6/tcp_ipv6.c | 29 |
1 files changed, 6 insertions, 23 deletions
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 4e5fa5f6ec6..d1db0caefdc 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -485,34 +485,17 @@ static int tcp_v6_send_synack(struct sock *sk, | |||
485 | struct inet6_request_sock *treq = inet6_rsk(req); | 485 | struct inet6_request_sock *treq = inet6_rsk(req); |
486 | struct ipv6_pinfo *np = inet6_sk(sk); | 486 | struct ipv6_pinfo *np = inet6_sk(sk); |
487 | struct sk_buff * skb; | 487 | struct sk_buff * skb; |
488 | struct ipv6_txoptions *opt = NULL; | 488 | struct ipv6_txoptions *opt = np->opt; |
489 | struct in6_addr * final_p, final; | ||
490 | struct flowi6 fl6; | 489 | struct flowi6 fl6; |
491 | struct dst_entry *dst; | 490 | struct dst_entry *dst; |
492 | int err; | 491 | int err = -ENOMEM; |
493 | |||
494 | memset(&fl6, 0, sizeof(fl6)); | ||
495 | fl6.flowi6_proto = IPPROTO_TCP; | ||
496 | fl6.daddr = treq->rmt_addr; | ||
497 | fl6.saddr = treq->loc_addr; | ||
498 | fl6.flowlabel = 0; | ||
499 | fl6.flowi6_oif = treq->iif; | ||
500 | fl6.flowi6_mark = sk->sk_mark; | ||
501 | fl6.fl6_dport = inet_rsk(req)->rmt_port; | ||
502 | fl6.fl6_sport = inet_rsk(req)->loc_port; | ||
503 | security_req_classify_flow(req, flowi6_to_flowi(&fl6)); | ||
504 | |||
505 | opt = np->opt; | ||
506 | final_p = fl6_update_dst(&fl6, opt, &final); | ||
507 | 492 | ||
508 | dst = ip6_dst_lookup_flow(sk, &fl6, final_p, false); | 493 | dst = inet6_csk_route_req(sk, &fl6, req); |
509 | if (IS_ERR(dst)) { | 494 | if (!dst) |
510 | err = PTR_ERR(dst); | ||
511 | dst = NULL; | ||
512 | goto done; | 495 | goto done; |
513 | } | 496 | |
514 | skb = tcp_make_synack(sk, dst, req, rvp); | 497 | skb = tcp_make_synack(sk, dst, req, rvp); |
515 | err = -ENOMEM; | 498 | |
516 | if (skb) { | 499 | if (skb) { |
517 | __tcp_v6_send_check(skb, &treq->loc_addr, &treq->rmt_addr); | 500 | __tcp_v6_send_check(skb, &treq->loc_addr, &treq->rmt_addr); |
518 | 501 | ||