From patchwork Tue May 14 01:13:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mat Martineau X-Patchwork-Id: 13663746 X-Patchwork-Delegate: mat@martineau.name Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EE08717F6; Tue, 14 May 2024 01:13:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715649222; cv=none; b=GekpI0dEMD8DL8MOe8RxN9ReKiyLm0pFkl0rbvjo/LzUEMIoxE5jfIXmzdTQGW2S9R0Ka0ThgrWch15PEYoquezrVaezmzr4LRzOFytHXvwsLf56Kev5bUaIG2Fp/inX6G4Yr/cxeogaF1Br+c15Iu5ZFJUow8qvDsOnRkVykbM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715649222; c=relaxed/simple; bh=4zTY02OfhcmSpb8ZPvfgLYjQbOm/Y95AKG0XL8osBME=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZCsaFz1OswHnGRcm5ilB8gN3+VFiIghLInIF+Vt8Eb+cw1ypTQ4MrxdhOWtzdZ8wvtd2lH/ibWaQdCbQ/Hd7H/uzQDqKn7ic6Tugj5QceS07NKqtMxhF3XG8sTL9+6lQnWEDxH/XqqEI/olVYCcLUzrfFmGnZGWRw7d2p9rfUv0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=M3xopNSG; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="M3xopNSG" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32E7CC4AF08; Tue, 14 May 2024 01:13:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715649221; bh=4zTY02OfhcmSpb8ZPvfgLYjQbOm/Y95AKG0XL8osBME=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M3xopNSGOxCXeeH81/fRTobn0aDldBslmqtazkY6oadIt31nXEJhSujeoEFMHsg+L rf78IAoscZiSn5FBXvcQ76ZPxdwsY7xHzo3a0KvZjV1STh4y1vSz9Ea2KmvsSIpZPU VxltQR0H4OzaxWYxHJdUERfVwIJ41+UQqKt/U9AhKiK3ljmxilcrRkcDkD1kjEySzW /Z8ZsWfV2xdCasK2TBOzg7PYLNTagqB7XKNCcNjXBS119yCtXY7CJEOIT1iwsnkiHT Ie680GgrxngRsRjsiQvrS6V9TJf4lX5FI5RR4enZb1Lsbq6ET6PvVGyZOtT3U+9FnV PLT9bospnlu2w== From: Mat Martineau To: mptcp@lists.linux.dev, geliang@kernel.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, fw@strlen.de Cc: "Matthieu Baerts (NGI0)" , netdev@vger.kernel.org, Mat Martineau Subject: [PATCH net-next v2 1/8] mptcp: SO_KEEPALIVE: fix getsockopt support Date: Mon, 13 May 2024 18:13:25 -0700 Message-ID: <20240514011335.176158-2-martineau@kernel.org> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240514011335.176158-1-martineau@kernel.org> References: <20240514011335.176158-1-martineau@kernel.org> Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: "Matthieu Baerts (NGI0)" SO_KEEPALIVE support has to be set on each subflow: on each TCP socket, where sk_prot->keepalive is defined. Technically, nothing has to be done on the MPTCP socket. That's why mptcp_sol_socket_sync_intval() was called instead of mptcp_sol_socket_intval(). Except that when nothing is done on the MPTCP socket, the getsockopt(SO_KEEPALIVE), handled in net/core/sock.c:sk_getsockopt(), will not know if SO_KEEPALIVE has been set on the different subflows or not. The fix is simple: simply call mptcp_sol_socket_intval() which will end up calling net/core/sock.c:sk_setsockopt() where the SOCK_KEEPOPEN flag will be set, the one used in sk_getsockopt(). So now, getsockopt(SO_KEEPALIVE) on an MPTCP socket will return the same value as the one previously set with setsockopt(SO_KEEPALIVE). Fixes: 1b3e7ede1365 ("mptcp: setsockopt: handle SO_KEEPALIVE and SO_PRIORITY") Acked-by: Paolo Abeni Signed-off-by: Matthieu Baerts (NGI0) Signed-off-by: Mat Martineau --- net/mptcp/sockopt.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/net/mptcp/sockopt.c b/net/mptcp/sockopt.c index eaa3b79651a4..5ab506c96609 100644 --- a/net/mptcp/sockopt.c +++ b/net/mptcp/sockopt.c @@ -181,8 +181,6 @@ static int mptcp_setsockopt_sol_socket_int(struct mptcp_sock *msk, int optname, switch (optname) { case SO_KEEPALIVE: - mptcp_sol_socket_sync_intval(msk, optname, val); - return 0; case SO_DEBUG: case SO_MARK: case SO_PRIORITY: From patchwork Tue May 14 01:13:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mat Martineau X-Patchwork-Id: 13663747 X-Patchwork-Delegate: mat@martineau.name Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0274317F7; Tue, 14 May 2024 01:13:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715649222; cv=none; b=W9bUJIo5iSRDUm/IqK9ivikFEMqiaA4x0IMq7nikGf8TOQmHrG7Ifl1ynJUOC/6IOmp4zQbn8OSBUPJ78fXWYfIdbwvOyyHPBAVo0gSCUPSwMQjC1kXdARcd6mPoqSLWLDAH1xhE3a82lIgrS5GFHny0TZGLpTPig1Gh3ksbOiw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715649222; c=relaxed/simple; bh=tRW28Brz1eO720bUTQnl2CsfBEv0lJcxPbGrPbVZ2Ak=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XXNWRoV4yQUOzYyzOlyL74TjM7IMZ0LXToSBMtrQ8WO3TAD12MgDTCNNvbBXVdDazvmICJ7ywg8lhOKF+u513pN6pUFkQDH6vrucH67ctvKmiMS+2lLB+nRF1eFCquhGjG6o9aAEFHxrvqygbrlMTp2YMf8Yh0S4kFaueNkQ584= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=E8Z8omV/; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="E8Z8omV/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 90BB9C4AF0E; Tue, 14 May 2024 01:13:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715649221; bh=tRW28Brz1eO720bUTQnl2CsfBEv0lJcxPbGrPbVZ2Ak=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E8Z8omV/dQWtwdsu93nMXFqGQMWFbQO4NswzKCMHj9Jnv34bMB/mjG0j0ghxPS9Q9 qfYdgojnmRo+eFS5YDy9Ah0FhM30J4+Lmf7xWrBEfSO9sIU9ZP4NHkDXrntWFEbFmW 8jlk8+Yri6N3F4+wxgO8bn/bg4dYLUbDzi4HZWI2wG7EltupgbzWOtJ+8hewvwa63s 5W/NUFxRFvRBr6F7l6NEmcKe6csa+SjoiBq7BoEENZitYCzSrLSNG4/jljO64TCOtz dTEAPhr7fj2anNwub1mjz653ad85psPjgSROB5P3MNzQGIxFsivnDpDtUGUJ4f0mFD u61rgLA7cupnw== From: Mat Martineau To: mptcp@lists.linux.dev, geliang@kernel.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, fw@strlen.de Cc: "Matthieu Baerts (NGI0)" , netdev@vger.kernel.org, Mat Martineau Subject: [PATCH net-next v2 2/8] mptcp: fix full TCP keep-alive support Date: Mon, 13 May 2024 18:13:26 -0700 Message-ID: <20240514011335.176158-3-martineau@kernel.org> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240514011335.176158-1-martineau@kernel.org> References: <20240514011335.176158-1-martineau@kernel.org> Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: "Matthieu Baerts (NGI0)" SO_KEEPALIVE support has been added a while ago, as part of a series "adding SOL_SOCKET" support. To have a full control of this keep-alive feature, it is important to also support TCP_KEEP* socket options at the SOL_TCP level. Supporting them on the setsockopt() part is easy, it is just a matter of remembering each value in the MPTCP sock structure, and calling tcp_sock_set_keep*() helpers on each subflow. If the value is not modified (0), calling these helpers will not do anything. For the getsockopt() part, the corresponding value from the MPTCP sock structure or the default one is simply returned. All of this is very similar to other TCP_* socket options supported by MPTCP. It looks important for kernels supporting SO_KEEPALIVE, to also support TCP_KEEP* options as well: some apps seem to (wrongly) consider that if the former is supported, the latter ones will be supported as well. But also, not having this simple and isolated change is preventing MPTCP support in some apps, and libraries like GoLang [1]. This is why this patch is seen as a fix. Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/383 Fixes: 1b3e7ede1365 ("mptcp: setsockopt: handle SO_KEEPALIVE and SO_PRIORITY") Link: https://github.com/golang/go/issues/56539 [1] Acked-by: Paolo Abeni Signed-off-by: Matthieu Baerts (NGI0) Signed-off-by: Mat Martineau --- net/mptcp/protocol.h | 3 +++ net/mptcp/sockopt.c | 58 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index cfc5f9c3f113..4dcce3641d1d 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -312,6 +312,9 @@ struct mptcp_sock { free_first:1, rcvspace_init:1; u32 notsent_lowat; + int keepalive_cnt; + int keepalive_idle; + int keepalive_intvl; struct work_struct work; struct sk_buff *ooo_last_skb; struct rb_root out_of_order_queue; diff --git a/net/mptcp/sockopt.c b/net/mptcp/sockopt.c index 5ab506c96609..fcca9433c858 100644 --- a/net/mptcp/sockopt.c +++ b/net/mptcp/sockopt.c @@ -622,6 +622,31 @@ static int mptcp_setsockopt_sol_tcp_congestion(struct mptcp_sock *msk, sockptr_t return ret; } +static int __mptcp_setsockopt_set_val(struct mptcp_sock *msk, int max, + int (*set_val)(struct sock *, int), + int *msk_val, int val) +{ + struct mptcp_subflow_context *subflow; + int err = 0; + + mptcp_for_each_subflow(msk, subflow) { + struct sock *ssk = mptcp_subflow_tcp_sock(subflow); + int ret; + + lock_sock(ssk); + ret = set_val(ssk, val); + err = err ? : ret; + release_sock(ssk); + } + + if (!err) { + *msk_val = val; + sockopt_seq_inc(msk); + } + + return err; +} + static int __mptcp_setsockopt_sol_tcp_cork(struct mptcp_sock *msk, int val) { struct mptcp_subflow_context *subflow; @@ -818,6 +843,22 @@ static int mptcp_setsockopt_sol_tcp(struct mptcp_sock *msk, int optname, case TCP_NODELAY: ret = __mptcp_setsockopt_sol_tcp_nodelay(msk, val); break; + case TCP_KEEPIDLE: + ret = __mptcp_setsockopt_set_val(msk, MAX_TCP_KEEPIDLE, + &tcp_sock_set_keepidle_locked, + &msk->keepalive_idle, val); + break; + case TCP_KEEPINTVL: + ret = __mptcp_setsockopt_set_val(msk, MAX_TCP_KEEPINTVL, + &tcp_sock_set_keepintvl, + &msk->keepalive_intvl, val); + break; + case TCP_KEEPCNT: + ret = __mptcp_setsockopt_set_val(msk, MAX_TCP_KEEPCNT, + &tcp_sock_set_keepcnt, + &msk->keepalive_cnt, + val); + break; default: ret = -ENOPROTOOPT; } @@ -1326,6 +1367,8 @@ static int mptcp_put_int_option(struct mptcp_sock *msk, char __user *optval, static int mptcp_getsockopt_sol_tcp(struct mptcp_sock *msk, int optname, char __user *optval, int __user *optlen) { + struct sock *sk = (void *)msk; + switch (optname) { case TCP_ULP: case TCP_CONGESTION: @@ -1344,6 +1387,18 @@ static int mptcp_getsockopt_sol_tcp(struct mptcp_sock *msk, int optname, return mptcp_put_int_option(msk, optval, optlen, msk->cork); case TCP_NODELAY: return mptcp_put_int_option(msk, optval, optlen, msk->nodelay); + case TCP_KEEPIDLE: + return mptcp_put_int_option(msk, optval, optlen, + msk->keepalive_idle ? : + READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_keepalive_time) / HZ); + case TCP_KEEPINTVL: + return mptcp_put_int_option(msk, optval, optlen, + msk->keepalive_intvl ? : + READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_keepalive_intvl) / HZ); + case TCP_KEEPCNT: + return mptcp_put_int_option(msk, optval, optlen, + msk->keepalive_cnt ? : + READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_keepalive_probes)); case TCP_NOTSENT_LOWAT: return mptcp_put_int_option(msk, optval, optlen, msk->notsent_lowat); case TCP_IS_MPTCP: @@ -1463,6 +1518,9 @@ static void sync_socket_options(struct mptcp_sock *msk, struct sock *ssk) tcp_set_congestion_control(ssk, msk->ca_name, false, true); __tcp_sock_set_cork(ssk, !!msk->cork); __tcp_sock_set_nodelay(ssk, !!msk->nodelay); + tcp_sock_set_keepidle_locked(ssk, msk->keepalive_idle); + tcp_sock_set_keepintvl(ssk, msk->keepalive_intvl); + tcp_sock_set_keepcnt(ssk, msk->keepalive_cnt); inet_assign_bit(TRANSPARENT, ssk, inet_test_bit(TRANSPARENT, sk)); inet_assign_bit(FREEBIND, ssk, inet_test_bit(FREEBIND, sk)); From patchwork Tue May 14 01:13:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mat Martineau X-Patchwork-Id: 13663748 X-Patchwork-Delegate: mat@martineau.name Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B1CFD524F; Tue, 14 May 2024 01:13:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715649222; cv=none; b=tWEDYFFm9+BukaE/n0WW5hZUkQvPovwe4Qgc186xOQvUKt8z6rF3+DRhbsS9KPyICTv6TVyHt0n572dy46AiEHlSMPWV5C8c9D3Eal7usSFRuc6BJJYEwR2mqFtO94L4PUW0kAvGAJtgWhwNScmJRxcqTliZ6QesRNdCdEEkncE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715649222; c=relaxed/simple; bh=n9oAOoyV8ndvOD7gMvnNfgAjFUhX65q5z8LOi/+KKtA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TdzVNJ/v3YHh/2EVLi85hBLN7uLKsDu/66XdpZkGO9vfGpRZ39tVTaan4yG/+iAki+oWyzqEGo9nd+fgNpmzTqONjjTcJGHSmxtb8BWga/XZY7DaxN3N83JT2S3UdZekuDWhzJnLqebyV5vf502XPt8OszoS29uIQiKrCn+9oNk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=J8TQ0hv3; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="J8TQ0hv3" Received: by smtp.kernel.org (Postfix) with ESMTPSA id ED80EC4AF16; Tue, 14 May 2024 01:13:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715649222; bh=n9oAOoyV8ndvOD7gMvnNfgAjFUhX65q5z8LOi/+KKtA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J8TQ0hv3qmDmHOXYFKYTx13UHkszIygak84lQNDzNrM/dc6SP3HnYA6njG4VZRfzC tKsW+oYDccMGeQkbe8v3pHu2f5bOPYrp5LiSVB5NzOMicLlcsl5oFRGBZ+iRk3wDLJ SK3/1SKVbqIcjlr2Ek4ZS81G6lNSc87hXnSRWGpUMOuuNlWnqTtlJvWqQDUkaCG2ZK jvN6rSR9U8DFMQur1q529k6GvjyMrt3mMy9MI1Q6/EAy3L66FeCmBjqpKdeHQBozko 4fZWfYo1dnocZQMb9h78D/9/31klxVP1Juh977AZGpwWBIzjW0gjPLRFYlu/dvHbxg w1Kosq5cdbU/w== From: Mat Martineau To: mptcp@lists.linux.dev, geliang@kernel.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, fw@strlen.de Cc: "Matthieu Baerts (NGI0)" , netdev@vger.kernel.org, Mat Martineau Subject: [PATCH net-next v2 3/8] mptcp: sockopt: info: stop early if no buffer Date: Mon, 13 May 2024 18:13:27 -0700 Message-ID: <20240514011335.176158-4-martineau@kernel.org> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240514011335.176158-1-martineau@kernel.org> References: <20240514011335.176158-1-martineau@kernel.org> Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: "Matthieu Baerts (NGI0)" Up to recently, it has been recommended to use getsockopt(MPTCP_INFO) to check if a fallback to TCP happened, or if the client requested to use MPTCP. In this case, the userspace app is only interested by the returned value of the getsocktop() call, and can then give 0 for the option length, and NULL for the buffer address. An easy optimisation is then to stop early, and avoid filling a local buffer -- which now requires two different locks -- if it is not needed. Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) Signed-off-by: Mat Martineau --- net/mptcp/sockopt.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/mptcp/sockopt.c b/net/mptcp/sockopt.c index fcca9433c858..a77b33488176 100644 --- a/net/mptcp/sockopt.c +++ b/net/mptcp/sockopt.c @@ -999,6 +999,10 @@ static int mptcp_getsockopt_info(struct mptcp_sock *msk, char __user *optval, in if (get_user(len, optlen)) return -EFAULT; + /* When used only to check if a fallback to TCP happened. */ + if (len == 0) + return 0; + len = min_t(unsigned int, len, sizeof(struct mptcp_info)); mptcp_diag_fill_info(msk, &m_info); From patchwork Tue May 14 01:13:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mat Martineau X-Patchwork-Id: 13663749 X-Patchwork-Delegate: mat@martineau.name Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1FFB7A943; Tue, 14 May 2024 01:13:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715649223; cv=none; b=hhI4SSyXMcxht9muZrBc0sOIH6bPQnLWib4O8w/xPtHAaTmFYxKJsZyAlo7kvW0U7GhFU7lyeYMq6rP+1qODUSdHk5bExZCEJ+Yzyq5K5eXY/ONzCpYckjcmEMCcbiIkDaHB6+hgs2J/o6X9BkjCMz182nP5juxTDjIO2XIv80M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715649223; c=relaxed/simple; bh=/tjjLXnJZHXr0yUVZDx0IqmuMZqiXFKW/W/L5z1PYUI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jz7D+FZGEW6R/egTdtWpxRirZIvOqS73fajB/XOTfq3FJW5UAKfvpLd4/7TueWkdsMisUeQJ+shLf4Oe55nUuYx7SRE/H4PYgVbux7ja09c2fLnMSM+kUpF5ETOaycIq1fb6n1Ke2JiTNtcE+mWC2/7gDEet1Apku4EbioEANhI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=M7yL0+bU; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="M7yL0+bU" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5733EC4AF17; Tue, 14 May 2024 01:13:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715649222; bh=/tjjLXnJZHXr0yUVZDx0IqmuMZqiXFKW/W/L5z1PYUI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M7yL0+bUnzZp4M5idIf9Ek5ksSa/cMN2bW+JJ7bWwu6uHsi61RPc+4Uu8ybYKbHsP fe0Ga3f2b1I4Q/U2hO6ok8/ZbgwNpTOBm1SjMPYEAfLkJJBxVXGXV2XACLuydNLM9r YySxev1f3wcwOVl+d6qWy+NGbjruT59okD4BEbE5dRw/1cG6jSuPXNOeSS7tfI7J7z w//HarTGr3gcC5uPCZMuTbUdsAIZLZ2d6t7CuNOQLRhZFWEiwmFOZ72SW+dTryu+GG qaADATm2dqm6Fk0awW1cjgHpnOeNpdZkA8MLDVoeaBMXkMNQLLN5P5mPUG6NPRkERR WkSwOOOR1CJHw== From: Mat Martineau To: mptcp@lists.linux.dev, geliang@kernel.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, fw@strlen.de Cc: Gregory Detal , netdev@vger.kernel.org, Mat Martineau , Matthieu Baerts Subject: [PATCH net-next v2 4/8] mptcp: add net.mptcp.available_schedulers Date: Mon, 13 May 2024 18:13:28 -0700 Message-ID: <20240514011335.176158-5-martineau@kernel.org> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240514011335.176158-1-martineau@kernel.org> References: <20240514011335.176158-1-martineau@kernel.org> Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Gregory Detal The sysctl lists the available schedulers that can be set using net.mptcp.scheduler similarly to net.ipv4.tcp_available_congestion_control. Signed-off-by: Gregory Detal Reviewed-by: Mat Martineau Tested-by: Geliang Tang Reviewed-by: Matthieu Baerts (NGI0) Signed-off-by: Matthieu Baerts (NGI0) Signed-off-by: Mat Martineau --- include/net/mptcp.h | 3 +++ net/mptcp/ctrl.c | 27 ++++++++++++++++++++++++++- net/mptcp/protocol.h | 1 + net/mptcp/sched.c | 22 ++++++++++++++++++++++ 4 files changed, 52 insertions(+), 1 deletion(-) diff --git a/include/net/mptcp.h b/include/net/mptcp.h index fb996124b3d5..0bc4ab03f487 100644 --- a/include/net/mptcp.h +++ b/include/net/mptcp.h @@ -97,6 +97,9 @@ struct mptcp_out_options { }; #define MPTCP_SCHED_NAME_MAX 16 +#define MPTCP_SCHED_MAX 128 +#define MPTCP_SCHED_BUF_MAX (MPTCP_SCHED_NAME_MAX * MPTCP_SCHED_MAX) + #define MPTCP_SUBFLOWS_MAX 8 struct mptcp_sched_data { diff --git a/net/mptcp/ctrl.c b/net/mptcp/ctrl.c index 49abf80b3fad..542555ba474c 100644 --- a/net/mptcp/ctrl.c +++ b/net/mptcp/ctrl.c @@ -133,6 +133,24 @@ static int proc_scheduler(struct ctl_table *ctl, int write, return ret; } +static int proc_available_schedulers(struct ctl_table *ctl, + int write, void *buffer, + size_t *lenp, loff_t *ppos) +{ + struct ctl_table tbl = { .maxlen = MPTCP_SCHED_BUF_MAX, }; + int ret; + + tbl.data = kmalloc(tbl.maxlen, GFP_USER); + if (!tbl.data) + return -ENOMEM; + + mptcp_get_available_schedulers(tbl.data, MPTCP_SCHED_BUF_MAX); + ret = proc_dostring(&tbl, write, buffer, lenp, ppos); + kfree(tbl.data); + + return ret; +} + static struct ctl_table mptcp_sysctl_table[] = { { .procname = "enabled", @@ -187,6 +205,12 @@ static struct ctl_table mptcp_sysctl_table[] = { .mode = 0644, .proc_handler = proc_scheduler, }, + { + .procname = "available_schedulers", + .maxlen = MPTCP_SCHED_BUF_MAX, + .mode = 0644, + .proc_handler = proc_available_schedulers, + }, { .procname = "close_timeout", .maxlen = sizeof(unsigned int), @@ -214,7 +238,8 @@ static int mptcp_pernet_new_table(struct net *net, struct mptcp_pernet *pernet) table[4].data = &pernet->stale_loss_cnt; table[5].data = &pernet->pm_type; table[6].data = &pernet->scheduler; - table[7].data = &pernet->close_timeout; + /* table[7] is for available_schedulers which is read-only info */ + table[8].data = &pernet->close_timeout; hdr = register_net_sysctl_sz(net, MPTCP_SYSCTL_PATH, table, ARRAY_SIZE(mptcp_sysctl_table)); diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 4dcce3641d1d..39fc47e6b88a 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -686,6 +686,7 @@ unsigned int mptcp_stale_loss_cnt(const struct net *net); unsigned int mptcp_close_timeout(const struct sock *sk); int mptcp_get_pm_type(const struct net *net); const char *mptcp_get_scheduler(const struct net *net); +void mptcp_get_available_schedulers(char *buf, size_t maxlen); void __mptcp_subflow_fully_established(struct mptcp_sock *msk, struct mptcp_subflow_context *subflow, const struct mptcp_options_received *mp_opt); diff --git a/net/mptcp/sched.c b/net/mptcp/sched.c index 4ab0693c069c..4a7fd0508ad2 100644 --- a/net/mptcp/sched.c +++ b/net/mptcp/sched.c @@ -51,6 +51,28 @@ struct mptcp_sched_ops *mptcp_sched_find(const char *name) return ret; } +/* Build string with list of available scheduler values. + * Similar to tcp_get_available_congestion_control() + */ +void mptcp_get_available_schedulers(char *buf, size_t maxlen) +{ + struct mptcp_sched_ops *sched; + size_t offs = 0; + + rcu_read_lock(); + spin_lock(&mptcp_sched_list_lock); + list_for_each_entry_rcu(sched, &mptcp_sched_list, list) { + offs += snprintf(buf + offs, maxlen - offs, + "%s%s", + offs == 0 ? "" : " ", sched->name); + + if (WARN_ON_ONCE(offs >= maxlen)) + break; + } + spin_unlock(&mptcp_sched_list_lock); + rcu_read_unlock(); +} + int mptcp_register_scheduler(struct mptcp_sched_ops *sched) { if (!sched->get_subflow) From patchwork Tue May 14 01:13:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mat Martineau X-Patchwork-Id: 13663750 X-Patchwork-Delegate: mat@martineau.name Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 30DADA94B; Tue, 14 May 2024 01:13:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715649223; cv=none; b=SejsbJ7M4xzuSiNZ1sFxzZHNMFAaIL/4rd4RPXKxIa4Sh4uJcEIgi9dThe+v4U4W4ENvVA6QudLO0tw6jWI/xlvXPttlWDUlfm5vJTWV07Wo4p1rzhERURNa7CqohpaatnDKUyBMGSI+28Q5jJIOTUhg7rvH7x8d5qGrNSwO5Pc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715649223; c=relaxed/simple; bh=gFakMct8wqfURtjlv4dVJOCOcVG3xoX/nIjOFY3vLYM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KeRh37CRI1mAVA1dUpPOsJDlaBnBbmB1EKM+V5vzq4eQlzdV5Bn0O288mPEOR1yVgNx4GXba49sILTeYD5nipKYjJ0vLk1FLAVJjYiLDt4e8FxrJI2Lp6lgG+STMmJrhUJJdvHspkU/NGU1+JYFdgRiJNNqOFLl/Lz3BgeygY88= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GUZ8U8ZH; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="GUZ8U8ZH" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B9B28C4DDEA; Tue, 14 May 2024 01:13:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715649223; bh=gFakMct8wqfURtjlv4dVJOCOcVG3xoX/nIjOFY3vLYM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GUZ8U8ZHaCczR6fkAeWWdG61qy5Qlc68EQ3UNDExq1KinGktXNHW12ftQQgLcLh59 xzq+q4j09ob5+tVIAdLFCDa6mUFxj5Xazg5K7GbSgJP4tE5AzqYMMscK4ohZeRxwxa gwistGvddn8MTq/c8gNuOyeR5QcgkWUZeKTR+aJssiDaFDGtBPIWe6kQMNSV8nZHGc /PB4utNpC+wWI3JNWTy9QFdo2sTPEBgCVY22y/Hsj2WNNTIh+6wWKe1J8X7Tpljypc f4z0JMoHEyIlVzn5jht1l1dAFQialjm4p73l51Ap9Oig1sJXeRc4AVJmRf6Cgqretv mSnyVq75NsbWQ== From: Mat Martineau To: mptcp@lists.linux.dev, geliang@kernel.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, fw@strlen.de Cc: "Matthieu Baerts (NGI0)" , netdev@vger.kernel.org, Mat Martineau Subject: [PATCH net-next v2 5/8] mptcp: prefer strscpy over strcpy Date: Mon, 13 May 2024 18:13:29 -0700 Message-ID: <20240514011335.176158-6-martineau@kernel.org> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240514011335.176158-1-martineau@kernel.org> References: <20240514011335.176158-1-martineau@kernel.org> Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: "Matthieu Baerts (NGI0)" strcpy() performs no bounds checking on the destination buffer. This could result in linear overflows beyond the end of the buffer, leading to all kinds of misbehaviors. The safe replacement is strscpy() [1]. This is in preparation of a possible future step where all strcpy() uses will be removed in favour of strscpy() [2]. This fixes CheckPatch warnings: WARNING: Prefer strscpy over strcpy Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strcpy [1] Link: https://github.com/KSPP/linux/issues/88 [2] Reviewed-by: Geliang Tang Signed-off-by: Matthieu Baerts (NGI0) Signed-off-by: Mat Martineau --- net/mptcp/ctrl.c | 2 +- net/mptcp/protocol.c | 5 +++-- net/mptcp/sockopt.c | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/net/mptcp/ctrl.c b/net/mptcp/ctrl.c index 542555ba474c..98b1dd498ff6 100644 --- a/net/mptcp/ctrl.c +++ b/net/mptcp/ctrl.c @@ -92,7 +92,7 @@ static void mptcp_pernet_set_defaults(struct mptcp_pernet *pernet) pernet->allow_join_initial_addr_port = 1; pernet->stale_loss_cnt = 4; pernet->pm_type = MPTCP_PM_TYPE_KERNEL; - strcpy(pernet->scheduler, "default"); + strscpy(pernet->scheduler, "default", sizeof(pernet->scheduler)); } #ifdef CONFIG_SYSCTL diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index bb8f96f2b86f..a42494d3a71b 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -2814,7 +2814,8 @@ static void mptcp_ca_reset(struct sock *sk) struct inet_connection_sock *icsk = inet_csk(sk); tcp_assign_congestion_control(sk); - strcpy(mptcp_sk(sk)->ca_name, icsk->icsk_ca_ops->name); + strscpy(mptcp_sk(sk)->ca_name, icsk->icsk_ca_ops->name, + sizeof(mptcp_sk(sk)->ca_name)); /* no need to keep a reference to the ops, the name will suffice */ tcp_cleanup_congestion_control(sk); @@ -4169,7 +4170,7 @@ int __init mptcp_proto_v6_init(void) int err; mptcp_v6_prot = mptcp_prot; - strcpy(mptcp_v6_prot.name, "MPTCPv6"); + strscpy(mptcp_v6_prot.name, "MPTCPv6", sizeof(mptcp_v6_prot.name)); mptcp_v6_prot.slab = NULL; mptcp_v6_prot.obj_size = sizeof(struct mptcp6_sock); mptcp_v6_prot.ipv6_pinfo_offset = offsetof(struct mptcp6_sock, np); diff --git a/net/mptcp/sockopt.c b/net/mptcp/sockopt.c index a77b33488176..f9a4fb17b5b7 100644 --- a/net/mptcp/sockopt.c +++ b/net/mptcp/sockopt.c @@ -616,7 +616,7 @@ static int mptcp_setsockopt_sol_tcp_congestion(struct mptcp_sock *msk, sockptr_t } if (ret == 0) - strcpy(msk->ca_name, name); + strscpy(msk->ca_name, name, sizeof(msk->ca_name)); release_sock(sk); return ret; From patchwork Tue May 14 01:13:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mat Martineau X-Patchwork-Id: 13663751 X-Patchwork-Delegate: mat@martineau.name Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 81181AD5A; Tue, 14 May 2024 01:13:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715649223; cv=none; b=fElJFr06KbWTza51CTZntMNbw5zgbza/iSjPai4b319KUbxxngHrKzj9EpuDrWp++qD/TlUSgWqpPEK63XSA8o80/nFHILnIXKikpALrNbbEan0wJcgo61P8i/ctR84GEhaDxbG5ItxbVc9/+bv+OrhmmKL8MCGkAJrbmlgUms0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715649223; c=relaxed/simple; bh=SuBQO5z3Rf1aCOlyglm3AKTFHnDNU1WgZ4qtAUIiPDM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=K8E8v/qDjcrWvoShxg9Z5BCTcB222oFLzzv2Xc3Xj3U1LxZ20VC2wDMcmiGpnx/oJDRnU47MWkNywexVoHKFC++AOu4UP/CitKZvf9VHPuKYMyU1jOIn5QO9YcGS0BG4PuUmvUTunbOd0ikdx4vaiiXKisRCoaEDkTI+pfKH38s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GwKSVFV8; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="GwKSVFV8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2313CC4DDE2; Tue, 14 May 2024 01:13:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715649223; bh=SuBQO5z3Rf1aCOlyglm3AKTFHnDNU1WgZ4qtAUIiPDM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GwKSVFV8l52+D30/uQIgifgwxne5su7EhYEYrWH2tYXNhvCKB7Kl3f5eWGNCHoiFC ozuNQWQMYfNGgiNRXd0jHzzEI7DRaXKcDuhAzWzv1wIBUsfO4Vs02zilEA9Ol8Rqai 2kotIXA8DsdyJIW0rYmyGSzUi2HZfkOD9PbUVuvGcLr32CQ7SYvGS6l1GgSZ7EQG/K IF6I470PAfBMNtcOnLS/2U03QDVrkQG71ZtE3TufIlCJsKgJbpv/L/xmwZCj+0BU5M FlreYGd7ZcO9DW0I49gOErSS/wjggoqFWyKgt5bN7xP/3IWP5c9Wga6JOgwQCTiGkD 0lT7XvAKfAIgg== From: Mat Martineau To: mptcp@lists.linux.dev, geliang@kernel.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, fw@strlen.de Cc: "Matthieu Baerts (NGI0)" , netdev@vger.kernel.org, Mat Martineau Subject: [PATCH net-next v2 6/8] mptcp: remove unnecessary else statements Date: Mon, 13 May 2024 18:13:30 -0700 Message-ID: <20240514011335.176158-7-martineau@kernel.org> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240514011335.176158-1-martineau@kernel.org> References: <20240514011335.176158-1-martineau@kernel.org> Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: "Matthieu Baerts (NGI0)" The 'else' statements are not needed here, because their previous 'if' block ends with a 'return'. This fixes CheckPatch warnings: WARNING: else is not generally useful after a break or return Reviewed-by: Geliang Tang Signed-off-by: Matthieu Baerts (NGI0) Signed-off-by: Mat Martineau --- net/mptcp/subflow.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c index c1d13e555d10..612c38570a64 100644 --- a/net/mptcp/subflow.c +++ b/net/mptcp/subflow.c @@ -1119,6 +1119,8 @@ static enum mapping_status get_mapping_status(struct sock *ssk, } if (mpext->data_fin == 1) { + u64 data_fin_seq; + if (data_len == 1) { bool updated = mptcp_update_rcv_data_fin(msk, mpext->data_seq, mpext->dsn64); @@ -1131,26 +1133,26 @@ static enum mapping_status get_mapping_status(struct sock *ssk, */ skb_ext_del(skb, SKB_EXT_MPTCP); return MAPPING_OK; - } else { - if (updated) - mptcp_schedule_work((struct sock *)msk); - - return MAPPING_DATA_FIN; } - } else { - u64 data_fin_seq = mpext->data_seq + data_len - 1; - /* If mpext->data_seq is a 32-bit value, data_fin_seq - * must also be limited to 32 bits. - */ - if (!mpext->dsn64) - data_fin_seq &= GENMASK_ULL(31, 0); + if (updated) + mptcp_schedule_work((struct sock *)msk); - mptcp_update_rcv_data_fin(msk, data_fin_seq, mpext->dsn64); - pr_debug("DATA_FIN with mapping seq=%llu dsn64=%d", - data_fin_seq, mpext->dsn64); + return MAPPING_DATA_FIN; } + data_fin_seq = mpext->data_seq + data_len - 1; + + /* If mpext->data_seq is a 32-bit value, data_fin_seq must also + * be limited to 32 bits. + */ + if (!mpext->dsn64) + data_fin_seq &= GENMASK_ULL(31, 0); + + mptcp_update_rcv_data_fin(msk, data_fin_seq, mpext->dsn64); + pr_debug("DATA_FIN with mapping seq=%llu dsn64=%d", + data_fin_seq, mpext->dsn64); + /* Adjust for DATA_FIN using 1 byte of sequence space */ data_len--; } From patchwork Tue May 14 01:13:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mat Martineau X-Patchwork-Id: 13663752 X-Patchwork-Delegate: mat@martineau.name Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4B9F610942; Tue, 14 May 2024 01:13:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715649224; cv=none; b=M9wSRzXz1Juc086V7IXv2w9Zlsgt38YiWLycfs1xKgYETqvpbkxhOmYqulvrFzhmYyr0C3hDghPaC8VJJ7oDkalMYqdx2nL9+vbjZMr6NNCHWl7Dgoy5WhOL8G+usp6c2KgmOvRX1sw8GkcEbB1F0rYwqA9FxDJgzYz9w2lHLmc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715649224; c=relaxed/simple; bh=NgVt6XeU+I2oaazTnOoG5Kow+tEb+mvwZ+uG+3wUE0E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=doTI/469c7WLtXk/Xx3wMEx2klnM52FFKVxLpInU+BfXYHIkxrTq8bCIONFs9TjbzQjbzmBIaO2ok/zhUJMshMxrKqx7I7g/Gauc0RgmhctNiphOIAywuADKwvlax1NbJxIT4sT1p12fxebvX8hIewDB2RjbemNZ4/T78l+OErI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Ra2pHEDd; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Ra2pHEDd" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82FD9C4AF17; Tue, 14 May 2024 01:13:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715649223; bh=NgVt6XeU+I2oaazTnOoG5Kow+tEb+mvwZ+uG+3wUE0E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ra2pHEDdNC0Cx58ex+NYJiXBZ5QKkEqBMl/n+XcOy87AveUpF3jHvLFB+4PzFKjjz O32eUknpczKuPe8A7QuRxQMQl8Y37XZz8hAl1DrPrhZCdTJoWd3J/OrxMnbvWQ/3LV 8LnISjskjCxFo5kdPMzmfXtbByQY+Gb1Q9XuK4qWlg94ltPKslDdYPmUxDjF1M1Ucg KiPbZi0g0cFllYtme1Fo/lXL1VxSmA4H0frUrS/u0B0deeeOl5ryBu6tiVu4XLKkG0 Z8FwS4iacLSD8RJ4BmQp5K8QmMxQsfJVjVYFtSBNEZTeJZhi01L5AtbC8rZvJjT+AX cSZImGNcM5nuQ== From: Mat Martineau To: mptcp@lists.linux.dev, geliang@kernel.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, fw@strlen.de Cc: "Matthieu Baerts (NGI0)" , netdev@vger.kernel.org, Mat Martineau Subject: [PATCH net-next v2 7/8] mptcp: move mptcp_pm_gen.h's include Date: Mon, 13 May 2024 18:13:31 -0700 Message-ID: <20240514011335.176158-8-martineau@kernel.org> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240514011335.176158-1-martineau@kernel.org> References: <20240514011335.176158-1-martineau@kernel.org> Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: "Matthieu Baerts (NGI0)" Nothing from protocol.h depends on mptcp_pm_gen.h, only code from pm_netlink.c and pm_userspace.c depends on it. So this include can be moved where it is needed to avoid a "unused includes" warning. Reviewed-by: Geliang Tang Signed-off-by: Matthieu Baerts (NGI0) Signed-off-by: Mat Martineau --- net/mptcp/pm_netlink.c | 1 + net/mptcp/pm_userspace.c | 1 + net/mptcp/protocol.h | 2 -- 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index 5c17d39146ea..7f53e022e27e 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -14,6 +14,7 @@ #include "protocol.h" #include "mib.h" +#include "mptcp_pm_gen.h" static int pm_nl_pernet_id; diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index 9f5d422d5ef6..f0a4590506c6 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -6,6 +6,7 @@ #include "protocol.h" #include "mib.h" +#include "mptcp_pm_gen.h" void mptcp_free_local_addr_list(struct mptcp_sock *msk) { diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 39fc47e6b88a..7aa47e2dd52b 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -14,8 +14,6 @@ #include #include -#include "mptcp_pm_gen.h" - #define MPTCP_SUPPORTED_VERSION 1 /* MPTCP option bits */ From patchwork Tue May 14 01:13:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mat Martineau X-Patchwork-Id: 13663753 X-Patchwork-Delegate: mat@martineau.name Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4F95B111A8; Tue, 14 May 2024 01:13:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715649224; cv=none; b=YIlT7NhAl64oky3qTJiYKcZI5lGcKNtfJLYt1tnrEyhNwUUyG0iRsBR3otICJ4HxknD8FS3gW6WoS5J1w1YNqv0X8Tt7sO3DJAr1QkN/sn38v9zmSvVPsFJcpn0A9kCjkq/J0Mi2z18qIlhFYuazwMEmQsivOdGjVcbk1mbP45g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715649224; c=relaxed/simple; bh=Ct/2fDVBOpgHX6ViSh82CQRY4rG3MD+taLck/RW657c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Vw58Vr/H4BWrSpDqEFvRie4TH82h21WjtF5OeN+KFPYfc9XMxby2OFvshNGttjmkAAUAwy96xmifstxz60zfOhKEtGzJezu6am7Q8zAzEl3a9BZ+Ei/NIIubAOY8wpOaqUWM/KhAvPG9QZ3lbKScf1TYYqDYBaGLsB8jxK72FDQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=M6vK+T8v; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="M6vK+T8v" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E06F2C4AF08; Tue, 14 May 2024 01:13:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715649224; bh=Ct/2fDVBOpgHX6ViSh82CQRY4rG3MD+taLck/RW657c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M6vK+T8v21VuYurIZSTxAUe4FTPUTyitfl9VtAk8xKrpFBSQdYXyLndrivXdyUpV2 aTUzSMN0ttvjm7FH3hfmSbkftKBsMRWyaLXSKn4B/OPaoITWLGraKYRI/M7pG0htQ2 3amu5Irzi4+JILkHYWowY3Q0zd9SRhnnr0J2CiQGGgl4uACJq/sZKIKUL8CER3j+vy Mo8P40WAcOTjD3RFPYJIHyb2JzZGs5PZaT2AiQPcp4+y/6S104oo0zM+bUXtlj6mZi wkbOK7HF50ZQwHtXy8iOEHW0Sdw6YdVXJrGbYfbPMt7ueu65wtRHSeWEb+OX+5K152 fFBe1XOIoY8hQ== From: Mat Martineau To: mptcp@lists.linux.dev, geliang@kernel.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, fw@strlen.de Cc: "Matthieu Baerts (NGI0)" , netdev@vger.kernel.org, Mat Martineau Subject: [PATCH net-next v2 8/8] mptcp: include inet_common in mib.h Date: Mon, 13 May 2024 18:13:32 -0700 Message-ID: <20240514011335.176158-9-martineau@kernel.org> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240514011335.176158-1-martineau@kernel.org> References: <20240514011335.176158-1-martineau@kernel.org> Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: "Matthieu Baerts (NGI0)" So this file is now self-contained: it can be compiled alone with analytic tools. Reviewed-by: Geliang Tang Signed-off-by: Matthieu Baerts (NGI0) Signed-off-by: Mat Martineau --- net/mptcp/mib.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/mptcp/mib.h b/net/mptcp/mib.h index dd7fd1f246b5..2704afd0dfe4 100644 --- a/net/mptcp/mib.h +++ b/net/mptcp/mib.h @@ -1,5 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */ +#include + enum linux_mptcp_mib_field { MPTCP_MIB_NUM = 0, MPTCP_MIB_MPCAPABLEPASSIVE, /* Received SYN with MP_CAPABLE */