From nobody Thu Sep 18 09:21:28 2025 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:a05:6638:bd2:0:0:0:0 with SMTP id g18csp413118jad; Wed, 23 Feb 2022 03:08:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJxApOmWr6G1xmk7X3CI7FCXWeOsXBcH9gIlMdyHFob2VeFLiUwIiVObqNMGVFGcMj+6kw/j X-Received: by 2002:a05:6402:511:b0:40d:e8eb:1dbb with SMTP id m17-20020a056402051100b0040de8eb1dbbmr29808498edv.418.1645614532909; Wed, 23 Feb 2022 03:08:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645614532; cv=none; d=google.com; s=arc-20160816; b=MslDFyiM5EtCnG+zFpHBt3IXDpETx9oYAD1Dcur0Zav5RabJzoZgE1kzSn1vLuvyIZ jdIidVBm7esWl6x4vRSe24X+6n0Cita0JAOFC3f/76AdRWDhkEYyj5zMoF/Gufa4tCpc QsWBbpPcKKWWcjiSOmedhEecPSZxKULdHeD+8mSDT2GNG8I+9zODankru1JPxwWBGyQK iLtiWtfn55tuwupsBY4ltRORWT+TFbtkO2qpo7GV/o+tf5NB2HqrSwlaoilBo64pY9hY YTn9OLLPzPNWHD7nzujcXdffgb7pjWQXTODNqi45hJu9iHXbIFqybbhJlOFaTkcYmpL2 kEFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=oe9U5aLYp8bBrs68q8/y/RSSc8fm1QjR9AQ5Il+9/iw=; b=HzhY1SqU9VTkvk0qIvx0dHlyBdOIu0elNKMQzvVZtI3Jr7YDCyUMZ4Bf6wGlEWSoNk owIASVHQv+1Q++/iqsrm3vs4ZaZ1BWR5CnJ1NYS2b91BWu7Zwl63ZuWsP1nKDOpH0PwF upvE6zSjKX4wM9vCWb8IFoXNDIOcL1Gjoo70Djqlcx9MCGuWvboJurhHG0iOYJFGWKXI cEg7/6HU7pcSuBr4MbwEgAE9XLuqImrkCltuKc8nsGGBM54BHx7vllhpiO/xxLHfx3PQ MuF2RZP7KAmNd/0tJy1yiw/UTgn9sGfPdJqRmeBA0TD9Q53u8Oif5TzMWvzz7gw6vOYm EPtQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of mptcp+bounces-3956-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1:3600::1 as permitted sender) smtp.mailfrom="mptcp+bounces-3956-wpasupplicant.patchew=gmail.com@lists.linux.dev" Return-Path: Received: from ewr.edge.kernel.org (ewr.edge.kernel.org. [2604:1380:1:3600::1]) by mx.google.com with ESMTPS id d15si16222683edm.562.2022.02.23.03.08.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Feb 2022 03:08:52 -0800 (PST) Received-SPF: pass (google.com: domain of mptcp+bounces-3956-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1:3600::1 as permitted sender) client-ip=2604:1380:1:3600::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of mptcp+bounces-3956-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1:3600::1 as permitted sender) smtp.mailfrom="mptcp+bounces-3956-wpasupplicant.patchew=gmail.com@lists.linux.dev" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ewr.edge.kernel.org (Postfix) with ESMTPS id E146D1C06FB for ; Wed, 23 Feb 2022 11:08:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A4533642; Wed, 23 Feb 2022 11:08:50 +0000 (UTC) X-Original-To: mptcp@lists.linux.dev Received: from Chamillionaire.breakpoint.cc (Chamillionaire.breakpoint.cc [193.142.43.52]) (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 61B22A57 for ; Wed, 23 Feb 2022 11:08:49 +0000 (UTC) Received: from fw by Chamillionaire.breakpoint.cc with local (Exim 4.92) (envelope-from ) id 1nMpVn-0005hz-9S; Wed, 23 Feb 2022 12:08:47 +0100 From: Florian Westphal To: Cc: Florian Westphal Subject: [PATCH 2/4] tcp: add mptcp join demultiplex hooks Date: Wed, 23 Feb 2022 12:08:30 +0100 Message-Id: <20220223110832.29357-3-fw@strlen.de> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220223110832.29357-1-fw@strlen.de> References: <20220223110832.29357-1-fw@strlen.de> Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Split from the next patch to make core tcp changes more obvious: add a dummy function that gets called after tcp socket demux came up empty. This will be used by mptcp to check if a tcp syn contains an mptcp join option with a valid token (connection id). If so, a hidden pernet mptcp listener socket is returned and packet resumes normally. Signed-off-by: Florian Westphal --- include/net/mptcp.h | 5 +++++ net/ipv4/tcp_ipv4.c | 7 +++++++ net/ipv6/tcp_ipv6.c | 7 +++++++ 3 files changed, 19 insertions(+) diff --git a/include/net/mptcp.h b/include/net/mptcp.h index 8b1afd6f5cc4..5ee422b56902 100644 --- a/include/net/mptcp.h +++ b/include/net/mptcp.h @@ -197,6 +197,10 @@ static inline __be32 mptcp_reset_option(const struct s= k_buff *skb) =20 return htonl(0u); } +static inline struct sock *mptcp_handle_join(int af, struct sk_buff *skb) +{ + return NULL; +} #else =20 static inline void mptcp_init(void) @@ -274,6 +278,7 @@ static inline int mptcp_subflow_init_cookie_req(struct = request_sock *req, } =20 static inline __be32 mptcp_reset_option(const struct sk_buff *skb) { retu= rn htonl(0u); } +static inline struct sock *mptcp_handle_join(int af, struct sk_buff *skb) = { return NULL; } #endif /* CONFIG_MPTCP */ =20 #if IS_ENABLED(CONFIG_MPTCP_IPV6) diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index d42824aedc36..06e5bdf53278 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -2155,6 +2155,10 @@ int tcp_v4_rcv(struct sk_buff *skb) if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) goto discard_it; =20 + sk =3D mptcp_handle_join(AF_INET, skb); + if (sk) + goto process; + tcp_v4_fill_cb(skb, iph, th); =20 if (tcp_checksum_complete(skb)) { @@ -2201,6 +2205,9 @@ int tcp_v4_rcv(struct sk_buff *skb) iph->daddr, th->dest, inet_iif(skb), sdif); + if (!sk2) + sk2 =3D mptcp_handle_join(AF_INET, skb); + if (sk2) { inet_twsk_deschedule_put(inet_twsk(sk)); sk =3D sk2; diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 749de8529c83..8ae0db599f56 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c @@ -1800,6 +1800,10 @@ INDIRECT_CALLABLE_SCOPE int tcp_v6_rcv(struct sk_buf= f *skb) if (!xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb)) goto discard_it; =20 + sk =3D mptcp_handle_join(AF_INET6, skb); + if (sk) + goto process; + tcp_v6_fill_cb(skb, hdr, th); =20 if (tcp_checksum_complete(skb)) { @@ -1849,6 +1853,9 @@ INDIRECT_CALLABLE_SCOPE int tcp_v6_rcv(struct sk_buff= *skb) ntohs(th->dest), tcp_v6_iif_l3_slave(skb), sdif); + if (!sk2) + sk2 =3D mptcp_handle_join(AF_INET6, skb); + if (sk2) { struct inet_timewait_sock *tw =3D inet_twsk(sk); inet_twsk_deschedule_put(tw); --=20 2.34.1