All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni at redhat.com>
To: mptcp at lists.01.org
Subject: [MPTCP] [PATCH net-next 8/8] subflow: introduce and use mptcp_can_accept_new_subflow()
Date: Thu, 23 Jul 2020 13:02:36 +0200	[thread overview]
Message-ID: <f917ce96fa7c3ff623378a01ae8fb52d4ac1884f.1595431326.git.pabeni@redhat.com> (raw)
In-Reply-To: cover.1595431326.git.pabeni@redhat.com

[-- Attachment #1: Type: text/plain, Size: 1424 bytes --]

So that we can easily perform some basic PM-related
adimission checks before creating the child socket.

Reviewed-by: Mat Martineau <mathew.j.martineau(a)linux.intel.com>
Tested-by: Christoph Paasch <cpaasch(a)apple.com>
Signed-off-by: Paolo Abeni <pabeni(a)redhat.com>
---
 net/mptcp/subflow.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
index ada04df6f99f..e645483d1200 100644
--- a/net/mptcp/subflow.c
+++ b/net/mptcp/subflow.c
@@ -53,6 +53,12 @@ static void subflow_generate_hmac(u64 key1, u64 key2, u32 nonce1, u32 nonce2,
 	mptcp_crypto_hmac_sha(key1, key2, msg, 8, hmac);
 }
 
+static bool mptcp_can_accept_new_subflow(const struct mptcp_sock *msk)
+{
+	return mptcp_is_fully_established((void *)msk) &&
+	       READ_ONCE(msk->pm.accept_subflow);
+}
+
 /* validate received token and create truncated hmac and nonce for SYN-ACK */
 static struct mptcp_sock *subflow_token_join_request(struct request_sock *req,
 						     const struct sk_buff *skb)
@@ -443,6 +449,7 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk,
 	} else if (subflow_req->mp_join) {
 		mptcp_get_options(skb, &mp_opt);
 		if (!mp_opt.mp_join ||
+		    !mptcp_can_accept_new_subflow(subflow_req->msk) ||
 		    !subflow_hmac_valid(req, &mp_opt)) {
 			SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINACKMAC);
 			fallback = true;
-- 
2.26.2

WARNING: multiple messages have this Message-ID (diff)
From: Paolo Abeni <pabeni@redhat.com>
To: netdev@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>, mptcp@lists.01.org
Subject: [PATCH net-next 8/8] subflow: introduce and use mptcp_can_accept_new_subflow()
Date: Thu, 23 Jul 2020 13:02:36 +0200	[thread overview]
Message-ID: <f917ce96fa7c3ff623378a01ae8fb52d4ac1884f.1595431326.git.pabeni@redhat.com> (raw)
In-Reply-To: <cover.1595431326.git.pabeni@redhat.com>

So that we can easily perform some basic PM-related
adimission checks before creating the child socket.

Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Tested-by: Christoph Paasch <cpaasch@apple.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
 net/mptcp/subflow.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
index ada04df6f99f..e645483d1200 100644
--- a/net/mptcp/subflow.c
+++ b/net/mptcp/subflow.c
@@ -53,6 +53,12 @@ static void subflow_generate_hmac(u64 key1, u64 key2, u32 nonce1, u32 nonce2,
 	mptcp_crypto_hmac_sha(key1, key2, msg, 8, hmac);
 }
 
+static bool mptcp_can_accept_new_subflow(const struct mptcp_sock *msk)
+{
+	return mptcp_is_fully_established((void *)msk) &&
+	       READ_ONCE(msk->pm.accept_subflow);
+}
+
 /* validate received token and create truncated hmac and nonce for SYN-ACK */
 static struct mptcp_sock *subflow_token_join_request(struct request_sock *req,
 						     const struct sk_buff *skb)
@@ -443,6 +449,7 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk,
 	} else if (subflow_req->mp_join) {
 		mptcp_get_options(skb, &mp_opt);
 		if (!mp_opt.mp_join ||
+		    !mptcp_can_accept_new_subflow(subflow_req->msk) ||
 		    !subflow_hmac_valid(req, &mp_opt)) {
 			SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINACKMAC);
 			fallback = true;
-- 
2.26.2


             reply	other threads:[~2020-07-23 11:02 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-23 11:02 Paolo Abeni [this message]
2020-07-23 11:02 ` [PATCH net-next 8/8] subflow: introduce and use mptcp_can_accept_new_subflow() Paolo Abeni
  -- strict thread matches above, loose matches on Subject: below --
2020-07-23 18:47 [MPTCP] Re: [PATCH net-next 0/8] mptcp: non backup subflows pre-reqs David Miller
2020-07-23 18:47 ` David Miller
2020-07-23 11:02 [MPTCP] [PATCH net-next 7/8] subflow: use rsk_ops->send_reset() Paolo Abeni
2020-07-23 11:02 ` Paolo Abeni
2020-07-23 11:02 [MPTCP] [PATCH net-next 6/8] subflow: explicitly check for plain tcp rsk Paolo Abeni
2020-07-23 11:02 ` Paolo Abeni
2020-07-23 11:02 [MPTCP] [PATCH net-next 5/8] mptcp: cleanup subflow_finish_connect() Paolo Abeni
2020-07-23 11:02 ` Paolo Abeni
2020-07-23 11:02 [MPTCP] [PATCH net-next 4/8] mptcp: explicitly track the fully established status Paolo Abeni
2020-07-23 11:02 ` Paolo Abeni
2020-07-23 11:02 [MPTCP] [PATCH net-next 3/8] mptcp: mark as fallback even early ones Paolo Abeni
2020-07-23 11:02 ` Paolo Abeni
2020-07-23 11:02 [MPTCP] [PATCH net-next 2/8] mptcp: avoid data corruption on reinsert Paolo Abeni
2020-07-23 11:02 ` Paolo Abeni
2020-07-23 11:02 [MPTCP] [PATCH net-next 1/8] subflow: always init 'rel_write_seq' Paolo Abeni
2020-07-23 11:02 ` Paolo Abeni
2020-07-23 11:02 [MPTCP] [PATCH net-next 0/8] mptcp: non backup subflows pre-reqs Paolo Abeni
2020-07-23 11:02 ` Paolo Abeni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f917ce96fa7c3ff623378a01ae8fb52d4ac1884f.1595431326.git.pabeni@redhat.com \
    --to=unknown@example.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.