Netdev List
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@nvidia.com>
To: Wenbo Sun <sunwenbo@cmss.chinamobile.com>
Cc: David Ahern <dsahern@kernel.org>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.org>,
	Simon Horman <horms@kernel.org>,
	Hangbin Liu <hangbin.liu@linux.dev>,
	Hangbin Liu <liuhangbin@kylinos.cn>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	1342116488@qq.com
Subject: Re: [PATCH net-next v4] ipv6: check mc_forwarding before calling ip6mr_get_route()
Date: Tue, 24 Nov 2026 16:41:18 +0200	[thread overview]
Message-ID: <20261124144118.GA3904967@shredder> (raw)
In-Reply-To: <20261120032327.18375-1-sunwenbo@cmss.chinamobile.com>

On Fri, Nov 20, 2026 at 11:23:27AM +0800, Wenbo Sun wrote:
> When CONFIG_IPV6_MROUTE is enabled, rt6_fill_node() currently calls
> ip6mr_get_route() whenever an input interface (RTA_IIF) is specified and
> the matched route prefix (rt6_dst->addr) is multicast.
> 
> However, ip6mr_get_route() should not be invoked in three cases where
> the kernel does not perform multicast forwarding lookup:
> 1. Multicast forwarding is disabled in the network namespace
>    (mc_forwarding is 0);
> 2. The queried destination address (dest) has interface-local
>    (IPV6_ADDR_LOOPBACK) or link-local (IPV6_ADDR_LINKLOCAL) scope, which
>    ip6_mc_input() never forwards;
> 3. The query requests a raw FIB entry via RTM_F_FIB_MATCH (where
>    inet6_rtm_getroute() passes dest as NULL), for which IPv4 uses
>    fib_dump_info() rather than ipmr_get_route().
> 
> In those cases, calling ip6mr_get_route() falls into the cache-miss path
> (where skb->dev is not set by inet6_rtm_getroute()) and fails, causing
> rt6_fill_node() to jump to nla_put_failure and return -EMSGSIZE instead
> of emitting RTA_IIF and the matched route attributes. Note that
> supporting MFC cache lookups when mc_forwarding is enabled for routable
> multicast groups would also require passing the queried (S,G) and input
> device into ip6mr_get_route(), which is left out of scope for this
> change.
> 
> Align rt6_fill_node() with IPv4 rt_fill_info() and ip6_mc_input() by
> requiring that dest is non-NULL, the matched route prefix
> (rt6_dst->addr) is multicast, dest is neither interface-local nor
> link-local multicast, and mc_forwarding is enabled before calling
> ip6mr_get_route().
> 
> This alignment was identified with the assistance of an LLM-based code
> review comparing IPv4 and IPv6 multicast route get handling, confirmed
> in a User-Mode Linux (UML) environment, and verified in UML that
> routable multicast queries with mc_forwarding disabled, link-local
> (ff02::1) and interface-local (ff01::1) queries with mc_forwarding
> enabled, RTM_F_FIB_MATCH queries, and queries matching a non-multicast
> route (::/0) all succeed and report RTA_IIF.
> 
> Built with W=1 on UML, x86_64 allmodconfig, and x86_64 allyesconfig with
> zero new warnings or errors.
> 
> Signed-off-by: Wenbo Sun <sunwenbo@cmss.chinamobile.com>

Reviewed-by: Ido Schimmel <idosch@nvidia.com>

      reply	other threads:[~2026-11-24 14:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20  3:23 [PATCH net-next v4] ipv6: check mc_forwarding before calling ip6mr_get_route() Wenbo Sun
2026-11-24 14:41 ` 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=20261124144118.GA3904967@shredder \
    --to=idosch@nvidia.com \
    --cc=1342116488@qq.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@kernel.org \
    --cc=hangbin.liu@linux.dev \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liuhangbin@kylinos.cn \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.org \
    --cc=sunwenbo@cmss.chinamobile.com \
    /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