mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Geliang Tang <geliangtang@gmail.com>
To: Mat Martineau <mathew.j.martineau@linux.intel.com>,
	Matthieu Baerts <matthieu.baerts@tessares.net>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>
Cc: Geliang Tang <geliangtang@gmail.com>,
	netdev@vger.kernel.org, mptcp@lists.01.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH net-next 2/3] mptcp: add MP_FAIL suboption handling
Date: Tue, 16 Jun 2020 14:47:37 +0800	[thread overview]
Message-ID: <9bb5cb494f4ac53845f2d233409073d8e71d0e4f.1592289629.git.geliangtang@gmail.com> (raw)
In-Reply-To: <cover.1592289629.git.geliangtang@gmail.com>
In-Reply-To: <f86a2f6f241b7f7a49fec17b3428ae5a0fadc93e.1592289629.git.geliangtang@gmail.com>

Add handling for sending and receiving MP_FAIL suboption.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
---
 net/mptcp/options.c  | 18 ++++++++++++++++++
 net/mptcp/protocol.h |  2 ++
 2 files changed, 20 insertions(+)

diff --git a/net/mptcp/options.c b/net/mptcp/options.c
index cc3039f0ac43..82b3d7c566b4 100644
--- a/net/mptcp/options.c
+++ b/net/mptcp/options.c
@@ -288,6 +288,15 @@ static void mptcp_parse_option(const struct sk_buff *skb,
 		pr_debug("MP_PRIO: backup=%d", mp_opt->backup);
 		break;
 
+	case MPTCPOPT_MP_FAIL:
+		if (opsize != TCPOLEN_MPTCP_FAIL)
+			break;
+
+		ptr += 2;
+		mp_opt->data_seq = get_unaligned_be64(ptr);
+		pr_debug("MP_FAIL: data_seq=%lld", mp_opt->data_seq);
+		break;
+
 	default:
 		break;
 	}
@@ -975,6 +984,15 @@ void mptcp_write_options(__be32 *ptr, struct mptcp_out_options *opts)
 				      opts->backup, 0);
 	}
 
+	if (OPTION_MPTCP_FAIL & opts->suboptions) {
+		struct mptcp_ext *mpext = &opts->ext_copy;
+
+		*ptr++ = mptcp_option(MPTCPOPT_MP_FAIL,
+				      TCPOLEN_MPTCP_FAIL,
+				      0, 0);
+		put_unaligned_be64(mpext->data_seq, ptr);
+	}
+
 	if (OPTION_MPTCP_MPJ_SYN & opts->suboptions) {
 		*ptr++ = mptcp_option(MPTCPOPT_MP_JOIN,
 				      TCPOLEN_MPTCP_MPJ_SYN,
diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
index 623c9a1c4343..e6ae0a73716b 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -24,6 +24,7 @@
 #define OPTION_MPTCP_ADD_ADDR6	BIT(7)
 #define OPTION_MPTCP_RM_ADDR	BIT(8)
 #define OPTION_MPTCP_PRIO	BIT(9)
+#define OPTION_MPTCP_FAIL	BIT(10)
 
 /* MPTCP option subtypes */
 #define MPTCPOPT_MP_CAPABLE	0
@@ -60,6 +61,7 @@
 #define TCPOLEN_MPTCP_PORT_LEN		2
 #define TCPOLEN_MPTCP_RM_ADDR_BASE	4
 #define TCPOLEN_MPTCP_PRIO		3
+#define TCPOLEN_MPTCP_FAIL		12
 
 /* MPTCP MP_JOIN flags */
 #define MPTCPOPT_BACKUP		BIT(0)
-- 
2.17.1


  reply	other threads:[~2020-06-16  6:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-16  6:47 [PATCH net-next 0/3] add MP_PRIO, MP_FAIL and MP_FASTCLOSE suboptions handling Geliang Tang
2020-06-16  6:47 ` [PATCH net-next 1/3] mptcp: add MP_PRIO suboption handling Geliang Tang
2020-06-16  6:47   ` Geliang Tang [this message]
2020-06-16  6:47     ` [PATCH net-next 3/3] mptcp: add MP_FASTCLOSE " Geliang Tang
2020-06-16 15:18 ` [PATCH net-next 0/3] add MP_PRIO, MP_FAIL and MP_FASTCLOSE suboptions handling Matthieu Baerts
2020-06-18  6:27   ` Geliang Tang
2020-06-18  8:06     ` 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=9bb5cb494f4ac53845f2d233409073d8e71d0e4f.1592289629.git.geliangtang@gmail.com \
    --to=geliangtang@gmail.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathew.j.martineau@linux.intel.com \
    --cc=matthieu.baerts@tessares.net \
    --cc=mptcp@lists.01.org \
    --cc=netdev@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®