From patchwork Thu Jun 28 22:34:20 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neal Cardwell X-Patchwork-Id: 167967 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id EEDE6B6FFF for ; Fri, 29 Jun 2012 09:45:42 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753788Ab2F1Xpj (ORCPT ); Thu, 28 Jun 2012 19:45:39 -0400 Received: from mail-qa0-f74.google.com ([209.85.216.74]:37791 "EHLO mail-qa0-f74.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751825Ab2F1Xph (ORCPT ); Thu, 28 Jun 2012 19:45:37 -0400 Received: by qabg24 with SMTP id g24so68366qab.1 for ; Thu, 28 Jun 2012 16:45:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=h+fs7m+uqDix8OZfZn/uZDSqUp8ECTD7Yg63WHgu9Z8=; b=Hm/hlbIrPb0g7wncyTLAvZUn4qBdRFDaru7k7liYqmeqtn1zGct5FUX79Wd36MrmEa TN6lDOy6I4Gp0L5qbFXa2mWL4Qgo/hiuGbDvS8Wi6dseJ9u/pwV82Ex03qk+IFRkl7AS SdI4TEl6yx9w+BMPaqBgDogSK4+2Ki1WxFpg5qBLa0bd+n3/7NWTqcAVxjzoTKExnfMR vwR/vwUtAXCuQm0hM6xtbUY5T/9WDg7xiRuo8eCyv/1gN5nAMQDi9vfALPMoTIAJE5Ce 5p2uEkbyPnnzKAgtQKAtAPB7XmsqvxrirbsDNPJZRmKT5OVA9p/ka8yULjbRKcCaK44D OKZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=h+fs7m+uqDix8OZfZn/uZDSqUp8ECTD7Yg63WHgu9Z8=; b=PCAxk5Pn2aed3e9ocDjmyp7QVsbuI3G8Rl3wytlq6iZuxe82R322grkIMZKev1e4KH bZ0+K5PtcN4e5E+PGqrfSHCb8eyyC3IK61xSycvQVp0eLurT/ePQe66Ohe1kj9qk4ky2 Dje6o7mvlaDmggbrtDEVN9gvN+PJu5BA6EhW7IwVkYg244b8pQuas9KmA19H71T7P0db IPgAxgJej+eYjUa68izA3eThXtK4l/KbA2aHJfIN2+0HJeWMywtHDwjfvmaHejjVTsSr H0ZqZSGbdNIDYMh1XIGzAfR06HdII6QJzqEikRQntha4+vl3edbdit5rBqfaxblnvnew FhKg== Received: by 10.236.144.228 with SMTP id n64mr6427285yhj.5.1340927136486; Thu, 28 Jun 2012 16:45:36 -0700 (PDT) Received: by 10.236.144.228 with SMTP id n64mr6427279yhj.5.1340927136440; Thu, 28 Jun 2012 16:45:36 -0700 (PDT) Received: from wpzn3.hot.corp.google.com (216-239-44-65.google.com [216.239.44.65]) by gmr-mx.google.com with ESMTPS id z53si38245yhi.4.2012.06.28.16.45.36 (version=TLSv1/SSLv3 cipher=AES128-SHA); Thu, 28 Jun 2012 16:45:36 -0700 (PDT) Received: from ncardwell-vm (unknown [172.29.167.239]) by wpzn3.hot.corp.google.com (Postfix) with ESMTP id 2AF5B100048; Thu, 28 Jun 2012 16:45:36 -0700 (PDT) Received: by ncardwell-vm (Postfix, from userid 1000) id C29D31096D8; Thu, 28 Jun 2012 18:34:37 -0400 (EDT) From: Neal Cardwell To: David Miller Cc: netdev@vger.kernel.org, Eric Dumazet , Neal Cardwell Subject: [PATCH net-next 3/4] tcp: use inet6_csk_route_req() in tcp_v6_send_synack() Date: Thu, 28 Jun 2012 15:34:20 -0700 Message-Id: <1340922861-11684-3-git-send-email-ncardwell@google.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1340922861-11684-1-git-send-email-ncardwell@google.com> References: <1340922861-11684-1-git-send-email-ncardwell@google.com> X-Gm-Message-State: ALoCoQnlF5eZg2ulEf/bDxa9aUjCSDTgG2w+rffi9cAsGNBDpd9Zx6oAJYCUe3EM8HKaF7Elf/th9dqN4fzv22hUsYAUqCkGpRPQMkRs++E+pYF0Lw0Fjkf+SBbgJfMuf3hfWgV0ktWdbWC/QP8RJqJiAt5hR0bTc26oiv4GILnT64U07cPjbHu5euLrKMAT5LfWCS41SL7c Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- 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 3b79e94..c221086 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, struct inet6_request_sock *treq = inet6_rsk(req); struct ipv6_pinfo *np = inet6_sk(sk); struct sk_buff * skb; - struct ipv6_txoptions *opt = NULL; - struct in6_addr * final_p, final; + struct ipv6_txoptions *opt = np->opt; struct flowi6 fl6; struct dst_entry *dst; - int err; - - memset(&fl6, 0, sizeof(fl6)); - fl6.flowi6_proto = IPPROTO_TCP; - fl6.daddr = treq->rmt_addr; - fl6.saddr = treq->loc_addr; - fl6.flowlabel = 0; - fl6.flowi6_oif = treq->iif; - fl6.flowi6_mark = sk->sk_mark; - fl6.fl6_dport = inet_rsk(req)->rmt_port; - fl6.fl6_sport = inet_rsk(req)->loc_port; - security_req_classify_flow(req, flowi6_to_flowi(&fl6)); - - opt = np->opt; - final_p = fl6_update_dst(&fl6, opt, &final); + int err = -ENOMEM; - dst = ip6_dst_lookup_flow(sk, &fl6, final_p, false); - if (IS_ERR(dst)) { - err = PTR_ERR(dst); - dst = NULL; + dst = inet6_csk_route_req(sk, &fl6, req); + if (!dst) goto done; - } + skb = tcp_make_synack(sk, dst, req, rvp); - err = -ENOMEM; + if (skb) { __tcp_v6_send_check(skb, &treq->loc_addr, &treq->rmt_addr);