From nobody Fri Apr 19 13:03:27 2024 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:a05:6638:38c:0:0:0:0 with SMTP id y12csp6363271jap; Thu, 30 Dec 2021 11:17:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJxhNJhYWqx/nCwN64NIftacIAupxgpQeXf2galyL4JZVb5XE2qA6zehdNYiCbS5qG24zydI X-Received: by 2002:a05:622a:15c3:: with SMTP id d3mr28109986qty.194.1640891866460; Thu, 30 Dec 2021 11:17:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1640891866; cv=none; d=google.com; s=arc-20160816; b=K//CFzJv9aIjpy97sAKl4sb01ggtO/0NqgOOblf9Ked1QrzSDdcOUwmCgs1q3O/xeG HQgQAIuPMXp5+WE9iiYMF8y9JOob/vkt2AQVPYJe9XMM+CymJTa4JzQQrsv1oa/l8gBM tPzD4UQu3lK2MRS0GytPbQ6CcCaZN5/9NGqRQg+ci3KGZQGde+hGyY80L8nwJ/J1JJAn GaBP3w+wZcNd0r8zXhb31n29y+A25UHH9O8OJv5nIZVMo17zc3hw+RZM8tYjv/eOUeAP fp82+KmWiwgecNG5GNZNN6fC2RDXGQJUK/JJkPrJX721rancPpKNuL0gVcgsAP/PEVxU MnOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=coY5IWE8WsTmu8wB43g2Fb20MGtXGQRTSRhx9pY0gGI=; b=MDrQrbv6pe6AMgpGqsmSRxcBpa4bOmelqNoBGbbpbL+HszNLSFRe22YnpaHlx8ti/I qi2ygY7gzzD7VIGM65Gtf+PxucifhWBwE/hoEI4untQ+mD8Ph8BlNB2crHZBUaUfoY80 0z1dhE61yQjk5065+++PgbE5vIyLH2EXV530QpX1oiQlKJuwewSuLwHyewWVTmmnmWRp 1rfay/VXKR3O50LSX889lhWeRYDRqzikGEyQSYZUed2WQh2X9i3vq+cY83VYnvc01sLa amcfle5ScV5bLnvma2s2pRiClyoCrMmbXgnq6nSIYzFsia9A7IfKRmzT3k3GbGm6HP3w 8idw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tessares-net.20210112.gappssmtp.com header.s=20210112 header.b=XLMBtY2x; spf=pass (google.com: domain of mptcp+bounces-2874-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1:3600::1 as permitted sender) smtp.mailfrom="mptcp+bounces-2874-wpasupplicant.patchew=gmail.com@lists.linux.dev" Return-Path: Received: from ewr.edge.kernel.org (ewr.edge.kernel.org. [2604:1380:1:3600::1]) by mx.google.com with ESMTPS id bq32si10672121qkb.290.2021.12.30.11.17.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Dec 2021 11:17:46 -0800 (PST) Received-SPF: pass (google.com: domain of mptcp+bounces-2874-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1:3600::1 as permitted sender) client-ip=2604:1380:1:3600::1; Authentication-Results: mx.google.com; dkim=pass header.i=@tessares-net.20210112.gappssmtp.com header.s=20210112 header.b=XLMBtY2x; spf=pass (google.com: domain of mptcp+bounces-2874-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1:3600::1 as permitted sender) smtp.mailfrom="mptcp+bounces-2874-wpasupplicant.patchew=gmail.com@lists.linux.dev" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ewr.edge.kernel.org (Postfix) with ESMTPS id 2FFED1C08CB for ; Thu, 30 Dec 2021 19:17:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 03C532CA1; Thu, 30 Dec 2021 19:17:45 +0000 (UTC) X-Original-To: mptcp@lists.linux.dev Received: from mail-ed1-f41.google.com (mail-ed1-f41.google.com [209.85.208.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 446992C80 for ; Thu, 30 Dec 2021 19:17:43 +0000 (UTC) Received: by mail-ed1-f41.google.com with SMTP id j6so101336357edw.12 for ; Thu, 30 Dec 2021 11:17:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tessares-net.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=coY5IWE8WsTmu8wB43g2Fb20MGtXGQRTSRhx9pY0gGI=; b=XLMBtY2xp2TziK+S4vk6NyzDOiY94RpqxwpKqTBbYkZWy+LNoOoL0eLIaMItzumPnO x879NBGR7+aaLb62Ilt9dcgfUbLRSGTqLp1+l+MQJNVUYFlGhG6gktseJVfYyQ0B239L Z+AqcHtfxoY4UztGaXPVauxNn8/GilbM/wY23jylx9XovPq01Xiwvwh/yEgKXNc9Q1Vm 5rNm9DaK0qzw3O2yOoLjoro5FsknsOId+gj2LlQiMYhZKT9SvUha2CAyQtU/Cjnp5DlC Jjth0mreRPyd1TJYkBR8se9uHd9hHVZojWbhOOeVWa3DdR1qNtWSlnKd4vZT59p4XJVQ Szrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=coY5IWE8WsTmu8wB43g2Fb20MGtXGQRTSRhx9pY0gGI=; b=Tcv84Q+buVE9PL2T57gsWAi8oWSd4i+QDGThXNjaOaK9W1GfUD/vwTPBGJd0riVFw4 HhzIW+sziQamdroxhfsSc6mlXR0gCbeKX++sWwcxyqw8WID3IWZ5CUHvntHxc4EVsaI6 HnI/5Ri+0OYQYDPmta/sG3k00mnmFHHhKBWRo5wi23RfrPuEco3QvKO0a81T5QEUP/iq uORL//Hd2LPaWul3xA7VQdODbggjKs7kLAjjp4RPg/XKxCymmErhRihtX5IiBiLHfDTy 4Gc2RWp0vHw2WIiZlUrqQm5WaPcP23PFUWMdK4BFeBziuMi4/XLgvBWucU91e7sYw+Zs pGDA== X-Gm-Message-State: AOAM532Av/mwWB5EsA6vs2ySRdDwYGEMy2XZWGV3nD2P7o60M/0xhrrp t8nSpoWDpdsv3aWtlJqft4kL+PLqLdVazw2P X-Received: by 2002:a17:906:5d01:: with SMTP id g1mr25947538ejt.219.1640891861088; Thu, 30 Dec 2021 11:17:41 -0800 (PST) Received: from tsr-vdi-mbaerts.nix.tessares.net (static.23.216.130.94.clients.your-server.de. [94.130.216.23]) by smtp.gmail.com with ESMTPSA id m6sm9918244edc.36.2021.12.30.11.17.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Dec 2021 11:17:40 -0800 (PST) From: Matthieu Baerts To: mptcp@lists.linux.dev Cc: Geliang Tang , Paolo Abeni , Matthieu Baerts Subject: [PATCH mptcp-next v7 1/4] Squash to "mptcp: implement fastclose xmit path" Date: Thu, 30 Dec 2021 20:16:48 +0100 Message-Id: <20211230191651.1831507-2-matthieu.baerts@tessares.net> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211230191651.1831507-1-matthieu.baerts@tessares.net> References: <20211230191651.1831507-1-matthieu.baerts@tessares.net> Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Geliang Tang MP_FAIL could be sent with RST or DSS, and FASTCLOSE can be sent with RST too. So we should use a similar xmit logic for FASTCLOSE and MP_FAIL in both mptcp_write_options() and mptcp_established_options*(). Cc: Paolo Abeni Co-developed-by: Matthieu Baerts Signed-off-by: Matthieu Baerts Signed-off-by: Geliang Tang --- net/mptcp/options.c | 66 ++++++++++++++++++++++++++++----------------- 1 file changed, 41 insertions(+), 25 deletions(-) diff --git a/net/mptcp/options.c b/net/mptcp/options.c index c6726e8389ec..9d2c1c9edbe6 100644 --- a/net/mptcp/options.c +++ b/net/mptcp/options.c @@ -829,8 +829,12 @@ bool mptcp_established_options(struct sock *sk, struct= sk_buff *skb, =20 if (unlikely(skb && TCP_SKB_CB(skb)->tcp_flags & TCPHDR_RST)) { if (mptcp_established_options_fastclose(sk, &opt_size, remaining, opts) = || - mptcp_established_options_mp_fail(sk, &opt_size, remaining, opts) || - mptcp_established_options_rst(sk, skb, &opt_size, remaining, opts)) { + mptcp_established_options_mp_fail(sk, &opt_size, remaining, opts)) { + *size +=3D opt_size; + remaining -=3D opt_size; + } + /* MP_RST can be used with MP_FASTCLOSE and MP_FAIL if there is room */ + if (mptcp_established_options_rst(sk, skb, &opt_size, remaining, opts)) { *size +=3D opt_size; remaining -=3D opt_size; } @@ -1257,21 +1261,7 @@ static u16 mptcp_make_csum(const struct mptcp_ext *m= pext) void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp, struct mptcp_out_options *opts) { - if (unlikely(OPTION_MPTCP_FAIL & opts->suboptions)) { - const struct sock *ssk =3D (const struct sock *)tp; - struct mptcp_subflow_context *subflow; - - subflow =3D mptcp_subflow_ctx(ssk); - subflow->send_mp_fail =3D 0; - - *ptr++ =3D mptcp_option(MPTCPOPT_MP_FAIL, - TCPOLEN_MPTCP_FAIL, - 0, 0); - put_unaligned_be64(opts->fail_seq, ptr); - ptr +=3D 2; - } - - /* DSS, MPC, MPJ, ADD_ADDR, FASTCLOSE and RST are mutually exclusive, + /* DSS, MPC, MPJ, ADD_ADDR, FASTCLOSE and FAIL are mutually exclusive, * see mptcp_established_options*() */ if (likely(OPTION_MPTCP_DSS & opts->suboptions)) { @@ -1328,6 +1318,10 @@ void mptcp_write_options(__be32 *ptr, const struct t= cp_sock *tp, TCPOPT_NOP << 8 | TCPOPT_NOP, ptr); } } + + /* We might need to add MP_FAIL options in rare cases */ + if (unlikely(OPTION_MPTCP_FAIL & opts->suboptions)) + goto mp_fail; } else if (OPTIONS_MPTCP_MPC & opts->suboptions) { u8 len, flag =3D MPTCP_CAP_HMAC_SHA256; =20 @@ -1460,19 +1454,41 @@ void mptcp_write_options(__be32 *ptr, const struct = tcp_sock *tp, ptr +=3D 1; } } - } else if (unlikely(OPTION_MPTCP_RST & opts->suboptions)) { - /* RST is mutually exclusive with everything else */ - *ptr++ =3D mptcp_option(MPTCPOPT_RST, - TCPOLEN_MPTCP_RST, - opts->reset_transient, - opts->reset_reason); - return; } else if (unlikely(OPTION_MPTCP_FASTCLOSE & opts->suboptions)) { - /* FASTCLOSE is mutually exclusive with everything else */ + /* FASTCLOSE is mutually exclusive with others except RST */ *ptr++ =3D mptcp_option(MPTCPOPT_MP_FASTCLOSE, TCPOLEN_MPTCP_FASTCLOSE, 0, 0); put_unaligned_be64(opts->rcvr_key, ptr); + + if (OPTION_MPTCP_RST & opts->suboptions) + goto mp_rst; + return; + } else if (unlikely(OPTION_MPTCP_FAIL & opts->suboptions)) +mp_fail: + { + /* MP_FAIL is mutually exclusive with others except RST */ + const struct sock *ssk =3D (const struct sock *)tp; + struct mptcp_subflow_context *subflow; + + subflow =3D mptcp_subflow_ctx(ssk); + subflow->send_mp_fail =3D 0; + + *ptr++ =3D mptcp_option(MPTCPOPT_MP_FAIL, + TCPOLEN_MPTCP_FAIL, + 0, 0); + put_unaligned_be64(opts->fail_seq, ptr); + ptr +=3D 2; + + if (OPTION_MPTCP_RST & opts->suboptions) + goto mp_rst; + return; + } else if (unlikely(OPTION_MPTCP_RST & opts->suboptions)) { +mp_rst: + *ptr++ =3D mptcp_option(MPTCPOPT_RST, + TCPOLEN_MPTCP_RST, + opts->reset_transient, + opts->reset_reason); return; } =20 --=20 2.33.1