From patchwork Tue Nov 17 14:11:00 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ralf Lici X-Patchwork-Id: 5726 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:6022:9292:b0:11a:f58a:e788 with SMTP id dc18csp2609519lab; Tue, 17 Nov 2026 06:11:24 -0800 (PST) X-Forwarded-Encrypted: i=2; AL+hErFp2pYBLUsMd3TaNfoIqCreWt8cJfKHx1zis8+1eSQK8llQj7xLbR4XRGI4smNwEaLVA/5YndukanQ=@openvpn.net X-Received: by 2002:a05:701b:4584:b0:144:fb87:5b91 with SMTP id a92af1059eb24-1b50310ae62mr12560520c88.44.1794924683814; Tue, 17 Nov 2026 06:11:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1794924683; cv=none; d=google.com; s=arc-20260327; b=VaDlsauBgEXNVyQ1fex0i2vN95f7fHrFjD2tQqLkaK7gVcsFYiFyHROuT03bBRnEO0 8QNeW5gpNFG2zvN984vhHixp8MW2wT54Fei6VTgtUAX+2eYtjFwD3MFp27cHuvmXP7qQ /HLlYzKy0Nsj2tctqDt5e5mp8GR+HUpwMcutA0j6Hg5HAwz2Civ1whnzFpsqL3Gkwll0 5X2OLFtWCmgnkApohTMbIdelVIMHZ8JKFgQCkVc6gMw0ERQlc3bWCgyui00+KXTUS1fJ Idx6NIZQxmXzwmAN7ahyOHzzS9mvirRwQ6gPScNorYQxBXCjJlbYstettN4b3BDi3H3O dxIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :dkim-signature:dkim-signature:dkim-signature:dkim-signature; bh=+JiYLcDdg08cZ6PPFcfNU/BmiK5efHPnX1ubO7cYu60=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=hx4N8F08T9FFBvBHUsX7nnD1XmdrWlgRHNf7481fLuaRMQMgegj8l70r6FT5nLAdTh hC3btNbBKAaYmZFp6LwcQL42zcV0TXFRwVazNcjxUYcgbW3dbIu40icVbwDqWQsogTsu ig3DcCnwNmE09Y5xm7EJYk9FQiBdKbCF8NBbpeVOEhl6BjxB5Np2YLvyMrgxU0oaEJq6 RH2pWtjHtuJ2KVRw0z7cN8fRNnmBUkkGR0jYAHWAEjg9ZtRc1mAsSLmr0QhkhsI8xhz1 WiNIHqzYetr0aNk5aTo0iQ8F5gGPzHDjiM7v2+6yjEplgntZUHfFujiDCmB1PD2V2heO 5d+A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=dXfAYbvz; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=TcgRnj2A; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=VvaCicxy; dkim=neutral (body hash did not verify) header.i=@mandelbit.com header.s=MBO0001 header.b=eXdQRJ71; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id 5a478bee46e88-3816d419631si5354411eec.54.2026.11.17.06.11.23 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Nov 2026 06:11:23 -0800 (PST) Received-SPF: pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) client-ip=216.105.38.7; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=dXfAYbvz; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=TcgRnj2A; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=VvaCicxy; dkim=neutral (body hash did not verify) header.i=@mandelbit.com header.s=MBO0001 header.b=eXdQRJ71; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.sourceforge.net; s=beta; h=Content-Transfer-Encoding:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Subject:MIME-Version:References:In-Reply-To:Message-ID:Date:To:From:Sender: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Unsubscribe-Post: List-Owner; bh=+JiYLcDdg08cZ6PPFcfNU/BmiK5efHPnX1ubO7cYu60=; b=dXfAYbvz7/Bnp1 AGJiLiyjOgGzvLgAPsqY8l7mIEuDedNkjLZyb7ZRKcvh7SwNnP+5w+B6AtnpwuADfqLy7oEEML6Ty HyB/6R7yQ0gQTW2SALn8jrGXXzGtv68BHqC8nQN6gnnl62JqdDTlJXJYrH/ikD0Q5T5wnrAPpHdLF Ixo=; Received: from [127.0.0.1] (helo=sfs-ml-3.v29.lw.sourceforge.com) by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.100.1) (envelope-from ) id 1xTJu6-000000001sx-3ME1; Tue, 17 Nov 2026 14:11:22 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.100.1) (envelope-from ) id 1xTJu5-000000001sZ-0UxJ for openvpn-devel@lists.sourceforge.net; Tue, 17 Nov 2026 14:11:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Unsubscribe-Post:List-Subscribe:List-Post:List-Owner:List-Archive; bh=el38liqVEHYqmnWDeZ1yuP1/i4B9z0xN3MNdso0KXR0=; b=TcgRnj2AIzi/1HsyneSUlkl+oa Ah3l1hJd7pS9WBxkavmRNZcYLEKVOkXeGHCYDg1DabFtjM4edMavc38Fy3EBOa4s0Ji/EzHFYPEuK IpLT63QIBNFcwXw7atKpaRDTZhADM9ydfegUgQNeaoeiepeyKcPDsq+CgEc+1cmtTXcA=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID: Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Unsubscribe-Post: List-Subscribe:List-Post:List-Owner:List-Archive; bh=el38liqVEHYqmnWDeZ1yuP1/i4B9z0xN3MNdso0KXR0=; b=VvaCicxydc16DnD7BRDwjkYrr3 PXc9zaQDDtZ8bLdMmdKryet6kMAX0vYd6H0+ozPM8Xx2CSibzJtVjmwk7An0k3Lpfyv0IqzSDFjNh jMzTALH6EqDKiKBb0y5pzJG6E2bfYXXmldovo1bfmdmC33DegndhvMrfy/cfusjQNujU=; Received: from mout-b-202.mailbox.org ([195.10.208.62]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.100.1) id 1xTJu2-000000007sy-1ddx for openvpn-devel@lists.sourceforge.net; Tue, 17 Nov 2026 14:11:21 +0000 Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:b231:465::102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519MLKEM768 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-b-202.mailbox.org (Postfix) with ESMTPS id 4jTRV63ZrxzKmcv for ; Tue, 17 Nov 2026 15:11:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandelbit.com; s=MBO0001; t=1794924670; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=el38liqVEHYqmnWDeZ1yuP1/i4B9z0xN3MNdso0KXR0=; b=eXdQRJ71wBvrcgW4YFdJYiXxcHFmJsfZkt304/DPgqcoL48/+o+qb7NIIbwnimqtWsIRlr 5DVbwDvqSyF1q2vLTXFmqr6ZI+ERsbHndz+Ew7QxYH+LKUIT4Ogwb5ZzQ1pBXihFQOx1dX LCzj/FgDvV1HCZpsfQKTZGWxB3V4UHNDRtgSElHCxgTS//J60Lm2eRzI2WtXCqR6gnWQZg kqvcw0qqBTj0puvgbbTLaPALnCv+l2uymL1EHlAfRd4krowkJB7nLE342I6yfqyFECIHok nDUnETwvLO0Qdk3sD754n3kLSBAPA6g7HVfMls0Ge8kjGerxpYItSHjpR3y0NQ== Authentication-Results: outgoing_mbo_mout; dkim=none; spf=pass (outgoing_mbo_mout: domain of ralf@mandelbit.com designates 2001:67c:2050:b231:465::102 as permitted sender) smtp.mailfrom=ralf@mandelbit.com From: Ralf Lici To: openvpn-devel@lists.sourceforge.net Date: Tue, 17 Nov 2026 15:11:00 +0100 Message-ID: <45fd7978aa65dca13632657bcaba9fab6002f6c3.1794922487.git.ralf@mandelbit.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: References: MIME-Version: 1.0 X-Rspamd-Queue-Id: 4jTRV63ZrxzKmcv X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "sfi-spamd-2.hosts.colo.sdot.me", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: __get_hash_from_flowi4 was removed for lack of users in commit de7a0f871fab ("net: Remove unused get_hash_from_flow functions"), while its IPv6 counterpart survived for automatic flow labels. A tunnel [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-Headers-End: 1xTJu2-000000007sy-1ddx Subject: [Openvpn-devel] [PATCH ovpn net-next 3/4] net: restore __get_hash_from_flowi4 X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: 1882114945225652898 X-GMAIL-MSGID: 1882114945225652898 __get_hash_from_flowi4 was removed for lack of users in commit de7a0f871fab ("net: Remove unused get_hash_from_flow functions"), while its IPv6 counterpart survived for automatic flow labels. A tunnel which routes its outer packets with a flowi can use these helpers to set the outer flow hash without dissecting the packet, as ovpn will. Restore the helper and add skb_get_hash_flowi4 next to skb_get_hash_flowi6. Like the IPv6 variant, it leaves basic.n_proto unset, so the hash is stable for a flow but not identical to the one the flow dissector computes from the packet itself. Signed-off-by: Ralf Lici --- include/linux/skbuff.h | 13 +++++++++++++ include/net/flow.h | 1 + net/core/flow_dissector.c | 16 ++++++++++++++++ 3 files changed, 30 insertions(+) diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index aaa33d44b01c..1c8bcacd4d0d 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -1679,6 +1679,19 @@ static inline __u32 skb_get_hash(struct sk_buff *skb) return skb->hash; } +static inline __u32 skb_get_hash_flowi4(struct sk_buff *skb, + const struct flowi4 *fl4) +{ + if (!skb->l4_hash && !skb->sw_hash) { + struct flow_keys keys; + __u32 hash = __get_hash_from_flowi4(fl4, &keys); + + __skb_set_sw_hash(skb, hash, flow_keys_have_l4(&keys)); + } + + return skb->hash; +} + static inline __u32 skb_get_hash_flowi6(struct sk_buff *skb, const struct flowi6 *fl6) { if (!skb->l4_hash && !skb->sw_hash) { diff --git a/include/net/flow.h b/include/net/flow.h index ae9481c40063..7a6ccd0d56bd 100644 --- a/include/net/flow.h +++ b/include/net/flow.h @@ -194,5 +194,6 @@ static inline struct flowi_common *flowi6_to_flowi_common(struct flowi6 *fl6) } __u32 __get_hash_from_flowi6(const struct flowi6 *fl6, struct flow_keys *keys); +__u32 __get_hash_from_flowi4(const struct flowi4 *fl4, struct flow_keys *keys); #endif diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c index 1be6c739e3c7..8533a9ce232e 100644 --- a/net/core/flow_dissector.c +++ b/net/core/flow_dissector.c @@ -2020,6 +2020,22 @@ __u32 __get_hash_from_flowi6(const struct flowi6 *fl6, struct flow_keys *keys) } EXPORT_SYMBOL(__get_hash_from_flowi6); +__u32 __get_hash_from_flowi4(const struct flowi4 *fl4, struct flow_keys *keys) +{ + memset(keys, 0, sizeof(*keys)); + + keys->addrs.v4addrs.src = fl4->saddr; + keys->addrs.v4addrs.dst = fl4->daddr; + keys->control.addr_type = FLOW_DISSECTOR_KEY_IPV4_ADDRS; + keys->ports.src = fl4->fl4_sport; + keys->ports.dst = fl4->fl4_dport; + keys->keyid.keyid = fl4->fl4_gre_key; + keys->basic.ip_proto = fl4->flowi4_proto; + + return flow_hash_from_keys(keys); +} +EXPORT_SYMBOL(__get_hash_from_flowi4); + static const struct flow_dissector_key flow_keys_dissector_keys[] = { { .key_id = FLOW_DISSECTOR_KEY_CONTROL,