From nobody Thu Apr 25 11:22:30 2024 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:ab0:32da:0:0:0:0:0 with SMTP id f26csp607109uao; Sat, 17 Sep 2022 15:29:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7OgdumKOAhv3kTHr0Jxbzrqf5Rxmpbyvj/K0OXBJtoYlNULm7HONqyKB8MnJw5sXcU1x26 X-Received: by 2002:a05:620a:2793:b0:6cb:c11a:130f with SMTP id g19-20020a05620a279300b006cbc11a130fmr8407341qkp.549.1663453772699; Sat, 17 Sep 2022 15:29:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1663453772; cv=pass; d=google.com; s=arc-20160816; b=v9+AZjXx0gDxmlQb0+BfT96m1QOtmDIXT/rQ0vTEXAS6UiB3eWnSmq21l198pzB96O JkZ8P0ewQILILD0KnmaqWtJ0T3LegaO17Pq7YVZAZa5PHRLBJiMhwOkaFwi8eX81cO/b I9ClROHryzLh8m72PKgNzPpozaQCj1Z4j5rokkhbrUS3iKAZ77TFpip6SZLlcvjK2A+x ycKd7MwBmSSrxvZIj481SozVlCibFculwX8svS+7aM2ahum9+htkXjQuTqVLdlhv1f3+ iGZ7lyq1dkTLac7/HGn9Qxha5fVHzqtwDL0t7CFOS/lIQbLyosHNgOBefUw4Tndc1w1d w89w== ARC-Message-Signature: i=2; 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:date :subject:message-id:cc:to:from:dkim-signature; bh=GsQyvmSGizvFF+1HgibWVVbslT+CcV6JOXOiNAGM9iQ=; b=LK3dzUtxQSf8AiywMjtXi1q4OYBbhF0Pe7h8Roy1A2iOge6nNFa3yeU8AlKPBi079Z YvXuEEqEiMMTePqBOUNJP97p08+qimUXv5JC1Vr64gAx3HX91knE1e8syzyB1YO9QAXw n94+gTVRLfjziymkBlJACMNg+3ywayTIAGn137mW93rF3ejwGVvXKw0oDFY1z/jdplXI hxtDHnF468B1kdXJDLucKTq1QC6wDS+3bYSql7miv+VvkZrFbK8p+paLnD5jDok9WeIK z3wR8Tgy+TETaCAkHo14aKY1Dnwbg3rGqJfaY2bMo3gA5alVAfrIOgCqK5BpAqqB3rRl n54Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@shytyi.net header.s=hs header.b=JACzBwXc; arc=pass (i=1 spf=pass spfdomain=shytyi.net dkim=pass dkdomain=shytyi.net dmarc=pass fromdomain=shytyi.net>); spf=pass (google.com: domain of mptcp+bounces-6293-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.199.223 as permitted sender) smtp.mailfrom="mptcp+bounces-6293-wpasupplicant.patchew=gmail.com@lists.linux.dev" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id t14-20020a0562140c6e00b004a5dee54dc8si7176992qvj.76.2022.09.17.15.29.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 17 Sep 2022 15:29:32 -0700 (PDT) Received-SPF: pass (google.com: domain of mptcp+bounces-6293-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@shytyi.net header.s=hs header.b=JACzBwXc; arc=pass (i=1 spf=pass spfdomain=shytyi.net dkim=pass dkdomain=shytyi.net dmarc=pass fromdomain=shytyi.net>); spf=pass (google.com: domain of mptcp+bounces-6293-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.199.223 as permitted sender) smtp.mailfrom="mptcp+bounces-6293-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 8929C1C208C2 for ; Sat, 17 Sep 2022 22:29:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DE8CF5CA2; Sat, 17 Sep 2022 22:29:29 +0000 (UTC) X-Original-To: mptcp@lists.linux.dev Received: from sender11-of-o51.zoho.eu (sender11-of-o51.zoho.eu [31.186.226.237]) (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 EF6A05C80 for ; Sat, 17 Sep 2022 22:29:27 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; t=1663453758; cv=none; d=zohomail.eu; s=zohoarc; b=hmr70rOdxz8elnGTizpPK8nfnxAjrmuR3AOw9hxdH+4Xw0qAVvVKdqtq0Dri0twVXKZDbYtkucIX/eMEZkV7bq9J5bs00kYDsWnUlc3iZj6J71Gr0tiVwRfZAPjlwotyWcrsPvmyoUA1ArvnHWoj1dBoi0VvEjydbwxNXuFHvV4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1663453758; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=GsQyvmSGizvFF+1HgibWVVbslT+CcV6JOXOiNAGM9iQ=; b=JfG+mD8uPSBQrIZ7/3eZMDm9YLHU/0TDziEjonCo7EPxhtdey36jIs6hcv5ursvEBdZ4zihY+hiANRJ9RvYRkW1b29ATqvQIztDkE4/Dh0Z+2Vd4VGJS2HJRdDd0yxKu6JKJf88JCzMSRy+vfbl2k2b65IQgU9WWvZNfRYvuO2c= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=shytyi.net; spf=pass smtp.mailfrom=dmytro@shytyi.net; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1663453758; s=hs; d=shytyi.net; i=dmytro@shytyi.net; h=From:From:To:To:Cc:Cc:Message-ID:Subject:Subject:Date:Date:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Content-Type:Message-Id:Reply-To; bh=GsQyvmSGizvFF+1HgibWVVbslT+CcV6JOXOiNAGM9iQ=; b=JACzBwXcXL00YNPfowS6yNdHs24Mkw9OXb+7E5EwO9Hne6jnq7DVeCjwLjCGfYks kzyZMz5oMRfZgFSjMizFcrjmwmL73RXfKsr8repLStiUrj2/GCGuhbj2OCw/3l1c2gy xohFqAsEJOyGO9JxkBBKu6MZAs6ODfUwgUHwPWoA= Received: from doris.localdomain (243.34.22.93.rev.sfr.net [93.22.34.243]) by mx.zoho.eu with SMTPS id 166345375767072.63750628351613; Sun, 18 Sep 2022 00:29:17 +0200 (CEST) From: Dmytro Shytyi To: mptcp@lists.linux.dev Cc: Dmytro Shytyi Message-ID: <20220917222853.2406-2-dmytro@shytyi.net> Subject: [RFC PATCH mptcp-next v7 01/11] Add separate fastopen.c file. Date: Sun, 18 Sep 2022 00:28:43 +0200 X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220917222853.2406-1-dmytro@shytyi.net> References: <20220917222853.2406-1-dmytro@shytyi.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 X-ZohoMailClient: External Content-Type: text/plain; charset="utf-8" Add separate *.c file. Function prototypes are coming to protocol.h (Suggestion of @palbeni (JUN 17)) Signed-off-by: Dmytro Shytyi --- net/mptcp/Makefile | 2 +- net/mptcp/fastopen.c | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 net/mptcp/fastopen.c diff --git a/net/mptcp/Makefile b/net/mptcp/Makefile index 8a7f68efa35f..c42ad8609876 100644 --- a/net/mptcp/Makefile +++ b/net/mptcp/Makefile @@ -2,7 +2,7 @@ obj-$(CONFIG_MPTCP) +=3D mptcp.o =20 mptcp-y :=3D protocol.o subflow.o options.o token.o crypto.o ctrl.o pm.o d= iag.o \ - mib.o pm_netlink.o sockopt.o pm_userspace.o sched.o + mib.o pm_netlink.o sockopt.o pm_userspace.o sched.o fastopen.o =20 obj-$(CONFIG_SYN_COOKIES) +=3D syncookies.o obj-$(CONFIG_INET_MPTCP_DIAG) +=3D mptcp_diag.o diff --git a/net/mptcp/fastopen.c b/net/mptcp/fastopen.c new file mode 100644 index 000000000000..0c9ef6f5d528 --- /dev/null +++ b/net/mptcp/fastopen.c @@ -0,0 +1,5 @@ +/* SPDX-License-Identifier: GPL-2.0 + * MPTCP Fast Open Mechanism. Copyright (c) 2021-2022, Dmytro SHYTYI + */ + +#include "protocol.h" --=20 2.25.1 From nobody Thu Apr 25 11:22:30 2024 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:ab0:32da:0:0:0:0:0 with SMTP id f26csp607103uao; Sat, 17 Sep 2022 15:29:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7hcxuwl3gylOEeGiqeq45hDyBgXBL4xLrG9YDUNc/LTwfdPA/03uCqQpb0+L1iq1KI6IMW X-Received: by 2002:a05:620a:2785:b0:6ce:7dc2:2b2 with SMTP id g5-20020a05620a278500b006ce7dc202b2mr8578137qkp.395.1663453771977; Sat, 17 Sep 2022 15:29:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1663453771; cv=pass; d=google.com; s=arc-20160816; b=bJpo09XPVCEx2fE+L53x6PawuJukTwbZaBWoRnI3+Lk7TxABPAsG0sSXEVnRNCIv4c cz+Jm5O/ivI1/JvVzWpXMe7FOAOSSgwRlabtyiR7wqcocNQlKonTqF+Bi7j4He8nO1Mu Fbf4+ChyaXof9COix0TgSNK2xNleJhVRFxyZZmGiFQhjHYCDO5AqD3g9og/PPncX4mFq 8LRhFXvDdMXG6iDJKTXrTm1IaqeykX37BL0TKMwkh62Ud0FNwdjUvKr2VoYJUs/UGH62 mrwCSFwEy5ydgT8K/xdjNNnUwwXfaZmAUR+b1kPX/IKoTghLybB9HW7BN99rK6oKNfLT Kjmg== ARC-Message-Signature: i=2; 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:date :subject:message-id:cc:to:from:dkim-signature; bh=lQrsdQ7WntcxlzBejgs67ot2JiQC73UDXM2RJFaYzv0=; b=MMuDUzs5WeM1lXhAbqlxgy4wyRpRH5TA28O0MssmLwOUzI9eX+8LFmK0CyX6A39RkW YtMyma6XWRifKs0DD9Eca+/7ZyoxAtpDMa0GSLZoGmefgNqGFB9bWTSm5lmRbVyYeb06 ZqMfQOV/QG1X+JuqCUeL3srjFoTHdWFZPGA3jnvYFAS1IvWabPrCgXEMoKCgY42LPqmF KZcqyyiry4yAV42y8JFNMlMJHOIxfutpEXeJRgt4VcOa1H2PU9AAF4jEH9KrEOl7FPw7 b3PsZDKhfvmZ8enwZnzlbTXpIhTDv2xHSTnAclQSiqBmGSbarKGH/6AOV8ZiVcnFsDmn R9gw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@shytyi.net header.s=hs header.b=YnM+9PGd; arc=pass (i=1 spf=pass spfdomain=shytyi.net dkim=pass dkdomain=shytyi.net dmarc=pass fromdomain=shytyi.net>); spf=pass (google.com: domain of mptcp+bounces-6292-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="mptcp+bounces-6292-wpasupplicant.patchew=gmail.com@lists.linux.dev" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id x22-20020a05620a0b5600b006af435b6aa3si6843107qkg.677.2022.09.17.15.29.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 17 Sep 2022 15:29:31 -0700 (PDT) Received-SPF: pass (google.com: domain of mptcp+bounces-6292-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@shytyi.net header.s=hs header.b=YnM+9PGd; arc=pass (i=1 spf=pass spfdomain=shytyi.net dkim=pass dkdomain=shytyi.net dmarc=pass fromdomain=shytyi.net>); spf=pass (google.com: domain of mptcp+bounces-6292-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="mptcp+bounces-6292-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 5626D1C20971 for ; Sat, 17 Sep 2022 22:29:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C3F815C87; Sat, 17 Sep 2022 22:29:29 +0000 (UTC) X-Original-To: mptcp@lists.linux.dev Received: from sender11-of-o51.zoho.eu (sender11-of-o51.zoho.eu [31.186.226.237]) (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 D2F2746BA for ; Sat, 17 Sep 2022 22:29:27 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; t=1663453759; cv=none; d=zohomail.eu; s=zohoarc; b=jZvMGDzgqE7fLpBcWQhOsrPvxbPUGlnBgHzVF8kWkPpFvqgtJ7iasaxrGH5uQMPAMlSafu6yacE7dDp5c3f/6yIhfa0yw3BlEk783x/cVK9unuzmJ1Bwn92rcUWFEIMjTBwk+tKE0A4kZAr004WQAMcjmrADgajJgF20sluu5hI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1663453759; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=lQrsdQ7WntcxlzBejgs67ot2JiQC73UDXM2RJFaYzv0=; b=fCjX9NZ20Uf3RtVEv6kR3kgSHPlKA3p+891QKMb1EAdu4gEPFH1eSU7y+nhXHsMYi5pLHwiGN5yg44EVfwtNR5mrOVKmwBFlQJSC4SiKRIgi9+LgEx2+MKoN1UNc+nAxo6tQwa3dy3mq2OHNSZgJeiLcIFXLGi+GZhsJTCGgN+k= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=shytyi.net; spf=pass smtp.mailfrom=dmytro@shytyi.net; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1663453759; s=hs; d=shytyi.net; i=dmytro@shytyi.net; h=From:From:To:To:Cc:Cc:Message-ID:Subject:Subject:Date:Date:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Content-Type:Message-Id:Reply-To; bh=lQrsdQ7WntcxlzBejgs67ot2JiQC73UDXM2RJFaYzv0=; b=YnM+9PGdd8cZFwn/Kr56fiFSCp3Kgw7YHMjWAEfoS3uO2noXNGw/oHo55xhpRV73 dG0RBie+/QRk1voZNJrrNH6NfkXXWidB+//57F7/A0Q7ZHF/lv51RqbOO19eAWp1g0N xnSqt7NbfbILmRybrnb8RbBp9nO0ccPqcno+a6ew= Received: from doris.localdomain (243.34.22.93.rev.sfr.net [93.22.34.243]) by mx.zoho.eu with SMTPS id 166345375788882.48674977069504; Sun, 18 Sep 2022 00:29:17 +0200 (CEST) From: Dmytro Shytyi To: mptcp@lists.linux.dev Cc: Dmytro Shytyi Message-ID: <20220917222853.2406-3-dmytro@shytyi.net> Subject: [RFC PATCH mptcp-next v7 02/11] add mptcp_stream_connect to protocol.h Date: Sun, 18 Sep 2022 00:28:44 +0200 X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220917222853.2406-1-dmytro@shytyi.net> References: <20220917222853.2406-1-dmytro@shytyi.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 X-ZohoMailClient: External Content-Type: text/plain; charset="utf-8" We call mptcp_stream_connect() from mptcp_sendmsg_fastopen() in fastopen.c Signed-off-by: Dmytro Shytyi --- net/mptcp/protocol.c | 4 ++-- net/mptcp/protocol.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index 55442df8fb97..0e5db0a634d3 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -3474,8 +3474,8 @@ static void mptcp_subflow_early_fallback(struct mptcp= _sock *msk, __mptcp_do_fallback(msk); } =20 -static int mptcp_stream_connect(struct socket *sock, struct sockaddr *uadd= r, - int addr_len, int flags) +int mptcp_stream_connect(struct socket *sock, struct sockaddr *uaddr, + int addr_len, int flags) { struct mptcp_sock *msk =3D mptcp_sk(sock->sk); struct mptcp_subflow_context *subflow; diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 1bc9f6e77ddd..1e21293bceaa 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -835,6 +835,7 @@ void mptcp_event(enum mptcp_event_type type, const stru= ct mptcp_sock *msk, void mptcp_event_addr_announced(const struct sock *ssk, const struct mptcp= _addr_info *info); void mptcp_event_addr_removed(const struct mptcp_sock *msk, u8 id); bool mptcp_userspace_pm_active(const struct mptcp_sock *msk); +int mptcp_stream_connect(struct socket *sock, struct sockaddr *uaddr, int = addr_len, int flags); =20 static inline bool mptcp_pm_should_add_signal(struct mptcp_sock *msk) { --=20 2.25.1 From nobody Thu Apr 25 11:22:30 2024 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:ab0:32da:0:0:0:0:0 with SMTP id f26csp607118uao; Sat, 17 Sep 2022 15:29:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6I6IZPCdXVhwVv8peqWedSX0fD35zsZPXt4Z08gW78vXmFRO+ckwLUBlXkLklYQySRDppq X-Received: by 2002:a0c:da14:0:b0:4aa:aad9:e450 with SMTP id x20-20020a0cda14000000b004aaaad9e450mr9744332qvj.130.1663453774989; Sat, 17 Sep 2022 15:29:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1663453774; cv=pass; d=google.com; s=arc-20160816; b=Aq7171mBTlDcg20eZ2WSXfed4je+bX6EVqupsg8nmYnY9rt3oVxPG8LjFhKo4p6hA/ x0Cug2JPVVqCSnwV2aDvGt7dSlvpIN4PWHDZyryDKk3/9DcAX0IDRjVdZypnc5uq6DVR vcxOHZ6V3NhljorX5QIoYs1l3KhwPZEY1lrICo/oxSnJdBRrySFlyEeMMGeld03Yj8rq iUVDN8yxtfQ4VycxQ+DB1aD4qGc8NjtzBnbWDsgjZCUWgP6WVwS9FLX+qTtS7ld8R3Zp xbxRAOwaM/xEsm6k+p8aF3HZZ6htuUZgebivisWQEwjKkrG7bgmbEMrHngPgdbq9wC9q MVyg== ARC-Message-Signature: i=2; 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:date :subject:message-id:cc:to:from:dkim-signature; bh=7IYuOTC/csJn4GK6bWNW85nwG5yGcE+PlbLHcHsmsH0=; b=RbZQVavH2Izwt8YK1eFegnJ0SHPywEYpMiiqO1Z7+Qz6Ik1Bpr3NVp6JnqjV1ga3mv SEF3bU2TIAoRXYQfFk7WfknHmte3IwNYSAOADpz0a+YyhTk1eqM8eHsJeQWSo5v+gKxV aDd6L72XgmA6k2osDuyqO+lvtO84uLcCJ18WBfD5b7lokhEOZgq9apBhrkm7BxvN2yJY Q3wABLTKkd2ue8/GUwc3IjGTQA7cwMStPR/F4QrGQ7kD24FlrMS8WZ3eossqsck2PDjb F3h6qkaKX3mZG2f52+tYaGbIHvKmbZYcA3fVZkWxHIKjHvUcNHdIc3ApFUd7ICQP+zC/ zXTg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@shytyi.net header.s=hs header.b=TbSkzJ5+; arc=pass (i=1 spf=pass spfdomain=shytyi.net dkim=pass dkdomain=shytyi.net dmarc=pass fromdomain=shytyi.net>); spf=pass (google.com: domain of mptcp+bounces-6295-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="mptcp+bounces-6295-wpasupplicant.patchew=gmail.com@lists.linux.dev" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id b5-20020ac87fc5000000b0035ce2ebc998si375451qtk.147.2022.09.17.15.29.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 17 Sep 2022 15:29:34 -0700 (PDT) Received-SPF: pass (google.com: domain of mptcp+bounces-6295-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@shytyi.net header.s=hs header.b=TbSkzJ5+; arc=pass (i=1 spf=pass spfdomain=shytyi.net dkim=pass dkdomain=shytyi.net dmarc=pass fromdomain=shytyi.net>); spf=pass (google.com: domain of mptcp+bounces-6295-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="mptcp+bounces-6295-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id C9D0D1C20971 for ; Sat, 17 Sep 2022 22:29:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E2AAE5C81; Sat, 17 Sep 2022 22:29:31 +0000 (UTC) X-Original-To: mptcp@lists.linux.dev Received: from sender11-of-o51.zoho.eu (sender11-of-o51.zoho.eu [31.186.226.237]) (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 E9BA35CA5 for ; Sat, 17 Sep 2022 22:29:29 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; t=1663453760; cv=none; d=zohomail.eu; s=zohoarc; b=itcpAeE80FIJYwj5SB/rpDIbzmDCUArKcdB8G8ueS07C7lBCwa1LAI2mCwlPxwUh2yhVCKHN/HH1QSByRvm19bvNxqGxmJ9G/CEHrrEZhEmbgJ3MTgZ4T2k5ao1URxNjF+VQYGQWp46hnuolaRUN0T3Q/LIdP0UWtAHahLkQZkc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1663453760; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=7IYuOTC/csJn4GK6bWNW85nwG5yGcE+PlbLHcHsmsH0=; b=a1wm9IlSysrnJOmgHrq1XthFkv4NhaiTa9NujOQtiGJp+oYL9ELF5/rzMduv2uepddhZibC5nF4waEToyfuMCx9Gj7PmBBkqE2WFPep0jFXnDXtOMf/tdmtM5v7sQCm4Q7igyz5gh7XMq81qCNMBmyMpz+xuhkOY4j9vVD9jyl8= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=shytyi.net; spf=pass smtp.mailfrom=dmytro@shytyi.net; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1663453760; s=hs; d=shytyi.net; i=dmytro@shytyi.net; h=From:From:To:To:Cc:Cc:Message-ID:Subject:Subject:Date:Date:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Content-Type:Message-Id:Reply-To; bh=7IYuOTC/csJn4GK6bWNW85nwG5yGcE+PlbLHcHsmsH0=; b=TbSkzJ5+5JKo8vm3sBgpg72u4GGHnMXzfBXt3gVh0yARm3O4FGz6+i1ZWaCotWVb c9kGBucCBx66oVa5Uv2IjJQFtMLdP5zaTpnHEHPbzg6bATd1u9AxNdVN6A8VuvNzurB C6STK2c+pSanlf4wUD4hn8t2CNDC4PHXURkhxHuI= Received: from doris.localdomain (243.34.22.93.rev.sfr.net [93.22.34.243]) by mx.zoho.eu with SMTPS id 1663453758103740.42406034695; Sun, 18 Sep 2022 00:29:18 +0200 (CEST) From: Dmytro Shytyi To: mptcp@lists.linux.dev Cc: Dmytro Shytyi Message-ID: <20220917222853.2406-4-dmytro@shytyi.net> Subject: [RFC PATCH mptcp-next v7 03/11] Initiator: MSG_FASTOPEN sendto(). request cookie Date: Sun, 18 Sep 2022 00:28:45 +0200 X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220917222853.2406-1-dmytro@shytyi.net> References: <20220917222853.2406-1-dmytro@shytyi.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 X-ZohoMailClient: External Content-Type: text/plain; charset="utf-8" Initiator: MSG_FASTOPEN in sendto triggers the mptcp_sendsmg_fastopen. It requests a MPTFO cookie. Suggestion @palbeni(JAN 17): 'split the patch in several small one'. Signed-off-by: Dmytro Shytyi --- net/mptcp/fastopen.c | 50 ++++++++++++++++++++++++++++++++++++++++++++ net/mptcp/protocol.c | 4 ++-- net/mptcp/protocol.h | 6 ++++++ 3 files changed, 58 insertions(+), 2 deletions(-) diff --git a/net/mptcp/fastopen.c b/net/mptcp/fastopen.c index 0c9ef6f5d528..9974508e0f4c 100644 --- a/net/mptcp/fastopen.c +++ b/net/mptcp/fastopen.c @@ -3,3 +3,53 @@ */ =20 #include "protocol.h" + +int mptcp_sendmsg_fastopen(struct sock *sk, struct msghdr *msg, + size_t len, struct mptcp_sock *msk, + size_t *copied) +{ + const struct iphdr *iph; + struct ubuf_info *uarg; + struct sockaddr *uaddr; + struct sk_buff *skb; + struct tcp_sock *tp; + struct socket *ssk; + int ret; + + ssk =3D __mptcp_nmpc_socket(msk); + if (unlikely(!ssk)) + goto out_EFAULT; + skb =3D tcp_stream_alloc_skb(ssk->sk, 0, ssk->sk->sk_allocation, true); + if (unlikely(!skb)) + goto out_EFAULT; + iph =3D ip_hdr(skb); + if (unlikely(!iph)) + goto out_EFAULT; + uarg =3D msg_zerocopy_realloc(sk, len, skb_zcopy(skb)); + if (unlikely(!uarg)) + goto out_EFAULT; + uaddr =3D msg->msg_name; + + tp =3D tcp_sk(ssk->sk); + if (unlikely(!tp)) + goto out_EFAULT; + if (!tp->fastopen_req) + tp->fastopen_req =3D kzalloc(sizeof(*tp->fastopen_req), + ssk->sk->sk_allocation); + + if (unlikely(!tp->fastopen_req)) + goto out_EFAULT; + tp->fastopen_req->data =3D msg; + tp->fastopen_req->size =3D len; + tp->fastopen_req->uarg =3D uarg; + + /* requests a cookie */ + ret =3D mptcp_stream_connect(sk->sk_socket, uaddr, + msg->msg_namelen, msg->msg_flags); + if (!ret) + *copied =3D len; + return ret; +out_EFAULT: + ret =3D -EFAULT; + return ret; +} diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index 0e5db0a634d3..af99a03021c9 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -1672,9 +1672,9 @@ static int mptcp_sendmsg(struct sock *sk, struct msgh= dr *msg, size_t len) int ret =3D 0; long timeo; =20 - /* we don't support FASTOPEN yet */ + /* we don't fully support FASTOPEN yet */ if (msg->msg_flags & MSG_FASTOPEN) - return -EOPNOTSUPP; + ret =3D mptcp_sendmsg_fastopen(sk, msg, len, msk, &copied); =20 /* silently ignore everything else */ msg->msg_flags &=3D MSG_MORE | MSG_DONTWAIT | MSG_NOSIGNAL; diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 1e21293bceaa..21f9bf6d2f7e 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -837,6 +837,12 @@ void mptcp_event_addr_removed(const struct mptcp_sock = *msk, u8 id); bool mptcp_userspace_pm_active(const struct mptcp_sock *msk); int mptcp_stream_connect(struct socket *sock, struct sockaddr *uaddr, int = addr_len, int flags); =20 +// Fast Open Mechanism functions begin +int mptcp_sendmsg_fastopen(struct sock *sk, struct msghdr *msg, + size_t len, struct mptcp_sock *msk, + size_t *copied); +// Fast Open Mechanism functions end + static inline bool mptcp_pm_should_add_signal(struct mptcp_sock *msk) { return READ_ONCE(msk->pm.addr_signal) & --=20 2.25.1 From nobody Thu Apr 25 11:22:30 2024 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:ab0:32da:0:0:0:0:0 with SMTP id f26csp607152uao; Sat, 17 Sep 2022 15:29:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7HMio1TQfJuSLlxGQ071SvWjXUi6/slGSmUt7/5FZznVbeeF6NvF2pp2QXlbJnzoQYZVNs X-Received: by 2002:a63:5658:0:b0:42a:1663:b965 with SMTP id g24-20020a635658000000b0042a1663b965mr9917710pgm.486.1663453779390; Sat, 17 Sep 2022 15:29:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1663453779; cv=pass; d=google.com; s=arc-20160816; b=rz9dlaHGdzM8h5IUjJWkVW0i2WYj6ZfldO8wXhjSJfTq1fcM5s2ANMlvLa75P/XsET 2kWx7jAtUScUT20IyoblhDfmHEuSpO7xEH39Wv4pk7EDVqtFMfNV2BGqyjvWEK5pZUZ/ 5zglR/zeb/lGqr7a33J02oTF3/a7JGUTmBI+3WVU0Th0X/vLRRB+nlcacz4gvceAwdOy MvRt1ACtf6XKLf0G6QrsqkMGcXB7ujuBUVZ+IDpygmVCF/O6+iLu6Fr9Qn7Za6yHw1Dw sfMHE88BTK6HXZBoMlxO+9Kxl//yKqd0R0FMOqP53jIgF845+UsnqTR9Utb+2ZotJ1M+ 2E7w== ARC-Message-Signature: i=2; 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:date :subject:message-id:cc:to:from:dkim-signature; bh=SC+suiNAZkW/fD2mjxJ+3iyyTMFO/a23DalUYjpKULA=; b=Dj+xvUFdFjOYHuIto2RBblMsOBxSDckkRpIlqmrbHNe7AGN/S5ax4k8CNyIrVZTNsW yegQqh7vwXODMOpo9D6x2uuejM9fuB08ZOIOOpolI+qj+gaabF5+7ZbUqt9FWUg3xVbB 8nMMTg/T0H3wuMiyzZZG/KRqwIy7f4BrkS9vhQQbv34pFU5SbtIwupp/8ZVZmdEBWwYz Miq/ITyjCcUZ0kS7sbJ0JkJNL9uVzVzZAgwhxcG4OrBJuJYYAQuYkW3rUdDvd8iHIwJc NB1NbwdebLoMZ6gPbMP2Y+r9NdwsePDz4nvRqcAkc/r2NKj3REQtc0djRtiUYJnVNmbz kigw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@shytyi.net header.s=hs header.b=eWjkYyl1; arc=pass (i=1 spf=pass spfdomain=shytyi.net dkim=pass dkdomain=shytyi.net dmarc=pass fromdomain=shytyi.net>); spf=pass (google.com: domain of mptcp+bounces-6299-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="mptcp+bounces-6299-wpasupplicant.patchew=gmail.com@lists.linux.dev" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id i3-20020a6551c3000000b0043a0510a992si707325pgq.270.2022.09.17.15.29.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 17 Sep 2022 15:29:39 -0700 (PDT) Received-SPF: pass (google.com: domain of mptcp+bounces-6299-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@shytyi.net header.s=hs header.b=eWjkYyl1; arc=pass (i=1 spf=pass spfdomain=shytyi.net dkim=pass dkdomain=shytyi.net dmarc=pass fromdomain=shytyi.net>); spf=pass (google.com: domain of mptcp+bounces-6299-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="mptcp+bounces-6299-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id DCF7E280C46 for ; Sat, 17 Sep 2022 22:29:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 06B785CA5; Sat, 17 Sep 2022 22:29:33 +0000 (UTC) X-Original-To: mptcp@lists.linux.dev Received: from sender11-of-o51.zoho.eu (sender11-of-o51.zoho.eu [31.186.226.237]) (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 912265CB2 for ; Sat, 17 Sep 2022 22:29:30 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; t=1663453761; cv=none; d=zohomail.eu; s=zohoarc; b=IDDxXAwVGGdxN9NJwP7NOzUXEal2xsEVcPEocS0XfPc2z8ip/DsTp9wVgfu3CeeYWp+WnN3bagkpdBchDojVrOJ6Gv25GGhB9ef55+mEdpnGRnitXm5I8b0pTYD+U584anFojSVYE7tohrtDaH+l7RGqGNqAkZIsyWYfRlA2Tho= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1663453761; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=SC+suiNAZkW/fD2mjxJ+3iyyTMFO/a23DalUYjpKULA=; b=PJ5PvnQLnNORd8wJmUwUmN4oKsUBgIRpv/ppManJNRjUPpi/WAPwwSa9zrTNKq+hGmYSiNAmNC2RzczIFOc6AZNeF53vWE9cKQGextJrNldB20tEBQPFDvwQwNOTLURiozsZrpUTO68r978u1Yk0pbEk0KxQ6KJ4YCyoJef/nLg= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=shytyi.net; spf=pass smtp.mailfrom=dmytro@shytyi.net; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1663453761; s=hs; d=shytyi.net; i=dmytro@shytyi.net; h=From:From:To:To:Cc:Cc:Message-ID:Subject:Subject:Date:Date:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Content-Type:Message-Id:Reply-To; bh=SC+suiNAZkW/fD2mjxJ+3iyyTMFO/a23DalUYjpKULA=; b=eWjkYyl128LMRimbRAKQURiMgC2+C+wmmQcMVXSdtwl1OiUFejlzcUzOyxEAPtim AOUCBEM5NS+9dUSAgZzQix+mtZj8LHb4JjB2rUWGzH7oCxOi4C7/w1MBFbVTYy2SRj7 KqgfpLqlprzkslpmYWSjcsiHQe53c3Uhp7Nc0pyI= Received: from doris.localdomain (243.34.22.93.rev.sfr.net [93.22.34.243]) by mx.zoho.eu with SMTPS id 1663453758328617.93880329637; Sun, 18 Sep 2022 00:29:18 +0200 (CEST) From: Dmytro Shytyi To: mptcp@lists.linux.dev Cc: Dmytro Shytyi Message-ID: <20220917222853.2406-5-dmytro@shytyi.net> Subject: [RFC PATCH mptcp-next v7 04/11] rfree(), rmem_uncharge() prototypes to protocol.h Date: Sun, 18 Sep 2022 00:28:46 +0200 X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220917222853.2406-1-dmytro@shytyi.net> References: <20220917222853.2406-1-dmytro@shytyi.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 X-ZohoMailClient: External Content-Type: text/plain; charset="utf-8" These 2 functions required the mptcp_fastopen_add_skb() that is not in protocol.c. Thus we export them to *.h and reuse in fastopen.c Signed-off-by: Dmytro Shytyi --- net/mptcp/protocol.c | 4 ++-- net/mptcp/protocol.h | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index af99a03021c9..357767a84c57 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -178,7 +178,7 @@ static void __mptcp_rmem_reclaim(struct sock *sk, int a= mount) __sk_mem_reduce_allocated(sk, amount); } =20 -static void mptcp_rmem_uncharge(struct sock *sk, int size) +void mptcp_rmem_uncharge(struct sock *sk, int size) { struct mptcp_sock *msk =3D mptcp_sk(sk); int reclaimable; @@ -191,7 +191,7 @@ static void mptcp_rmem_uncharge(struct sock *sk, int si= ze) __mptcp_rmem_reclaim(sk, reclaimable); } =20 -static void mptcp_rfree(struct sk_buff *skb) +void mptcp_rfree(struct sk_buff *skb) { unsigned int len =3D skb->truesize; struct sock *sk =3D skb->sk; diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 21f9bf6d2f7e..5cd14eacd1d6 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -836,6 +836,8 @@ void mptcp_event_addr_announced(const struct sock *ssk,= const struct mptcp_addr_ void mptcp_event_addr_removed(const struct mptcp_sock *msk, u8 id); bool mptcp_userspace_pm_active(const struct mptcp_sock *msk); int mptcp_stream_connect(struct socket *sock, struct sockaddr *uaddr, int = addr_len, int flags); +void mptcp_rmem_uncharge(struct sock *sk, int size); +void mptcp_rfree(struct sk_buff *skb); =20 // Fast Open Mechanism functions begin int mptcp_sendmsg_fastopen(struct sock *sk, struct msghdr *msg, --=20 2.25.1 From nobody Thu Apr 25 11:22:30 2024 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:ab0:32da:0:0:0:0:0 with SMTP id f26csp607174uao; Sat, 17 Sep 2022 15:29:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6ghTbWetLCJT+wH7BM3Lv+W5vscZiJTlasxu7v4Lo2RfrhqJALAE2gw1WHjMvh6f8Csham X-Received: by 2002:a05:620a:248e:b0:6ce:5f25:deb2 with SMTP id i14-20020a05620a248e00b006ce5f25deb2mr8824042qkn.750.1663453782711; Sat, 17 Sep 2022 15:29:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1663453782; cv=pass; d=google.com; s=arc-20160816; b=wIMXISRPoKbxK2oFmJrX9XnVQYN7AFWjFOcAa45G0DWzHmmAUwD1q+WoJUM7g/LPVG Iwcsv88zV2Mn0V7flS22QjyHJeSy6MY8IP6jzK1LtLq4IcGPejoRXA7SS6KiT6VmSjy4 ofBOcjtJcfmQlBwm2PDC6CM9naYdl7upjc2jJotCYYhodhEOpOqxwJpbnsWnMDZuPuRZ TBi71ynEtETfBExubd3glW+v3lT8IobNZ/9RIOt7Lk9mT8A+TWD/XprcWDOb8Vov/+4F ZJ0gJYBL/bfffgXo9oLDMqQatJvfsKkCc64lfFmpFEhPhh/j+HbD9YnBfYPg4RnZ+Fzz skEA== ARC-Message-Signature: i=2; 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:date :subject:message-id:cc:to:from:dkim-signature; bh=PdOfAx87hUidcxyexSbnMCRoaRxCRRCf+MrLYZHkhkQ=; b=ys52TRqicXwOWos8QeSvwUNiwNSkOeuLA16/UWlsNCjDrz9SY8NbcBtdOdUsqhwYPE 64Fe9d3Zp6zSLn+kUug93Egif8uf6Mj0GFJmmIn16rHavJeNgWjNPWB9gl9zIh6dirhy ZZDH4K4RQw1Um4JPE96H6MQUcHc5ghC9XWBTjl2EE5xyK0I7EWRsJayMZoMwHc4pDKzl 8I6jKKFFjYs+A77aDVI1QTMXLrshhKAQ5piJNeCnASBzxqhU2ENqIkeUhGDVuBYhVUbR gUmtE4IlmRPbr4h2l69sCMtg5r8OvEOjBDBjCfBzVI9IPCXAkn7ieAWEm7XY3IespgYW /0Sg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@shytyi.net header.s=hs header.b=TrugaokD; arc=pass (i=1 spf=pass spfdomain=shytyi.net dkim=pass dkdomain=shytyi.net dmarc=pass fromdomain=shytyi.net>); spf=pass (google.com: domain of mptcp+bounces-6302-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="mptcp+bounces-6302-wpasupplicant.patchew=gmail.com@lists.linux.dev" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id t3-20020ac87383000000b0031898a8698dsi6718702qtp.534.2022.09.17.15.29.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 17 Sep 2022 15:29:42 -0700 (PDT) Received-SPF: pass (google.com: domain of mptcp+bounces-6302-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@shytyi.net header.s=hs header.b=TrugaokD; arc=pass (i=1 spf=pass spfdomain=shytyi.net dkim=pass dkdomain=shytyi.net dmarc=pass fromdomain=shytyi.net>); spf=pass (google.com: domain of mptcp+bounces-6302-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="mptcp+bounces-6302-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 70C421C209BD for ; Sat, 17 Sep 2022 22:29:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 168105CA8; Sat, 17 Sep 2022 22:29:34 +0000 (UTC) X-Original-To: mptcp@lists.linux.dev Received: from sender11-of-o51.zoho.eu (sender11-of-o51.zoho.eu [31.186.226.237]) (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 852535CA6 for ; Sat, 17 Sep 2022 22:29:30 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; t=1663453760; cv=none; d=zohomail.eu; s=zohoarc; b=MybpxLPW3aruFCqgsWr4V8zozzFCZi9+8ikHKGv/4qOuTqd/x8tmlyI1X5KdD3crApG2i+vrl1vsmDy1IXV5jVEmtZJ00rhPTw04QbUSi+Pvq7U6p0+m5sA0q1TOr7Dmuu/gCfOKNL6IX3UlFICou4DqJXePhKbBoYqOKbsOue4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1663453760; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=PdOfAx87hUidcxyexSbnMCRoaRxCRRCf+MrLYZHkhkQ=; b=QkpqXl4NYfYVdKTjxX4e7dvZBIe3uIhF6B2lqA3V5HewOqRQSzVvuu6c4i+Bekv0yHHKvSC+4UuhfMiing8X5f5caR4iwMhdzfrTKffEWbetZWO2s9FH//azklUvh2Vol4x7OqGq+2I9+bTnrWwT258muqzwWz+Pewt1Nl1jJSU= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=shytyi.net; spf=pass smtp.mailfrom=dmytro@shytyi.net; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1663453760; s=hs; d=shytyi.net; i=dmytro@shytyi.net; h=From:From:To:To:Cc:Cc:Message-ID:Subject:Subject:Date:Date:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Content-Type:Message-Id:Reply-To; bh=PdOfAx87hUidcxyexSbnMCRoaRxCRRCf+MrLYZHkhkQ=; b=TrugaokDLbMM9E98JLViOqmXBy49GZp21ENWJe3q4X/DW8OD/DrnWrTaq4qEOzAD fZsdJ+YxstfYGU9BqrnqSgldNb/ckzl2LZVcZQqaywMg87vSJCdi/SdvCDap/hcOtuw ewJScKHrBh9mptgBpNhX/Pe01U8uY6xk2PzpK7Pc= Received: from doris.localdomain (243.34.22.93.rev.sfr.net [93.22.34.243]) by mx.zoho.eu with SMTPS id 1663453758548401.1813275717594; Sun, 18 Sep 2022 00:29:18 +0200 (CEST) From: Dmytro Shytyi To: mptcp@lists.linux.dev Cc: Dmytro Shytyi Message-ID: <20220917222853.2406-6-dmytro@shytyi.net> Subject: [RFC PATCH mptcp-next v7 05/11] Initiator: add locks() to mptcp_sendmsg_fastopen. Date: Sun, 18 Sep 2022 00:28:47 +0200 X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220917222853.2406-1-dmytro@shytyi.net> References: <20220917222853.2406-1-dmytro@shytyi.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 X-ZohoMailClient: External Content-Type: text/plain; charset="utf-8" Suggestion of @mmartineau : 'add locks' is implemented in this patch Signed-off-by: Dmytro Shytyi --- net/mptcp/fastopen.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/net/mptcp/fastopen.c b/net/mptcp/fastopen.c index 9974508e0f4c..50b5c3376672 100644 --- a/net/mptcp/fastopen.c +++ b/net/mptcp/fastopen.c @@ -16,6 +16,7 @@ int mptcp_sendmsg_fastopen(struct sock *sk, struct msghdr= *msg, struct socket *ssk; int ret; =20 + lock_sock((struct sock *)msk); ssk =3D __mptcp_nmpc_socket(msk); if (unlikely(!ssk)) goto out_EFAULT; @@ -30,26 +31,35 @@ int mptcp_sendmsg_fastopen(struct sock *sk, struct msgh= dr *msg, goto out_EFAULT; uaddr =3D msg->msg_name; =20 + lock_sock(ssk->sk); + tp =3D tcp_sk(ssk->sk); if (unlikely(!tp)) - goto out_EFAULT; + goto out_lock_EFAULT; if (!tp->fastopen_req) tp->fastopen_req =3D kzalloc(sizeof(*tp->fastopen_req), ssk->sk->sk_allocation); =20 if (unlikely(!tp->fastopen_req)) - goto out_EFAULT; + goto out_lock_EFAULT; tp->fastopen_req->data =3D msg; tp->fastopen_req->size =3D len; tp->fastopen_req->uarg =3D uarg; =20 + release_sock(ssk->sk); + release_sock((struct sock *)msk); + /* requests a cookie */ ret =3D mptcp_stream_connect(sk->sk_socket, uaddr, msg->msg_namelen, msg->msg_flags); if (!ret) *copied =3D len; return ret; + +out_lock_EFAULT: + release_sock(ssk->sk); out_EFAULT: + release_sock((struct sock *)msk); ret =3D -EFAULT; return ret; } --=20 2.25.1 From nobody Thu Apr 25 11:22:30 2024 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:ab0:32da:0:0:0:0:0 with SMTP id f26csp607183uao; Sat, 17 Sep 2022 15:29:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5jisdWWFSEsCK+E66DG/g6C+IeSVCvOUdbs9oEaak6cRK2sT1bCFrEWOdo+DGNqN0bgZah X-Received: by 2002:a63:1d1a:0:b0:433:f6ea:dce6 with SMTP id d26-20020a631d1a000000b00433f6eadce6mr9817092pgd.178.1663453783886; Sat, 17 Sep 2022 15:29:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1663453783; cv=pass; d=google.com; s=arc-20160816; b=DsbenSABbSoOhb1iauPGk0afzf2dmZljRyD0lK4WHpAEhImgkbaRPvUXLPgtShcuoA Y00pHlfLBYT9ew8PL+HmsURV1hBkB26r50wC3GWqNQiwn2ZDpVENsFqzZtWZhV6ffvq6 7J2bGt+MWb6VHq1gtm3nyUR1oa4lKsySbOhWaqSYyvQUGXxoOLsdndRt1Y7TCJAsCe9t E1isdvA2eTITYlRMT8AiteK4ufGTTU3azOE6j+j1pyHm8KU6ZH5Xn2ejaIP0qNO7fL2H jQ3C38zaMSbaFS5wCdWdJ44oN6C2ha7RDwILkNjDWJ7vjasKYf2PwEJOez2Ip3j6EhHe kdxg== ARC-Message-Signature: i=2; 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:date :subject:message-id:cc:to:from:dkim-signature; bh=VUQ2DrqX5H85H/h5p3TVuwYf0CORD1YLYTYfaKLasHw=; b=c9gjKbXRyNo6K4z7y8KzOqRAoJ59sNCg24t2DG3+npS4w9UyNEZQaEy7rGNxzG08nP X/ORV3EBqNgvJp2IMeDn9b+7XnOt18UFKvA4iBrncBDS3G7kFt/tTtrdRaq76ts+o1BE e3L+4xYC2hQAkZpE3ZBlZlGGpJePdP7+Gl1wx1EdluvOyR99ReTRcgVCdTQvkC4dTOl2 f83a2IMSzh03R/aH94gCSTBwb5kKBVKz76ExK4xG/gk4b+yOvNDJ2FoCIWV5nuBPpj6C PCsfBUX4vyuy4w+QbjCsnuH5hI98LF5H1UeJIEOqr17hdRKtULPipGMHFiydsl1kLbqP wnBg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@shytyi.net header.s=hs header.b=AOEtPJU6; arc=pass (i=1 spf=pass spfdomain=shytyi.net dkim=pass dkdomain=shytyi.net dmarc=pass fromdomain=shytyi.net>); spf=pass (google.com: domain of mptcp+bounces-6303-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="mptcp+bounces-6303-wpasupplicant.patchew=gmail.com@lists.linux.dev" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id q10-20020a63e94a000000b004359279de16si15330141pgj.648.2022.09.17.15.29.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 17 Sep 2022 15:29:43 -0700 (PDT) Received-SPF: pass (google.com: domain of mptcp+bounces-6303-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@shytyi.net header.s=hs header.b=AOEtPJU6; arc=pass (i=1 spf=pass spfdomain=shytyi.net dkim=pass dkdomain=shytyi.net dmarc=pass fromdomain=shytyi.net>); spf=pass (google.com: domain of mptcp+bounces-6303-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="mptcp+bounces-6303-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 59349280C6F for ; Sat, 17 Sep 2022 22:29:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3A5E05CA6; Sat, 17 Sep 2022 22:29:34 +0000 (UTC) X-Original-To: mptcp@lists.linux.dev Received: from sender11-of-o51.zoho.eu (sender11-of-o51.zoho.eu [31.186.226.237]) (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 E7B525CA4 for ; Sat, 17 Sep 2022 22:29:29 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; t=1663453761; cv=none; d=zohomail.eu; s=zohoarc; b=IKOipHfF/+bz6XTLwq+rr5gnYjgrL0MTtjhyA5XjAEBf32LWcyqs5swMEYg3CYv0denI1JlSgz0uq6moOiqjZ5uylX5vVA7ql8H24iwE54EkWEnVork2LUk1QPrgx80m/DvrVYoMjz/OacCoCY8lBR4ESDKwyMsmVFoTY/gU9eA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1663453761; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=VUQ2DrqX5H85H/h5p3TVuwYf0CORD1YLYTYfaKLasHw=; b=V+bon2RHZ9xokdm5JrwIW7/XxqdN5nWLY97zlFXsbH6TQoTm/NXhIoUxM4Adb+ccfh+wQJeC3QyGqH+MVeWUE+2QMsP4k0elmyt2bTImVgmcjBopPMM+GX6x4DWf5wsQ1p/UPIDInxO++TQ4QL+T/zPrxe+xcKB2//JZGQpm9dE= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=shytyi.net; spf=pass smtp.mailfrom=dmytro@shytyi.net; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1663453761; s=hs; d=shytyi.net; i=dmytro@shytyi.net; h=From:From:To:To:Cc:Cc:Message-ID:Subject:Subject:Date:Date:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Content-Type:Message-Id:Reply-To; bh=VUQ2DrqX5H85H/h5p3TVuwYf0CORD1YLYTYfaKLasHw=; b=AOEtPJU6Grsq50Cl7kTYEqTEX6HA5E6PaklXSnEJDk/W8KkyOEbb7IGpBlyttSpY cFs5y7xwYAr1nHU/fys6qMG9jeWjmasq2y+MVygxvim7j/vUjZN04zlvwnF67wK5aC1 7kRLLD/cWnmxaImnKVhK0NOq7E7qFUfenImm9+kc= Received: from doris.localdomain (243.34.22.93.rev.sfr.net [93.22.34.243]) by mx.zoho.eu with SMTPS id 1663453758759400.21130895780834; Sun, 18 Sep 2022 00:29:18 +0200 (CEST) From: Dmytro Shytyi To: mptcp@lists.linux.dev Cc: Dmytro Shytyi Message-ID: <20220917222853.2406-7-dmytro@shytyi.net> Subject: [RFC PATCH mptcp-next v7 06/11] add mptcp_setsockopt_fastopen Date: Sun, 18 Sep 2022 00:28:48 +0200 X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220917222853.2406-1-dmytro@shytyi.net> References: <20220917222853.2406-1-dmytro@shytyi.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 X-ZohoMailClient: External Content-Type: text/plain; charset="utf-8" Add set MPTFO socket option for MPTCP. Signed-off-by: Dmytro Shytyi --- net/mptcp/fastopen.c | 28 ++++++++++++++++++++++++++++ net/mptcp/protocol.h | 2 ++ net/mptcp/sockopt.c | 3 +++ 3 files changed, 33 insertions(+) diff --git a/net/mptcp/fastopen.c b/net/mptcp/fastopen.c index 50b5c3376672..436e773d798a 100644 --- a/net/mptcp/fastopen.c +++ b/net/mptcp/fastopen.c @@ -63,3 +63,31 @@ int mptcp_sendmsg_fastopen(struct sock *sk, struct msghd= r *msg, ret =3D -EFAULT; return ret; } + +int mptcp_setsockopt_sol_tcp_fastopen(struct mptcp_sock *msk, sockptr_t op= tval, + unsigned int optlen) +{ + struct sock *sk =3D (struct sock *)msk; + struct net *net =3D sock_net(sk); + int val; + int ret; + + ret =3D 0; + + if (copy_from_sockptr(&val, optval, sizeof(val))) + return -EFAULT; + + lock_sock(sk); + + if (val >=3D 0 && ((1 << sk->sk_state) & (TCPF_CLOSE | + TCPF_LISTEN))) { + tcp_fastopen_init_key_once(net); + fastopen_queue_tune(sk, val); + } else { + ret =3D -EINVAL; + } + + release_sock(sk); + + return ret; +} diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 5cd14eacd1d6..8caaeeedb9da 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -843,6 +843,8 @@ void mptcp_rfree(struct sk_buff *skb); int mptcp_sendmsg_fastopen(struct sock *sk, struct msghdr *msg, size_t len, struct mptcp_sock *msk, size_t *copied); +int mptcp_setsockopt_sol_tcp_fastopen(struct mptcp_sock *msk, sockptr_t op= tval, + unsigned int optlen); // Fast Open Mechanism functions end =20 static inline bool mptcp_pm_should_add_signal(struct mptcp_sock *msk) diff --git a/net/mptcp/sockopt.c b/net/mptcp/sockopt.c index 423d3826ca1e..f62f0d63b8e6 100644 --- a/net/mptcp/sockopt.c +++ b/net/mptcp/sockopt.c @@ -559,6 +559,7 @@ static bool mptcp_supported_sockopt(int level, int optn= ame) case TCP_NOTSENT_LOWAT: case TCP_TX_DELAY: case TCP_INQ: + case TCP_FASTOPEN: return true; } =20 @@ -796,6 +797,8 @@ static int mptcp_setsockopt_sol_tcp(struct mptcp_sock *= msk, int optname, return mptcp_setsockopt_sol_tcp_nodelay(msk, optval, optlen); case TCP_DEFER_ACCEPT: return mptcp_setsockopt_sol_tcp_defer(msk, optval, optlen); + case TCP_FASTOPEN: + return mptcp_setsockopt_sol_tcp_fastopen(msk, optval, optlen); } =20 return -EOPNOTSUPP; --=20 2.25.1 From nobody Thu Apr 25 11:22:30 2024 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:ab0:32da:0:0:0:0:0 with SMTP id f26csp607157uao; Sat, 17 Sep 2022 15:29:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5D17nVxiqdJv8lY4dAyxJbXxH6G5jx6f5J26Ga2+BCN3z6kXaWAOjQCR3jaHPlTie39mGz X-Received: by 2002:a05:6214:1cc9:b0:496:aa2c:c927 with SMTP id g9-20020a0562141cc900b00496aa2cc927mr8874960qvd.15.1663453780598; Sat, 17 Sep 2022 15:29:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1663453780; cv=pass; d=google.com; s=arc-20160816; b=GFSN/GMvpFOvGTb7wjG9hm/W117EMsXVKsPXvypKmj7nDewGGkUxsvr3ktciH7K8st TUs0Vm4OtslHLnyDIyNycq8l641+6hlYqr06Pqn/f2no5DulPOz3+i1RE1Gkpdo+ZyUs OtXrgSnuF6T9+N8jSrB5tELvbJxeWEP3Dj3iT4mSBlF4+hw3fGgkpDsQ9z9RF79ki8Ff HyxqfU3yFB4fv5w1ZSzko8GgFxfUgc39RFn1GUqB3vafRmdy4FUTnVb8WWnxsWi5VrBp CxdN6xJJcRap3tNiSciqa3AkrN59hmjcr7AzC+BJXqdaISsxGYxeP1jjgMn/jKz6V9Wy AuXw== ARC-Message-Signature: i=2; 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:date :subject:message-id:cc:to:from:dkim-signature; bh=bRLvB8X3nZZqZQeW0nlDsooMgFLChvaIezA0PVqeJdg=; b=Jdt1/6bltoos/zfaYQ8xF4SkQgH61RzH6ynmJ4m8FrsNN72iHR/u1EuPtdErKV3Q+l Ns0XW5s+Lknq3JA5Aq+urnL7pa0Ui7p7CpiGJxTATfVxvVVBdHESV7suP+Rl8nm48oqk iVLYu5X5kWUGqTCn4QPoa0ceaNnfqriXJMBVAf+4Ik/cYqgIS+BX/zr1Kc0nDvqxlfZt ZNVGTL3N3IGN664XkTt5UX4HWsiKpTGOQVvnkfnly2/6ArBd1yiyaaJFMPLFmDKXdztc UGFdlPsJXmykAANpoY3KIhO3f3QsAWj0jL7xxxr3ozwcHDtYNNS1VrV8WZQhuimXq/xu lXfg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@shytyi.net header.s=hs header.b=Pcv1rqGJ; arc=pass (i=1 spf=pass spfdomain=shytyi.net dkim=pass dkdomain=shytyi.net dmarc=pass fromdomain=shytyi.net>); spf=pass (google.com: domain of mptcp+bounces-6300-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="mptcp+bounces-6300-wpasupplicant.patchew=gmail.com@lists.linux.dev" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id c24-20020a05620a269800b006c095f4f235si8011084qkp.705.2022.09.17.15.29.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 17 Sep 2022 15:29:40 -0700 (PDT) Received-SPF: pass (google.com: domain of mptcp+bounces-6300-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@shytyi.net header.s=hs header.b=Pcv1rqGJ; arc=pass (i=1 spf=pass spfdomain=shytyi.net dkim=pass dkdomain=shytyi.net dmarc=pass fromdomain=shytyi.net>); spf=pass (google.com: domain of mptcp+bounces-6300-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="mptcp+bounces-6300-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 442001C209B3 for ; Sat, 17 Sep 2022 22:29:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1B0EC5CB2; Sat, 17 Sep 2022 22:29:33 +0000 (UTC) X-Original-To: mptcp@lists.linux.dev Received: from sender11-of-o51.zoho.eu (sender11-of-o51.zoho.eu [31.186.226.237]) (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 86E165CA8 for ; Sat, 17 Sep 2022 22:29:30 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; t=1663453761; cv=none; d=zohomail.eu; s=zohoarc; b=XjCR8AGSmRjgsmyBHuSU5bf9nMVVhIAbKIbI7iEq7qKTcU8cXKal0JNER5r0K2gi6uS4t7KbbBawhMF7fYX37aeJlF4A27tUOqk2iC/UIIjtNhEinokXj6zUt/6a+Cm+uQHtdPXuv+Hjp8fE++8wfoBoiDdENjLwbwGONj9KLN4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1663453761; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=bRLvB8X3nZZqZQeW0nlDsooMgFLChvaIezA0PVqeJdg=; b=ZKxMetxICSIW9tdCuWTboiMJDajulcwyKJKNyCtL4KzYgyXgjd0bwFd1mvRvo4XsnEw9eTpyYJAZoOatDTJgIV4KUGcihofuClAOTjeP6fLoxM2MHc7cCRz5QPBdGlpK1MTwOBaHof85UFhjyz1NoQ8AF8y1apKUkudKod+mqlo= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=shytyi.net; spf=pass smtp.mailfrom=dmytro@shytyi.net; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1663453761; s=hs; d=shytyi.net; i=dmytro@shytyi.net; h=From:From:To:To:Cc:Cc:Message-ID:Subject:Subject:Date:Date:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Content-Type:Message-Id:Reply-To; bh=bRLvB8X3nZZqZQeW0nlDsooMgFLChvaIezA0PVqeJdg=; b=Pcv1rqGJOKzGa0Rl9JriXuGQL9RElqjJjKBGnv92JNfIez5gB9r8068iIZuufn5B 1ioYBw++p1MhupmqHebDOqDhp7r1bA16BY3VHWtgAa6km334sMtq1+4/grHcHJu5Ybj DOrGyaJ7kzpUfY64vbH5Atn3eEyXbMYQ0Ei05QF0= Received: from doris.localdomain (243.34.22.93.rev.sfr.net [93.22.34.243]) by mx.zoho.eu with SMTPS id 1663453758974307.86487598948486; Sun, 18 Sep 2022 00:29:18 +0200 (CEST) From: Dmytro Shytyi To: mptcp@lists.linux.dev Cc: Dmytro Shytyi Message-ID: <20220917222853.2406-8-dmytro@shytyi.net> Subject: [RFC PATCH mptcp-next v7 07/11] mptfo variables for msk, options. Fix loop retrans Date: Sun, 18 Sep 2022 00:28:49 +0200 X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220917222853.2406-1-dmytro@shytyi.net> References: <20220917222853.2406-1-dmytro@shytyi.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 X-ZohoMailClient: External Content-Type: text/plain; charset="utf-8" Introduce mptfo variables for msk and options. Also fixe the infinite retransmissions in the end of second session. Suggestion @palbeni (SEP 1) during the meting to 'look at ack' Signed-off-by: Dmytro Shytyi --- net/mptcp/fastopen.c | 16 ++++++++++++++++ net/mptcp/options.c | 3 +++ net/mptcp/protocol.h | 6 +++++- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/net/mptcp/fastopen.c b/net/mptcp/fastopen.c index 436e773d798a..149a4b1d3dac 100644 --- a/net/mptcp/fastopen.c +++ b/net/mptcp/fastopen.c @@ -91,3 +91,19 @@ int mptcp_setsockopt_sol_tcp_fastopen(struct mptcp_sock = *msk, sockptr_t optval, =20 return ret; } + +void mptcp_treat_hshake_ack_fastopen(struct mptcp_sock *msk, struct mptcp_= subflow_context *subflow, + struct mptcp_options_received mp_opt) +{ + u64 ack_seq; + + if (mp_opt.suboptions & OPTIONS_MPTCP_MPC && mp_opt.is_mptfo && msk->is_m= ptfo) { + msk->can_ack =3D true; + msk->remote_key =3D mp_opt.sndr_key; + mptcp_crypto_key_sha(msk->remote_key, NULL, &ack_seq); + ack_seq++; + WRITE_ONCE(msk->ack_seq, ack_seq); + pr_debug("ack_seq=3D%llu sndr_key=3D%llu", msk->ack_seq, mp_opt.sndr_key= ); + atomic64_set(&msk->rcv_wnd_sent, ack_seq); + } +} diff --git a/net/mptcp/options.c b/net/mptcp/options.c index 30d289044e71..185b069e57f4 100644 --- a/net/mptcp/options.c +++ b/net/mptcp/options.c @@ -91,6 +91,7 @@ static void mptcp_parse_option(const struct sk_buff *skb, ptr +=3D 8; } if (opsize >=3D TCPOLEN_MPTCP_MPC_ACK) { + mp_opt->is_mptfo =3D 1; mp_opt->rcvr_key =3D get_unaligned_be64(ptr); ptr +=3D 8; } @@ -1124,6 +1125,8 @@ bool mptcp_incoming_options(struct sock *sk, struct s= k_buff *skb) return sk->sk_state !=3D TCP_CLOSE; =20 if (unlikely(mp_opt.suboptions !=3D OPTION_MPTCP_DSS)) { + mptcp_treat_hshake_ack_fastopen(msk, subflow, mp_opt); + if ((mp_opt.suboptions & OPTION_MPTCP_FASTCLOSE) && msk->local_key =3D=3D mp_opt.rcvr_key) { WRITE_ONCE(msk->rcv_fastclose, true); diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 8caaeeedb9da..b90279c734ae 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -155,7 +155,8 @@ struct mptcp_options_received { echo:1, backup:1, deny_join_id0:1, - __unused:2; + is_mptfo:1, + __unused:1; u8 join_id; u64 thmac; u8 hmac[MPTCPOPT_HMAC_LEN]; @@ -282,6 +283,7 @@ struct mptcp_sock { bool use_64bit_ack; /* Set when we received a 64-bit DSN */ bool csum_enabled; bool allow_infinite_fallback; + bool is_mptfo; u8 mpc_endpoint_id; u8 recvmsg_inq:1, cork:1, @@ -845,6 +847,8 @@ int mptcp_sendmsg_fastopen(struct sock *sk, struct msgh= dr *msg, size_t *copied); int mptcp_setsockopt_sol_tcp_fastopen(struct mptcp_sock *msk, sockptr_t op= tval, unsigned int optlen); +void mptcp_treat_hshake_ack_fastopen(struct mptcp_sock *msk, struct mptcp_= subflow_context *subflow, + struct mptcp_options_received mp_opt); // Fast Open Mechanism functions end =20 static inline bool mptcp_pm_should_add_signal(struct mptcp_sock *msk) --=20 2.25.1 From nobody Thu Apr 25 11:22:30 2024 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:ab0:32da:0:0:0:0:0 with SMTP id f26csp607136uao; Sat, 17 Sep 2022 15:29:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4ZvEIaUP7OhpPU3KvtO4ggPb75zJxIIUzjU43g+imczg/Bfie/oBShlvBmvgV2dWiOJsXv X-Received: by 2002:a05:620a:c50:b0:6b9:6e6:428d with SMTP id u16-20020a05620a0c5000b006b906e6428dmr8411187qki.280.1663453777308; Sat, 17 Sep 2022 15:29:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1663453777; cv=pass; d=google.com; s=arc-20160816; b=BKMPC5xC7dZwGL6UrOHVloF9Bq+Dbrwg1jVIt42Gb4B/sVOPfJ1AkUZFcjOLGGzGKU pMQTRNXjIqzelHL4XHPB3AJYyNjw0bEhRKfRTcd4mlnOq+NJLR3a+W2GGQcFLfDbp95j rWNdISOdGu9MOS0aGcFRwuQLwZgvHD4h6I98GoZ8aUBt5S8HWUBitTaZTFtyEaUrJ/H6 5hxs2LVP1icFi8aEH+0iK12cPnEA7NNOCymZFc/mQRE8ACmyxZpwZ8ktStsaDlfYDxE5 Yf43N29A8MvVrUqeGVUfwxIy6mL6akSCFdB3KUVV83kJHxdnMZZTlPDVkX9YS5JFgMgz iOrA== ARC-Message-Signature: i=2; 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:date :subject:message-id:cc:to:from:dkim-signature; bh=+8imo3OCRmqKISgsXkqfhzJBUDKk85uQ/XsmLjuFMtA=; b=giHu2IAc6Ia9qe4Qr/GrKyXPzI5JvVOLxJSuSup79m/1ChWJZ34v6UsztnOJNvEBVM hcmnlBCEXDchOs8dmgJjZfLWVxrYFcKjry28Wlb3Y8S42hqpcyrn/W8nLjOhVTgPRcCx Z53M7ICIVBxEPJbsUnXurcEhpI+Dtwuqfk58NXh4l/R6R95vxSyyE9Xxc9awwXuz3p84 paFJSSsI4s9X4nCbFab/wkQP++BQ/WqYFmAVZJmrDqcR9riF01C7ccmOPYtOM4OoGzGT kVQsqK/PkAGfwB495Uwlj3IDc6N/FFO5syk6nY+M5A63dLW2rNCzWpLw83jQwqksWL4p NAsw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@shytyi.net header.s=hs header.b=Uyp8WXlT; arc=pass (i=1 spf=pass spfdomain=shytyi.net dkim=pass dkdomain=shytyi.net dmarc=pass fromdomain=shytyi.net>); spf=pass (google.com: domain of mptcp+bounces-6297-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="mptcp+bounces-6297-wpasupplicant.patchew=gmail.com@lists.linux.dev" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id j8-20020a05620a288800b006b8ef971f17si7594741qkp.420.2022.09.17.15.29.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 17 Sep 2022 15:29:37 -0700 (PDT) Received-SPF: pass (google.com: domain of mptcp+bounces-6297-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@shytyi.net header.s=hs header.b=Uyp8WXlT; arc=pass (i=1 spf=pass spfdomain=shytyi.net dkim=pass dkdomain=shytyi.net dmarc=pass fromdomain=shytyi.net>); spf=pass (google.com: domain of mptcp+bounces-6297-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="mptcp+bounces-6297-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id F0EB41C209B6 for ; Sat, 17 Sep 2022 22:29:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D00B45C9B; Sat, 17 Sep 2022 22:29:32 +0000 (UTC) X-Original-To: mptcp@lists.linux.dev Received: from sender11-of-o51.zoho.eu (sender11-of-o51.zoho.eu [31.186.226.237]) (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 E44665C80 for ; Sat, 17 Sep 2022 22:29:29 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; t=1663453761; cv=none; d=zohomail.eu; s=zohoarc; b=YUN9suur0TtQ/dETTl80ZqWRvd9uDlzYVD6Gtk1pvvZPRcFVk/NhDj518T4rPVyIVKlRS5yMgwwO6mOa0Gp7DloBvK7czT93bhvnWVZRLMaB57t5T0F6VvrmsKDpT2+5HAtP/E7Wn/8gh6Dt2P6znIIgYP1utWyA5PtJBuHXZh0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1663453761; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=+8imo3OCRmqKISgsXkqfhzJBUDKk85uQ/XsmLjuFMtA=; b=gYOJgm7xmnSf5Btvhw89IkY40ZuFq5zlH/kh//9WtUvyIyPRWgqm9nkaQpPtIV3bBt5I5wJ5qjTESZyLo7QPc1S61DwOZH1q91kVs2z7h6tl2fpmnUWQZFr38H0s1IrlhFd7pM0HzQ/PEUEELumKYmv9PfJ9bHfD7IEsoizhrxc= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=shytyi.net; spf=pass smtp.mailfrom=dmytro@shytyi.net; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1663453761; s=hs; d=shytyi.net; i=dmytro@shytyi.net; h=From:From:To:To:Cc:Cc:Message-ID:Subject:Subject:Date:Date:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Content-Type:Message-Id:Reply-To; bh=+8imo3OCRmqKISgsXkqfhzJBUDKk85uQ/XsmLjuFMtA=; b=Uyp8WXlTCtE93TIb6ILWlHuQR2z3u/QADTb2REs4/TNK+5IyB6M1THBQC0dUlyeW wsqTfFCdEX/TM4LmlSy89bnSy9Yb2aU9YokRaNfzvfxenSlALFjOmtRpKnWOF4qc61J 86sTKubwGkdRVRdskh5w13VKhugP/i9skEHwUqoY= Received: from doris.localdomain (243.34.22.93.rev.sfr.net [93.22.34.243]) by mx.zoho.eu with SMTPS id 1663453759189384.00449923472763; Sun, 18 Sep 2022 00:29:19 +0200 (CEST) From: Dmytro Shytyi To: mptcp@lists.linux.dev Cc: Dmytro Shytyi Message-ID: <20220917222853.2406-9-dmytro@shytyi.net> Subject: [RFC PATCH mptcp-next v7 08/11] Fix unxpctd val of subflow->map_seq(dscrd packet) Date: Sun, 18 Sep 2022 00:28:50 +0200 X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220917222853.2406-1-dmytro@shytyi.net> References: <20220917222853.2406-1-dmytro@shytyi.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 X-ZohoMailClient: External Content-Type: text/plain; charset="utf-8" Fix unexpected value of subflow->map_seq (discarded and after retransmitted 2nd packet) Signed-off-by: Dmytro Shytyi --- net/mptcp/subflow.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c index c7d49fb6e7bd..075c61d1d37f 100644 --- a/net/mptcp/subflow.c +++ b/net/mptcp/subflow.c @@ -1077,8 +1077,10 @@ static enum mapping_status get_mapping_status(struct= sock *ssk, /* will validate the next map after consuming the current one */ goto validate_csum; } - - subflow->map_seq =3D map_seq; + if (msk->is_mptfo) + subflow->map_seq =3D READ_ONCE(msk->ack_seq); + else + subflow->map_seq =3D map_seq; subflow->map_subflow_seq =3D mpext->subflow_seq; subflow->map_data_len =3D data_len; subflow->map_valid =3D 1; --=20 2.25.1 From nobody Thu Apr 25 11:22:30 2024 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:ab0:32da:0:0:0:0:0 with SMTP id f26csp607145uao; Sat, 17 Sep 2022 15:29:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7ORCba95QJ1EEkgUrHCQawQ1jRW4bTnlZqD9oh1nzNkV9Pl/Kaf8GsddZhQ1i7O1jtsCrA X-Received: by 2002:a17:90b:254a:b0:200:53f:891d with SMTP id nw10-20020a17090b254a00b00200053f891dmr12397340pjb.168.1663453778471; Sat, 17 Sep 2022 15:29:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1663453778; cv=pass; d=google.com; s=arc-20160816; b=JmipBANTLpEUXs3raVUXa6yYdaCQ4x9Ryg8py2Tk2KgGJRZaiXI+TLZZaEX/co3oLi mfgmVb1ZZWHosHK+DORSa7obTM77RfLRKRzjFSYiKxkMmoYn9iBOXa8s1Mk/NGAo3GMG 7o9BGTEs2cd6snnj2zQzHecdqKa9c4/VrvTAavZIulGUY+u7RFs4zCesmcMKVSR//tbI jjlIvAxXPkLwBguQA4pNiMGZze0P8E3JKoxQDoQbRlS+lrE9UlxalsD8esajRDdqfJ6z kdGKf+scwglRRR9EGG2aHLAHPSo9DIlU0C0mH0o2Z39oRpuZdvicKPmgSrSuR4cPLUhT Ks3Q== ARC-Message-Signature: i=2; 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:date :subject:message-id:cc:to:from:dkim-signature; bh=ppfFb8p/8O9dbAZabMWGp/OiVD2Ku9RlmzYx+I9f110=; b=dc8KTqUiUuxk75wkTwlaQo0bg2b46QfW4bPdFURJ+M2+dd9dwHLcpV9+QXwn+TdKRG qoQ9OvvaevSZeVH5nm9ayrl18NutI5BXWi1UfOo7J5vO8vEfSx4RNFm0eLpe8e1ErYuE ztDGfWkwHYl8VVyFn8L14xl8nhrCdrcoWgwSkrdiffWnlgX8dP72IMOze/vuqAGRxvBq Xe61u8UQfTc1YlYqz2ip92rGo8an5+L+BtFPE5TADUqFnBhlSXdsedoyJGwouZ7y056J sp40uyt6o67hD8OXuqqR2ftub4FyAqnIJd77e2uEb8rXWm8k1FlTs6rFi3lKo9X+ny0W UpoQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@shytyi.net header.s=hs header.b=XF9dbnuo; arc=pass (i=1 spf=pass spfdomain=shytyi.net dkim=pass dkdomain=shytyi.net dmarc=pass fromdomain=shytyi.net>); spf=pass (google.com: domain of mptcp+bounces-6298-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="mptcp+bounces-6298-wpasupplicant.patchew=gmail.com@lists.linux.dev" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id r200-20020a632bd1000000b0043932315880si17146297pgr.323.2022.09.17.15.29.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 17 Sep 2022 15:29:38 -0700 (PDT) Received-SPF: pass (google.com: domain of mptcp+bounces-6298-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@shytyi.net header.s=hs header.b=XF9dbnuo; arc=pass (i=1 spf=pass spfdomain=shytyi.net dkim=pass dkdomain=shytyi.net dmarc=pass fromdomain=shytyi.net>); spf=pass (google.com: domain of mptcp+bounces-6298-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="mptcp+bounces-6298-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id C1ECC280C50 for ; Sat, 17 Sep 2022 22:29:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EA1835C80; Sat, 17 Sep 2022 22:29:32 +0000 (UTC) X-Original-To: mptcp@lists.linux.dev Received: from sender11-of-o51.zoho.eu (sender11-of-o51.zoho.eu [31.186.226.237]) (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 935445CB5 for ; Sat, 17 Sep 2022 22:29:30 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; t=1663453760; cv=none; d=zohomail.eu; s=zohoarc; b=CZbisGLQBClTomdOl37s56gmZbkxyiZpFqwtbX+M4Fey0XMtcGBpVPcclK4vjw5En190EROafTGvAdIOmpXkjcJlcc2ADL5Vh55nE6RtnaOV0YsWM1ixVg3tN2tmEu/6D1Zx2aEVa182dbl3kBk4y/zc+3Ea3UzrICjyZmqtFrI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1663453760; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=ppfFb8p/8O9dbAZabMWGp/OiVD2Ku9RlmzYx+I9f110=; b=cB1swd5bisr0VwVkPHEpYuIWczSTv9EpPyWXSB1angyNSgPtnWSBVgPDuSNZs8ohh6xf/jAj0bz21RaQJmZDxqjmdxnI3pBAEo5ncA1VfgoX0xVk3YcZ1+QuJWXKPsyogdIFBtQ3Ku+xJq0jvCUeABRkjn84K9SzFvlB0xvOdtM= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=shytyi.net; spf=pass smtp.mailfrom=dmytro@shytyi.net; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1663453760; s=hs; d=shytyi.net; i=dmytro@shytyi.net; h=From:From:To:To:Cc:Cc:Message-ID:Subject:Subject:Date:Date:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Content-Type:Message-Id:Reply-To; bh=ppfFb8p/8O9dbAZabMWGp/OiVD2Ku9RlmzYx+I9f110=; b=XF9dbnuob+5MUtt2tRLp/x16KlHSgBgqQmT92Sxuclc+9DuqOr/bRqY3IivMxrWA OG0dA2pVJ7N5tJpoGZY0VRzNMPqU5G7mg2WMrn+8dtmZutN2A0VeTs5BhmwLlsqllLk WeO5oTvp4HGqlH8TKEn0TsMazOa6xhoyebDPbLB8= Received: from doris.localdomain (243.34.22.93.rev.sfr.net [93.22.34.243]) by mx.zoho.eu with SMTPS id 1663453759426593.4557057376785; Sun, 18 Sep 2022 00:29:19 +0200 (CEST) From: Dmytro Shytyi To: mptcp@lists.linux.dev Cc: Dmytro Shytyi Message-ID: <20220917222853.2406-10-dmytro@shytyi.net> Subject: [RFC PATCH mptcp-next v7 09/11] Listener: Add received skb to msk Date: Sun, 18 Sep 2022 00:28:51 +0200 X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220917222853.2406-1-dmytro@shytyi.net> References: <20220917222853.2406-1-dmytro@shytyi.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 X-ZohoMailClient: External Content-Type: text/plain; charset="utf-8" Add the received skb on the listener side to msk and set flag mptfo to 1 to treat some parts only in MPTFO case. This function is called from the functions presented in the one of the patch of this serie (mptcp_add_skb helpers). Signed-off-by: Dmytro Shytyi --- net/mptcp/fastopen.c | 59 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/net/mptcp/fastopen.c b/net/mptcp/fastopen.c index 149a4b1d3dac..1b9caf56e02f 100644 --- a/net/mptcp/fastopen.c +++ b/net/mptcp/fastopen.c @@ -107,3 +107,62 @@ void mptcp_treat_hshake_ack_fastopen(struct mptcp_sock= *msk, struct mptcp_subflo atomic64_set(&msk->rcv_wnd_sent, ack_seq); } } + +void mptcp_fastopen_add_skb(struct sock *sk, struct sk_buff *skb, struct r= equest_sock *req) +{ + struct mptcp_subflow_context *subflow =3D mptcp_subflow_ctx(sk); + struct tcp_request_sock *tcp_r_sock =3D tcp_rsk(req); + struct sock *socket =3D mptcp_subflow_ctx(sk)->conn; + struct mptcp_sock *msk =3D mptcp_sk(socket); + struct tcp_sock *tp =3D tcp_sk(sk); + + if (TCP_SKB_CB(skb)->end_seq =3D=3D tp->rcv_nxt) + return; + + skb =3D skb_clone(skb, GFP_ATOMIC); + if (!skb) + return; + + skb_dst_drop(skb); + + tp->segs_in =3D 0; + tcp_segs_in(tp, skb); + __skb_pull(skb, tcp_hdrlen(skb)); + sk_forced_mem_schedule(sk, skb->truesize); + + TCP_SKB_CB(skb)->seq++; + TCP_SKB_CB(skb)->tcp_flags &=3D ~TCPHDR_SYN; + + tp->rcv_nxt =3D TCP_SKB_CB(skb)->end_seq; + + msk->is_mptfo =3D 1; + + //Solves: WARNING: at 704 _mptcp_move_skbs_from_subflow+0x5d0/0x651 + tp->copied_seq +=3D tp->rcv_nxt - tcp_r_sock->rcv_isn - 1; + + subflow->map_seq =3D mptcp_subflow_get_mapped_dsn(subflow); + + //Solves: BAD mapping: ssn=3D0 map_seq=3D1 map_data_len=3D3 + subflow->ssn_offset =3D tp->copied_seq - 1; + + skb_ext_reset(skb); + + //mptcp_set_owner_r begin + skb_orphan(skb); + skb->sk =3D socket; + skb->destructor =3D mptcp_rfree; + atomic_add(skb->truesize, &socket->sk_rmem_alloc); + msk->rmem_fwd_alloc -=3D skb->truesize; + //mptcp_set owner_r end + + __skb_queue_tail(&msk->receive_queue, skb); + + atomic64_set(&msk->rcv_wnd_sent, mptcp_subflow_get_mapped_dsn(subflow)); + + tp->syn_data_acked =3D 1; + + tp->bytes_received =3D skb->len; + + if (TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN) + tcp_fin(sk); +} --=20 2.25.1 From nobody Thu Apr 25 11:22:30 2024 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:ab0:32da:0:0:0:0:0 with SMTP id f26csp607166uao; Sat, 17 Sep 2022 15:29:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM49oa15lG+DSU3r6gSYFB8eUS6Bocik2MLqzT3GdQh7qETntptLalA/BcrUwOyQDexkttb1 X-Received: by 2002:a05:6214:769:b0:4ac:a40a:a5d7 with SMTP id f9-20020a056214076900b004aca40aa5d7mr9506631qvz.39.1663453781732; Sat, 17 Sep 2022 15:29:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1663453781; cv=pass; d=google.com; s=arc-20160816; b=K2GrZ3UdEdHv1DUupYj5YVcGfya3aJecYUE6zML+dRS3f5ooCOv9G7IXvDLlo8twdl lF6h9Vl+Bj4depNq/hI8/wBV59LqaIT2EXfw9oKnlhoNmpIGlh16TeoIUITbght6VqDN bBBGPDrg7kbMayBc3Nwp7yKrpOADuc2DY2VS/a1y6WSTAeQ4qdccXjkk8IwWrUDUS/8N T8x/v8Kgf6bZujYCOETfyOSmWZSS8Mmrt+AnWXvqFJIGlduKfi2ZNdnhHLPAez5JobAx pPTRakM7HRlzimKONCsRHiijsg4quhrmrKAh/XJXym8ncR2To+C2bvSp1fk4Mr+5UF4o ayFw== ARC-Message-Signature: i=2; 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:date :subject:message-id:cc:to:from:dkim-signature; bh=CjnHzb19W1HTiaiy3mDtVHHyf8GTgmbek5aJWS5nu7s=; b=SqS+ff1R1FMCsSOEO7nFTspzHuczb5X1yfs8dQ6SHSbrejQAa/xPtBIKRdmSfi9SGN Jm24NhSmURzbFBk3nP9XpwSVOdS0TULpd81YLHmhCmH7hZ+UMKQkNK19lBe91IRwvmbc Hht/HRgDJhCaOqmFVZreRQXFGi8oHdjx4+S7WlkfUx/4zN/tHs5xOhOTSO3oWAEuBMcp 2ZmEMMVMGcisq3tngrhZc8IC74XqdivTsFeRvQVuptMBts/XnN/P1p7BdulbLBJsR+2+ 2ckjAxhV7e2XLHzZxptlE0hD6pT3WMQi0SRxLAG8mCV/m1yTmfdSIkzijTLkURYK7I/Z r68Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@shytyi.net header.s=hs header.b=NGBBkFjG; arc=pass (i=1 spf=pass spfdomain=shytyi.net dkim=pass dkdomain=shytyi.net dmarc=pass fromdomain=shytyi.net>); spf=pass (google.com: domain of mptcp+bounces-6301-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="mptcp+bounces-6301-wpasupplicant.patchew=gmail.com@lists.linux.dev" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id l18-20020ae9f012000000b006bbe6e893cesi6341940qkg.143.2022.09.17.15.29.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 17 Sep 2022 15:29:41 -0700 (PDT) Received-SPF: pass (google.com: domain of mptcp+bounces-6301-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@shytyi.net header.s=hs header.b=NGBBkFjG; arc=pass (i=1 spf=pass spfdomain=shytyi.net dkim=pass dkdomain=shytyi.net dmarc=pass fromdomain=shytyi.net>); spf=pass (google.com: domain of mptcp+bounces-6301-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="mptcp+bounces-6301-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 71EFB1C209BB for ; Sat, 17 Sep 2022 22:29:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 775F75CA2; Sat, 17 Sep 2022 22:29:33 +0000 (UTC) X-Original-To: mptcp@lists.linux.dev Received: from sender11-of-o51.zoho.eu (sender11-of-o51.zoho.eu [31.186.226.237]) (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 B50805CB8 for ; Sat, 17 Sep 2022 22:29:30 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; t=1663453761; cv=none; d=zohomail.eu; s=zohoarc; b=Kc+ddRLyJ6Vy7jPDpjCeSgcAxY4fmbtSGRyDimgVu3k7fiZ4wWK83Yy7mnhAgdCDoTf4of7JpwRxTTTbBwnvgRXot/NOUfjxcBAHJvsrI4c2u5K1oNGSGHgJ+WOxp/1rp5uN0ZbC5G3r0k508l5fCe7WeypuEpmQsBruatdeTC8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1663453761; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=CjnHzb19W1HTiaiy3mDtVHHyf8GTgmbek5aJWS5nu7s=; b=lXprRpUO0j18v9qEuGMsGELwGUVx82gqTS5RyDBrVNuwggoMbVAzZHPCrruZ+z0gNVtR/6GnlbuTjdpIwk/9TloOg/t7MDcNEFdd3hPbI5GAmWZHkZOxKsJUGlZlHyR1pKZ0HBl7pFtR0Dm1OS1f6MUqkdndYvxLeWE0NdoEzmc= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=shytyi.net; spf=pass smtp.mailfrom=dmytro@shytyi.net; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1663453761; s=hs; d=shytyi.net; i=dmytro@shytyi.net; h=From:From:To:To:Cc:Cc:Message-ID:Subject:Subject:Date:Date:In-Reply-To:References:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To; bh=CjnHzb19W1HTiaiy3mDtVHHyf8GTgmbek5aJWS5nu7s=; b=NGBBkFjG8oGUGzJrNTMvrU8Oehrqv4Ryke0AbutmD3ELhv3l+n9wu0R7VJW7SN0D Xlprrvqc15BP6S3gxtUE7EBlTpXIPqomHdY7uOCvu4g1Ds0mxNAR7lmMLDuiNWYoNLm fORILZbiVgdBBpiNgneF5RtA1/NY2n1iZoxNDpe8= Received: from doris.localdomain (243.34.22.93.rev.sfr.net [93.22.34.243]) by mx.zoho.eu with SMTPS id 166345375965291.97026866699537; Sun, 18 Sep 2022 00:29:19 +0200 (CEST) From: Dmytro Shytyi To: mptcp@lists.linux.dev Cc: Dmytro Shytyi Message-ID: <20220917222853.2406-11-dmytro@shytyi.net> Subject: [RFC PATCH mptcp-next v7 10/11] mptcp_fastopen_add_skb() helpers (skb to msk) Date: Sun, 18 Sep 2022 00:28:52 +0200 X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220917222853.2406-1-dmytro@shytyi.net> References: <20220917222853.2406-1-dmytro@shytyi.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 X-ZohoMailClient: External Content-Type: text/plain; charset="utf-8" Set of helpers for mptcp_skb_add(). Some functions are inspired from tcp fastopen.c file. This chain helps to add =E2=80=9Cskb=E2=80=9D to=20 =E2=80=9C&msk->sk_receive_queue=E2=80=9D Example: =E2=80=9Csubflow_v4_conn_request=E2=80=9D->=E2=80=9Dmptcp_conn_req= uest=E2=80=9D-> =E2=80=9Dmptcp_try_fastopen=E2=80=9D->=E2=80=9Dmptcp_fastopen_create_child= =E2=80=9D-> =E2=80=9Dmptcp_fastopen_add_skb=E2=80=9D Signed-off-by: Dmytro Shytyi --- include/net/tcp.h | 27 +++++++ net/ipv4/tcp_fastopen.c | 38 +++++----- net/ipv4/tcp_input.c | 20 ++--- net/mptcp/fastopen.c | 163 ++++++++++++++++++++++++++++++++++++++++ net/mptcp/protocol.h | 39 ++++++++++ net/mptcp/subflow.c | 2 +- 6 files changed, 261 insertions(+), 28 deletions(-) diff --git a/include/net/tcp.h b/include/net/tcp.h index 735e957f7f4b..dc072d120f32 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -1729,6 +1729,33 @@ int tcp_md5_hash_key(struct tcp_md5sig_pool *hp, const struct tcp_md5sig_key *key); =20 /* From tcp_fastopen.c */ +struct sock *tcp_fastopen_create_child(struct sock *sk, + struct sk_buff *skb, + struct request_sock *req); +bool tcp_fastopen_queue_check(struct sock *sk); +int tcp_fastopen_get_cipher(struct net *net, struct inet_connection_sock *= icsk, + u64 *key); +void tcp_fastopen_cookie_gen(struct sock *sk, + struct request_sock *req, + struct sk_buff *syn, + struct tcp_fastopen_cookie *foc); +int tcp_fastopen_cookie_gen_check(struct sock *sk, + struct request_sock *req, + struct sk_buff *syn, + struct tcp_fastopen_cookie *orig, + struct tcp_fastopen_cookie *valid_foc); +bool tcp_fastopen_no_cookie(const struct sock *sk, + const struct dst_entry *dst, + int flag); +void tcp_reqsk_record_syn(const struct sock *sk, + struct request_sock *req, + const struct sk_buff *skb); +void tcp_ecn_create_request(struct request_sock *req, + const struct sk_buff *skb, + const struct sock *listen_sk, + const struct dst_entry *dst); +void tcp_openreq_init(struct request_sock *req, + const struct tcp_options_received *rx_opt, + struct sk_buff *skb, const struct sock *sk); void tcp_fastopen_cache_get(struct sock *sk, u16 *mss, struct tcp_fastopen_cookie *cookie); void tcp_fastopen_cache_set(struct sock *sk, u16 mss, diff --git a/net/ipv4/tcp_fastopen.c b/net/ipv4/tcp_fastopen.c index 45cc7f1ca296..0963d7cbc8df 100644 --- a/net/ipv4/tcp_fastopen.c +++ b/net/ipv4/tcp_fastopen.c @@ -3,6 +3,7 @@ #include #include #include +#include "../mptcp/protocol.h" =20 void tcp_fastopen_init_key_once(struct net *net) { @@ -149,10 +150,10 @@ static bool __tcp_fastopen_cookie_gen_cipher(struct r= equest_sock *req, /* Generate the fastopen cookie by applying SipHash to both the source and * destination addresses. */ -static void tcp_fastopen_cookie_gen(struct sock *sk, - struct request_sock *req, - struct sk_buff *syn, - struct tcp_fastopen_cookie *foc) +void tcp_fastopen_cookie_gen(struct sock *sk, + struct request_sock *req, + struct sk_buff *syn, + struct tcp_fastopen_cookie *foc) { struct tcp_fastopen_context *ctx; =20 @@ -207,11 +208,11 @@ void tcp_fastopen_add_skb(struct sock *sk, struct sk_= buff *skb) } =20 /* returns 0 - no key match, 1 for primary, 2 for backup */ -static int tcp_fastopen_cookie_gen_check(struct sock *sk, - struct request_sock *req, - struct sk_buff *syn, - struct tcp_fastopen_cookie *orig, - struct tcp_fastopen_cookie *valid_foc) +int tcp_fastopen_cookie_gen_check(struct sock *sk, + struct request_sock *req, + struct sk_buff *syn, + struct tcp_fastopen_cookie *orig, + struct tcp_fastopen_cookie *valid_foc) { struct tcp_fastopen_cookie search_foc =3D { .len =3D -1 }; struct tcp_fastopen_cookie *foc =3D valid_foc; @@ -235,9 +236,9 @@ static int tcp_fastopen_cookie_gen_check(struct sock *s= k, return ret; } =20 -static struct sock *tcp_fastopen_create_child(struct sock *sk, - struct sk_buff *skb, - struct request_sock *req) +struct sock *tcp_fastopen_create_child(struct sock *sk, + struct sk_buff *skb, + struct request_sock *req) { struct tcp_sock *tp; struct request_sock_queue *queue =3D &inet_csk(sk)->icsk_accept_queue; @@ -283,7 +284,10 @@ static struct sock *tcp_fastopen_create_child(struct s= ock *sk, =20 tp->rcv_nxt =3D TCP_SKB_CB(skb)->seq + 1; =20 - tcp_fastopen_add_skb(child, skb); + if (sk_is_mptcp(sk)) + mptcp_fastopen_add_skb(child, skb, req); + else + tcp_fastopen_add_skb(child, skb); =20 tcp_rsk(req)->rcv_nxt =3D tp->rcv_nxt; tp->rcv_wup =3D tp->rcv_nxt; @@ -293,7 +297,7 @@ static struct sock *tcp_fastopen_create_child(struct so= ck *sk, return child; } =20 -static bool tcp_fastopen_queue_check(struct sock *sk) +bool tcp_fastopen_queue_check(struct sock *sk) { struct fastopen_queue *fastopenq; =20 @@ -329,9 +333,9 @@ static bool tcp_fastopen_queue_check(struct sock *sk) return true; } =20 -static bool tcp_fastopen_no_cookie(const struct sock *sk, - const struct dst_entry *dst, - int flag) +bool tcp_fastopen_no_cookie(const struct sock *sk, + const struct dst_entry *dst, + int flag) { return (READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_fastopen) & flag) || tcp_sk(sk)->fastopen_no_cookie || diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index bc2ea12221f9..c82b3d0a801a 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -6730,10 +6730,10 @@ static inline void pr_drop_req(struct request_sock = *req, __u16 port, int family) * RFC8311 =C2=A74.3 which updates RFC3168 to allow the development of such * extensions. */ -static void tcp_ecn_create_request(struct request_sock *req, - const struct sk_buff *skb, - const struct sock *listen_sk, - const struct dst_entry *dst) +void tcp_ecn_create_request(struct request_sock *req, + const struct sk_buff *skb, + const struct sock *listen_sk, + const struct dst_entry *dst) { const struct tcphdr *th =3D tcp_hdr(skb); const struct net *net =3D sock_net(listen_sk); @@ -6754,9 +6754,9 @@ static void tcp_ecn_create_request(struct request_soc= k *req, inet_rsk(req)->ecn_ok =3D 1; } =20 -static void tcp_openreq_init(struct request_sock *req, - const struct tcp_options_received *rx_opt, - struct sk_buff *skb, const struct sock *sk) +void tcp_openreq_init(struct request_sock *req, + const struct tcp_options_received *rx_opt, + struct sk_buff *skb, const struct sock *sk) { struct inet_request_sock *ireq =3D inet_rsk(req); =20 @@ -6837,9 +6837,9 @@ static bool tcp_syn_flood_action(const struct sock *s= k, const char *proto) return want_cookie; } =20 -static void tcp_reqsk_record_syn(const struct sock *sk, - struct request_sock *req, - const struct sk_buff *skb) +void tcp_reqsk_record_syn(const struct sock *sk, + struct request_sock *req, + const struct sk_buff *skb) { if (tcp_sk(sk)->save_syn) { u32 len =3D skb_network_header_len(skb) + tcp_hdrlen(skb); diff --git a/net/mptcp/fastopen.c b/net/mptcp/fastopen.c index 1b9caf56e02f..b7c1c4523c10 100644 --- a/net/mptcp/fastopen.c +++ b/net/mptcp/fastopen.c @@ -166,3 +166,166 @@ void mptcp_fastopen_add_skb(struct sock *sk, struct s= k_buff *skb, struct request if (TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN) tcp_fin(sk); } + +struct sock *mptcp_try_fastopen(struct sock *sk, struct sk_buff *skb, + struct request_sock *req, + struct tcp_fastopen_cookie *foc, + const struct dst_entry *dst) +{ + bool syn_data_status =3D TCP_SKB_CB(skb)->end_seq !=3D TCP_SKB_CB(skb)->s= eq + 1; + struct tcp_fastopen_cookie valid_mptcp_foc =3D { .len =3D -1 }; + struct sock *child_sock; + int ret =3D 0; + + if ((syn_data_status || foc->len >=3D 0) && + tcp_fastopen_queue_check(sk)) { + foc->len =3D -1; + return NULL; + } + + if (tcp_fastopen_no_cookie(sk, dst, TFO_SERVER_COOKIE_NOT_REQD)) + goto fastopen; + + if (foc->len =3D=3D 0) { + tcp_fastopen_cookie_gen(sk, req, skb, &valid_mptcp_foc); + } else if (foc->len > 0) { + ret =3D tcp_fastopen_cookie_gen_check(sk, req, skb, foc, + &valid_mptcp_foc); + if (ret) { +fastopen: + child_sock =3D tcp_fastopen_create_child(sk, skb, req); + if (child_sock) { + if (ret =3D=3D 2) { + valid_mptcp_foc.exp =3D foc->exp; + *foc =3D valid_mptcp_foc; + } else { + foc->len =3D -1; + } + return child_sock; + } + } + } + valid_mptcp_foc.exp =3D foc->exp; + *foc =3D valid_mptcp_foc; + return NULL; +} + +int mptcp_conn_request(struct request_sock_ops *rsk_ops, + const struct tcp_request_sock_ops *af_ops, + struct sock *sk, struct sk_buff *skb) +{ + struct tcp_fastopen_cookie mptcp_foc =3D { .len =3D -1 }; + struct tcp_options_received tmp_opt_rcvd; + __u32 isn =3D TCP_SKB_CB(skb)->tcp_tw_isn; + struct tcp_sock *tp_sock =3D tcp_sk(sk); + struct sock *mptcp_fo_sk =3D NULL; + struct net *net =3D sock_net(sk); + struct request_sock *req_sock; + bool want_cookie =3D false; + struct dst_entry *dst; + struct flowi fl; + + if (sk_acceptq_is_full(sk)) + goto drop; + + req_sock =3D inet_reqsk_alloc(rsk_ops, sk, !want_cookie); + if (!req_sock) + goto drop; + + req_sock->syncookie =3D want_cookie; + tcp_rsk(req_sock)->af_specific =3D af_ops; + tcp_rsk(req_sock)->ts_off =3D 1; + tcp_rsk(req_sock)->is_mptcp =3D 1; + + tcp_clear_options(&tmp_opt_rcvd); + tmp_opt_rcvd.mss_clamp =3D af_ops->mss_clamp; + tmp_opt_rcvd.user_mss =3D tp_sock->rx_opt.user_mss; + tcp_parse_options(sock_net(sk), skb, &tmp_opt_rcvd, 0, + want_cookie ? NULL : &mptcp_foc); + + if (want_cookie && !tmp_opt_rcvd.saw_tstamp) + tcp_clear_options(&tmp_opt_rcvd); + + if (IS_ENABLED(CONFIG_SMC) && want_cookie) + tmp_opt_rcvd.smc_ok =3D 0; + + tmp_opt_rcvd.tstamp_ok =3D 0; + tcp_openreq_init(req_sock, &tmp_opt_rcvd, skb, sk); + inet_rsk(req_sock)->no_srccheck =3D inet_sk(sk)->transparent; + + inet_rsk(req_sock)->ir_iif =3D inet_request_bound_dev_if(sk, skb); + + dst =3D af_ops->route_req(sk, skb, &fl, req_sock); + if (!dst) + goto drop_and_free; + + if (tmp_opt_rcvd.tstamp_ok) + tcp_rsk(req_sock)->ts_off =3D af_ops->init_ts_off(net, skb); + + if (!want_cookie && !isn) { + if (!net->ipv4.sysctl_tcp_syncookies && + (net->ipv4.sysctl_max_syn_backlog - inet_csk_reqsk_queue_len(sk) < + (net->ipv4.sysctl_max_syn_backlog >> 2)) && + !tcp_peer_is_proven(req_sock, dst)) { + goto drop_and_release; + } + + isn =3D af_ops->init_seq(skb); + } + + tcp_ecn_create_request(req_sock, skb, sk, dst); + + if (want_cookie) { + isn =3D cookie_init_sequence(af_ops, sk, skb, &req_sock->mss); + if (!tmp_opt_rcvd.tstamp_ok) + inet_rsk(req_sock)->ecn_ok =3D 0; + } + + tcp_rsk(req_sock)->snt_isn =3D isn; + tcp_rsk(req_sock)->txhash =3D net_tx_rndhash(); + tcp_rsk(req_sock)->syn_tos =3D TCP_SKB_CB(skb)->ip_dsfield; + + tcp_openreq_init_rwin(req_sock, sk, dst); + sk_rx_queue_set(req_to_sk(req_sock), skb); + if (!want_cookie) { + tcp_reqsk_record_syn(sk, req_sock, skb); + mptcp_fo_sk =3D mptcp_try_fastopen(sk, skb, req_sock, &mptcp_foc, dst); + } + if (mptcp_fo_sk) { + af_ops->send_synack(mptcp_fo_sk, dst, &fl, req_sock, + &mptcp_foc, TCP_SYNACK_FASTOPEN, skb); + if (!inet_csk_reqsk_queue_add(sk, req_sock, mptcp_fo_sk)) { + reqsk_fastopen_remove(mptcp_fo_sk, req_sock, false); + bh_unlock_sock(mptcp_fo_sk); + sock_put(mptcp_fo_sk); + goto drop_and_free; + } + sk->sk_data_ready(sk); + bh_unlock_sock(mptcp_fo_sk); + sock_put(mptcp_fo_sk); + } else { + tcp_rsk(req_sock)->tfo_listener =3D false; + if (!want_cookie) { + req_sock->timeout =3D tcp_timeout_init((struct sock *)req_sock); + inet_csk_reqsk_queue_hash_add(sk, req_sock, req_sock->timeout); + } + af_ops->send_synack(sk, dst, &fl, req_sock, &mptcp_foc, + !want_cookie ? TCP_SYNACK_NORMAL : + TCP_SYNACK_COOKIE, + skb); + if (want_cookie) { + reqsk_free(req_sock); + return 0; + } + } + reqsk_put(req_sock); + return 0; + +drop_and_release: + dst_release(dst); +drop_and_free: + __reqsk_free(req_sock); +drop: + tcp_listendrop(sk); + return 0; +} diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index b90279c734ae..8d894a2d06b3 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -849,6 +849,45 @@ int mptcp_setsockopt_sol_tcp_fastopen(struct mptcp_soc= k *msk, sockptr_t optval, unsigned int optlen); void mptcp_treat_hshake_ack_fastopen(struct mptcp_sock *msk, struct mptcp_= subflow_context *subflow, struct mptcp_options_received mp_opt); +void mptcp_fastopen_add_skb(struct sock *sk, struct sk_buff *skb, + struct request_sock *req); +void mptcp_reqsk_record_syn(const struct sock *sk, + struct request_sock *req, + const struct sk_buff *skb); +void mptcp_ecn_create_request(struct request_sock *req, + const struct sk_buff *skb, + const struct sock *listen_sk, + const struct dst_entry *dst); +void mptcp_openreq_init(struct request_sock *req, + const struct tcp_options_received *rx_opt, + struct sk_buff *skb, const struct sock *sk); +struct sock *mptcp_fastopen_create_child(struct sock *sk, + struct sk_buff *skb, + struct request_sock *req); +bool mptcp_fastopen_queue_check(struct sock *sk); +bool mptcp_fastopen_cookie_gen_cipher(struct request_sock *req, + struct sk_buff *syn, + const siphash_key_t *key, + struct tcp_fastopen_cookie *foc); +void mptcp_fastopen_cookie_gen(struct sock *sk, + struct request_sock *req, + struct sk_buff *syn, + struct tcp_fastopen_cookie *foc); +int mptcp_fastopen_cookie_gen_check(struct sock *sk, + struct request_sock *req, + struct sk_buff *syn, + struct tcp_fastopen_cookie *orig, + struct tcp_fastopen_cookie *valid_foc); +bool mptcp_fastopen_no_cookie(const struct sock *sk, + const struct dst_entry *dst, + int flag); +struct sock *mptcp_try_fastopen(struct sock *sk, struct sk_buff *skb, + struct request_sock *req, + struct tcp_fastopen_cookie *foc, + const struct dst_entry *dst); +int mptcp_conn_request(struct request_sock_ops *rsk_ops, + const struct tcp_request_sock_ops *af_ops, + struct sock *sk, struct sk_buff *skb); // Fast Open Mechanism functions end =20 static inline bool mptcp_pm_should_add_signal(struct mptcp_sock *msk) diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c index 075c61d1d37f..ff5fe4ff3d21 100644 --- a/net/mptcp/subflow.c +++ b/net/mptcp/subflow.c @@ -542,7 +542,7 @@ static int subflow_v4_conn_request(struct sock *sk, str= uct sk_buff *skb) if (skb_rtable(skb)->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST)) goto drop; =20 - return tcp_conn_request(&mptcp_subflow_request_sock_ops, + return mptcp_conn_request(&mptcp_subflow_request_sock_ops, &subflow_request_sock_ipv4_ops, sk, skb); drop: --=20 2.25.1 From nobody Thu Apr 25 11:22:30 2024 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:ab0:32da:0:0:0:0:0 with SMTP id f26csp607130uao; Sat, 17 Sep 2022 15:29:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5lD2tJSJ5q3vVPYJzldlIZsY20OWigC/WMmblGH4thd6kjeQU/wkyaxhVyahUKHLLN5udd X-Received: by 2002:a17:90b:38c5:b0:202:98df:208c with SMTP id nn5-20020a17090b38c500b0020298df208cmr22990971pjb.129.1663453776513; Sat, 17 Sep 2022 15:29:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1663453776; cv=pass; d=google.com; s=arc-20160816; b=OYHN7AFx7vPtl2ENcPw2qyjtcWU9CkYZ0TACVKHmeZKE85W3tL9R/4YrLoXqC4ic/F tnMeCxymI+ww1CPQj07X6ILu5P9V7aG8sG//nmnpADa1JRK02B2IvhWgthy4w3S5sc1D qlddtj9OMcVohZOUXSTP/hgS+8Pu4M1FNHeQ8ndte05FvzKjUs1/aNvrEZAe0H+nBWW4 uiG5JMeaFRdw6otNwLiA16cor1Ohcca3FxVOPhQnv3JWyePuUPiL6YJILTwR5FaU3in4 Ew8VVObv13btUJG55bL18dtaF3jCcZqasuPO2Wc/HqXmkJfS0gh8pyhowM/J9L6iPQf9 +wHg== ARC-Message-Signature: i=2; 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:date :subject:message-id:cc:to:from:dkim-signature; bh=A374qcFGZnxbZk1AlL4TUHso2FHnehXtgKDlDMolsaI=; b=T+WEuHLhrvsVzplZRlEdfwpiKEotdjLt4UcndpI+XMl5uj2vEUba6mzf24d2Ptm3UE 5KB+j9qU9rSywkRCQ7bcWVUqoGtZMmK6QfAf6xtP8Lfu2QeYDmyUMmJsl/AeRGbY/HOX IK1Z3/L/6GuLu+5ea3Gv7NFJ13twLIzRoSgJRe3wT8n5hM9XFs0yH2/ssRKeZp+SXO6h pCoLl+IkrKhwEsBD2p429Zk3p8gRYj3AoprO3EE6gJ/iC73Eme8TKKH2ti+werL5NSp8 VKbU0t2RoXFEF2WVTPwuDUETCjPbr29/OaOWpD5FxxZ4LtgQ6l1AWK5QgeXnJ68xB0iF ru2w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@shytyi.net header.s=hs header.b=HuwFjOkL; arc=pass (i=1 spf=pass spfdomain=shytyi.net dkim=pass dkdomain=shytyi.net dmarc=pass fromdomain=shytyi.net>); spf=pass (google.com: domain of mptcp+bounces-6296-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="mptcp+bounces-6296-wpasupplicant.patchew=gmail.com@lists.linux.dev" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id j64-20020a638b43000000b0042b23090b1csi26144775pge.197.2022.09.17.15.29.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 17 Sep 2022 15:29:36 -0700 (PDT) Received-SPF: pass (google.com: domain of mptcp+bounces-6296-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@shytyi.net header.s=hs header.b=HuwFjOkL; arc=pass (i=1 spf=pass spfdomain=shytyi.net dkim=pass dkdomain=shytyi.net dmarc=pass fromdomain=shytyi.net>); spf=pass (google.com: domain of mptcp+bounces-6296-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="mptcp+bounces-6296-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id A9639280CBF for ; Sat, 17 Sep 2022 22:29:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 189F85C87; Sat, 17 Sep 2022 22:29:32 +0000 (UTC) X-Original-To: mptcp@lists.linux.dev Received: from sender11-of-o51.zoho.eu (sender11-of-o51.zoho.eu [31.186.226.237]) (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 C6AAE5C9B for ; Sat, 17 Sep 2022 22:29:29 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; t=1663453760; cv=none; d=zohomail.eu; s=zohoarc; b=CePXCIQVytVmQ9eqP9twB2xSWprKwawPnRsMUIstQZcqfGnU9fsxxPR5mBff4FAtzWUFnkosklr6Q9CeU+AEFQwcnKD3+/NTR7npD+uCcwYoF07YFZ+hmIaoiAwErj/g+yij2KM5rIdRwr5+ECdsxOM+XDsGTnhqRXDjkEKdUZc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1663453760; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=A374qcFGZnxbZk1AlL4TUHso2FHnehXtgKDlDMolsaI=; b=afuJAOk17ts56C30UhdyKplV1JrPWiyun2BRK13cYrXqFypiY8GDpRubFN3SFGjw9wUDILuf2T6ydP96OmNjMj+jiJH2KE2tHMa8IlCAOji9kK2RNmRviVKC4gscbiYDmcj7oK4XcYYuWD882MH+QTjHhEPBmW5M8+n92XPho+A= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=shytyi.net; spf=pass smtp.mailfrom=dmytro@shytyi.net; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1663453760; s=hs; d=shytyi.net; i=dmytro@shytyi.net; h=From:From:To:To:Cc:Cc:Message-ID:Subject:Subject:Date:Date:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Content-Type:Message-Id:Reply-To; bh=A374qcFGZnxbZk1AlL4TUHso2FHnehXtgKDlDMolsaI=; b=HuwFjOkL44m4Rm/pQsyzeM6/J8RV4tVPJrvZssuKmlxATV3JXqeEXa+WNz1WqcE0 rPY4qECgFfKkAtguKaFYmOLYStUsnWHiy5+b5sO7RlCWyS8F8HOQaCUoxQ/p7qtL+I/ joccEinO0ovFmmWfcXDkdon6H40fNYvYb3mgrNlI= Received: from doris.localdomain (243.34.22.93.rev.sfr.net [93.22.34.243]) by mx.zoho.eu with SMTPS id 1663453759878256.3947009535458; Sun, 18 Sep 2022 00:29:19 +0200 (CEST) From: Dmytro Shytyi To: mptcp@lists.linux.dev Cc: Dmytro Shytyi Message-ID: <20220917222853.2406-12-dmytro@shytyi.net> Subject: [RFC PATCH mptcp-next v7 11/11] selftests: mptfo initiator/listener Date: Sun, 18 Sep 2022 00:28:53 +0200 X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220917222853.2406-1-dmytro@shytyi.net> References: <20220917222853.2406-1-dmytro@shytyi.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 X-ZohoMailClient: External Content-Type: text/plain; charset="utf-8" MPTFO tests: these are examples of initiator (sendto) and listener, probably are going to be integrated to the mptcp_connect.* selftests Signed-off-by: Dmytro Shytyi --- tools/testing/selftests/net/mptcp/mptfo.sh | 13 +++ .../selftests/net/mptcp/mptfo_initiator.c | 41 ++++++++ .../selftests/net/mptcp/mptfo_listener.c | 98 +++++++++++++++++++ 3 files changed, 152 insertions(+) create mode 100644 tools/testing/selftests/net/mptcp/mptfo.sh create mode 100644 tools/testing/selftests/net/mptcp/mptfo_initiator.c create mode 100644 tools/testing/selftests/net/mptcp/mptfo_listener.c diff --git a/tools/testing/selftests/net/mptcp/mptfo.sh b/tools/testing/sel= ftests/net/mptcp/mptfo.sh new file mode 100644 index 000000000000..9ed0cb281094 --- /dev/null +++ b/tools/testing/selftests/net/mptcp/mptfo.sh @@ -0,0 +1,13 @@ +#!/bin/bash +#This is an example of environmen that was used to generate wireshark +sudo ip netns add server +sudo ip netns add client +sudo ip link add veth0 type veth peer name veth1 +sudo ip link set veth1 netns server +sudo ip link set veth0 netns client +sudo ip netns exec client ip a a 10.10.0.1/24 dev veth0 +sudo ip netns exec server ip a a 10.10.0.2/24 dev veth1 +sudo ip netns exec client ip link set dev veth0 up +sudo ip netns exec server ip link set dev veth1 up +sudo ip netns exec server bash -c "echo 2 > /proc/sys/net/ipv4/tcp_fastope= n" +sudo ip netns exec client bash -c "echo 1 > /proc/sys/net/ipv4/tcp_fastope= n" diff --git a/tools/testing/selftests/net/mptcp/mptfo_initiator.c b/tools/te= sting/selftests/net/mptcp/mptfo_initiator.c new file mode 100644 index 000000000000..e23b88693fb0 --- /dev/null +++ b/tools/testing/selftests/net/mptcp/mptfo_initiator.c @@ -0,0 +1,41 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define SERVER_PORT 7003 + +int main(int argc, char *argv[]) +{ + unsigned char valsyn[3] =3D "abc"; + struct sockaddr_in daddr; + char *valend =3D "fff"; + char *val1 =3D "zz1"; + char *val2 =3D "zz2"; + char *val3 =3D "zz3"; + int sock_fd =3D -1; + int ret; + + memset(&daddr, 0, sizeof(daddr)); + inet_pton(AF_INET, "10.10.0.2", &daddr.sin_addr); + daddr.sin_family =3D AF_INET; + daddr.sin_port =3D htons(SERVER_PORT); + + sock_fd =3D socket(AF_INET, SOCK_STREAM, IPPROTO_MPTCP); + + ret =3D sendto(sock_fd, valsyn, 3, MSG_FASTOPEN, (struct sockaddr *) &dad= dr, sizeof(daddr)); + ret =3D write(sock_fd, val1, 3); + ret =3D write(sock_fd, val2, 3); + ret =3D write(sock_fd, val2, 3); + ret =3D write(sock_fd, val2, 3); + ret =3D write(sock_fd, val3, 3); + ret =3D write(sock_fd, valend, 3); + + close(sock_fd); + return EXIT_SUCCESS; +} diff --git a/tools/testing/selftests/net/mptcp/mptfo_listener.c b/tools/tes= ting/selftests/net/mptcp/mptfo_listener.c new file mode 100644 index 000000000000..7e3de8d1d08c --- /dev/null +++ b/tools/testing/selftests/net/mptcp/mptfo_listener.c @@ -0,0 +1,98 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define CLIENT_QUEUE_LEN 10 +#define SERVER_PORT 7003 + +int main(void) +{ + int listen_sock_fd =3D -1, client_sock_fd =3D -1; + char str_addr[INET6_ADDRSTRLEN]; + struct sockaddr_in server_addr; + int ret, flag; + int qlen =3D 5; + char ch; + + server_addr.sin_family =3D AF_INET; + inet_pton(AF_INET, "10.10.0.2", &server_addr.sin_addr); + server_addr.sin_port =3D htons(SERVER_PORT); + + /* Create socket for listening (client requests) */ + listen_sock_fd =3D socket(AF_INET, SOCK_STREAM, IPPROTO_MPTCP); + if (listen_sock_fd =3D=3D -1) { + perror("socket()server"); + return EXIT_FAILURE; + } + + /* Set socket to reuse address */ + flag =3D 1; + ret =3D setsockopt(listen_sock_fd, SOL_SOCKET, SO_REUSEADDR, &flag, sizeo= f(flag)); + if (ret =3D=3D -1) { + perror("setsockopt()"); + return EXIT_FAILURE; + } + + ret =3D setsockopt(listen_sock_fd, SOL_TCP, TCP_FASTOPEN, &qlen, sizeof(q= len)); + if (ret =3D=3D -1) { + perror("setsockopt()TCP_FASTOPEN"); + return EXIT_FAILURE; + } + + /* Bind address and socket together */ + ret =3D bind(listen_sock_fd, (struct sockaddr *)&server_addr, sizeof(serv= er_addr)); + if (ret =3D=3D -1) { + perror("bind()"); + close(listen_sock_fd); + return EXIT_FAILURE; + } + + /* Create listening queue (client requests) */ + ret =3D listen(listen_sock_fd, CLIENT_QUEUE_LEN); + if (ret =3D=3D -1) { + perror("listen()"); + close(listen_sock_fd); + return EXIT_FAILURE; + } + perror("Server listening"); + while (1) { + /* Do TCP handshake with client */ + client_sock_fd =3D accept(listen_sock_fd, + NULL, + 0); + if (client_sock_fd =3D=3D -1) { + perror("accept()"); + close(listen_sock_fd); + return EXIT_FAILURE; + } else { + perror("ACCEPT_SUCCESS"); + } + + char rb[1024]; + + while (1) { + ret =3D read(client_sock_fd, rb, 3); + + if (ret =3D=3D -1) { + perror("SERVVERread()"); + close(client_sock_fd); + break; + } else { + fprintf(stderr, "received %c%c%c from client", rb[0], rb[1], rb[2]); + } + if (rb[0] =3D=3D 'f' && rb[1] =3D=3D 'f' && rb[2] =3D=3D 'f') { + close(client_sock_fd); + break; + } + + } + } + + return EXIT_SUCCESS; +} --=20 2.25.1