All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mat Martineau <mathew.j.martineau at linux.intel.com>
To: mptcp at lists.01.org
Subject: [MPTCP] [PATCH net-next 04/11] mptcp: use adding up size to get ADD_ADDR length
Date: Wed, 09 Dec 2020 15:51:21 -0800	[thread overview]
Message-ID: <20201209235128.175473-5-mathew.j.martineau@linux.intel.com> (raw)
In-Reply-To: 20201209235128.175473-1-mathew.j.martineau@linux.intel.com

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

From: Geliang Tang <geliangtang(a)gmail.com>

This patch uses adding up size to get the ADD_ADDR suboption length rather
than returning the ADD_ADDR size constants.

Signed-off-by: Geliang Tang <geliangtang(a)gmail.com>
Signed-off-by: Mat Martineau <mathew.j.martineau(a)linux.intel.com>
---
 net/mptcp/protocol.h | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
index 987046d9d1d4..5c45aabf4c6a 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -578,10 +578,14 @@ static inline bool mptcp_pm_should_rm_signal(struct mptcp_sock *msk)
 
 static inline unsigned int mptcp_add_addr_len(int family, bool echo)
 {
-	if (family == AF_INET)
-		return echo ? TCPOLEN_MPTCP_ADD_ADDR_BASE
-			    : TCPOLEN_MPTCP_ADD_ADDR;
-	return echo ? TCPOLEN_MPTCP_ADD_ADDR6_BASE : TCPOLEN_MPTCP_ADD_ADDR6;
+	u8 len = TCPOLEN_MPTCP_ADD_ADDR_BASE;
+
+	if (family == AF_INET6)
+		len = TCPOLEN_MPTCP_ADD_ADDR6_BASE;
+	if (!echo)
+		len += MPTCPOPT_THMAC_LEN;
+
+	return len;
 }
 
 bool mptcp_pm_add_addr_signal(struct mptcp_sock *msk, unsigned int remaining,
-- 
2.29.2

WARNING: multiple messages have this Message-ID (diff)
From: Mat Martineau <mathew.j.martineau@linux.intel.com>
To: netdev@vger.kernel.org
Cc: Geliang Tang <geliangtang@gmail.com>,
	davem@davemloft.net, kuba@kernel.org, mptcp@lists.01.org,
	Mat Martineau <mathew.j.martineau@linux.intel.com>
Subject: [PATCH net-next 04/11] mptcp: use adding up size to get ADD_ADDR length
Date: Wed,  9 Dec 2020 15:51:21 -0800	[thread overview]
Message-ID: <20201209235128.175473-5-mathew.j.martineau@linux.intel.com> (raw)
In-Reply-To: <20201209235128.175473-1-mathew.j.martineau@linux.intel.com>

From: Geliang Tang <geliangtang@gmail.com>

This patch uses adding up size to get the ADD_ADDR suboption length rather
than returning the ADD_ADDR size constants.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
---
 net/mptcp/protocol.h | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
index 987046d9d1d4..5c45aabf4c6a 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -578,10 +578,14 @@ static inline bool mptcp_pm_should_rm_signal(struct mptcp_sock *msk)
 
 static inline unsigned int mptcp_add_addr_len(int family, bool echo)
 {
-	if (family == AF_INET)
-		return echo ? TCPOLEN_MPTCP_ADD_ADDR_BASE
-			    : TCPOLEN_MPTCP_ADD_ADDR;
-	return echo ? TCPOLEN_MPTCP_ADD_ADDR6_BASE : TCPOLEN_MPTCP_ADD_ADDR6;
+	u8 len = TCPOLEN_MPTCP_ADD_ADDR_BASE;
+
+	if (family == AF_INET6)
+		len = TCPOLEN_MPTCP_ADD_ADDR6_BASE;
+	if (!echo)
+		len += MPTCPOPT_THMAC_LEN;
+
+	return len;
 }
 
 bool mptcp_pm_add_addr_signal(struct mptcp_sock *msk, unsigned int remaining,
-- 
2.29.2


             reply	other threads:[~2020-12-09 23:51 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-09 23:51 Mat Martineau [this message]
2020-12-09 23:51 ` [PATCH net-next 04/11] mptcp: use adding up size to get ADD_ADDR length Mat Martineau
  -- strict thread matches above, loose matches on Subject: below --
2020-12-10  3:04 [MPTCP] Re: [PATCH net-next 00/11] mptcp: Add port parameter to ADD_ADDR option David Miller
2020-12-10  3:04 ` David Miller
2020-12-09 23:51 [MPTCP] [PATCH net-next 11/11] mptcp: use the variable sk instead of open-coding Mat Martineau
2020-12-09 23:51 ` Mat Martineau
2020-12-09 23:51 [MPTCP] [PATCH net-next 10/11] mptcp: rename add_addr_signal and mptcp_add_addr_status Mat Martineau
2020-12-09 23:51 ` Mat Martineau
2020-12-09 23:51 [MPTCP] [PATCH net-next 09/11] mptcp: drop rm_addr_signal flag Mat Martineau
2020-12-09 23:51 ` Mat Martineau
2020-12-09 23:51 [MPTCP] [PATCH net-next 08/11] mptcp: print out port and ahmac when receiving ADD_ADDR Mat Martineau
2020-12-09 23:51 ` Mat Martineau
2020-12-09 23:51 [MPTCP] [PATCH net-next 07/11] mptcp: add port parameter for mptcp_pm_announce_addr Mat Martineau
2020-12-09 23:51 ` Mat Martineau
2020-12-09 23:51 [MPTCP] [PATCH net-next 06/11] mptcp: send out dedicated packet for ADD_ADDR using port Mat Martineau
2020-12-09 23:51 ` Mat Martineau
2020-12-09 23:51 [MPTCP] [PATCH net-next 05/11] mptcp: add the outgoing ADD_ADDR port support Mat Martineau
2020-12-09 23:51 ` Mat Martineau
2020-12-09 23:51 [MPTCP] [PATCH net-next 03/11] mptcp: add port support for ADD_ADDR suboption writing Mat Martineau
2020-12-09 23:51 ` Mat Martineau
2020-12-09 23:51 [MPTCP] [PATCH net-next 02/11] mptcp: unify ADD_ADDR and ADD_ADDR6 suboptions writing Mat Martineau
2020-12-09 23:51 ` Mat Martineau
2020-12-09 23:51 [MPTCP] [PATCH net-next 01/11] mptcp: unify ADD_ADDR and echo " Mat Martineau
2020-12-09 23:51 ` Mat Martineau
2020-12-09 23:51 [MPTCP] [PATCH net-next 00/11] mptcp: Add port parameter to ADD_ADDR option Mat Martineau
2020-12-09 23:51 ` Mat Martineau

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=20201209235128.175473-5-mathew.j.martineau@linux.intel.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.