From patchwork Sun Aug 19 03:56:59 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neal Cardwell X-Patchwork-Id: 178525 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 D005B2C0094 for ; Sun, 19 Aug 2012 13:57:23 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751288Ab2HSD5K (ORCPT ); Sat, 18 Aug 2012 23:57:10 -0400 Received: from mail-wi0-f202.google.com ([209.85.212.202]:57743 "EHLO mail-wi0-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750918Ab2HSD5J (ORCPT ); Sat, 18 Aug 2012 23:57:09 -0400 Received: by wibhr14 with SMTP id hr14so144447wib.1 for ; Sat, 18 Aug 2012 20:57:07 -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; bh=OfU23SM98HbkHWScd56kuvl7t/NLk5gXS5SvvfXA6J4=; b=IdmIHGLbU9dncuNVo/OKY9srj6ETpLHTvQu5P0EDhHDqTWZ3a5EZeqILXiaDiteSZB tYBdujITj/kVSHYfgE6YXab47yIZoN487mrZrbBeZLSfph73hSFwtN6BkT1eZT/rMJJ8 pnsQnFsDzU+wL8dCyNZaWcB/3qDo+w6NnuSZDR4FK9dYFAwQPdAub//DlJXLbaSTzZ/8 QlqPLK9MHvWbvs/CgNtJgaOYIGPh94YyjA+5v5xDSEGTsNBEOgN0tfFxp9y7ppWXlY79 bullBSarVl+tn+1yneMRXwDWL87d3mVTfMTo5Tpcnkopy7GXUelIWa60Dxuunb0jNV4c +4/A== 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:x-gm-message-state; bh=OfU23SM98HbkHWScd56kuvl7t/NLk5gXS5SvvfXA6J4=; b=Sxp8IHkSOU1Jb8U6+kAeaIR02SA0745yFfSEr/XulvsgJRvE1YJCpa4R3Iqp5Sd2+4 yTZQ6ZcU3hkAtUhmB0PEcUzvBABjqJhY86JE2qeYBzihhEmJgtviIUM6ig8tLtBBYjNq nyJBY5GK6+pO+B+0tSUCfeMBUw7JZHFnjo4FSsz/77yAqa2k6A0x9wPyJ8ESM6PagXYB /5MyEj5LpVAhhzbdf4WD7OedbGjYQD3h/ZXs26NBGE1bumuEGCSmbfHhzU3pYjbg4xbg kMXdcZJQJXD7oLrJC6Lx1iA7DewkCRLBmE9rkmhftu5VgskJBFST14QD3xUtmzYi8v5k kE4g== Received: by 10.14.220.131 with SMTP id o3mr1485894eep.6.1345348627297; Sat, 18 Aug 2012 20:57:07 -0700 (PDT) Received: by 10.14.220.131 with SMTP id o3mr1485891eep.6.1345348627204; Sat, 18 Aug 2012 20:57:07 -0700 (PDT) Received: from hpza9.eem.corp.google.com ([74.125.121.33]) by gmr-mx.google.com with ESMTPS id d5si16414703eep.0.2012.08.18.20.57.07 (version=TLSv1/SSLv3 cipher=AES128-SHA); Sat, 18 Aug 2012 20:57:07 -0700 (PDT) Received: from coy.nyc.corp.google.com (coy.nyc.corp.google.com [172.26.105.221]) by hpza9.eem.corp.google.com (Postfix) with ESMTP id 1A3225C0050; Sat, 18 Aug 2012 20:57:07 -0700 (PDT) Received: by coy.nyc.corp.google.com (Postfix, from userid 4318) id 72F701C05EC; Sat, 18 Aug 2012 23:57:06 -0400 (EDT) From: Neal Cardwell To: David Miller Cc: netdev@vger.kernel.org, Eric Dumazet , Neal Cardwell Subject: [PATCH] net: tcp: move sk_rx_dst_set call after tcp_create_openreq_child() Date: Sat, 18 Aug 2012 23:56:59 -0400 Message-Id: <1345348619-19327-1-git-send-email-ncardwell@google.com> X-Mailer: git-send-email 1.7.7.3 X-Gm-Message-State: ALoCoQnFeown4K1q5z25xe4dPld0ml8vgJYPWUevpor/8FWv6H41irnZXvao503EiTBNmReWNI+s7IhQFJ9+j+N2FUBIthoy8KbucWTBPMTea1kCtSi4ik0WZHzU5YW6xxQBQPRCeoAwRxRIwImLfLtUK/alXNHDL+pUsFPTv04EBqTSH3xQX5iZFBpBi8rQ0LbddTh1OlrI Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This commit removes the sk_rx_dst_set calls from tcp_create_openreq_child(), because at that point the icsk_af_ops field of ipv6_mapped TCP sockets has not been set to its proper final value. Instead, to make sure we get the right sk_rx_dst_set variant appropriate for the address family of the new connection, we have tcp_v{4,6}_syn_recv_sock() directly call the appropriate function shortly after the call to tcp_create_openreq_child() returns. Signed-off-by: Neal Cardwell Reported-by: Artem Savkov Cc: Eric Dumazet --- net/ipv4/tcp_ipv4.c | 1 + net/ipv4/tcp_minisocks.c | 2 -- net/ipv6/tcp_ipv6.c | 3 +++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 7678237..5bf2040 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -1462,6 +1462,7 @@ struct sock *tcp_v4_syn_recv_sock(struct sock *sk, struct sk_buff *skb, goto exit_nonewsk; newsk->sk_gso_type = SKB_GSO_TCPV4; + inet_sk_rx_dst_set(newsk, skb); newtp = tcp_sk(newsk); newinet = inet_sk(newsk); diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c index d9c9dce..6ff7f10 100644 --- a/net/ipv4/tcp_minisocks.c +++ b/net/ipv4/tcp_minisocks.c @@ -387,8 +387,6 @@ struct sock *tcp_create_openreq_child(struct sock *sk, struct request_sock *req, struct tcp_sock *oldtp = tcp_sk(sk); struct tcp_cookie_values *oldcvp = oldtp->cookie_values; - newicsk->icsk_af_ops->sk_rx_dst_set(newsk, skb); - /* TCP Cookie Transactions require space for the cookie pair, * as it differs for each connection. There is no need to * copy any s_data_payload stored at the original socket. diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index bb9ce2b..492c2d9 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c @@ -81,6 +81,8 @@ static void __tcp_v6_send_check(struct sk_buff *skb, const struct in6_addr *saddr, const struct in6_addr *daddr); +static void inet6_sk_rx_dst_set(struct sock *sk, const struct sk_buff *skb); + static const struct inet_connection_sock_af_ops ipv6_mapped; static const struct inet_connection_sock_af_ops ipv6_specific; #ifdef CONFIG_TCP_MD5SIG @@ -1270,6 +1272,7 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, newsk->sk_gso_type = SKB_GSO_TCPV6; __ip6_dst_store(newsk, dst, NULL, NULL); + inet6_sk_rx_dst_set(newsk, skb); newtcp6sk = (struct tcp6_sock *)newsk; inet_sk(newsk)->pinet6 = &newtcp6sk->inet6;