From patchwork Tue Nov 17 19:47:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Westphal X-Patchwork-Id: 1401794 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.01.org (client-ip=198.145.21.10; helo=ml01.01.org; envelope-from=mptcp-bounces@lists.01.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=strlen.de Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CbGgM1hZrz9sT6 for ; Wed, 18 Nov 2020 06:47:26 +1100 (AEDT) Received: from ml01.vlan13.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 802CE100EBBC0; Tue, 17 Nov 2020 11:47:23 -0800 (PST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a0a:51c0:0:12e:520::1; helo=chamillionaire.breakpoint.cc; envelope-from=fw@breakpoint.cc; receiver= Received: from Chamillionaire.breakpoint.cc (Chamillionaire.breakpoint.cc [IPv6:2a0a:51c0:0:12e:520::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id AEF45100EBBBE for ; Tue, 17 Nov 2020 11:47:21 -0800 (PST) Received: from fw by Chamillionaire.breakpoint.cc with local (Exim 4.92) (envelope-from ) id 1kf6wh-0007VV-Lv; Tue, 17 Nov 2020 20:47:19 +0100 From: Florian Westphal To: Cc: Florian Westphal Date: Tue, 17 Nov 2020 20:47:12 +0100 Message-Id: <20201117194712.23209-1-fw@strlen.de> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Message-ID-Hash: V7Q457TWXNSKDCVQZGPLRDC7OV6YX2H6 X-Message-ID-Hash: V7Q457TWXNSKDCVQZGPLRDC7OV6YX2H6 X-MailFrom: fw@breakpoint.cc X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.1.1 Precedence: list Subject: [MPTCP] Fastclose packetdrill test cases List-Id: Discussions regarding MPTCP upstreaming Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: I've been working on packetdrill test cases to cover the 'fastclose' option. I've included this as a patch -- no need to apply, I can do a pull request via github. I'm only including it as a reference. A few questions below. It covers three scenarios: 1. fastclose_with_ack.pkt: single subflow. Test ACK with fastclose & bogus key has no effect. Test ACK with fastclose & expected key closes the mptcp connection: Further data should result in a RST. 2. fastclose_with_rst.pkt: single subflow. Test RST with fastclose & bogus key closes the subflow but keeps mptcp socket around. This sends a JOIN request after the RST, its expected to succeed. Then, another RST is sent, this time with correct fastclose. RST is expected again. 3. fastclose_with_rst_multi.pkt: same as 2), but two subflows are created before the fastclose is sent on the new subflow. Its expected that the kernel sends a RST on the original subflow. Is my understanding of the expected beahvior correct? In particular: 1. RST+fastclose always closes the subflow, even if the fastclose key doesn't match. 2. RST+fastclose has no effect whatsoever if the RST fails window checks, even if the fastclose would have a correct key. Is any important scenario missing that should be covered? Thanks. --- .../mptcp/fastclose/fastclose_with_ack.pkt | 36 +++++++++++++++ .../mptcp/fastclose/fastclose_with_rst.pkt | 44 +++++++++++++++++++ .../fastclose/fastclose_with_rst_multi.pkt | 43 ++++++++++++++++++ 3 files changed, 123 insertions(+) create mode 100644 gtests/net/mptcp/fastclose/fastclose_with_ack.pkt create mode 100644 gtests/net/mptcp/fastclose/fastclose_with_rst.pkt create mode 100644 gtests/net/mptcp/fastclose/fastclose_with_rst_multi.pkt diff --git a/gtests/net/mptcp/fastclose/fastclose_with_ack.pkt b/gtests/net/mptcp/fastclose/fastclose_with_ack.pkt new file mode 100644 index 000000000000..d6432fc79800 --- /dev/null +++ b/gtests/net/mptcp/fastclose/fastclose_with_ack.pkt @@ -0,0 +1,36 @@ +// connection initiated by packetdrill +--tolerance_usecs=100000 +`../common/defaults.sh` + ++0 `../common/server.sh` + ++0 socket(..., SOCK_STREAM, IPPROTO_MPTCP) = 3 ++0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0 + ++0 bind(3, ..., ...) = 0 ++0 listen(3, 1) = 0 ++0.0 < addr[caddr0] > addr[saddr0] S 0:0(0) win 65535 ++0.0 > S. 0:0(0) ack 1 ++0.0 < . 1:1(0) ack 1 win 256 ++0 accept(3, ..., ...) = 4 + ++0.0 < P. 1:1001(1000) ack 1 win 450 ++0.0 > . 1:1(0) ack 1001 win 264 + +// send ack fastclose with a key that should not match. ++0 < . 1001:1001(0) win 450 + +// more data, expect ack ++1.0 < P. 1001:2001(1000) ack 1 win 450 ++0.0 > . 1:1(0) ack 2001 win 272 + +// send another ack fastclose, this time with matching key ++0.1 < . 2001:2001(0) win 450 +// expect peer to reset all subflows now: ++0.01 > R. 1:1(0) ack 2001 win 272 + +// more data, expect a reset and win0 (no socket anymore) ++1.0 < P. 2001:3001(1000) ack 1 win 450 ++0.01 > R 1:1(0) ack 0 win 0 + ++0 close(4) = 0 diff --git a/gtests/net/mptcp/fastclose/fastclose_with_rst.pkt b/gtests/net/mptcp/fastclose/fastclose_with_rst.pkt new file mode 100644 index 000000000000..d0cf45da0b40 --- /dev/null +++ b/gtests/net/mptcp/fastclose/fastclose_with_rst.pkt @@ -0,0 +1,44 @@ +// connection initiated by packetdrill +--tolerance_usecs=100000 +`../common/defaults.sh` + ++0 `../common/server.sh` + ++0 socket(..., SOCK_STREAM, IPPROTO_MPTCP) = 3 ++0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0 + ++0 bind(3, ..., ...) = 0 ++0 listen(3, 1) = 0 ++0.0 < addr[caddr0] > addr[saddr0] S 0:0(0) win 65535 ++0.0 > S. 0:0(0) ack 1 ++0.0 < . 1:1(0) ack 1 win 256 ++0 accept(3, ..., ...) = 4 + ++0.0 < P. 1:1001(1000) ack 1 win 450 ++0.0 > . 1:1(0) ack 1001 win 264 + +// send rst fastclose with a key that should not match. ++0 < R. 1001:1001(0) win 450 + +// more data, but expect rst: the subflow is gone. ++1.0 < P. 1001:2001(1000) ack 1 win 450 ++0.02 > R 1:1(0) ack 0 win 0 + +// mp_join: supposed to work -- fastclose should have had no effect. ++0.1 < addr[caddr0] > addr[saddr0] S 0:0(0) win 65535 ++0.0 > S. 0:0(0) ack 1 ++0.0 < . 1:1(0) ack 1 win 256 ++0.0 > . 1:1(0) ack 1 win 256 + +// more data, resend. should work now. ++0.0 < P. 1:1001(1000) ack 1 win 450 ++0.0 > . 1:1(0) ack 1001 win 264 + +// send another rst fastclose, this time with matching key ++0.1 < R. 1001:1001(0) win 450 + +// more data, expect a reset and win0 (no socket anymore) ++1.0 < P. 2001:3001(1000) ack 1 win 450 ++0.01 > R 1:1(0) ack 0 win 0 + ++0 close(4) = 0 diff --git a/gtests/net/mptcp/fastclose/fastclose_with_rst_multi.pkt b/gtests/net/mptcp/fastclose/fastclose_with_rst_multi.pkt new file mode 100644 index 000000000000..da49ed2bfa68 --- /dev/null +++ b/gtests/net/mptcp/fastclose/fastclose_with_rst_multi.pkt @@ -0,0 +1,43 @@ +// connection initiated by packetdrill +--tolerance_usecs=100000 +`../common/defaults.sh` + ++0 `../common/server.sh` + ++0 socket(..., SOCK_STREAM, IPPROTO_MPTCP) = 3 ++0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0 + ++0 bind(3, ..., ...) = 0 ++0 listen(3, 1) = 0 ++0.0 < addr[caddr0] > addr[saddr0] S 0:0(0) win 65535 ++0.0 > S. 0:0(0) ack 1 ++0.0 < . 1:1(0) ack 1 win 256 ++0 accept(3, ..., ...) = 4 + ++0.0 < P. 1:1001(1000) ack 1 win 450 ++0.0 > . 1:1(0) ack 1001 win 264 + ++0.2 < P. 1:3(2) ack 1 win 450 ++0.0 > . 1:1(0) ack 1001 + +// add another subflow. ++0.5 < addr[caddr1] > addr[saddr1] S 0:0(0) win 65535 ++0.0 > S. 0:0(0) ack 1 ++0.0 < . 1:1(0) ack 1 win 256 ++0.0 > . 1:1(0) ack 1 win 256 + +// send more data. ++0.2 < P. 1001:2001(1000) ack 1 win 450 ++0 > . 1:1(0) ack 1 win 256 + +// send rst fastclose. Out of window, so it should have no effect. ++0.1 < R. 1001:1001(0) win 450 ++0 > . 1:1(0) ack 1 win 256 + +// again. fastclose on the 2nd subflow. ++0.1 < R. 1:1(0) win 450 + +// expect peer to reset the original flow now: ++0.0 > addr[saddr0] > addr[caddr0] R. 1:1(0) ack 1001 win 264 + ++0 close(4) = 0