mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: sunwenbo@cmss.chinamobile.com
Cc: dsahern@kernel.org, idosch@nvidia.com, davem@davemloft.net,
	edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
	horms@kernel.org, hangbin.liu@linux.dev, liuhangbin@kylinos.cn,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	1342116488@qq.com
Subject: Re: [PATCH net-next v2 1/2] ipv6: check mc_forwarding before calling ip6mr_get_route()
Date: Mon, 16 Nov 2026 13:54:34 +0000	[thread overview]
Message-ID: <179483727465.3136.6148701646538562238@kernel.org> (raw)
In-Reply-To: <20261112094630.197244-2-sunwenbo@cmss.chinamobile.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 1

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] The fix only works when multicast forwarding is off.
- [Low] The commit fixes a reproducible, user-visible failure: on
  CONFIG_IPV6_MROUTE kernels with mc_forwarding at 0, `ip -6 route get…

--

ipv6: check mc_forwarding before calling ip6mr_get_route()

This commit makes the ip6mr_get_route() call in rt6_fill_node() depend
on devconf_all->mc_forwarding. With multicast forwarding disabled,
multicast route get queries with an iif then emit RTA_IIF and the normal
route attributes. The goal is to match IPv4 rt_fill_info() behavior.

> Signed-off-by: Wenbo Sun <sunwenbo@cmss.chinamobile.com>
> Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>

[Severity: Low]
This fixes a user-visible "RTNETLINK answers: Message too long" from
ip -6 route get, but the commit has no Fixes: tag.

git blame traces the multicast ip6mr_get_route() branch in
rt6_fill_node(), which had no mc_forwarding check, back to:

commit 7bc570c8b4f7 ("[IPV6] MROUTE: Support multicast forwarding.")

Later commits changed that branch: fd61c6ba313d ("net: ipv6: remove
nowait arg to rt6_fill_node") reworked the error handling, and
22d0bd82cc7c ("ipv6: use rt6_info members when dst is set in
rt6_fill_node") changed the condition.

Could a Fixes: tag be added so stable backporters can tell which
releases need this?

> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index 04098cf32eabe..cb8cfd8b5c8b7 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
> @@ -5862,7 +5862,8 @@ static int rt6_fill_node(struct net *net, struct sk_buff *skb,
>  #endif
>  	if (iif) {
>  #ifdef CONFIG_IPV6_MROUTE
> -		if (ipv6_addr_is_multicast(&rt6_dst->addr)) {
> +		if (ipv6_addr_is_multicast(&rt6_dst->addr) &&
> +		    atomic_read(&net->ipv6.devconf_all->mc_forwarding)) {
>  			int err = ip6mr_get_route(net, skb, rtm, portid);
>  
>  			if (err == 0)

[Severity: Medium]
Does this cover only the forwarding-disabled case? The commit message
says the -ENODEV comes from skb->dev being NULL in the reply skb that
inet6_rtm_getroute() allocates. After this patch, skb->dev is still
never set.

In the iif branch of inet6_rtm_getroute(), dev is resolved and passed
to the lookup, but the reply skb only gets a dst:

net/ipv6/route.c:inet6_rtm_getroute() {
    ...
		dst = ip6_route_input_lookup(net, dev, &fl6, NULL, flags);
    ...
	skb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL);
    ...
	skb_dst_set(skb, &rt->dst);
    ...
}

When a multicast routing daemon opens an mroute socket, ip6mr_sk_init()
does:

		atomic_inc(&net->ipv6.devconf_all->mc_forwarding);

After that the new check passes, and ip6mr_get_route() is still called
with a NULL skb->dev. On a cache miss, the (*,G) lookup guarded by
"if (!cache && skb->dev)" is skipped, and then:

net/ipv6/ip6mr.c:ip6mr_get_route() {
    ...
		dev = skb->dev;
		if (!dev || (vif = ip6mr_find_vif(mrt, dev)) < 0) {
			rcu_read_unlock();
			return -ENODEV;
		}
    ...
}

This happens even when the iif is a configured MIF.

In that setup, would "ip -6 route get <mcast> from <src> iif <dev>"
still return -EMSGSIZE? With the follow-up "ipv6: preserve
ip6mr_get_route() error in rt6_fill_node()" applied, it would return
-ENODEV instead, but the query would still fail.

For comparison, IPv4's inet_rtm_getroute() sets the device on the reply
skb:

		fl4.flowi4_iif = iif; /* for rt_fill_info */
		skb->dev	= dev;

This lets ipmr_get_route() find the VIF, then either queue an
unresolved entry or return the mroute data.

Should inet6_rtm_getroute() also set skb->dev = dev in its iif branch,
so that the "matching IPv4 behavior" claim also holds with
mc_forwarding enabled?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261112094630.197244-1-sunwenbo%40cmss.chinamobile.com

  reply	other threads:[~2026-11-16 13:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-12  9:46 [PATCH net-next v2 0/2] ipv6: fix rt6_fill_node() multicast route query handling Wenbo Sun
2026-11-12  9:46 ` [PATCH net-next v2 1/2] ipv6: check mc_forwarding before calling ip6mr_get_route() Wenbo Sun
2026-11-16 13:54   ` netdev-bot+sashiko [this message]
2026-11-12  9:46 ` [PATCH net-next v2 2/2] ipv6: preserve ip6mr_get_route() error in rt6_fill_node() Wenbo Sun
2026-11-16 13:54   ` netdev-bot+sashiko
2026-11-13  2:29 ` [PATCH net-next v2 0/2] ipv6: fix rt6_fill_node() multicast route query handling Hangbin Liu

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=179483727465.3136.6148701646538562238@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --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=idosch@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liuhangbin@kylinos.cn \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --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

all inboxes | Powered by JetHome®