From nobody Fri Mar 29 11:56:52 2024 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:a05:6638:38c:0:0:0:0 with SMTP id y12csp584251jap; Wed, 5 Jan 2022 07:57:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJyQnVWDvv5lWk/6ug12u8m9+yyyYq2GoJhehip6Rcubkfj3clSHe6IVaXa88M/xgfmUSNqf X-Received: by 2002:a25:d844:: with SMTP id p65mr28691991ybg.714.1641398256456; Wed, 05 Jan 2022 07:57:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1641398256; cv=none; d=google.com; s=arc-20160816; b=VG9ycBMMQyOSOdkyP3xIbdaWdHtl70rDqgQ6ZPOxgCKhC/q7kITIiCS8o/cA7CBPBN 17vhFGRRkomALQGv0Xs7jb6q3f5hcOZkC0h/AyWnLpCGqz/IQ5JhTYJesa/uKGl0I0dW l3Bt+LmP7Q2vF/4Cfm7tSBurm+lOnDeJ1GM4sGQtBYhNeYJNVKlZ7a5WXs8/PrTs8Lfq 8XZxr/riVhNN8xwkoxPd8CaH/MKuJZ/FH/380m55WnSEY+TB28U2I6NQNv8VHnOdBkY/ ThnX0ujfmHXHTIoTj94ZExZ89e2w6+x1QqE+k37WimkiicTGwmKn9uPm6+vDqkezvh/G O4Jg== 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=1DYnJ6GiDDCb36cp6Mrm9pK+SQp1df2TyTcvRE0MlOc=; b=xHxPb5rimuiTzMosQsMbSArVlgXpgzNvYtv+MtfoD9hxCDT9M1T0jjBGZMzSzLvFtJ degkQu3ng9h6qerCE13aAWv6B3UuppxU7MpukmwMlNlJPYNKVOpPJPwds4Z/xLBKUrZH kZXyUci5jL8b/2C0K5KInjDmv0qIjHpmvgoPj5SVFiH/6LWdDt/MEbKhitRlbR3vQbLN tsLPWzl+/LVFmkzJ3SXlhDCOuCx4k2TsqjVB4HZfxVLffxDZxY3316UD6vK3TKfo//wr aW31mt+6NjoFkasqwk2yCpZNUzt+6yx7gWwcdrwooz4eb+vzJ21syygGs2nPhAtDqFY8 nzlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tessares-net.20210112.gappssmtp.com header.s=20210112 header.b=2bZQQbMg; spf=pass (google.com: domain of mptcp+bounces-2910-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1:3600::1 as permitted sender) smtp.mailfrom="mptcp+bounces-2910-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 x14si16693097ybt.543.2022.01.05.07.57.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Jan 2022 07:57:36 -0800 (PST) Received-SPF: pass (google.com: domain of mptcp+bounces-2910-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=2bZQQbMg; spf=pass (google.com: domain of mptcp+bounces-2910-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1:3600::1 as permitted sender) smtp.mailfrom="mptcp+bounces-2910-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 E22EF1C09E3 for ; Wed, 5 Jan 2022 15:57:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 87C362C9D; Wed, 5 Jan 2022 15:57:33 +0000 (UTC) X-Original-To: mptcp@lists.linux.dev Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.42]) (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 890672CA0 for ; Wed, 5 Jan 2022 15:57:31 +0000 (UTC) Received: by mail-ed1-f42.google.com with SMTP id q14so156035748edi.3 for ; Wed, 05 Jan 2022 07:57:31 -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=1DYnJ6GiDDCb36cp6Mrm9pK+SQp1df2TyTcvRE0MlOc=; b=2bZQQbMgOu1vwuqwCyg4Rlyv75t9YUQgUoWSa+m4S/fbA7VPOwOSDIF2rlvoFhEPqQ eA6qhLrXWlmcYvJlcDYtK9qF7qcYs50xnMnJ7lgxMqPPoUkm9n3ABGl++7Z3Pf0jC208 H7RWDshjO6qgPZi5vI5Dpsajr8DbMlOS8x28uCJlduSV9JDy0RQX+yj0fh+hgeG1oKSU 2FHyGHGnHmOibFRLauRdtAvOXabpf2Y6WZo+qzl5UTHRAXGFyWSSOUkmdBQMyjz5KvDk H2Io/BaCMxEBN4JHdng6U1lD+AYUMy1kFPd51/qAgFPvcy+Jc5r1UUkiiCvjaTKzdvWo HdUA== 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=1DYnJ6GiDDCb36cp6Mrm9pK+SQp1df2TyTcvRE0MlOc=; b=J+a0bnlUKechLe1SEAZZCuMMSDrhnh/ybbk0Mc70R5tPRXNqoE75EeV9+/ayb0veRv 3/VISgNlB9qBpAqPNoUpKiZHDD50QBA4SRHt5Wykwbbb6fb1/jOBhvzYiuHZEsu5Os9k d5Vgn/7WlJ43OoxizCczhNcQAzQUQZnNvr9EPg4ubcvEHrk+/fbSmOT4K/NSg/95AuzY l5sHiBlZfcmXGZ8ndVGiPMfAdvrmKi+pF9SmxsMwMotqsGWcQSHjOCfzXL3H1LvsRAfE nAUZDo1ukeDQO5h+SgXIcaPpShJ/OTgbpIJp0tvEHIpqbmmO2pDe81+GtM1zWtT4K+K1 /xJw== X-Gm-Message-State: AOAM533n9QZDTJf2b9CT27YSHgDb3JKgSrEa1fiqvHM/QvslB5KFV1vK CN/DOW39bEZyUwoGUM3HQ6JyPeLLNDLBOZEyWMg= X-Received: by 2002:aa7:c481:: with SMTP id m1mr52683100edq.204.1641398249649; Wed, 05 Jan 2022 07:57:29 -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 c30sm12399684ejj.190.2022.01.05.07.57.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jan 2022 07:57:29 -0800 (PST) From: Matthieu Baerts To: mptcp@lists.linux.dev Cc: Geliang Tang , Paolo Abeni , Matthieu Baerts Subject: [PATCH mptcp-next v8 1/8] Squash to "mptcp: implement fastclose xmit path" Date: Wed, 5 Jan 2022 16:56:55 +0100 Message-Id: <20220105155702.165123-2-matthieu.baerts@tessares.net> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220105155702.165123-1-matthieu.baerts@tessares.net> References: <20220105155702.165123-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 can 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 --- Notes: v8: - 'ptr +=3D 2;' was missing for FastClose (Geliang) - moving the MP_FAIL option is now in a dedicated patch ("mptcp: reduce branching when writing MP_FAIL option") net/mptcp/options.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/net/mptcp/options.c b/net/mptcp/options.c index c6726e8389ec..aa3ed37bc59a 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; } @@ -1460,19 +1464,23 @@ 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); + 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 From nobody Fri Mar 29 11:56:52 2024 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:a05:6638:38c:0:0:0:0 with SMTP id y12csp584307jap; Wed, 5 Jan 2022 07:57:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJwMQUCKBesSg+6LVJJqWphIInu+DSmZptHMEboj1NN1Um6DN/3IjGxbPR7vrn028JiTaxAS X-Received: by 2002:a17:902:d484:b0:148:e505:7de9 with SMTP id c4-20020a170902d48400b00148e5057de9mr55891999plg.14.1641398260691; Wed, 05 Jan 2022 07:57:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1641398260; cv=none; d=google.com; s=arc-20160816; b=wu6jmTIIP5rZgzMawKHxsOe2e3yoUqu5agiaBVKLnsvs2RiqgMUCvGUXJZ5GU2SGyH q9IrUxoMm/lZmsXxHQZCtyjj24EJBOd6rYE0/GzA1dv2dMoORTE0go1p4/cr3XtctD33 bLmgd/p1Sw/B4TMzpduMb9xaLUUFsXRYEcAv7hJhrQOHNbBokFs6Ucs/v66agbSaZ9Dk l7E09GYVdceKgXIfY5i6zlcCVneVG69z0EN6IbVHq0+so1Sh72I3CuIu8o6uBk8QIxHG 4qBACxftN1DrZqUI/mq0cpcTRKi54g13GrN51bcbBOeGpxgZw3w1r9bodFE4gPo7mjV1 9UFw== 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=A7ANgkGtQZK9Nc5HOgbMT9n/B9bvRtpJxNwtwFZ96e8=; b=fHmiaJfc8BosXmjBxpI4bTw9VdemMdfnVQK/euOWgdEm1EPEXPe8GoJIqpz0dLTo0P 4pJVVOt79xRuBqDNXnkY93Rl6yCD+VbWMjZueHFOat35YipO5Qy8wgfpivVw5YLqW6DT wClNnl/PQhst89FdFNZJPy/VBsG/izRb6lXodDkUP63YhOwQAR/4zV1Xuh54IbSErOat uRsekR/SyOypRX7s7i95nTQblNsvJxzSNLkNN0wqWwnZKCQs2+hKYE/8W5GXDR/uWwso FfQfAD//r5l2PzWfNSM2THtgSJwUAQlJ2v7ZOzCuRku32Iq7rwmfRzIZYvdvs1O/VBFF lLMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tessares-net.20210112.gappssmtp.com header.s=20210112 header.b=OeTbLxEe; spf=pass (google.com: domain of mptcp+bounces-2914-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.69.165 as permitted sender) smtp.mailfrom="mptcp+bounces-2914-wpasupplicant.patchew=gmail.com@lists.linux.dev" Return-Path: Received: from sjc.edge.kernel.org (sjc.edge.kernel.org. [147.75.69.165]) by mx.google.com with ESMTPS id r21si9075289pls.276.2022.01.05.07.57.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Jan 2022 07:57:40 -0800 (PST) Received-SPF: pass (google.com: domain of mptcp+bounces-2914-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.69.165 as permitted sender) client-ip=147.75.69.165; Authentication-Results: mx.google.com; dkim=pass header.i=@tessares-net.20210112.gappssmtp.com header.s=20210112 header.b=OeTbLxEe; spf=pass (google.com: domain of mptcp+bounces-2914-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.69.165 as permitted sender) smtp.mailfrom="mptcp+bounces-2914-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 sjc.edge.kernel.org (Postfix) with ESMTPS id 1D46B3E0EA1 for ; Wed, 5 Jan 2022 15:57:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 773CB2CAA; Wed, 5 Jan 2022 15:57:35 +0000 (UTC) X-Original-To: mptcp@lists.linux.dev Received: from mail-ed1-f43.google.com (mail-ed1-f43.google.com [209.85.208.43]) (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 903E52CA1 for ; Wed, 5 Jan 2022 15:57:32 +0000 (UTC) Received: by mail-ed1-f43.google.com with SMTP id w16so163988884edc.11 for ; Wed, 05 Jan 2022 07:57:32 -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=A7ANgkGtQZK9Nc5HOgbMT9n/B9bvRtpJxNwtwFZ96e8=; b=OeTbLxEeprlPuXg4XRF21QIxiZX6MAX9Frfaijxy3V9Tm5fcxTFQysWs7BexG5W5Nf vLER8pxm9JfR/Aj1KMrBPOUI9B+UnuvfTfXQzxuvARVkywW4jvTHu1cG0et6KlA/E4xl BG3PqfYiks5I3JHEdO62piXJIlSoMwedwILfkeAafZMI3P7np7HG+urD7zX1SNH3gzEs sbVaq4chH4if10NlmmvaEzFECAUgblktPiQy/P83H9DV6I8xbEDzxdcy5kW7U+5JQh9Q oq/7/MbKXX2gDJAecaKbUv9qF+QDe9+qjBoPvfCqLN7BmPqqzZXJLS/9zbMU/I14ExIv v9Lg== 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=A7ANgkGtQZK9Nc5HOgbMT9n/B9bvRtpJxNwtwFZ96e8=; b=iGzguaqEQ0GxPFWIckIBE7mlbk8i8MQc5vMSYO0s7Q9bpLpmaym+jOivgink5g/itO 7tgtDvhGGynpO1SE2j/+wdT2FqNID//1OagGpAewyiqj3jjdO9WDDfju+SlocDmjTGRj TPackxPFmXYYzBmTBFpwWXUAuHbrFJDQ7rJxQYxrKQv3WJ5ah/lO4HVV6NT+HCQwJL2Y 2CXdvlxjozkxw2hMT1cenH3xRK3M22SnT2kd4GFOcj4O0HahzU4Pw5gvlFd5E/0jHsgs 18Wd8kl2th9655jt2BGBqBVB6q7XygerkngtIsgSSFs3meuEt434sNQMsYcXaFFYrYRK pueA== X-Gm-Message-State: AOAM530MgAy+z4KphZRbJnU7/6g4SCRM6WPklGuHyxFZAuxpoP7RJTN1 WHQtdD+yrPXOMAIiPBbsGwbQJAgAHvb48CFa1s8= X-Received: by 2002:a17:907:9621:: with SMTP id gb33mr43352125ejc.394.1641398250318; Wed, 05 Jan 2022 07:57:30 -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 c30sm12399684ejj.190.2022.01.05.07.57.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jan 2022 07:57:29 -0800 (PST) From: Matthieu Baerts To: mptcp@lists.linux.dev Cc: Matthieu Baerts Subject: [PATCH mptcp-next v8 2/8] mptcp: fix opt size when sending DSS + MP_FAIL Date: Wed, 5 Jan 2022 16:56:56 +0100 Message-Id: <20220105155702.165123-3-matthieu.baerts@tessares.net> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220105155702.165123-1-matthieu.baerts@tessares.net> References: <20220105155702.165123-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" When these two options had to be sent -- which is not common -- the DSS size was not being taken into account in the remaining size. Additionaly in this situation, the reported size was only the one of the MP_FAIL which can cause issue if at the end, we need to write more in the TCP options than previously said. Here we use a dedicated variable for MP_FAIL size to keep the WARN_ON_ONCE() just after. Fixes: c25aeb4e0953 ("mptcp: MP_FAIL suboption sending") Signed-off-by: Matthieu Baerts --- net/mptcp/options.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/net/mptcp/options.c b/net/mptcp/options.c index aa3ed37bc59a..36ab69906af3 100644 --- a/net/mptcp/options.c +++ b/net/mptcp/options.c @@ -845,10 +845,13 @@ bool mptcp_established_options(struct sock *sk, struc= t sk_buff *skb, if (mptcp_established_options_mp(sk, skb, snd_data_fin, &opt_size, remain= ing, opts)) ret =3D true; else if (mptcp_established_options_dss(sk, skb, snd_data_fin, &opt_size, = remaining, opts)) { + unsigned int mp_fail_size; + ret =3D true; - if (mptcp_established_options_mp_fail(sk, &opt_size, remaining, opts)) { - *size +=3D opt_size; - remaining -=3D opt_size; + if (mptcp_established_options_mp_fail(sk, &mp_fail_size, + remaining - opt_size, opts)) { + *size +=3D opt_size + mp_fail_size; + remaining -=3D opt_size - mp_fail_size; return true; } } --=20 2.33.1 From nobody Fri Mar 29 11:56:52 2024 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:a05:6638:38c:0:0:0:0 with SMTP id y12csp584266jap; Wed, 5 Jan 2022 07:57:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJwdevVzhXRCN7+NYpUzSwNrGzNg5qQoK48nq66bLQ8VdVktt8QwAb/3+xOC4+OI6aNzmO95 X-Received: by 2002:a17:90a:e7c6:: with SMTP id kb6mr4859500pjb.200.1641398256930; Wed, 05 Jan 2022 07:57:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1641398256; cv=none; d=google.com; s=arc-20160816; b=LatSgeEdt/8oompYCp1VJZ0Mh4qSBrFPTGWmNdw40IXQSWFLLFqWyhGVQLpP8ad0mS nPBQgvjBszuYUg9lgShGV3qYXFUlhQyUtsk0cndKL59waOSJIm1fIlWw+wSWflwRmTix iSKAOXkWNleB92nPr3SvwGpNEX1GIk6owkqNApx37Lk7XeWdeEaZUTncpwuj0lPsVmVB uPMQedb5tpXZeJeyXJpZqctTJZU7Ehh4WLpnZ2V9b4bhcsmmZJ0f6tGRZbCIiHkg1rav tx7DjqmQoAHL2RvXHuz32aFTpDnKmqshNdVUQ9ETYLdvhl/NeYjtQZe8tyMTqOPMqN9p 0ryQ== 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=pZRucwN/iu3JhRKyQBm7cwK6+MBX/OabN6ofIvRd0nQ=; b=Xp2qPyo8vUSGBzenpuioPVr1Fa2/4Ncttb80W8QIKcPYUJuWaZe0vUdScnH0fMH4yi 4WmXS1zX+HnlSn2/W8+VnmsVfJdpnlXqzgxGwy7x1XtLVymeUjh3SmKQdfova3o/HLMf I58m5xGceIzGO88X2DjqwtwSVBtFUSGAmej4G1X8WDNwaJdKFsX0XCfr68fogb86zMEE BFtCxmYxcB9XDxJilLofEtjV3m+8NMnz+jbKhAwXOCaTWK/6UIC8HheRssVJQO1vKeG+ FiXFegyvR4FBSyPR2ay1uluY70/Kr0nqkw+B/aGGFz/Fv6J8D7/alq7teEmF5oW6L54b L0hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tessares-net.20210112.gappssmtp.com header.s=20210112 header.b=GfGgRMnv; spf=pass (google.com: domain of mptcp+bounces-2911-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.69.165 as permitted sender) smtp.mailfrom="mptcp+bounces-2911-wpasupplicant.patchew=gmail.com@lists.linux.dev" Return-Path: Received: from sjc.edge.kernel.org (sjc.edge.kernel.org. [147.75.69.165]) by mx.google.com with ESMTPS id i13si42415489pli.571.2022.01.05.07.57.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Jan 2022 07:57:36 -0800 (PST) Received-SPF: pass (google.com: domain of mptcp+bounces-2911-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.69.165 as permitted sender) client-ip=147.75.69.165; Authentication-Results: mx.google.com; dkim=pass header.i=@tessares-net.20210112.gappssmtp.com header.s=20210112 header.b=GfGgRMnv; spf=pass (google.com: domain of mptcp+bounces-2911-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.69.165 as permitted sender) smtp.mailfrom="mptcp+bounces-2911-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 sjc.edge.kernel.org (Postfix) with ESMTPS id AF6323E0A57 for ; Wed, 5 Jan 2022 15:57:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BE6962CA8; Wed, 5 Jan 2022 15:57:34 +0000 (UTC) X-Original-To: mptcp@lists.linux.dev Received: from mail-ed1-f52.google.com (mail-ed1-f52.google.com [209.85.208.52]) (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 92FED2CA2 for ; Wed, 5 Jan 2022 15:57:32 +0000 (UTC) Received: by mail-ed1-f52.google.com with SMTP id m21so165021747edc.0 for ; Wed, 05 Jan 2022 07:57:32 -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=pZRucwN/iu3JhRKyQBm7cwK6+MBX/OabN6ofIvRd0nQ=; b=GfGgRMnvMinVLkUPdGS8nQKDqMYzbAFaQEufsu3NKUNo/lcbzLKWGvoBIxoQ+LSc/3 VNlwQbfLs8k+w1fsHCH53VM0cQPceGi23LfvpLSdF5Shuk44kDfuQNCUG4Fjy+uCaiWr EbN/D0adfCVE6lAw6iqfYpN3MmvDGvedXDLmeh9XYz8NNz/M4skIP9RJ3Ka2QtQIEHbv N/hPY63yvqPIgHXhCUwDONq1BF3tPDokdNfI6kBnREPoJyFPdE0C4tojZtwiU4kuNtLy y72u6Oj+aBlXGMx2GZAIB4b1uoZqk4bdk3qFZyQKS/CdvA565gSSexDwPPdThqRECoq9 C9rw== 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=pZRucwN/iu3JhRKyQBm7cwK6+MBX/OabN6ofIvRd0nQ=; b=AgyrpzCcQUtUE1iymOYSXFdsEe0zN2ixSLzq34L5HjxupmZ3EELWha7rHWQHJu67Bp h/WoLKbVZeN9WCJRykFRnjqasYrqEpitGHZsWxaEFR1DBaMx9JJSgRC1HptFzrtVB7e2 s0cGy9qkt//NryrjtHqSgOTRr2fIHZiV82tCUlHI/y6rg9hwcmZ6tK9+NkZbPYjw9LyH LfJjNb+rJ+7nTWhrnqAGbDiJe4QwmaiNy5AtFFpCxHvhK8euq1FQ1yIexZeVdEj2mMao UGD7PQUbBRKObVMn3mEup5DYaZrJ0VgEFT4Ax/sd0lf6A/W20WXcUZoFKnhj0YHqiEzj J4EA== X-Gm-Message-State: AOAM531jf6u1f8+PyZukZgljjtCVhg046VUbzC3rF12zXh5URxgu+B9u 60wJowZRWuNVyctsdDKg2A7CS+tbgmL5bHD9OCU= X-Received: by 2002:a17:906:7954:: with SMTP id l20mr42833590ejo.358.1641398250744; Wed, 05 Jan 2022 07:57:30 -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 c30sm12399684ejj.190.2022.01.05.07.57.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jan 2022 07:57:30 -0800 (PST) From: Matthieu Baerts To: mptcp@lists.linux.dev Cc: Geliang Tang , Matthieu Baerts Subject: [PATCH mptcp-next v8 3/8] mptcp: fix a DSS option writing error Date: Wed, 5 Jan 2022 16:56:57 +0100 Message-Id: <20220105155702.165123-4-matthieu.baerts@tessares.net> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220105155702.165123-1-matthieu.baerts@tessares.net> References: <20220105155702.165123-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 'ptr +=3D 1;' was omitted in the original code. If the DSS is the last option -- which is what we have most of the time -- that's not an issue. Fixes: 1bff1e43a30e ("mptcp: optimize out option generation") Signed-off-by: Geliang Tang Signed-off-by: Matthieu Baerts --- net/mptcp/options.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/mptcp/options.c b/net/mptcp/options.c index 36ab69906af3..bbf61dedb4b5 100644 --- a/net/mptcp/options.c +++ b/net/mptcp/options.c @@ -1334,6 +1334,7 @@ void mptcp_write_options(__be32 *ptr, const struct tc= p_sock *tp, put_unaligned_be32(mpext->data_len << 16 | TCPOPT_NOP << 8 | TCPOPT_NOP, ptr); } + ptr +=3D 1; } } else if (OPTIONS_MPTCP_MPC & opts->suboptions) { u8 len, flag =3D MPTCP_CAP_HMAC_SHA256; --=20 2.33.1 From nobody Fri Mar 29 11:56:52 2024 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:a05:6638:38c:0:0:0:0 with SMTP id y12csp584283jap; Wed, 5 Jan 2022 07:57:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJw0J6unlOlUUulec2lMFw0sig2uVA+K8Eo92XPViOIde5h6rFVEzoA4vzfCAwMNMs1v1I/p X-Received: by 2002:a17:902:650c:b0:149:72d5:9c0a with SMTP id b12-20020a170902650c00b0014972d59c0amr45381546plk.78.1641398258711; Wed, 05 Jan 2022 07:57:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1641398258; cv=none; d=google.com; s=arc-20160816; b=DXe2ByG4PCe/ad/p/fpkZXXl0FDuWp/rxsHmhrSarHBRkjTVMlo6DFcFz1CRw4t/wa wYoNalArQYN3Z/yHcdwj5NBP7kUORIlDaOr4uSfEFAmtWfx5PuuKnMWVaFMGFvAjvlAq evFAwL+OWKvmdwe+IkQjhow4nP6EsjRPLM+xgb5e0h1ZmOyxscOY7qoVPSsBo9EZ69t9 Bu2/z1EcSlc/tkEHkD9lp+1xeaKjsTzGvpdkZjKBRjxkJRyA0Wv9HIdrnz0uJQV4KGa1 6r8iV2k47YxNTYRdApftkAP3/DZ/9R2oIP24XcGKTtFnpUcG4jArBUQFsUKWtsku7s+y TXzQ== 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=NqeY/CeV1WVqI+B6x+o4V50N25t9dNLAiKSFr3ItOYc=; b=ZAPbmg0WEOe6b3G7LdeoIekXMTyMd01OYETRwSTl0NbM2/r79U87q3zIiC7HweJfov v5a/2ItUD3Pe/mIfyyrLNfuD97Qy5Csp5dBmPqtuG3nLOgfJZcwJODo5ITkUwktbWvVo KMddzDkdYeoFiXTRdRDMg8jyowAagNP0R/MhUQY9o1VC54W0jK8CB2VovEPH5nRKTvNs KhJYrGPz3HeWWzxY/B6F5o5j3itDDVElElvQVaxFRKJHeSZZ16MRFvRYIQvf3yWtJDMP clE/HSV3+RbDMnQGJrRYVxR2Hptnp8jL1kaGRqTlqUtUOlt2RKqZYIaoizp+eeM6LeQp nsrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tessares-net.20210112.gappssmtp.com header.s=20210112 header.b=ISuBzIEI; spf=pass (google.com: domain of mptcp+bounces-2912-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.69.165 as permitted sender) smtp.mailfrom="mptcp+bounces-2912-wpasupplicant.patchew=gmail.com@lists.linux.dev" Return-Path: Received: from sjc.edge.kernel.org (sjc.edge.kernel.org. [147.75.69.165]) by mx.google.com with ESMTPS id 38si39599462pgt.442.2022.01.05.07.57.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Jan 2022 07:57:38 -0800 (PST) Received-SPF: pass (google.com: domain of mptcp+bounces-2912-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.69.165 as permitted sender) client-ip=147.75.69.165; Authentication-Results: mx.google.com; dkim=pass header.i=@tessares-net.20210112.gappssmtp.com header.s=20210112 header.b=ISuBzIEI; spf=pass (google.com: domain of mptcp+bounces-2912-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.69.165 as permitted sender) smtp.mailfrom="mptcp+bounces-2912-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 sjc.edge.kernel.org (Postfix) with ESMTPS id CA4183E0EA0 for ; Wed, 5 Jan 2022 15:57:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E103C2CA9; Wed, 5 Jan 2022 15:57:34 +0000 (UTC) X-Original-To: mptcp@lists.linux.dev Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.45]) (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 4758B2CA3 for ; Wed, 5 Jan 2022 15:57:33 +0000 (UTC) Received: by mail-ed1-f45.google.com with SMTP id z29so163798399edl.7 for ; Wed, 05 Jan 2022 07:57:33 -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=NqeY/CeV1WVqI+B6x+o4V50N25t9dNLAiKSFr3ItOYc=; b=ISuBzIEIeDbLO6R5YOPnPj3Z9l1KHSf4xFvQWhn4MoX3demSxivdqcNeuN0RgY515U BKVHxzqqWMxgQDDH0FmGjoMqMz75NYhxeTu5ZaHMnz2+hvwmwEnObkv+nD3vWT4jycNQ vT4Am5o/vHTZrZ4lImf4Ptokx3UquO5uGNKQoYSubmrdZVwtTg4vWd90LFyzTcnum2xf 29Zq7yv9Z7BU9RRPmpXaYU1tZd4Yc5UZXXXRG6VWQjsGxNXxtYhzh1g9X+bBnHio8o0Y Lgy91mxzsNrL5/s94Xhqmp6MZULMiMn2/0elalSRGhGC03TLtI4cY+fzRZ5cIJMYGHgH eAPQ== 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=NqeY/CeV1WVqI+B6x+o4V50N25t9dNLAiKSFr3ItOYc=; b=Wy8Clk9Hlwe7dYza9PZMY+DxRq2piB56aTcBB4XGXVzI+Ahml1CgumD3gh60B5tCf0 wSlEMK9syFL6LHTdCET++yqYeyMdW/9tl1xFNZK+3WnyG9vs0yfMIrEQ4qtbx5X4K/tm DbKiz+wmetswzlZT19Tdw9Tq8K1TPN6ukB//6g/9Hcj32zmEN8mrDfhQH9q3gNsrB767 sFt38zrbpLoiLJbXrCsz2Ummbg5naUpi3y/iuGD4JgEdA4/VqCKBMUdrW5R8r8lyXlsB sXTNcKdltP+JYx73XCU9oIjLP/Nlnq9tXr2Kt3Oq0rcwWZA5IqTpWmTlRZUZIGw6sxPY H/aw== X-Gm-Message-State: AOAM531ivMjo/MxBk9izuQLmwFJsxsnQ3RAGt7Gq3t8uzSDhnW/h9TFu 3RilUvSsB6sHps2CDMMsKWcmVn6XM9l+MtQzv9Y= X-Received: by 2002:a17:906:58c7:: with SMTP id e7mr42138947ejs.146.1641398251345; Wed, 05 Jan 2022 07:57:31 -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 c30sm12399684ejj.190.2022.01.05.07.57.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jan 2022 07:57:30 -0800 (PST) From: Matthieu Baerts To: mptcp@lists.linux.dev Cc: Matthieu Baerts , Geliang Tang Subject: [PATCH mptcp-next v8 4/8] mptcp: reduce branching when writing MP_FAIL option Date: Wed, 5 Jan 2022 16:56:58 +0100 Message-Id: <20220105155702.165123-5-matthieu.baerts@tessares.net> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220105155702.165123-1-matthieu.baerts@tessares.net> References: <20220105155702.165123-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" MP_FAIL should be use in very rare cases, either when the TCP RST flag is set -- with or without an MP_RST -- or with a DSS, see mptcp_established_options(). Here, we do the same in mptcp_write_options(). Co-developed-by: Geliang Tang Signed-off-by: Geliang Tang Signed-off-by: Matthieu Baerts --- net/mptcp/options.c | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/net/mptcp/options.c b/net/mptcp/options.c index bbf61dedb4b5..2f94069808a4 100644 --- a/net/mptcp/options.c +++ b/net/mptcp/options.c @@ -1264,21 +1264,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)) { @@ -1336,6 +1322,10 @@ void mptcp_write_options(__be32 *ptr, const struct t= cp_sock *tp, } ptr +=3D 1; } + + /* 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 @@ -1476,6 +1466,25 @@ void mptcp_write_options(__be32 *ptr, const struct t= cp_sock *tp, put_unaligned_be64(opts->rcvr_key, ptr); ptr +=3D 2; =20 + 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; --=20 2.33.1 From nobody Fri Mar 29 11:56:52 2024 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:a05:6638:38c:0:0:0:0 with SMTP id y12csp584290jap; Wed, 5 Jan 2022 07:57:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJzvfV95l63EL4XZRverWz1qq+bNn7aUCDySTINpmOrPStrglkqFEtJ0zvygYyeunEfXJx7e X-Received: by 2002:a17:90a:db92:: with SMTP id h18mr4825925pjv.149.1641398259296; Wed, 05 Jan 2022 07:57:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1641398259; cv=none; d=google.com; s=arc-20160816; b=qZALUKbdOn+oUSySukpLi4W+PCeccSd9l7I35EpUawu+l578jTSzThrw+5r3OBHi1L mZGRuAPtZ6cVTjSWob4qVWL2dZvESRfoMgv5CzrtT+eKenKAFVr/Ugx922xmtiM6Slb6 OVcieoBOgkG796h4+BCJjiHCiajLmWWWc9uWa2p2KhMRJyhnvQvvOeFQX03EvG9GnTDy apqOs0gH14dtQERxRkESm+MAMJVfsrZcaJKbOJ4A9N/7ElG9Flm2u458kTuy5bNMaY3b uxr574XVqZkcvfLr5YJ218fBTd5xZwgI33n19fPXMPCL/55UCx8FsHduSb8KcybBwlgo jhKA== 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=C7zGPZuJSopLvqGh8GZ6exc6w0u1cXbCYnQTOZawGT4=; b=jshD3lENqbKH7ik3nuLbCb1/mNBAZTR75MtLB5XLSvWfku/KiSuMkLcPBsIbJ3SAdt qku0OB/iHCAbsLWoeJ+eIAlUhkXQ+t6YQbVr81Xh1Hpe64D9mhcR2cnZDEqI5uUdopDz K/HASr2cwDpPjKWUAQ/voahDMYCn/4flIJBbIzrJjxIpc778GPChzzZ8iM3L7BelJOTs 8ZXua6MSlo2+eTO4h6/3xk5KoE7ihileEuRvW+P+fRCioQjsDEmfSaTOQfxLhchmt7yH XCJ6WaOuNdB95dMBRGgmWEecQpTVWXKfUi61cSECNe0sO189hBUKEyMOm3x4HSJd4h8A nWcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tessares-net.20210112.gappssmtp.com header.s=20210112 header.b=nJWwdupj; spf=pass (google.com: domain of mptcp+bounces-2913-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.69.165 as permitted sender) smtp.mailfrom="mptcp+bounces-2913-wpasupplicant.patchew=gmail.com@lists.linux.dev" Return-Path: Received: from sjc.edge.kernel.org (sjc.edge.kernel.org. [147.75.69.165]) by mx.google.com with ESMTPS id 38si39599462pgt.442.2022.01.05.07.57.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Jan 2022 07:57:39 -0800 (PST) Received-SPF: pass (google.com: domain of mptcp+bounces-2913-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.69.165 as permitted sender) client-ip=147.75.69.165; Authentication-Results: mx.google.com; dkim=pass header.i=@tessares-net.20210112.gappssmtp.com header.s=20210112 header.b=nJWwdupj; spf=pass (google.com: domain of mptcp+bounces-2913-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.69.165 as permitted sender) smtp.mailfrom="mptcp+bounces-2913-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 sjc.edge.kernel.org (Postfix) with ESMTPS id 0B95A3E0E64 for ; Wed, 5 Jan 2022 15:57:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 42BC02CA3; Wed, 5 Jan 2022 15:57:35 +0000 (UTC) X-Original-To: mptcp@lists.linux.dev Received: from mail-ed1-f47.google.com (mail-ed1-f47.google.com [209.85.208.47]) (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 B82F32CA0 for ; Wed, 5 Jan 2022 15:57:33 +0000 (UTC) Received: by mail-ed1-f47.google.com with SMTP id z29so163798479edl.7 for ; Wed, 05 Jan 2022 07:57:33 -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=C7zGPZuJSopLvqGh8GZ6exc6w0u1cXbCYnQTOZawGT4=; b=nJWwdupjnx6V321BYzulHMsGmPXE06Wf+2HCj7aEt5Oo8g/nrzin1ouFHGaWGXro4c EmE3WDbbBHWWbnaUVIo3YV+daAfr55wft31DCKlYMKZEs35yUwrdkeyMrY199/b3j6jb bx3SqbZYWTn7i6sAD+uKMpqV17KnvbGzj+hbGtKzycq7iXdOY/UnwCSkyLllBsakquOM lUysmWQ6vHF8E2BtTPe3lytjjY7soqGCPCFbq0wBqyd03m/M4kYXiSnpAmZkx5hY76LK SCNL2cuSGEH4V94EgK3pQjnGxWGSeZJyq5cz4NtzSXAEbKSfvj+UtVM1A6v6dug9Qt9+ cNfg== 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=C7zGPZuJSopLvqGh8GZ6exc6w0u1cXbCYnQTOZawGT4=; b=fIM9ptHRFkFiE92dC9yKZsXnD6stmMxwHrC4z6a8ZBiIpxnfFaG/4maGEjfx1QTjT2 qIaHiZVp7dh4XmOMWOluedT04Qay7DQWu2TNE/f/J5h8KnwLpOCLpGDOZxIUHlwEMppH uLZOq/8kad960q0h8MgwzOuw1yb26VwuEnzLByk1RlasqXcCaA+4TOXDaFd5kStpEz69 EyirXxpbXya884OK0cCgwbUq5/q6u8V3toCxgDwt59Nelsx6omxgj+Mdh/hhNlRP2obF lWaMCDKnXqnRGcVl7taNE4hcSnkHbm9Ixtl4W0oZNvobni21qWKeSs9O/bUIOpwu132z CsvA== X-Gm-Message-State: AOAM533SICSgvk0McUDP4ft+4EBL+Hpxr0vYtor2HEGP8UEPumHW6bEq ieeZ3/buzkYnQG+OaqINxNC8tCXXSW7zbFM40YA= X-Received: by 2002:a17:907:97ca:: with SMTP id js10mr42571051ejc.640.1641398251745; Wed, 05 Jan 2022 07:57:31 -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 c30sm12399684ejj.190.2022.01.05.07.57.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jan 2022 07:57:31 -0800 (PST) From: Matthieu Baerts To: mptcp@lists.linux.dev Cc: Matthieu Baerts Subject: [PATCH mptcp-next v8 5/8] mptcp: clarify when options can be used Date: Wed, 5 Jan 2022 16:56:59 +0100 Message-Id: <20220105155702.165123-6-matthieu.baerts@tessares.net> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220105155702.165123-1-matthieu.baerts@tessares.net> References: <20220105155702.165123-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" RFC8684 doesn't seem to clearly specify which MPTCP options can be used together. Some options are mutually exclusive -- e.g. MP_CAPABLE and MP_JOIN --, some can be used together -- e.g. DSS + MP_PRIO --, some can but we prefer not to -- e.g. DSS + ADD_ADDR -- and some have to be used together at some points -- e.g. MP_FAIL and DSS. We need to clarify this as a base before allowing other modifications. For example, does it make sense to send a RM_ADDR with an MPC or MPJ? This remains open for possible future discussions. Signed-off-by: Matthieu Baerts --- net/mptcp/options.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/net/mptcp/options.c b/net/mptcp/options.c index 2f94069808a4..8553b928c5bf 100644 --- a/net/mptcp/options.c +++ b/net/mptcp/options.c @@ -1264,8 +1264,27 @@ 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) { - /* DSS, MPC, MPJ, ADD_ADDR, FASTCLOSE and FAIL are mutually exclusive, - * see mptcp_established_options*() + /* Which options can be used together? + * + * X: mutually exclusive + * O: often used together + * C: can be used together in some cases + * P: could be used together but we prefer not to (optimisations) + * + * Opt: | MPC | MPJ | DSS | ADD | RM | PRIO | FAIL | FC | + * ------|------|------|------|------|------|------|------|------| + * MPC |------|------|------|------|------|------|------|------| + * MPJ | X |------|------|------|------|------|------|------| + * DSS | X | X |------|------|------|------|------|------| + * ADD | X | X | P |------|------|------|------|------| + * RM | C | C | C | C |------|------|------|------| + * PRIO | X | C | C | C | C |------|------|------| + * FAIL | X | X | C | X | X | X |------|------| + * FC | X | X | X | X | X | X | X |------| + * RST | X | X | X | X | X | X | O | O | + * ------|------|------|------|------|------|------|------|------| + * + * The same applies in mptcp_established_options() function. */ if (likely(OPTION_MPTCP_DSS & opts->suboptions)) { struct mptcp_ext *mpext =3D &opts->ext_copy; --=20 2.33.1 From nobody Fri Mar 29 11:56:52 2024 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:a05:6638:38c:0:0:0:0 with SMTP id y12csp584324jap; Wed, 5 Jan 2022 07:57:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJw8IksQ+0i3YcRMoaurwLtkhq32SSqM9A25wQ5grJ09U0xCn34I76XF0VpxRj1U7QM0A28w X-Received: by 2002:a63:b905:: with SMTP id z5mr32716015pge.245.1641398261835; Wed, 05 Jan 2022 07:57:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1641398261; cv=none; d=google.com; s=arc-20160816; b=rYJZfdEhexJyFCH1MY7mt+cvsK0Y/sJu2XZHzPj1FBC25vpj/hbe4cgciszmz4Pgl6 onzuxeoLjFB31SgsVhqPtkqRkSiFC93ZV1xemg/RCXgqMLAFF+nfetZcANf6iAzKmsB3 wiqyndH/yC+5cF2mSaXft6zsBUdzidH806QF2lyOze8Av32MgF8NOpoTzmJe5YX1flgf uMNVDCxRU4u9ks2CTVbJPKqtfjdP1AU1SXnt23PE1QFAMePz+iUUiwS9e2+5QiNSjd3S GUoXDY0/+IShNL0w+I7LJS7UDlS/OiyRhT0Ck7ifYY30jRkmlx3g9NGvY2XRX4hZQmTd P7Yw== 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=eUDvi1snSI8RgS26pUudf/i3rGeVB0SFTUvO9vgaQEY=; b=0VBx7viFwr/RXkFVzonMVt8NmWDB/yyWkcEkdo8pT6VcxPorL6epBiWcdH/NxgK6VZ mIxHeg1XPzEC1/mk/P4Qj+IwdDiVBUrHGTt1cJ4BJgwTiS8H2Pa/qQZRCu260o01eBju aD8lvPgfVIW1D1y8+llgem356wUMXm3Iv/G197A5vgZFBeb4gCxBtW5MLYIYC9NC6eYh 2P2OOF0qbI6wAcEiwzLFK6opurVnBdVJdrP3+m2tYczYXJFQWKdyu6y+9PMx5AW+fSjW sc0D3y3xLtM8m4umDcByLS7gKGd5lJUQg7Jh294g/Ji3zOVUTvC3GA8phv5JKd/F3SOA f+Bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tessares-net.20210112.gappssmtp.com header.s=20210112 header.b="GylllEw/"; spf=pass (google.com: domain of mptcp+bounces-2915-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1000:8100::1 as permitted sender) smtp.mailfrom="mptcp+bounces-2915-wpasupplicant.patchew=gmail.com@lists.linux.dev" Return-Path: Received: from sjc.edge.kernel.org (sjc.edge.kernel.org. [2604:1380:1000:8100::1]) by mx.google.com with ESMTPS id s17si36970558plq.235.2022.01.05.07.57.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Jan 2022 07:57:41 -0800 (PST) Received-SPF: pass (google.com: domain of mptcp+bounces-2915-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1000:8100::1 as permitted sender) client-ip=2604:1380:1000:8100::1; Authentication-Results: mx.google.com; dkim=pass header.i=@tessares-net.20210112.gappssmtp.com header.s=20210112 header.b="GylllEw/"; spf=pass (google.com: domain of mptcp+bounces-2915-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1000:8100::1 as permitted sender) smtp.mailfrom="mptcp+bounces-2915-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 sjc.edge.kernel.org (Postfix) with ESMTPS id 4C7443E0EC0 for ; Wed, 5 Jan 2022 15:57:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B85F92CA1; Wed, 5 Jan 2022 15:57:35 +0000 (UTC) X-Original-To: mptcp@lists.linux.dev Received: from mail-ed1-f43.google.com (mail-ed1-f43.google.com [209.85.208.43]) (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 17ECF2CA7 for ; Wed, 5 Jan 2022 15:57:34 +0000 (UTC) Received: by mail-ed1-f43.google.com with SMTP id b13so163815791edd.8 for ; Wed, 05 Jan 2022 07:57:34 -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=eUDvi1snSI8RgS26pUudf/i3rGeVB0SFTUvO9vgaQEY=; b=GylllEw/0Ra4qtJvR/YAN2jqK0I2v6rXt5EtJDeg+ga8zfruCO9nNdzzZnPaSU+BQR mXQ1hnoW9Ner/3Caw/jWEuggCBlByf3z2T23YpItuF3k6v7njy0bny6xPfEYQiBWwDDR W3ETEvpeQ9jTKJcyGH6INITqz0pk0PEJ7p70c563yDrkXt+1mmcch2JmbimckKfZT032 lybVZJ5C74SGmhcWGzfmPMtsh8kuTJumiKj1cy3RMlZXKOms+VAOIp+2N1o4k4jO507F Sf116AdWV5WkgzvnYykLvT593s1O/8tq73xSEKFSM5zzwEHnkQERTmyu8ZHYSO3boJe/ qSiQ== 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=eUDvi1snSI8RgS26pUudf/i3rGeVB0SFTUvO9vgaQEY=; b=nQP2Y8iShydxikEcYn90EEnTgPWPBAKb+C3PS72NMq42GB12DvVAhuHJ9iM5QY/CWL R6Rdf7gKJyp6KZVgVjls+4l/hDWOUyotkBLBP5jZuxH4y3Zd6sgg8Y5nlY2iP+xkXSB7 JG7UupLusEds1u5ChKvve2orXjwDA4smUs+5GgS6290ya6OKk1jnTGHg4ybeMsUaQMlo p4Penl4HQavTAdc0RYqPcFMj3jWxNvufPfkO/Sa0iXEWhqQlnqA85J4gbNUI/Sl1yW2Z ZX8CIIVr3aZz+FU9YzGdmKZoVJhavZMvX6vQNxIjq9gpstovyyw6g08n9RmgnBQZqRuI 166Q== X-Gm-Message-State: AOAM531oNhGGo26hKipU0hUI85ddkgsiTI+YA/5INX+a8PUHh2Q4fKQq E5amTsZK5PXClkkkQkV3JN5ELL5ZeHIYTXXB5XE= X-Received: by 2002:a17:906:974c:: with SMTP id o12mr42064770ejy.229.1641398252265; Wed, 05 Jan 2022 07:57:32 -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 c30sm12399684ejj.190.2022.01.05.07.57.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jan 2022 07:57:32 -0800 (PST) From: Matthieu Baerts To: mptcp@lists.linux.dev Cc: Matthieu Baerts Subject: [PATCH mptcp-next v8 6/8] mptcp: allow sending both ADD_ADDR and RM_ADDR Date: Wed, 5 Jan 2022 16:57:00 +0100 Message-Id: <20220105155702.165123-7-matthieu.baerts@tessares.net> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220105155702.165123-1-matthieu.baerts@tessares.net> References: <20220105155702.165123-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" This is mainly to be sync with what is done in mptcp_write_options() where after having written the ADD_ADDR option, we check if the RM_ADDR option also needs to be added. But if we have room, it makes sense to write the two options in the same packet. So best to remove the 'else'. While at it, also mention that mptcp_established_options_add_addr() can remove options. Signed-off-by: Matthieu Baerts --- net/mptcp/options.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/mptcp/options.c b/net/mptcp/options.c index 8553b928c5bf..06f64101d27b 100644 --- a/net/mptcp/options.c +++ b/net/mptcp/options.c @@ -864,11 +864,14 @@ bool mptcp_established_options(struct sock *sk, struc= t sk_buff *skb, =20 *size +=3D opt_size; remaining -=3D opt_size; + /* Note: this can remove previously set options in some conditions */ if (mptcp_established_options_add_addr(sk, skb, &opt_size, remaining, opt= s)) { *size +=3D opt_size; remaining -=3D opt_size; ret =3D true; - } else if (mptcp_established_options_rm_addr(sk, &opt_size, remaining, op= ts)) { + } + + if (mptcp_established_options_rm_addr(sk, &opt_size, remaining, opts)) { *size +=3D opt_size; remaining -=3D opt_size; ret =3D true; --=20 2.33.1 From nobody Fri Mar 29 11:56:52 2024 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:a05:6638:38c:0:0:0:0 with SMTP id y12csp584336jap; Wed, 5 Jan 2022 07:57:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJwU9s1zcLK0b9fidA9R2fXMLp3SwC/XBVagX9WoBOE1fGAJp/KYFHB9j42z0Szz26S7yIlQ X-Received: by 2002:a17:902:ecc6:b0:148:a65d:842d with SMTP id a6-20020a170902ecc600b00148a65d842dmr54075483plh.56.1641398262975; Wed, 05 Jan 2022 07:57:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1641398262; cv=none; d=google.com; s=arc-20160816; b=rn3pfbaAZy63Nwpp86lTFAkszbKDP6GLfqdjCV7J5lonw/i2wjhAtHADA7Ow8L+XQO FZaC+/9hTssMaZs9OLLbubT0oOhYswyZwuY4Ka6u7e6yLuK07PIx/ED8dcelHN7rfcR9 /2zKF+Px/XP1j0ZRxuqJSnkSPqa/20NubAztFHxbko06UEr2P8B2Q+jhdPjoAy2PgkpU 71WEhXAJJly50/oWeY42Qfuy8NVlcMCwVTq3ubZx4eJbPtNlHHTTxu+VFUQG03TZs1Yy KFviFuf65l2RNpIkjaQ+ikNgsHZJqBIGxFM1rt0jVy+OeErciYCeuaStLCXhRlF80gHo +fUg== 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=ivp8ax95rhA0MAcxTz6MrRYhpRq1HirsyBfpAU4/xzI=; b=ZUOLz5YLWhqdtGZ46yxEGmtVg9S1MLEgwGTbkbbRrmG07ODNy/EGE9kO4EbTSvikSs qaNXB7dZXyutdXJ/w4n+wx+W2APWSTYxaKDK/lXQa7ulGisTv/vKISx1fht9iodo//hu WPWTdj9cX46nh4L7mK2a/kOlTa1SO9sCu088j84wY/ILzA2WXvV0ngpnuempQvo63aQ6 wgiNNN5cV7tzWCHclBtFuyaH90U+hwCu/dIR4StFzvFNC9zefw+YFeWrJv2cMejvRyJb FzYKVfCsH8dy3ZypZ49SDZrY+gL8LwpBRvbMTRFQF4bPdHim7S4EuX93N2OKp44rIwTh fF+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tessares-net.20210112.gappssmtp.com header.s=20210112 header.b=IMPtsuA2; spf=pass (google.com: domain of mptcp+bounces-2916-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1000:8100::1 as permitted sender) smtp.mailfrom="mptcp+bounces-2916-wpasupplicant.patchew=gmail.com@lists.linux.dev" Return-Path: Received: from sjc.edge.kernel.org (sjc.edge.kernel.org. [2604:1380:1000:8100::1]) by mx.google.com with ESMTPS id b8si3107504pgb.104.2022.01.05.07.57.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Jan 2022 07:57:42 -0800 (PST) Received-SPF: pass (google.com: domain of mptcp+bounces-2916-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1000:8100::1 as permitted sender) client-ip=2604:1380:1000:8100::1; Authentication-Results: mx.google.com; dkim=pass header.i=@tessares-net.20210112.gappssmtp.com header.s=20210112 header.b=IMPtsuA2; spf=pass (google.com: domain of mptcp+bounces-2916-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1000:8100::1 as permitted sender) smtp.mailfrom="mptcp+bounces-2916-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 sjc.edge.kernel.org (Postfix) with ESMTPS id 72E703E0ECC for ; Wed, 5 Jan 2022 15:57:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 125A92CA5; Wed, 5 Jan 2022 15:57:36 +0000 (UTC) X-Original-To: mptcp@lists.linux.dev Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) (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 CC3472CA2 for ; Wed, 5 Jan 2022 15:57:34 +0000 (UTC) Received: by mail-ed1-f46.google.com with SMTP id z9so93916416edm.10 for ; Wed, 05 Jan 2022 07:57:34 -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=ivp8ax95rhA0MAcxTz6MrRYhpRq1HirsyBfpAU4/xzI=; b=IMPtsuA29de9TT2WsN9+YdTeo/T/J7qx0ovp6Ezlr6d4IVRXlwKcOl5D6yG1gR19na QsYCOQCt76QhVWurpYD2xkMigdQ9EA1Kb6uduVq0DJ1bDpXVTlWklJlseZwapuhU38OK 9xapr9os7oGSgzz/KceRnyTteOf4ZvTuHW9NHMAu262ZVIAEQASJgZG4NOUU/hFb0eiS m0eIBmAk+hNtqCF1c5faWKkaeoTZzIhBs3EU0Aeu5qIrQNbZU5WLuJcAp9OOBaGQNMuN KT9acQpC0nBpkMXt9RIAulO8in9kfGDjOuM8IE7Ndafp0/SxCIo6nnVWpThHIP1f3pB4 Dfjg== 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=ivp8ax95rhA0MAcxTz6MrRYhpRq1HirsyBfpAU4/xzI=; b=YEajOW0UgR7ufvZ5L53F515x1r91wAgiRbwlcOurjiW/fSWC8NxsXEoRBp+y4urxu8 A4VIfREOOsttaMfe3bSNhqkZzyDvVemVwPhtX0gqji2B5zewpMK1CCBohP9+H0dGw5OW h0gUR45lF6Qxf/+RouZIDM/bo2M37qS7iqHFTu6qwn4wnlEQZ72gj23zhwioeudBF1V8 dfaWQA5Ghp5fTzMqysIK/m8J+gE178+zAtvYHLruqACEqshGmriDy5CmcTZFu6u+O14l pqYS7GCJl41qiIYWpeXy5vVejQwfQGZYDYAATsYk39OcpGMZLot5y1pQ5Cke5y2tzgMU SA9A== X-Gm-Message-State: AOAM530zB+AJlc5J75SXWsJYvm9/qr7MDeGzziD3FR2A9wgC9UKNjo3M nBAA3/EiAjhB0Pt+6pDOo9U8Uug/EogWK/y2Hb4= X-Received: by 2002:a17:906:2793:: with SMTP id j19mr42009708ejc.254.1641398252977; Wed, 05 Jan 2022 07:57:32 -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 c30sm12399684ejj.190.2022.01.05.07.57.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jan 2022 07:57:32 -0800 (PST) From: Matthieu Baerts To: mptcp@lists.linux.dev Cc: Geliang Tang , Matthieu Baerts Subject: [PATCH mptcp-next v8 7/8] mptcp: print out reset infos of MP_RST Date: Wed, 5 Jan 2022 16:57:01 +0100 Message-Id: <20220105155702.165123-8-matthieu.baerts@tessares.net> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220105155702.165123-1-matthieu.baerts@tessares.net> References: <20220105155702.165123-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 This patch printed out the reset infos, reset_transient and reset_reason, of MP_RST in mptcp_parse_option() to show that MP_RST is received. Signed-off-by: Geliang Tang Signed-off-by: Matthieu Baerts --- net/mptcp/options.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/mptcp/options.c b/net/mptcp/options.c index 06f64101d27b..182fb885f5e6 100644 --- a/net/mptcp/options.c +++ b/net/mptcp/options.c @@ -336,6 +336,8 @@ static void mptcp_parse_option(const struct sk_buff *sk= b, flags =3D *ptr++; mp_opt->reset_transient =3D flags & MPTCP_RST_TRANSIENT; mp_opt->reset_reason =3D *ptr; + pr_debug("MP_RST: transient=3D%u reason=3D%u", + mp_opt->reset_transient, mp_opt->reset_reason); break; =20 case MPTCPOPT_MP_FAIL: --=20 2.33.1 From nobody Fri Mar 29 11:56:52 2024 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:a05:6638:38c:0:0:0:0 with SMTP id y12csp584354jap; Wed, 5 Jan 2022 07:57:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJx8xbkH7vXtZc/BKbhpNQbXNv8CtgVqbYzxP63Ok/pfO8ZGxYzFt+2fmOwKIWLOR242WheV X-Received: by 2002:a17:90b:3907:: with SMTP id ob7mr4801698pjb.176.1641398264459; Wed, 05 Jan 2022 07:57:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1641398264; cv=none; d=google.com; s=arc-20160816; b=F+3ls87MMzBB3AnRXH+lypgCIW3IAiuadsHe3fij01Krfo6nn7BULswyUwlAmj2gKg C5znAcQr2DXJYKmshpSU2B9SAI1LChH+Y3RpFbBdeLDY3hfRZTCS8nJYhBownNPkggVg VsnexIFVaHTfLbBiswinze8RA3CiP+gnuCzVkKILjcJG8eeKvenYzDEhxIbRVYdl+SyY NXhhg+eT9yWuETJ/MN4WBQYE/mGDIApmOj8f0REWong4eIib3LtGsvQLPtULQYQuXd1Q lGXXWBQregwh0fsJiOxPT1DyBNZBHjGVBo33Au7rIUwV8W3PfCIipljE+OOn3I9IWSm9 AbBA== 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=hmf5Gx8AjygTWcq7F7esM2bVIG4OLuFLdG3P509K/gw=; b=P+z4CWuol859NI0W/Ydjkrmz2k6Uw5zw8ydz6/wKt9Tf2elrxPnUXmyLZ5KcZaphll lm9l+axmt1NEYqI8IbWhS2SWf16+vI+PypAVJoqmcg22NGhDWoB3TIHgqznMQXIb2NSM HbwEYMYa1fX7TLNfkMfAAmk2nACuvb39kD4QFC13yCuo0ROgL048p3DUAt5RLxp2SeQ4 uoOzj2ZgLLoff0K2ixzisZVhthJdKNrnLhLU1m1zWWhaDUu8rAU9tOdfTJUCOxltsQzA 7ssJBuJizfro1V8hUCl5zNumE624hDFBS9klN7c7ZVN3ni7haVX1S3ljSYNJjnSGW4JK MQvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tessares-net.20210112.gappssmtp.com header.s=20210112 header.b=nzMji4q5; spf=pass (google.com: domain of mptcp+bounces-2917-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1000:8100::1 as permitted sender) smtp.mailfrom="mptcp+bounces-2917-wpasupplicant.patchew=gmail.com@lists.linux.dev" Return-Path: Received: from sjc.edge.kernel.org (sjc.edge.kernel.org. [2604:1380:1000:8100::1]) by mx.google.com with ESMTPS id s17si36970558plq.235.2022.01.05.07.57.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Jan 2022 07:57:44 -0800 (PST) Received-SPF: pass (google.com: domain of mptcp+bounces-2917-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1000:8100::1 as permitted sender) client-ip=2604:1380:1000:8100::1; Authentication-Results: mx.google.com; dkim=pass header.i=@tessares-net.20210112.gappssmtp.com header.s=20210112 header.b=nzMji4q5; spf=pass (google.com: domain of mptcp+bounces-2917-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1000:8100::1 as permitted sender) smtp.mailfrom="mptcp+bounces-2917-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 sjc.edge.kernel.org (Postfix) with ESMTPS id B6A4B3E0EC2 for ; Wed, 5 Jan 2022 15:57:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D49812C9D; Wed, 5 Jan 2022 15:57:36 +0000 (UTC) X-Original-To: mptcp@lists.linux.dev Received: from mail-ed1-f43.google.com (mail-ed1-f43.google.com [209.85.208.43]) (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 641632CA0 for ; Wed, 5 Jan 2022 15:57:35 +0000 (UTC) Received: by mail-ed1-f43.google.com with SMTP id k15so829116edk.13 for ; Wed, 05 Jan 2022 07:57:35 -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=hmf5Gx8AjygTWcq7F7esM2bVIG4OLuFLdG3P509K/gw=; b=nzMji4q5ywrefDWI3YzwDy+c1wekMLJSqDG1W/yQAR2Bcck87TOpTPLmSjDOoLluZ8 cOfsHPgzjCwcTzsQlBGh3Ot8EZrNWPQvjuEvUorwJH/9k5bXLMyOf6eaEf/Ypcw0tDX8 j80wNi3vfE7lOy0XCUejnpsm++1JpJBFD0ny+Ke//Y74Ut+zETiUTQZCdGMDVXAQOxwV 76qhuZe/mYi72vTobhBtR3lZIcseazzADBPJ+RHVbXnEUjoywhqqEBKpxLg7hRQLvYbI B17XnWruuSC/VDk1wLzcBlT7qajpHLeyGyyqN7U3YLH6aGCd20PYqEERxY4TiTlzFj7D KHdg== 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=hmf5Gx8AjygTWcq7F7esM2bVIG4OLuFLdG3P509K/gw=; b=351cl31EyCUdPKvtgzaasoaJbbQRx70CYqsLWLZL1qGJqG6LzAf2rAsHH7Bq7Vne0k aRp5GzT05da46pfp33dOk+MJumJra1MobQGdXzlzxgBHaSIRqOPaFCw48WOyUk6QLjW8 canUmQkS8t/x2sXAFz5ViKjAdaALc2gn0WoU7WXdQaVSgOSbxv3yMkS7fd8uufhvSK1D UFBiqXeD0M/u6Um7yikXbz3yFhknrGnMjTMJhkxSC/sH2F+g76eAAjL0NKk8DIFTKrC1 ROBy1vViIsDjLyCq3QVyj/s+gn4n7Ly60HmENkXNycP3Lv4wHZra65AMWtPgHAAiB9zp lM2w== X-Gm-Message-State: AOAM531kikDyPBEIzJMvUMEnmLLlgFgjgsr+yZhIzOopSeQ8aN9y29Oe P0d5hCGcICeexQswE6Dk77EncqQuj68mZh6UWIs= X-Received: by 2002:a17:907:62a3:: with SMTP id nd35mr44757008ejc.650.1641398253600; Wed, 05 Jan 2022 07:57:33 -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 c30sm12399684ejj.190.2022.01.05.07.57.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jan 2022 07:57:33 -0800 (PST) From: Matthieu Baerts To: mptcp@lists.linux.dev Cc: Geliang Tang , Davide Caratti , Matthieu Baerts Subject: [PATCH mptcp-next v8 8/8] selftests: mptcp: add mp_fail testcases Date: Wed, 5 Jan 2022 16:57:02 +0100 Message-Id: <20220105155702.165123-9-matthieu.baerts@tessares.net> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220105155702.165123-1-matthieu.baerts@tessares.net> References: <20220105155702.165123-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 Added the test cases for MP_FAIL, use 'tc' command to trigger the checksum failure. Suggested-by: Davide Caratti Co-developed-by: Matthieu Baerts Signed-off-by: Matthieu Baerts Signed-off-by: Geliang Tang --- tools/testing/selftests/net/mptcp/config | 5 + .../testing/selftests/net/mptcp/mptcp_join.sh | 111 ++++++++++++++++-- 2 files changed, 107 insertions(+), 9 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/config b/tools/testing/selft= ests/net/mptcp/config index d36b7da5082a..26955abe49f0 100644 --- a/tools/testing/selftests/net/mptcp/config +++ b/tools/testing/selftests/net/mptcp/config @@ -19,3 +19,8 @@ CONFIG_IP_ADVANCED_ROUTER=3Dy CONFIG_IP_MULTIPLE_TABLES=3Dy CONFIG_IP_NF_TARGET_REJECT=3Dm CONFIG_IPV6_MULTIPLE_TABLES=3Dy +CONFIG_NET_ACT_CSUM=3Dm +CONFIG_NET_ACT_PEDIT=3Dm +CONFIG_NET_CLS_ACT=3Dy +CONFIG_NET_CLS_FLOWER=3Dm +CONFIG_NET_SCH_INGRESS=3Dm diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testin= g/selftests/net/mptcp/mptcp_join.sh index e48ce23d2386..535baa3c01e7 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -16,6 +16,7 @@ mptcp_connect=3D"" capture=3D0 checksum=3D0 do_all_tests=3D1 +nr_fail=3D0 =20 TEST_COUNT=3D0 =20 @@ -58,6 +59,8 @@ init() fi done =20 + validate_checksum=3D$checksum + # ns1 ns2 # ns1eth1 ns2eth1 # ns1eth2 ns2eth2 @@ -161,6 +164,45 @@ reset_with_allow_join_id0() ip netns exec $ns2 sysctl -q net.mptcp.allow_join_initial_addr_port=3D$ns= 2_enable } =20 +# Modify TCP payload without corrupting the TCP packet +# +# This rule inverts a 32-bit word at byte offset 148 for all TCP ACK +# packets carrying enough data. +# Once it is done, the TCP Checksum field is updated so the packet +# is still considered as valid at the TCP level. +# But because the MPTCP checksum, covering the TCP options and data, +# has not been updated, we will detect the modification and emit an +# MP_FAIL: what we want to validate here. +# +# Please note that this rule will produce this pr_info() message for +# each TCP ACK packets not carrying enough data: +# +# tc action pedit offset 162 out of bounds +# +# But this should be limited to a very few numbers of packets as we +# restrict this rule to outgoing TCP traffic with only the ACK flag +# + except the 3rd ACK, only packets carrying data should be seen in +# this direction. +reset_with_fail() +{ + reset + + ip netns exec $ns1 sysctl -q net.mptcp.checksum_enabled=3D1 + ip netns exec $ns2 sysctl -q net.mptcp.checksum_enabled=3D1 + + validate_checksum=3D1 + nr_fail=3D0 + i=3D"$1" + + tc -n $ns2 qdisc add dev ns2eth$i clsact + tc -n $ns2 filter add dev ns2eth$i egress \ + protocol ip prio 1000 \ + flower ip_proto tcp tcp_flags 0x10/0xff \ + action pedit munge offset 148 u32 invert \ + pipe csum tcp \ + index 100 +} + ip -Version > /dev/null 2>&1 if [ $? -ne 0 ];then echo "SKIP: Could not run test without ip tool" @@ -179,6 +221,12 @@ if [ $? -ne 0 ];then exit $ksft_skip fi =20 +jq -V > /dev/null 2>&1 +if [ $? -ne 0 ];then + echo "SKIP: Could not run all tests without jq tool" + exit $ksft_skip +fi + print_file_err() { ls -l "$1" 1>&2 @@ -233,6 +281,21 @@ link_failure() done } =20 +get_nr_fail() +{ + i=3D"$1" + + local action=3D$(tc -n $ns2 -j -s action show action pedit index 100) + local packets=3D$(echo $action | jq '.[1].actions[0].stats.packets') + local overlimits=3D$(echo $action | jq '.[1].actions[0].stats.overlimits') + + let pkt=3D$packets-$overlimits + if [ $pkt -gt 0 ]; then + nr_fail=3D1 + fi + tc -n $ns2 qdisc del dev ns2eth$i clsact +} + # $1: IP address is_v6() { @@ -589,6 +652,8 @@ dump_stats() chk_csum_nr() { local msg=3D${1:-""} + local csum_ns1=3D${2:-0} + local csum_ns2=3D${3:-0} local count local dump_stats =20 @@ -600,8 +665,8 @@ chk_csum_nr() printf " %-36s %s" "$msg" "sum" count=3D`ip netns exec $ns1 nstat -as | grep MPTcpExtDataCsumErr | awk '{= print $2}'` [ -z "$count" ] && count=3D0 - if [ "$count" !=3D 0 ]; then - echo "[fail] got $count data checksum error[s] expected 0" + if [ "$count" !=3D $csum_ns1 ]; then + echo "[fail] got $count data checksum error[s] expected $csum_ns1" ret=3D1 dump_stats=3D1 else @@ -610,8 +675,8 @@ chk_csum_nr() echo -n " - csum " count=3D`ip netns exec $ns2 nstat -as | grep MPTcpExtDataCsumErr | awk '{= print $2}'` [ -z "$count" ] && count=3D0 - if [ "$count" !=3D 0 ]; then - echo "[fail] got $count data checksum error[s] expected 0" + if [ "$count" !=3D $csum_ns2 ]; then + echo "[fail] got $count data checksum error[s] expected $csum_ns2" ret=3D1 dump_stats=3D1 else @@ -690,6 +755,8 @@ chk_join_nr() local syn_nr=3D$2 local syn_ack_nr=3D$3 local ack_nr=3D$4 + local fail_nr=3D${5:-0} + local infi_nr=3D${6:-0} local count local dump_stats =20 @@ -726,10 +793,10 @@ chk_join_nr() echo "[ ok ]" fi [ "${dump_stats}" =3D 1 ] && dump_stats - if [ $checksum -eq 1 ]; then - chk_csum_nr - chk_fail_nr 0 0 - chk_infi_nr 0 0 + if [ $validate_checksum -eq 1 ]; then + chk_csum_nr "" $fail_nr + chk_fail_nr $fail_nr $fail_nr + chk_infi_nr $infi_nr $infi_nr fi } =20 @@ -1985,6 +2052,27 @@ userspace_tests() chk_rm_nr 0 0 } =20 +fail_tests() +{ + # multiple subflows + reset_with_fail 2 + 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 dev ns2eth3 flags subflow + ip netns exec $ns2 ./pm_nl_ctl add 10.0.2.2 dev ns2eth2 flags subflow + run_tests $ns1 $ns2 10.0.1.1 2 + get_nr_fail 2 + chk_join_nr "$nr_fail MP_FAIL, multiple subflows" 2 2 2 $nr_fail + + # single subflow + reset_with_fail 1 + 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 2 + get_nr_fail 1 + chk_join_nr "$nr_fail MP_FAIL, single subflow" 0 0 0 $nr_fail $nr_fail +} + all_tests() { subflows_tests @@ -2003,6 +2091,7 @@ all_tests() deny_join_id0_tests fullmesh_tests userspace_tests + fail_tests } =20 usage() @@ -2024,6 +2113,7 @@ usage() echo " -d deny_join_id0_tests" echo " -m fullmesh_tests" echo " -u userspace_tests" + echo " -F fail_tests" echo " -c capture pcap files" echo " -C enable data checksum" echo " -h help" @@ -2059,7 +2149,7 @@ if [ $do_all_tests -eq 1 ]; then exit $ret fi =20 -while getopts 'fesltra64bpkdmuchCS' opt; do +while getopts 'fesltra64bpkdmuchCSF' opt; do case $opt in f) subflows_tests @@ -2109,6 +2199,9 @@ while getopts 'fesltra64bpkdmuchCS' opt; do u) userspace_tests ;; + F) + fail_tests + ;; c) ;; C) --=20 2.33.1