Article View: linux.kernel.netdev
Article #7010[RFC net-next v2 02/18] ipv4/ipv6: add LWT receive helpers
From: Ralf Lici
Date: Sat, 24 Oct 2026 09:25
Date: Sat, 24 Oct 2026 09:25
94 lines
12254 bytes
12254 bytes
Cross-family LWT translation constructs a validated target-family
packet and needs to enter its receive path at PRE_ROUTING. Add helpers
that invoke the hook and continue with normal input routing.
The continuation remains in IP core, so it stays valid if NFQUEUE holds
a packet after the selecting LWT dst has been dropped.
Signed-off-by: Ralf Lici <ralf@mandelbit.com>
---
New patch in RFC v2.
include/net/ip.h | 1 +
include/net/ipv6.h | 1 +
net/ipv4/ip_input.c | 10 ++++++++++
net/ipv6/ip6_input.c | 11 +++++++++++
4 files changed, 23 insertions(+)
diff --git a/include/net/ip.h b/include/net/ip.h
index 618b9806c10b..761b6b0d48f7 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -170,6 +170,7 @@ int ip_build_and_send_pkt(struct sk_buff *skb, const struct sock *sk,
struct ip_options_rcu *opt, u8 tos);
int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt,
struct net_device *orig_dev);
+int ip_rcv_lwt(struct sk_buff *skb);
void ip_list_rcv(struct list_head *head, struct packet_type *pt,
struct net_device *orig_dev);
int ip_local_deliver(struct sk_buff *skb);
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 3de07e738538..e3f245d640ac 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -1016,6 +1016,7 @@ static inline __be32 flowi6_get_flowlabel(const struct flowi6 *fl6)
int ipv6_rcv(struct sk_buff *skb, struct net_device *dev,
struct packet_type *pt, struct net_device *orig_dev);
+int ip6_rcv_lwt(struct sk_buff *skb);
void ipv6_list_rcv(struct list_head *head, struct packet_type *pt,
struct net_device *orig_dev);
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
index 9860178752b8..f679e38a1a1c 100644
--- a/net/ipv4/ip_input.c
+++ b/net/ipv4/ip_input.c
@@ -493,6 +493,16 @@ static int ip_rcv_finish(struct net *net, struct sock *sk, struct sk_buff *skb)
return ret;
}
+/* enter IPv4 PRE_ROUTING with a validated LWT packet */
+int ip_rcv_lwt(struct sk_buff *skb)
+{
+ struct net *net = dev_net(skb->dev);
+
+ return NF_HOOK(NFPROTO_IPV4, NF_INET_PRE_ROUTING, net, NULL, skb,
+ skb->dev, NULL, ip_rcv_finish);
+}
+EXPORT_SYMBOL_GPL(ip_rcv_lwt);
+
/*
* Main IP Receive routine.
*/
diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
index d332ec60f915..47aaa1fcf82b 100644
--- a/net/ipv6/ip6_input.c
+++ b/net/ipv6/ip6_input.c
@@ -26,6 +26,7 @@
#include <linux/mroute6.h>
#include <linux/slab.h>
#include <linux/indirect_call_wrapper.h>
+#include <linux/module.h>
#include <linux/netfilter.h>
#include <linux/netfilter_ipv6.h>
@@ -119,6 +120,16 @@ int ip6_rcv_finish(struct net *net, struct sock *sk, struct sk_buff *skb)
return dst_input(skb);
}
+/* enter IPv6 PRE_ROUTING with a validated LWT packet */
+int ip6_rcv_lwt(struct sk_buff *skb)
+{
+ struct net *net = dev_net(skb->dev);
+
+ return NF_HOOK(NFPROTO_IPV6, NF_INET_PRE_ROUTING, net, NULL, skb,
+ skb->dev, NULL, ip6_rcv_finish);
+}
+EXPORT_SYMBOL_GPL(ip6_rcv_lwt);
+
static void ip6_sublist_rcv_finish(struct list_head *head)
{
struct sk_buff *skb, *next;
--
2.55.0
Technical Details
Message-ID:
<20261024092532.172005-3-ralf@mandelbit.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-351329-linux-kernel-netdev=dewy.ruReferences:
<20261024092532.172005-1-ralf@mandelbit.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-351329-linux-kernel-netdev=dewy.ru From: ralf@mandelbit.com (Ralf Lici) Newsgroups: linux.kernel.netdev Subject: [RFC net-next v2 02/18] ipv4/ipv6: add LWT receive helpers Date: Sat, 24 Oct 2026 11:25:12 +0200 Organization: Usenet Network Message-ID: <20261024092532.172005-3-ralf@mandelbit.com> References: <20261024092532.172005-1-ralf@mandelbit.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="728413"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:KpSFGS7nyVnDxJDpaXNOiy/0cJs= sha256:vfe+GCMsU7zhmKKZo/qKpDCFV/uRmIWix3TIK4WKFlc= sha1:IvM/iDWU8IeZO5522V0HhR8Ybsk= sha256:woph1ZEPklvytkiHLbcKK1U6P4M5UZ6tSW83KgStrv0= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 19C0A111609; Sat, 24 Oct 2026 12:28:39 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.05 X-Spam-Status: No, score=-3.05 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=mandelbit.com X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id y70KJQMrSr9b; Sat, 24 Oct 2026 12:28:35 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-351329-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=mandelbit.com X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4]) by mail.dewy.ru (Postfix) with ESMTPS id 329BE111607; Sat, 24 Oct 2026 12:28:25 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sin.lore.kernel.org (Postfix) with ESMTP id 12DB22A9ED; Sat, 24 Oct 2026 09:27:23 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1792833991; b=ZomlYBKdONgyMD8Nmb/5fXCLfXafwBEzBqapKfmY+ZKBHkxtOE0uR696H6y4LH+evJcm 5NBWn+kFtBqMA4tZA1PVWECvmsFPfj/cq6VUDtVHnCgkewGOlzAtzR35BooSDlkvKM3kq kuii6DJR810NaWDpg25YdTSuGJM621j8OTn4C2XTr88X+4+RjHMiRF1Cvv/XBKr/1k+jF Yfdc8JBxKeSEE6Nm6jlLqBKVSWyb/UNpRL8O/gRAAoDMh8+uPRSBcM2kbl3oeBkccAkDT v6+vW//Kq0bwktBz/r3hu1vE12toeqFp8otKanqpgJJ1vxOsI+5W+vZ/fhUaEwcTSbg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792833991; h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:From:To: Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version: Content-Transfer-Encoding:X-Rspamd-Queue-Id; bh=aHQjbiEDaDFKpIHp1kYu+vnjbkH110NdIRcCdcZ77Ec=; b=hXmDJtZFCyiDpyTvswbOM/S0nXxscUIfYfkzjCNxvHqB4FRe1u3qL293dAxpGbMC+KdB o4PQqBflK0QRXS1Ev9K+/Fn98M6wMhQPAyBCNVKTlvs5rwQEEu8+VKoJJnqzj/uZcA1nQ AcWv1qywqoUJnqzjGmLT8A4qIIJ7FHJuVcNYN69ssm/gyjYiyLsEYIWnwGqY/W/K45GG/ HWYjVTpuxZiMxM5vdYoj0It7BaYDuS48C9HUoDz1lj6h4xV7pcch4RXzj7m96LgJSm7XX VqUoqMgWTq0nVkGKSzMfwNeOVa9O1TFjYxTuiNaz8vqqpHK46eMDuyf7KIJryDHSvmA== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=mandelbit.com header.i=@mandelbit.com header.a=rsa-sha256 header.s=MBO0001 header.b=b1PtLjSk; dmarc=none header.from=mandelbit.com; spf=pass smtp.mailfrom=mandelbit.com; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F2FFC606CA19; Sat, 24 Oct 2026 09:26:30 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=mandelbit.com header.i=@mandelbit.com header.a=rsa-sha256 header.s=MBO0001 header.b=b1PtLjSk X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=195.10.208.50 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1792833975; b=kOnWQhACyaGHuG/PXFiO83yuO0zHv6np4X7NANbGTCA4G6dLzyWPvQzxlEidBh4V54Vi u2P4GYT11c8XDeq6pm6L0n8PrcOWA31yqvAIzb26xv5ZkLVxVdocFtTkBU/+rV+0QCZ2L yZQx/hlAU6DPVu8HVOvnOa33Qe34KY1O/laiwppVO6yU6d22aDgLjG+E/MIjNlmKHQX4G f+cxTrQjIkyH4+ElsivTMjCK99FaW+Xr4D8yJhD2Yb4hrThPFkaqv5iP8No1anug1Xcv4 XNZjwFnEzi4+FqtnQebYwtfZzt4ElfpmS5jS8+Ux5Q5tg6FAi1xJ5FekJCdNRgxKNMQ== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792833975; h=DMARC-Filter:Received:DKIM-Signature:From:To:Cc:Subject:Date: Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding:X-Rspamd-Queue-Id; bh=aHQjbiEDaDFKpIHp1kYu+vnjbkH110NdIRcCdcZ77Ec=; b=GELSm3MhZcEPEHnn640+Z7cfANmhQQKiy0+TLRQotLukV2CUFUQla6x20bUcUcHRWY73 j32sfBo4a5L3FY9u8aJuvT4BMu95PrNwd8mEDgpFgnFYJr0k8ATgmYwV2/Uo9TbSE67DK MJTAk4vxttpMqGIFhxwa2IXUulmyoTA9xz5mb/O/1+rbUz2j73GIEEYGn9fKi23Zr6voz fW+ULeLQrc/Rpkg6iv6HgeAHeaAX5muef5fcVBRSdkyq6QGXUSOYBTmKzxMNd05gK7L1V KFFnt1f3nPcmTqJSKQUgh4U7nkKPkOPMMgPT7F9N90MQLjmZ88KfQFsrKzmNnl7E0TQ== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=mandelbit.com; spf=pass smtp.mailfrom=mandelbit.com; dkim=pass header.d=mandelbit.com header.i=@mandelbit.com header.a=rsa-sha256 header.s=MBO0001 header.b=b1PtLjSk; arc=none smtp.remote-ip=195.10.208.50 X-Received: from mout-b-105.mailbox.org (mout-b-105.mailbox.org [195.10.208.50]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C5150606A31E; Sat, 24 Oct 2026 09:26:13 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C5150606A31E X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=mandelbit.com X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mandelbit.com X-Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:b231:465::1]) (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-105.mailbox.org (Postfix) with ESMTPS id 4jBZJD0X7Jz9tWQ; Sat, 24 Oct 2026 11:26:04 +0200 (CEST) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandelbit.com; s=MBO0001; t=1792833964; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aHQjbiEDaDFKpIHp1kYu+vnjbkH110NdIRcCdcZ77Ec=; b=b1PtLjSkuSWz6XAdJZLejRYVmem8mctQoW3Y8ws4QiqRrsMvpRdYYlwHR1GR71uHlWDP0f hfWphuNwIESzXw+uTaZUqP2GH46vjalfe+iPRoqdbWpE3bRPlliNN5WSF0ou1e4P5kAnfV /btr9Wjk7L8opYCton1/+tncI32Q6zweZmmY287k3qHMYSF2N0QBik+TQh0eJYKHFst1sh Jbl/Ts3wVJYKrJGn9Lx717U2FPu1npaAZrIpA5QoXMz3qoi0G2puxLmgppeNXlV5/eZBKv QcIbD9Uy6nL+3SHecoNj4K4md1hjnbPabyYxyxvyom68s39OkdUsm+1iEdwslQ== X-Authentication-Results: outgoing_mbo_mout; dkim=none; spf=pass (outgoing_mbo_mout: domain of ralf@mandelbit.com designates 2001:67c:2050:b231:465::1 as permitted sender) smtp.mailfrom=ralf@mandelbit.com X-Cc: David Ahern <dsahern@kernel.org>, Ido Schimmel <idosch@nvidia.com>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@kernel.org>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>, Daniel Gröber <dxld@darkboxed.org>, Antonio Quartulli <antonio@mandelbit.com>, Toke Høiland-Jørgensen <toke@kernel.org>, linux-kernel@vger.kernel.org X-Mailer: git-send-email 2.55.0 X-In-Reply-To: <20261024092532.172005-1-ralf@mandelbit.com> X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-Rspamd-Queue-Id: 4jBZJD0X7Jz9tWQ