From patchwork Wed Nov 13 06:45:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Krystad X-Patchwork-Id: 1194082 X-Patchwork-Delegate: matthieu.baerts@tessares.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.01.org (client-ip=198.145.21.10; helo=ml01.01.org; envelope-from=mptcp-bounces@lists.01.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.intel.com Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47CZqq4ZNxz9sPc for ; Wed, 13 Nov 2019 17:45:26 +1100 (AEDT) Received: from new-ml01.vlan13.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 9FD81100DC434; Tue, 12 Nov 2019 22:47:04 -0800 (PST) Received-SPF: None (mailfrom) identity=mailfrom; client-ip=134.134.136.24; helo=mga09.intel.com; envelope-from=peter.krystad@linux.intel.com; receiver= Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 0A6FE100EA622 for ; Tue, 12 Nov 2019 22:47:02 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Nov 2019 22:45:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,299,1569308400"; d="scan'208";a="214252754" Received: from unknown (HELO localhost.localdomain) ([10.251.23.81]) by fmsmga001.fm.intel.com with ESMTP; 12 Nov 2019 22:45:19 -0800 From: Peter Krystad To: mptcp@lists.01.org Date: Tue, 12 Nov 2019 22:45:11 -0800 Message-Id: <20191113064518.4823-2-peter.krystad@linux.intel.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20191113064518.4823-1-peter.krystad@linux.intel.com> References: <20191113064518.4823-1-peter.krystad@linux.intel.com> Message-ID-Hash: A6MTSHPEWIEEH345RFAAO5GNTONXGWFL X-Message-ID-Hash: A6MTSHPEWIEEH345RFAAO5GNTONXGWFL X-MailFrom: peter.krystad@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.1.1 Precedence: list Subject: [MPTCP] [PATCH 1/8] mptcp: Add IPv6 support for MPTCP socket stubs List-Id: Discussions regarding MPTCP upstreaming Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 squashto: Add MPTCP socket stubs Signed-off-by: Peter Krystad --- include/net/mptcp.h | 10 ++++++++++ net/ipv6/tcp_ipv6.c | 7 +++++++ net/mptcp/protocol.c | 19 +++++++++++++++++++ 3 files changed, 36 insertions(+) diff --git a/include/net/mptcp.h b/include/net/mptcp.h index 535b27f6ba03..cc173e5f7900 100644 --- a/include/net/mptcp.h +++ b/include/net/mptcp.h @@ -146,4 +146,14 @@ static inline bool mptcp_sk_is_subflow(const struct sock *sk) } #endif /* CONFIG_MPTCP */ + +#if IS_ENABLED(CONFIG_MPTCP_IPV6) +int mptcpv6_init(void); +#elif IS_ENABLED(CONFIG_IPV6) +static inline int mptcpv6_init(void) +{ + return 0; +} +#endif + #endif /* __NET_MPTCP_H */ diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index bae175b57e0f..bcc3bb89938d 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c @@ -2108,9 +2108,16 @@ int __init tcpv6_init(void) ret = register_pernet_subsys(&tcpv6_net_ops); if (ret) goto out_tcpv6_protosw; + + ret = mptcpv6_init(); + if (ret) + goto out_tcpv6_pernet_subsys; + out: return ret; +out_tcpv6_pernet_subsys: + unregister_pernet_subsys(&tcpv6_net_ops); out_tcpv6_protosw: inet6_unregister_protosw(&tcpv6_protosw); out_tcpv6_protocol: diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index 42b33ed6b870..aa8444c2dd71 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -963,3 +963,22 @@ void mptcp_proto_init(void) inet_register_protosw(&mptcp_protosw); } + +#if IS_ENABLED(CONFIG_MPTCP_IPV6) +static struct inet_protosw mptcp_v6_protosw = { + .type = SOCK_STREAM, + .protocol = IPPROTO_MPTCP, + .prot = &mptcp_prot, + .ops = &inet6_stream_ops, + .flags = INET_PROTOSW_ICSK, +}; + +int mptcpv6_init(void) +{ + int err; + + err = inet6_register_protosw(&mptcp_v6_protosw); + + return err; +} +#endif From patchwork Wed Nov 13 06:45:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Krystad X-Patchwork-Id: 1194084 X-Patchwork-Delegate: matthieu.baerts@tessares.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.01.org (client-ip=2001:19d0:306:5::1; helo=ml01.01.org; envelope-from=mptcp-bounces@lists.01.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.intel.com Received: from ml01.01.org (ml01.01.org [IPv6:2001:19d0:306:5::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47CZqq41Zxz9sPZ for ; Wed, 13 Nov 2019 17:45:26 +1100 (AEDT) Received: from new-ml01.vlan13.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 83F27100DC42B; Tue, 12 Nov 2019 22:47:03 -0800 (PST) Received-SPF: None (mailfrom) identity=mailfrom; client-ip=134.134.136.24; helo=mga09.intel.com; envelope-from=peter.krystad@linux.intel.com; receiver= Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id F0897100EA622 for ; Tue, 12 Nov 2019 22:47:01 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Nov 2019 22:45:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,299,1569308400"; d="scan'208";a="214252755" Received: from unknown (HELO localhost.localdomain) ([10.251.23.81]) by fmsmga001.fm.intel.com with ESMTP; 12 Nov 2019 22:45:20 -0800 From: Peter Krystad To: mptcp@lists.01.org Date: Tue, 12 Nov 2019 22:45:12 -0800 Message-Id: <20191113064518.4823-3-peter.krystad@linux.intel.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20191113064518.4823-1-peter.krystad@linux.intel.com> References: <20191113064518.4823-1-peter.krystad@linux.intel.com> Message-ID-Hash: ECXPUID6T5ZPCCTX3UAA47DDERB3N7OO X-Message-ID-Hash: ECXPUID6T5ZPCCTX3UAA47DDERB3N7OO X-MailFrom: peter.krystad@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.1.1 Precedence: list Subject: [MPTCP] [PATCH 2/8] mptcp: Add IPv6 support for Associate MPTCP context List-Id: Discussions regarding MPTCP upstreaming Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 squashto: Associate MPTCP context with TCP socket Signed-off-by: Peter Krystad --- net/mptcp/protocol.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index aa8444c2dd71..03f43f3a7a9a 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -965,11 +965,13 @@ void mptcp_proto_init(void) } #if IS_ENABLED(CONFIG_MPTCP_IPV6) +static struct proto_ops mptcp_v6_stream_ops; + static struct inet_protosw mptcp_v6_protosw = { .type = SOCK_STREAM, .protocol = IPPROTO_MPTCP, .prot = &mptcp_prot, - .ops = &inet6_stream_ops, + .ops = &mptcp_v6_stream_ops, .flags = INET_PROTOSW_ICSK, }; @@ -977,6 +979,10 @@ int mptcpv6_init(void) { int err; + mptcp_v6_stream_ops = inet6_stream_ops; + mptcp_v6_stream_ops.bind = mptcp_bind; + mptcp_v6_stream_ops.connect = mptcp_stream_connect; + err = inet6_register_protosw(&mptcp_v6_protosw); return err; From patchwork Wed Nov 13 06:45:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Krystad X-Patchwork-Id: 1194088 X-Patchwork-Delegate: matthieu.baerts@tessares.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.01.org (client-ip=198.145.21.10; helo=ml01.01.org; envelope-from=mptcp-bounces@lists.01.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.intel.com Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47CZqs5w6jz9sPk for ; Wed, 13 Nov 2019 17:45:29 +1100 (AEDT) Received: from new-ml01.vlan13.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id B1F6A100DC43C; Tue, 12 Nov 2019 22:47:04 -0800 (PST) Received-SPF: None (mailfrom) identity=mailfrom; client-ip=134.134.136.24; helo=mga09.intel.com; envelope-from=peter.krystad@linux.intel.com; receiver= Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 4D57A100EA622 for ; Tue, 12 Nov 2019 22:47:02 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Nov 2019 22:45:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,299,1569308400"; d="scan'208";a="214252756" Received: from unknown (HELO localhost.localdomain) ([10.251.23.81]) by fmsmga001.fm.intel.com with ESMTP; 12 Nov 2019 22:45:20 -0800 From: Peter Krystad To: mptcp@lists.01.org Date: Tue, 12 Nov 2019 22:45:13 -0800 Message-Id: <20191113064518.4823-4-peter.krystad@linux.intel.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20191113064518.4823-1-peter.krystad@linux.intel.com> References: <20191113064518.4823-1-peter.krystad@linux.intel.com> Message-ID-Hash: QTUBOZM2PFMBQG7NT62CDDGZ6TOXLLX6 X-Message-ID-Hash: QTUBOZM2PFMBQG7NT62CDDGZ6TOXLLX6 X-MailFrom: peter.krystad@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.1.1 Precedence: list Subject: [MPTCP] [PATCH 3/8] mptcp: Add IPV6 support for outgoing connections List-Id: Discussions regarding MPTCP upstreaming Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 squashto: Handle MP_CAPABLE options for outgoing connections Signed-off-by: Peter Krystad --- net/mptcp/protocol.h | 3 +++ net/mptcp/subflow.c | 18 ++++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 0c5586f14e6a..2566858ea272 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -227,6 +227,9 @@ void mptcp_subflow_init(void); int mptcp_subflow_create_socket(struct sock *sk, struct socket **new_sock); extern const struct inet_connection_sock_af_ops ipv4_specific; +#if IS_ENABLED(CONFIG_MPTCP_IPV6) +extern const struct inet_connection_sock_af_ops ipv6_specific; +#endif void mptcp_proto_init(void); diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c index 12daebe16f5d..cf53729929bd 100644 --- a/net/mptcp/subflow.c +++ b/net/mptcp/subflow.c @@ -175,6 +175,10 @@ static int subflow_v4_conn_request(struct sock *sk, struct sk_buff *skb) return 0; } +#if IS_ENABLED(CONFIG_MPTCP_IPV6) +static struct inet_connection_sock_af_ops subflow_v6_specific; +#endif + /* validate hmac received in third ACK */ static bool subflow_hmac_valid(const struct request_sock *req, const struct tcp_options_received *rx_opt) @@ -575,7 +579,8 @@ int mptcp_subflow_create_socket(struct sock *sk, struct socket **new_sock) struct socket *sf; int err; - err = sock_create_kern(net, PF_INET, SOCK_STREAM, IPPROTO_TCP, &sf); + err = sock_create_kern(net, sk->sk_family, SOCK_STREAM, IPPROTO_TCP, + &sf); if (err) return err; @@ -637,11 +642,15 @@ static int subflow_ulp_init(struct sock *sk) goto out; } - pr_debug("subflow=%p", ctx); + pr_debug("subflow=%p, family=%d", ctx, sk->sk_family); tp->is_mptcp = 1; ctx->icsk_af_ops = icsk->icsk_af_ops; icsk->icsk_af_ops = &subflow_specific; +#if IS_ENABLED(CONFIG_MPTCP_IPV6) + if (sk->sk_family == AF_INET6) + icsk->icsk_af_ops = &subflow_v6_specific; +#endif ctx->tcp_sk_data_ready = sk->sk_data_ready; sk->sk_data_ready = subflow_data_ready; sk->sk_write_space = subflow_write_space; @@ -739,6 +748,11 @@ void mptcp_subflow_init(void) subflow_specific.sk_rx_dst_set = subflow_finish_connect; subflow_specific.rebuild_header = subflow_rebuild_header; +#if IS_ENABLED(CONFIG_MPTCP_IPV6) + subflow_v6_specific = ipv6_specific; + subflow_v6_specific.sk_rx_dst_set = subflow_finish_connect; +#endif + if (tcp_register_ulp(&subflow_ulp_ops) != 0) panic("MPTCP: failed to register subflows to ULP\n"); } From patchwork Wed Nov 13 06:45:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Krystad X-Patchwork-Id: 1194085 X-Patchwork-Delegate: matthieu.baerts@tessares.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.01.org (client-ip=2001:19d0:306:5::1; helo=ml01.01.org; envelope-from=mptcp-bounces@lists.01.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.intel.com Received: from ml01.01.org (ml01.01.org [IPv6:2001:19d0:306:5::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47CZqs5wG5z9sQp for ; Wed, 13 Nov 2019 17:45:29 +1100 (AEDT) Received: from new-ml01.vlan13.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id C7574100DC3C9; Tue, 12 Nov 2019 22:47:04 -0800 (PST) Received-SPF: None (mailfrom) identity=mailfrom; client-ip=134.134.136.24; helo=mga09.intel.com; envelope-from=peter.krystad@linux.intel.com; receiver= Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 650F4100EA622 for ; Tue, 12 Nov 2019 22:47:02 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Nov 2019 22:45:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,299,1569308400"; d="scan'208";a="214252757" Received: from unknown (HELO localhost.localdomain) ([10.251.23.81]) by fmsmga001.fm.intel.com with ESMTP; 12 Nov 2019 22:45:20 -0800 From: Peter Krystad To: mptcp@lists.01.org Date: Tue, 12 Nov 2019 22:45:14 -0800 Message-Id: <20191113064518.4823-5-peter.krystad@linux.intel.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20191113064518.4823-1-peter.krystad@linux.intel.com> References: <20191113064518.4823-1-peter.krystad@linux.intel.com> Message-ID-Hash: SMSFTFHIGMON7LUPNTOPGFMWADMHDBD3 X-Message-ID-Hash: SMSFTFHIGMON7LUPNTOPGFMWADMHDBD3 X-MailFrom: peter.krystad@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.1.1 Precedence: list Subject: [MPTCP] [PATCH 4/8] mptcp: Add IPv6 support for mptcp_poll List-Id: Discussions regarding MPTCP upstreaming Archived-At: <> List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 squashto: add mptcp_poll Signed-off-by: Peter Krystad --- net/mptcp/protocol.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index 03f43f3a7a9a..6bc064713500 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -982,6 +982,7 @@ int mptcpv6_init(void) mptcp_v6_stream_ops = inet6_stream_ops; mptcp_v6_stream_ops.bind = mptcp_bind; mptcp_v6_stream_ops.connect = mptcp_stream_connect; + mptcp_v6_stream_ops.poll = mptcp_poll; err = inet6_register_protosw(&mptcp_v6_protosw); From patchwork Wed Nov 13 06:45:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Krystad X-Patchwork-Id: 1194087 X-Patchwork-Delegate: matthieu.baerts@tessares.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.01.org (client-ip=2001:19d0:306:5::1; helo=ml01.01.org; envelope-from=mptcp-bounces@lists.01.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.intel.com Received: from ml01.01.org (ml01.01.org [IPv6:2001:19d0:306:5::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47CZqs5sWjz9sPh for ; Wed, 13 Nov 2019 17:45:29 +1100 (AEDT) Received: from new-ml01.vlan13.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id CEB26100DC43A; Tue, 12 Nov 2019 22:47:05 -0800 (PST) Received-SPF: None (mailfrom) identity=mailfrom; client-ip=134.134.136.24; helo=mga09.intel.com; envelope-from=peter.krystad@linux.intel.com; receiver= Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 72496100EA622 for ; Tue, 12 Nov 2019 22:47:02 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Nov 2019 22:45:21 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,299,1569308400"; d="scan'208";a="214252758" Received: from unknown (HELO localhost.localdomain) ([10.251.23.81]) by fmsmga001.fm.intel.com with ESMTP; 12 Nov 2019 22:45:20 -0800 From: Peter Krystad To: mptcp@lists.01.org Date: Tue, 12 Nov 2019 22:45:15 -0800 Message-Id: <20191113064518.4823-6-peter.krystad@linux.intel.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20191113064518.4823-1-peter.krystad@linux.intel.com> References: <20191113064518.4823-1-peter.krystad@linux.intel.com> Message-ID-Hash: VKOVBNZL2DLWU3Z7UF3KGSNDBP3R2NZD X-Message-ID-Hash: VKOVBNZL2DLWU3Z7UF3KGSNDBP3R2NZD X-MailFrom: peter.krystad@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.1.1 Precedence: list Subject: [MPTCP] [PATCH 5/8] mptcp: Add IPV6 support for incoming connections List-Id: Discussions regarding MPTCP upstreaming Archived-At: <> List-Archive: <> List-Help: List-Post: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 add mtpcp_accept and listent squashto: Create SUBFLOW socket for incoming connections Signed-off-by: Peter Krystad mtpcp: Add IPv6 support for for incoming connections [getname()] squashto: Create SUBFLOW socket for incoming connections Signed-off-by: Peter Krystad mtpcp: Add IPv6 support for incoming connections squashto: Create SUBFLOW socket for incoming connections Signed-off-by: Peter Krystad --- net/mptcp/protocol.c | 35 +++++++++++++++++++++++++++++++---- net/mptcp/subflow.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+), 4 deletions(-) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index 6bc064713500..bda16c399e23 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -16,6 +16,9 @@ #include #include #include +#if IS_ENABLED(CONFIG_MPTCP_IPV6) +#include +#endif #include #include "protocol.h" @@ -764,10 +767,7 @@ static int mptcp_stream_connect(struct socket *sock, struct sockaddr *uaddr, { struct mptcp_sock *msk = mptcp_sk(sock->sk); struct socket *ssock; - int err = -ENOTSUPP; - - if (uaddr->sa_family != AF_INET) // @@ allow only IPv4 for now - return err; + int err; ssock = mptcp_socket_create_get(msk); if (IS_ERR(ssock)) @@ -833,6 +833,30 @@ static int mptcp_v4_getname(struct socket *sock, struct sockaddr *uaddr, return ret; } +#if IS_ENABLED(CONFIG_MPTCP_IPV6) +static int mptcp_v6_getname(struct socket *sock, struct sockaddr *uaddr, + int peer) +{ + int ret; + + if (sock->sk->sk_prot == &tcpv6_prot) { + /* we are being invoked from __sys_accept4 after + * mptcp_accept() has accepted a non-mp-capable + * subflow: sk is a tcp_sk, not mptcp. + * + * Hand the socket over to tcp so all further + * socket ops bypass mptcp. + */ + sock->ops = &inet6_stream_ops; + return sock->ops->getname(sock, uaddr, peer); + } + + ret = mptcp_getname(sock, uaddr, peer); + + return ret; +} +#endif + static int mptcp_listen(struct socket *sock, int backlog) { struct mptcp_sock *msk = mptcp_sk(sock->sk); @@ -983,6 +1007,9 @@ int mptcpv6_init(void) mptcp_v6_stream_ops.bind = mptcp_bind; mptcp_v6_stream_ops.connect = mptcp_stream_connect; mptcp_v6_stream_ops.poll = mptcp_poll; + mptcp_v6_stream_ops.accept = mptcp_stream_accept; + mptcp_v6_stream_ops.getname = mptcp_v6_getname; + mptcp_v6_stream_ops.listen = mptcp_listen; err = inet6_register_protosw(&mptcp_v6_protosw); diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c index cf53729929bd..580cee2a5f84 100644 --- a/net/mptcp/subflow.c +++ b/net/mptcp/subflow.c @@ -15,6 +15,9 @@ #include #include #include +#if IS_ENABLED(CONFIG_MPTCP_IPV6) +#include +#endif #include #include "protocol.h" @@ -135,6 +138,19 @@ static void subflow_v4_init_req(struct request_sock *req, subflow_init_req(req, sk_listener, skb); } +#if IS_ENABLED(CONFIG_MPTCP_IPV6) +static void subflow_v6_init_req(struct request_sock *req, + const struct sock *sk_listener, + struct sk_buff *skb) +{ + tcp_rsk(req)->is_mptcp = 1; + + tcp_request_sock_ipv6_ops.init_req(req, sk_listener, skb); + + subflow_init_req(req, sk_listener, skb); +} +#endif + static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb) { struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); @@ -176,7 +192,28 @@ static int subflow_v4_conn_request(struct sock *sk, struct sk_buff *skb) } #if IS_ENABLED(CONFIG_MPTCP_IPV6) +static struct tcp_request_sock_ops subflow_request_sock_ipv6_ops; static struct inet_connection_sock_af_ops subflow_v6_specific; + +static int subflow_v6_conn_request(struct sock *sk, struct sk_buff *skb) +{ + struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + + pr_debug("subflow=%p", subflow); + + if (skb->protocol == htons(ETH_P_IP)) + return tcp_v4_conn_request(sk, skb); + + if (!ipv6_unicast_destination(skb)) + goto drop; + + return tcp_conn_request(&subflow_request_sock_ops, + &subflow_request_sock_ipv6_ops, sk, skb); + +drop: + tcp_listendrop(sk); + return 0; /* don't send reset */ +} #endif /* validate hmac received in third ACK */ @@ -749,7 +786,12 @@ void mptcp_subflow_init(void) subflow_specific.rebuild_header = subflow_rebuild_header; #if IS_ENABLED(CONFIG_MPTCP_IPV6) + subflow_request_sock_ipv6_ops = tcp_request_sock_ipv6_ops; + subflow_request_sock_ipv6_ops.init_req = subflow_v6_init_req; + subflow_v6_specific = ipv6_specific; + subflow_v6_specific.conn_request = subflow_v6_conn_request; + subflow_v6_specific.syn_recv_sock = subflow_syn_recv_sock; subflow_v6_specific.sk_rx_dst_set = subflow_finish_connect; #endif From patchwork Wed Nov 13 06:45:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Krystad X-Patchwork-Id: 1194081 X-Patchwork-Delegate: matthieu.baerts@tessares.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.01.org (client-ip=2001:19d0:306:5::1; helo=ml01.01.org; envelope-from=mptcp-bounces@lists.01.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.intel.com Received: from ml01.01.org (ml01.01.org [IPv6:2001:19d0:306:5::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47CZqq37Bfz9sNH for ; Wed, 13 Nov 2019 17:45:26 +1100 (AEDT) Received: from new-ml01.vlan13.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 92990100DC42F; Tue, 12 Nov 2019 22:47:04 -0800 (PST) Received-SPF: None (mailfrom) identity=mailfrom; client-ip=192.55.52.115; helo=mga14.intel.com; envelope-from=peter.krystad@linux.intel.com; receiver= Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 2C6F1100DC420 for ; Tue, 12 Nov 2019 22:47:02 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Nov 2019 22:45:21 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,299,1569308400"; d="scan'208";a="214252760" Received: from unknown (HELO localhost.localdomain) ([10.251.23.81]) by fmsmga001.fm.intel.com with ESMTP; 12 Nov 2019 22:45:20 -0800 From: Peter Krystad To: mptcp@lists.01.org Date: Tue, 12 Nov 2019 22:45:17 -0800 Message-Id: <20191113064518.4823-8-peter.krystad@linux.intel.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20191113064518.4823-1-peter.krystad@linux.intel.com> References: <20191113064518.4823-1-peter.krystad@linux.intel.com> Message-ID-Hash: JRNEKOPFR4FROP2GOX6MB4CKKGVQBP5F X-Message-ID-Hash: JRNEKOPFR4FROP2GOX6MB4CKKGVQBP5F X-MailFrom: peter.krystad@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.1.1 Precedence: list Subject: [MPTCP] [PATCH 7/8] mptcp: Add IPv6 support for shutdown() List-Id: Discussions regarding MPTCP upstreaming Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 squashto: Add shutdown() socket operation Signed-off-by: Peter Krystad --- net/mptcp/protocol.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index bda16c399e23..a831e7fdb90f 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -1010,6 +1010,7 @@ int mptcpv6_init(void) mptcp_v6_stream_ops.accept = mptcp_stream_accept; mptcp_v6_stream_ops.getname = mptcp_v6_getname; mptcp_v6_stream_ops.listen = mptcp_listen; + mptcp_v6_stream_ops.shutdown = mptcp_shutdown; err = inet6_register_protosw(&mptcp_v6_protosw); From patchwork Wed Nov 13 06:45:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Krystad X-Patchwork-Id: 1194086 X-Patchwork-Delegate: matthieu.baerts@tessares.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.01.org (client-ip=2001:19d0:306:5::1; helo=ml01.01.org; envelope-from=mptcp-bounces@lists.01.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.intel.com Received: from ml01.01.org (ml01.01.org [IPv6:2001:19d0:306:5::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47CZqs5VbYz9sNH for ; Wed, 13 Nov 2019 17:45:29 +1100 (AEDT) Received: from new-ml01.vlan13.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id BA98E100DC3C0; Tue, 12 Nov 2019 22:47:04 -0800 (PST) Received-SPF: None (mailfrom) identity=mailfrom; client-ip=192.55.52.115; helo=mga14.intel.com; envelope-from=peter.krystad@linux.intel.com; receiver= Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 5DF2D100DC420 for ; Tue, 12 Nov 2019 22:47:02 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Nov 2019 22:45:21 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,299,1569308400"; d="scan'208";a="214252761" Received: from unknown (HELO localhost.localdomain) ([10.251.23.81]) by fmsmga001.fm.intel.com with ESMTP; 12 Nov 2019 22:45:21 -0800 From: Peter Krystad To: mptcp@lists.01.org Date: Tue, 12 Nov 2019 22:45:18 -0800 Message-Id: <20191113064518.4823-9-peter.krystad@linux.intel.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20191113064518.4823-1-peter.krystad@linux.intel.com> References: <20191113064518.4823-1-peter.krystad@linux.intel.com> Message-ID-Hash: EHJPR7IUKDLCUA6O5AIMWFPMFXUKS3A3 X-Message-ID-Hash: EHJPR7IUKDLCUA6O5AIMWFPMFXUKS3A3 X-MailFrom: peter.krystad@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.1.1 Precedence: list Subject: [MPTCP] [PATCH 8/8] mptcp: Add IPv6 support for new sysctl initialization List-Id: Discussions regarding MPTCP upstreaming Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 squashto: new sysctl to control the activation per NS Signed-off-by: Peter Krystad --- net/mptcp/ctrl.c | 11 +++++++++++ net/mptcp/protocol.c | 2 +- net/mptcp/protocol.h | 3 +++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/net/mptcp/ctrl.c b/net/mptcp/ctrl.c index 6023c9f722ea..8e39585d37f3 100644 --- a/net/mptcp/ctrl.c +++ b/net/mptcp/ctrl.c @@ -117,3 +117,14 @@ void __init mptcp_init(void) if (register_pernet_subsys(&mptcp_pernet_ops) < 0) panic("Failed to register MPTCP pernet subsystem.\n"); } + +#if IS_ENABLED(CONFIG_MPTCP_IPV6) +int __init mptcpv6_init(void) +{ + int err; + + err = mptcp_proto_v6_init(); + + return err; +} +#endif diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index a831e7fdb90f..564a6204649e 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -999,7 +999,7 @@ static struct inet_protosw mptcp_v6_protosw = { .flags = INET_PROTOSW_ICSK, }; -int mptcpv6_init(void) +int mptcp_proto_v6_init(void) { int err; diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 2566858ea272..80e4cbfc389a 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -232,6 +232,9 @@ extern const struct inet_connection_sock_af_ops ipv6_specific; #endif void mptcp_proto_init(void); +#if IS_ENABLED(CONFIG_MPTCP_IPV6) +int mptcp_proto_v6_init(void); +#endif struct mptcp_read_arg { struct msghdr *msg;