From patchwork Wed Dec 9 23:51:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mat Martineau X-Patchwork-Id: 11962907 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25071C433FE for ; Wed, 9 Dec 2020 23:57:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E2C2522D06 for ; Wed, 9 Dec 2020 23:57:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729271AbgLIX5T (ORCPT ); Wed, 9 Dec 2020 18:57:19 -0500 Received: from mga06.intel.com ([134.134.136.31]:19498 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725965AbgLIX43 (ORCPT ); Wed, 9 Dec 2020 18:56:29 -0500 IronPort-SDR: WUwCAtOVaWmDG7LOJRClyzwf6fI6LyF5oLLjHkrwQvrxq5Ao6kXKloebgF/pkE1yxO0CSrcGcK HpNSNDok8cpA== X-IronPort-AV: E=McAfee;i="6000,8403,9830"; a="235763091" X-IronPort-AV: E=Sophos;i="5.78,407,1599548400"; d="scan'208";a="235763091" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Dec 2020 15:51:38 -0800 IronPort-SDR: sPmC5SrhMRAyrMmZXAUTOvm/ODC1NWdTHOPko4NRysgcf2u0Rx1fgYT2K6AgT0WD/ZNdnW+zez v3/gtK8HVMHg== X-IronPort-AV: E=Sophos;i="5.78,407,1599548400"; d="scan'208";a="318582186" Received: from mjmartin-nuc02.amr.corp.intel.com ([10.254.111.12]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Dec 2020 15:51:38 -0800 From: Mat Martineau To: netdev@vger.kernel.org Cc: Geliang Tang , davem@davemloft.net, kuba@kernel.org, mptcp@lists.01.org, Mat Martineau Subject: [PATCH net-next 04/11] mptcp: use adding up size to get ADD_ADDR length Date: Wed, 9 Dec 2020 15:51:21 -0800 Message-Id: <20201209235128.175473-5-mathew.j.martineau@linux.intel.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201209235128.175473-1-mathew.j.martineau@linux.intel.com> References: <20201209235128.175473-1-mathew.j.martineau@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Geliang Tang This patch uses adding up size to get the ADD_ADDR suboption length rather than returning the ADD_ADDR size constants. Signed-off-by: Geliang Tang Signed-off-by: Mat Martineau --- net/mptcp/protocol.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 987046d9d1d4..5c45aabf4c6a 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -578,10 +578,14 @@ static inline bool mptcp_pm_should_rm_signal(struct mptcp_sock *msk) static inline unsigned int mptcp_add_addr_len(int family, bool echo) { - if (family == AF_INET) - return echo ? TCPOLEN_MPTCP_ADD_ADDR_BASE - : TCPOLEN_MPTCP_ADD_ADDR; - return echo ? TCPOLEN_MPTCP_ADD_ADDR6_BASE : TCPOLEN_MPTCP_ADD_ADDR6; + u8 len = TCPOLEN_MPTCP_ADD_ADDR_BASE; + + if (family == AF_INET6) + len = TCPOLEN_MPTCP_ADD_ADDR6_BASE; + if (!echo) + len += MPTCPOPT_THMAC_LEN; + + return len; } bool mptcp_pm_add_addr_signal(struct mptcp_sock *msk, unsigned int remaining,