Netdev List
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: lorenzo@kernel.org
Cc: dsahern@kernel.org, idosch@nvidia.com, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	horms@kernel.org, pablo@netfilter.org, fw@strlen.de,
	netdev@vger.kernel.org, netfilter-devel@vger.kernel.org
Subject: Re: [PATCH net-next] net: ip6_tunnel: use tunnel parameters for fill_forward_path route lookup
Date: Tue, 21 Jul 2026 12:54:57 +0200	[thread overview]
Message-ID: <20260721105458.196550-1-pabeni@redhat.com> (raw)
In-Reply-To: <20260708-ip6ip6-route-lookup-fill_forward_path-v1-1-863b9647102e@kernel.org>

From: AI Reviewer <ai@example.com>

This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.
Full review at: https://sashiko.dev/
---
--- Patch [1]: [PATCH net-next] net: ip6_tunnel: use tunnel parameters for fill_forward_path route lookup ---
commit 40b6b6aa3f042df26b7e3c0a15bf2f7d4b9e9df6
Author: Lorenzo Bianconi <lorenzo@kernel.org>

net: ip6_tunnel: use tunnel parameters for fill_forward_path route lookup

This commit updates ip6_tnl_fill_forward_path() to pass the source address,
output interface, and flowlabel from the tunnel configuration to the flowi6
struct. This change intends to align the hardware offload route lookup with
the slow path implementation in ipxip6_tnl_xmit().

> diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
> index bf8e40af60b08..557d8637ac57e 100644
> --- a/net/ipv6/ip6_tunnel.c
> +++ b/net/ipv6/ip6_tunnel.c
> @@ -1847,6 +1847,10 @@ static int ip6_tnl_fill_forward_path(struct net_device_path_ctx *ctx,
>  	struct ip6_tnl *t = netdev_priv(ctx->dev);
>  	struct flowi6 fl6 = {
>  		.daddr = t->parms.raddr,
> +		.saddr = t->parms.laddr,

[Severity: High]
This is a pre-existing issue, but does reading the 128-bit IPv6 addresses
locklessly here risk torn reads if ip6_tnl_update() modifies the parameters
concurrently?

Since these addresses are read again later in this function to populate the
path tunnel information:

ip6_tnl_fill_forward_path() {
    ...
    path->tun.src_v6 = t->parms.laddr;
    path->tun.dst_v6 = t->parms.raddr;
    ...
}

could a concurrent update cause the hardware offload metadata to point to
new endpoints while the egress route was chosen using the old endpoints?
Would it be safer to reuse the fl6.saddr and fl6.daddr values for the path
metadata?

> +		.flowi6_oif = t->parms.link,

[Severity: High]
This is a pre-existing issue, but should the route lookup also include
t->parms.fwmark?

The commit aligns the route lookup with the slow path, but omits
flowi6_mark. If a tunnel relies on fwmark-based policy routing, leaving the
mark as 0 might cause the hardware offload path to resolve to a different
egress device than the software slow path.

> +		.flowlabel = t->parms.flowinfo &
> +			     (IPV6_TCLASS_MASK | IPV6_FLOWLABEL_MASK),

[Severity: High]
Does unconditionally applying the flowinfo mask here bypass per-packet
dynamic routing constraints?

If a tunnel is configured with IP6_TNL_F_USE_ORIG_TCLASS,
IP6_TNL_F_USE_ORIG_FLOWLABEL, or IP6_TNL_F_USE_ORIG_FWMARK, the egress route
might vary dynamically based on the inner packet. Since
ip6_tnl_fill_forward_path() provides a single static path for hardware
offload, shouldn't it explicitly check for these dynamic flags and return
-EOPNOTSUPP, similar to how it handles unsupported encap limits?

>  	};
-- 
This is an AI-generated review.


      parent reply	other threads:[~2026-07-21 10:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-08 12:48 [PATCH net-next] net: ip6_tunnel: use tunnel parameters for fill_forward_path route lookup Lorenzo Bianconi
2026-07-08 15:42 ` David Ahern
2026-07-21 10:54 ` Paolo Abeni [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260721105458.196550-1-pabeni@redhat.com \
    --to=pabeni@redhat.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=fw@strlen.de \
    --cc=horms@kernel.org \
    --cc=idosch@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=lorenzo@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox