From nobody Mon Feb 9 01:22:23 2026 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:a02:cbb9:0:0:0:0:0 with SMTP id v25csp7382238jap; Tue, 14 Dec 2021 08:59:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJy17e1e+OnNLGU8R9SXMF9uYZhJvaQlzScD3TCBR4L+m1XlLlSWXXmIgQMiRM7mpPmMpXIZ X-Received: by 2002:ac8:5e89:: with SMTP id r9mr7173225qtx.70.1639501168072; Tue, 14 Dec 2021 08:59:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1639501168; cv=none; d=google.com; s=arc-20160816; b=VBFRaFK+pd6mBJlRkEoq6+bHrcEkyPFJHUc6VCZ/qaa8slWbHgLwEoZcftAzxqbope uSnWZ7U5lJurvjDqUCccaYT83yoe0bGvydmzQB7uKNBSgqN1v4YXT+lekVOFrSKIgSct TBH0G75d7CEdtWB8ejMOH3yL8I5hffkyQi6gHrXe5AkfWXHfMTRMOmhdvyeJs97FK3iU 3O9pOaYIwrugqzgol7Ep0T1VAS4+zy7eVj1hdoPUOm0MNaiZlu0UzaUW6401aw1NtN2P y9PgzPI0UqchZNHS06USCDAT3j5qrXIva4/KUm4IAIJt3UzNv4tQnbJnyDoOKvW8rRLG Y5mA== 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:to:from:dkim-signature; bh=R1mY7UFdQVRSDeafvZWZ10zEPnX1i9Jjr2qNMeJH7g8=; b=vVkCCqsDAfOIQH6ImDuJJxkTx/Rgsu2rIjS7NeF+WlgIX22NeP1R9P0KSxQRybkpyn BJQDj9Gjj26CoWW1gWsrF0y1gZI5HlWEr8hrjA3iOld3VWkXBhj3RjWZBq4lddRp0xOt zfee0DyTUuI4GtRnBrMXrQj5k/viUo+uMMqzB5Pn+3aq8iqt07REgbA8eI0k/4TllBgW 9ng+3bS8XSYS5kuR9/D4XvGgFYTcBJ3tL6DlqKC0FMdTTpb57C7d2fTOlBnl8h9VM69p em9wTqf5XiWWvbC/F5+n3YH7/b9Bo8Vox5grhP1pZ25TjF/0T0ixiFgLi5A2yNYHuATj Cw6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gTCbeKHu; spf=pass (google.com: domain of mptcp+bounces-2747-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.197.195 as permitted sender) smtp.mailfrom="mptcp+bounces-2747-wpasupplicant.patchew=gmail.com@lists.linux.dev"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ewr.edge.kernel.org (ewr.edge.kernel.org. [147.75.197.195]) by mx.google.com with ESMTPS id n6si375719qkp.201.2021.12.14.08.59.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Dec 2021 08:59:28 -0800 (PST) Received-SPF: pass (google.com: domain of mptcp+bounces-2747-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.197.195 as permitted sender) client-ip=147.75.197.195; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gTCbeKHu; spf=pass (google.com: domain of mptcp+bounces-2747-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.197.195 as permitted sender) smtp.mailfrom="mptcp+bounces-2747-wpasupplicant.patchew=gmail.com@lists.linux.dev"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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 DC3851C08AB for ; Tue, 14 Dec 2021 16:59:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 79C362CAA; Tue, 14 Dec 2021 16:59:26 +0000 (UTC) X-Original-To: mptcp@lists.linux.dev Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D58812CB2 for ; Tue, 14 Dec 2021 16:59:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639501164; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=R1mY7UFdQVRSDeafvZWZ10zEPnX1i9Jjr2qNMeJH7g8=; b=gTCbeKHuU9XofQ833SJ4ySoX2FWHGwGs8Is8jV22dVkQAiUjPdXwfQkKLIwwR1SiWGg0Lv 48tWAT3YcKVdtqVTYjdpnZ3RlDBJdtqXDc+69E6p+hCMZJ8pisrMJqdcupIUR9pMalQLOI LAQ6pm0D2xbC9LKeZEevabjqFZ0PXIc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-524-oxJjpXLgOXuDQ4g6ZvsdSQ-1; Tue, 14 Dec 2021 11:59:22 -0500 X-MC-Unique: oxJjpXLgOXuDQ4g6ZvsdSQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D0280801AAB for ; Tue, 14 Dec 2021 16:59:21 +0000 (UTC) Received: from gerbillo.redhat.com (unknown [10.39.194.135]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2706D106A7AE for ; Tue, 14 Dec 2021 16:59:20 +0000 (UTC) From: Paolo Abeni To: mptcp@lists.linux.dev Subject: [PATCH v6 mptcp-next 2/7] mptcp: clean-up MPJ option writing. Date: Tue, 14 Dec 2021 17:58:52 +0100 Message-Id: In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pabeni@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Check for all MPJ variant at once, this reduces the number of conditionals traversed on average and will simplify the next patch. No functional change intended. Signed-off-by: Paolo Abeni --- net/mptcp/options.c | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/net/mptcp/options.c b/net/mptcp/options.c index 8a1020e4285c..7a6a39b71633 100644 --- a/net/mptcp/options.c +++ b/net/mptcp/options.c @@ -1381,27 +1381,29 @@ void mptcp_write_options(__be32 *ptr, const struct = tcp_sock *tp, =20 /* MPC is additionally mutually exclusive with MP_PRIO */ goto mp_capable_done; - } else if (OPTION_MPTCP_MPJ_SYN & opts->suboptions) { - *ptr++ =3D mptcp_option(MPTCPOPT_MP_JOIN, - TCPOLEN_MPTCP_MPJ_SYN, - opts->backup, opts->join_id); - put_unaligned_be32(opts->token, ptr); - ptr +=3D 1; - put_unaligned_be32(opts->nonce, ptr); - ptr +=3D 1; - } else if (OPTION_MPTCP_MPJ_SYNACK & opts->suboptions) { - *ptr++ =3D mptcp_option(MPTCPOPT_MP_JOIN, - TCPOLEN_MPTCP_MPJ_SYNACK, - opts->backup, opts->join_id); - put_unaligned_be64(opts->thmac, ptr); - ptr +=3D 2; - put_unaligned_be32(opts->nonce, ptr); - ptr +=3D 1; - } else if (OPTION_MPTCP_MPJ_ACK & opts->suboptions) { - *ptr++ =3D mptcp_option(MPTCPOPT_MP_JOIN, - TCPOLEN_MPTCP_MPJ_ACK, 0, 0); - memcpy(ptr, opts->hmac, MPTCPOPT_HMAC_LEN); - ptr +=3D 5; + } else if (OPTIONS_MPTCP_MPJ & opts->suboptions) { + if (OPTION_MPTCP_MPJ_SYN & opts->suboptions) { + *ptr++ =3D mptcp_option(MPTCPOPT_MP_JOIN, + TCPOLEN_MPTCP_MPJ_SYN, + opts->backup, opts->join_id); + put_unaligned_be32(opts->token, ptr); + ptr +=3D 1; + put_unaligned_be32(opts->nonce, ptr); + ptr +=3D 1; + } else if (OPTION_MPTCP_MPJ_SYNACK & opts->suboptions) { + *ptr++ =3D mptcp_option(MPTCPOPT_MP_JOIN, + TCPOLEN_MPTCP_MPJ_SYNACK, + opts->backup, opts->join_id); + put_unaligned_be64(opts->thmac, ptr); + ptr +=3D 2; + put_unaligned_be32(opts->nonce, ptr); + ptr +=3D 1; + } else { + *ptr++ =3D mptcp_option(MPTCPOPT_MP_JOIN, + TCPOLEN_MPTCP_MPJ_ACK, 0, 0); + memcpy(ptr, opts->hmac, MPTCPOPT_HMAC_LEN); + ptr +=3D 5; + } } else if (OPTION_MPTCP_ADD_ADDR & opts->suboptions) { u8 len =3D TCPOLEN_MPTCP_ADD_ADDR_BASE; u8 echo =3D MPTCP_ADDR_ECHO; --=20 2.33.1