All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Krystad <peter.krystad at linux.intel.com>
To: mptcp at lists.01.org
Subject: [MPTCP] [PATCH 1/7] mptcp: reduce number of pr_debug() calls.
Date: Wed, 05 Jun 2019 17:36:26 -0700	[thread overview]
Message-ID: <20190606003632.2863-2-peter.krystad@linux.intel.com> (raw)
In-Reply-To: 20190606003632.2863-1-peter.krystad@linux.intel.com

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

squash to: Handle MPTCP TCP options

Signed-off-by: Peter Krystad <peter.krystad(a)linux.intel.com>
---
 net/mptcp/options.c | 36 +++++++++++++++++++-----------------
 1 file changed, 19 insertions(+), 17 deletions(-)

diff --git a/net/mptcp/options.c b/net/mptcp/options.c
index 9b9b9c9390c1..964e73b6b48b 100644
--- a/net/mptcp/options.c
+++ b/net/mptcp/options.c
@@ -13,7 +13,7 @@
 void mptcp_parse_option(const unsigned char *ptr, int opsize,
 			struct tcp_options_received *opt_rx)
 {
-	struct mptcp_options_received *mp_opt;
+	struct mptcp_options_received *mp_opt = &opt_rx->mptcp;
 	u8 subtype = *ptr >> 4;
 	int expected_opsize;
 
@@ -25,25 +25,28 @@ void mptcp_parse_option(const unsigned char *ptr, int opsize,
 	 * 10-17: Receiver key (optional)
 	 */
 	case MPTCPOPT_MP_CAPABLE:
-		if (opsize != TCPOLEN_MPTCP_MPC_SYN &&
-		    opsize != TCPOLEN_MPTCP_MPC_SYNACK)
-			break;
-
-		pr_debug("MP_CAPABLE");
-		opt_rx->mptcp.version = *ptr++ & MPTCPOPT_VERSION_MASK;
-		if (opt_rx->mptcp.version != 0)
+		mp_opt->version = *ptr++ & MPTCPOPT_VERSION_MASK;
+		if (mp_opt->version != 0)
 			break;
 
-		opt_rx->mptcp.mp_capable = 1;
-		pr_debug("flags=%02x", *ptr);
-		opt_rx->mptcp.flags = *ptr++;
-		opt_rx->mptcp.sndr_key = get_unaligned_be64(ptr);
-		pr_debug("sndr_key=%llu", opt_rx->mptcp.sndr_key);
+		mp_opt->mp_capable = 1;
+		mp_opt->flags = *ptr++;
+		mp_opt->sndr_key = get_unaligned_be64(ptr);
 		ptr += 8;
-		if (opsize == TCPOLEN_MPTCP_MPC_SYNACK) {
-			opt_rx->mptcp.rcvr_key = get_unaligned_be64(ptr);
-			pr_debug("rcvr_key=%llu", opt_rx->mptcp.rcvr_key);
+
+		if (opsize == TCPOLEN_MPTCP_MPC_SYN) {
+			pr_debug("MP_CAPABLE flags=%x, sndr=%llu",
+				 mp_opt->flags, mp_opt->sndr_key);
+		} else if ((opsize == TCPOLEN_MPTCP_MPC_SYNACK) ||
+			   (opsize == TCPOLEN_MPTCP_MPC_ACK)) {
+			mp_opt->rcvr_key = get_unaligned_be64(ptr);
 			ptr += 8;
+			pr_debug("MP_CAPABLE flags=%x, sndr=%llu, rcvr=%llu",
+				 mp_opt->flags, mp_opt->sndr_key,
+				 mp_opt->rcvr_key);
+		} else {
+			pr_warn("MP_CAPABLE bad option size");
+			mp_opt->mp_capable = 0;
 		}
 		break;
 
@@ -79,7 +82,6 @@ void mptcp_parse_option(const unsigned char *ptr, int opsize,
 	 */
 	case MPTCPOPT_DSS:
 		pr_debug("DSS");
-		mp_opt = &opt_rx->mptcp;
 		mp_opt->dss = 1;
 		ptr++;
 
-- 
2.17.2


             reply	other threads:[~2019-06-06  0:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-06  0:36 Peter Krystad [this message]
  -- strict thread matches above, loose matches on Subject: below --
2019-06-06  7:11 [MPTCP] [PATCH 1/7] mptcp: reduce number of pr_debug() calls 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=20190606003632.2863-2-peter.krystad@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.