From nobody Mon Feb 9 10:32:51 2026 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:a05:6638:bd2:0:0:0:0 with SMTP id g18csp482392jad; Thu, 17 Feb 2022 06:26:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJybbmNUaePei5nspyvo8EtDGnRJe0f0++Jpm3BtX4uumGCHyb+aBpG+d2+p7KFLLz1bpmoH X-Received: by 2002:a17:90b:4391:b0:1b8:efac:58b6 with SMTP id in17-20020a17090b439100b001b8efac58b6mr7440772pjb.60.1645107960453; Thu, 17 Feb 2022 06:26:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645107960; cv=none; d=google.com; s=arc-20160816; b=FrbtkkURfUg3vHsvAG2h5T1LedCqr7o0ZPe58MreG1YWoySN/IocAmurm5FL5l3ln/ 9/AbhvppD0tTynx7uwyaravlP5rmSY0p7lrYC53lDcAUJkMX3vzge1vVtvABI1vaMfLv 65QJ++QrfW1ZciKouS7grkNyRbTiU7fpzmbJosCASgFBGtu1peBi0hXWUgVP510DM8A/ iJB1WVCfs61sw0eJbVwlIVSnDvwCmYf1c4FEDCuXT+NaVbGmTaevfXdNVJEHc4EBWOM3 Ik8gAo38ETawD/yMIhvQ5WhzRKRrOuV3ULPj9bFAhlfoPCEQ3HcjQIN307Rzl0DaUiWp RPCg== 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=WdJT3cbDm66ucF1Q7holBPmEhk4Q4YYGaTSfAEokRqw=; b=jqSpeB+2kjvwzgUrHAUPM/nZBWifPbM6v8Z4RmXYXcG54dlfTLK/rZAa+uCGQqR0hu SW3hsCYFaURz50tEy8077G58X7tsATewW0aQvzyd+8ZAKtR+2XcZ4RNvxSa9eERiSSTb bybWvHINt8rGHy1ZUCp+6gs9XOQeNnnGgKPXklPxirHe04brfItAR+DQPBr6jO9JUF3Y v3G1x3IS9XCEQlpDyHyWNRf/YiMcnawxM2T1A+9AKZfiCTgzqkUEBYLRm247/IVpE3bb +bsa5Bk/+FkPKYUBUW45mmzmlV4b7ueLT0N/B9khemflAXQ0ppmLOgGYjS+/q+4UoPjl 4eaA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of mptcp+bounces-3802-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.69.165 as permitted sender) smtp.mailfrom="mptcp+bounces-3802-wpasupplicant.patchew=gmail.com@lists.linux.dev" Return-Path: Received: from sjc.edge.kernel.org (sjc.edge.kernel.org. [147.75.69.165]) by mx.google.com with ESMTPS id g7si962904pgu.391.2022.02.17.06.26.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Feb 2022 06:26:00 -0800 (PST) Received-SPF: pass (google.com: domain of mptcp+bounces-3802-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.69.165 as permitted sender) client-ip=147.75.69.165; Authentication-Results: mx.google.com; spf=pass (google.com: domain of mptcp+bounces-3802-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.69.165 as permitted sender) smtp.mailfrom="mptcp+bounces-3802-wpasupplicant.patchew=gmail.com@lists.linux.dev" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sjc.edge.kernel.org (Postfix) with ESMTPS id CA49D3E0F69 for ; Thu, 17 Feb 2022 14:25:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C157A3D9E; Thu, 17 Feb 2022 14:25:58 +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 C368A291C for ; Thu, 17 Feb 2022 14:25:57 +0000 (UTC) Received: from fw by Chamillionaire.breakpoint.cc with local (Exim 4.92) (envelope-from ) id 1nKhjI-0004Ds-3j; Thu, 17 Feb 2022 15:25:56 +0100 From: Florian Westphal To: Cc: Florian Westphal Subject: [PATCH mptcp-next v2 3/5] tcp: add mptcp join demultiplex hooks Date: Thu, 17 Feb 2022 15:25:36 +0100 Message-Id: <20220217142538.7849-4-fw@strlen.de> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220217142538.7849-1-fw@strlen.de> References: <20220217142538.7849-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. This patch series does not cover timewait sockets so far. Signed-off-by: Florian Westphal --- include/net/mptcp.h | 5 +++++ net/ipv4/tcp_ipv4.c | 4 ++++ net/ipv6/tcp_ipv6.c | 4 ++++ 3 files changed, 13 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 6873f46fc8ba..6e6675a09443 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -2140,6 +2140,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)) { diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 0c648bf07f39..788040db8e9e 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c @@ -1782,6 +1782,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)) { --=20 2.34.1