mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@nvidia.com>
To: Haoran Wang <haoranwangsec@gmail.com>
Cc: David Ahern <dsahern@kernel.org>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ipv6: icmp: use skb_dst_dev_net_rcu() for echo reply and unreach
Date: Tue, 20 Oct 2026 20:34:11 +0300	[thread overview]
Message-ID: <20261020173411.GA3251490@shredder> (raw)
In-Reply-To: <179241613335.5916.18191480036849517944@whr>

On Mon, Oct 19, 2026 at 09:22:13PM +0800, Haoran Wang wrote:
> ip6_err_gen_icmpv6_unreach() and icmpv6_echo_reply() derive the network
> namespace from the ingress device with dev_net_rcu(skb->dev).
> 
>     /* ip6_err_gen_icmpv6_unreach, net/ipv6/icmp.c:885 */
>     rt = rt6_lookup(dev_net_rcu(skb->dev), &ipv6_hdr(skb2)->saddr, ...);
> 
>     /* icmpv6_echo_reply, net/ipv6/icmp.c:923 */
>     struct net *net = dev_net_rcu(skb->dev);
> 
> Under a VRF, skb->dev is the VRF master device, so dev_net_rcu(skb->dev)
> returns the netns of the master rather than the netns the packet is
> destined to.  The route lookup for the unreach and the send policy for
> the echo reply (ratelimit, IPsec, route) then run against the wrong
> namespace.  The rt6_lookup may miss the route to the source, leaving
> skb2->dev unset, and the echo reply is emitted/routed per the ingress
> netns instead of the destination netns.
> 
> The IPv4 ICMP echo path already uses the destination netns via
> skb_dst_dev_net_rcu(skb) (net/ipv4/icmp.c:1123 and :1267), and the IPv6
> echo path still uses dev_net_rcu(skb->dev).
> 
> Use skb_dst_dev_net_rcu(skb) at both IPv6 sites so the namespace is
> taken from the skb destination, matching the IPv4 path.

I don't understand any of this. VRF master and slave are always in the
same netns. Same comment about the IPv4 patch.

      parent reply	other threads:[~2026-10-20 17:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-19 13:22 Haoran Wang
2026-10-19 13:25 ` netdev-bot+sinfo
2026-10-20 17:34 ` Ido Schimmel [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=20261020173411.GA3251490@shredder \
    --to=idosch@nvidia.com \
    --cc=dsahern@kernel.org \
    --cc=haoranwangsec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.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

all inboxes | Powered by JetHome®