diff mbox series

[mptcp-next,v2,9/9] DO-NOT-MERGE: mptcp: mp_fail test

Message ID 5afb788b507a63f31f390c512fb5eedb464dd01e.1631188109.git.geliangtang@xiaomi.com (mailing list archive)
State Superseded, archived
Headers show
Series The infinite mapping support | expand

Commit Message

Geliang Tang Sept. 9, 2021, 11:51 a.m. UTC
From: Geliang Tang <geliangtang@xiaomi.com>

./mptcp_join.sh -Cf

Signed-off-by: Geliang Tang <geliangtang@xiaomi.com>
---
 net/mptcp/protocol.c                           |  9 +++++++++
 .../testing/selftests/net/mptcp/mptcp_join.sh  | 18 ++++++++++++++++++
 2 files changed, 27 insertions(+)

Comments

Paolo Abeni Sept. 9, 2021, 2:23 p.m. UTC | #1
On Thu, 2021-09-09 at 19:51 +0800, Geliang Tang wrote:
> From: Geliang Tang <geliangtang@xiaomi.com>
> 
> ./mptcp_join.sh -Cf
> 
> Signed-off-by: Geliang Tang <geliangtang@xiaomi.com>

I'm wondering if we could use the u32 target to replace all the TCP
options with u32 if find a DSS (tcp header len == 38, IIRC) and the DSS
len is not zero (checking 2 bytes at a fixed offset).

That will corrupt che tcp csum, but IIRC the csum is not really checked
over veth with default nic config.

/P
Geliang Tang Sept. 22, 2021, 3:50 a.m. UTC | #2
Hi Paolo,

Paolo Abeni <pabeni@redhat.com> 于2021年9月9日周四 下午10:23写道:
>
> On Thu, 2021-09-09 at 19:51 +0800, Geliang Tang wrote:
> > From: Geliang Tang <geliangtang@xiaomi.com>
> >
> > ./mptcp_join.sh -Cf
> >
> > Signed-off-by: Geliang Tang <geliangtang@xiaomi.com>
>
> I'm wondering if we could use the u32 target to replace all the TCP
> options with u32 if find a DSS (tcp header len == 38, IIRC) and the DSS
> len is not zero (checking 2 bytes at a fixed offset).

Please give me more help about how to use the u32 target to replace the TCP
options.

Thanks,
-Geliang

>
> That will corrupt che tcp csum, but IIRC the csum is not really checked
> over veth with default nic config.
>
> /P
>
diff mbox series

Patch

diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 7036c78ccef2..10d15e93d70b 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -1296,6 +1296,8 @@  static void mptcp_update_infinite_mapping(struct mptcp_sock *msk, struct mptcp_e
 	__mptcp_do_infinite(msk);
 }
 
+static int j;
+
 static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk,
 			      struct mptcp_data_frag *dfrag,
 			      struct mptcp_sendmsg_info *info)
@@ -1430,6 +1432,13 @@  static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk,
 		mptcp_update_data_checksum(skb, copy);
 	if (READ_ONCE(msk->snd_infinite_mapping_enable))
 		mptcp_update_infinite_mapping(msk, mpext);
+
+	pr_debug("%s j=%d", __func__, j++);
+	if (j == 20)
+		skb->data_len = 1;
+	if (j > 40)
+		j = 0;
+
 	mptcp_subflow_ctx(ssk)->rel_write_seq += copy;
 	return copy;
 }
diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
index fe0c8f3164a7..38663f6373b8 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
@@ -977,6 +977,24 @@  chk_link_usage()
 
 subflows_tests()
 {
+	# 1 subflow
+	reset
+	ip netns exec $ns1 ./pm_nl_ctl limits 0 2
+	ip netns exec $ns2 ./pm_nl_ctl limits 0 2
+	run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow
+	chk_join_nr "1 subflow" 0 0 0
+
+	exit
+
+	# multiple subflows
+	reset
+	ip netns exec $ns1 ./pm_nl_ctl limits 0 2
+	ip netns exec $ns2 ./pm_nl_ctl limits 0 2
+	ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow
+	ip netns exec $ns2 ./pm_nl_ctl add 10.0.2.2 flags subflow
+	run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow
+	chk_join_nr "multiple subflows" 2 2 2
+
 	reset
 	run_tests $ns1 $ns2 10.0.1.1
 	chk_join_nr "no JOIN" "0" "0" "0"