From: Peter Krystad <peter.krystad at linux.intel.com>
To: mptcp at lists.01.org
Subject: [MPTCP] [PATCH 6/7] mptcp: Check flags in MP_CAPABLE option
Date: Wed, 05 Jun 2019 17:36:31 -0700 [thread overview]
Message-ID: <20190606003632.2863-7-peter.krystad@linux.intel.com> (raw)
In-Reply-To: 20190606003632.2863-1-peter.krystad@linux.intel.com
[-- Attachment #1: Type: text/plain, Size: 1401 bytes --]
squashto: Handle MPTCP TCP options
Signed-off-by: Peter Krystad <peter.krystad(a)linux.intel.com>
---
net/mptcp/options.c | 6 +++++-
net/mptcp/protocol.h | 7 ++++---
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/net/mptcp/options.c b/net/mptcp/options.c
index df4405d268f0..98d582207cb0 100644
--- a/net/mptcp/options.c
+++ b/net/mptcp/options.c
@@ -29,8 +29,12 @@ void mptcp_parse_option(const unsigned char *ptr, int opsize,
if (mp_opt->version != 0)
break;
- mp_opt->mp_capable = 1;
mp_opt->flags = *ptr++;
+ if (!((mp_opt->flags & MPTCP_CAP_FLAG_MASK) == MPTCP_CAP_HMAC_SHA1) ||
+ (mp_opt->flags & MPTCP_CAP_EXTENSIBILITY))
+ break;
+
+ mp_opt->mp_capable = 1;
mp_opt->sndr_key = get_unaligned_be64(ptr);
ptr += 8;
diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
index 6498e68e1030..2c2f2ca4312b 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -23,9 +23,10 @@
#define MPTCPOPT_VERSION_MASK 0x0F
/* MPTCP handshake flags */
-#define MPTCP_CAP_CHECKSUM_REQD (1 << 7)
-#define MPTCP_CAP_EXTENSIBILITY (1 << 6)
-#define MPTCP_CAP_HMAC_SHA1 (1 << 0)
+#define MPTCP_CAP_CHECKSUM_REQD BIT(7)
+#define MPTCP_CAP_EXTENSIBILITY BIT(6)
+#define MPTCP_CAP_HMAC_SHA1 BIT(0)
+#define MPTCP_CAP_FLAG_MASK (0x3F)
/* MPTCP DSS flags */
#define MPTCP_DSS_DATA_FIN BIT(4)
--
2.17.2
next 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-07 11:24 [MPTCP] [PATCH 6/7] mptcp: Check flags in MP_CAPABLE option Matthieu Baerts
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-7-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.