Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next v3 0/2] ipv6: fix rt6_fill_node() multicast route query handling
@ 2026-11-16  1:47 Wenbo Sun
  2026-11-16  1:47 ` [PATCH net-next v3 1/2] ipv6: check mc_forwarding before calling ip6mr_get_route() Wenbo Sun
  2026-11-16  1:47 ` [PATCH net-next v3 2/2] ipv6: preserve ip6mr_get_route() error in rt6_fill_node() Wenbo Sun
  0 siblings, 2 replies; 5+ messages in thread
From: Wenbo Sun @ 2026-11-16  1:47 UTC (permalink / raw)
  To: David Ahern, Ido Schimmel, David S . Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: Simon Horman, Hangbin Liu, Hangbin Liu, netdev, linux-kernel,
	sunwenbo, 1342116488

When querying an IPv6 multicast route with an input interface (RTA_IIF),
rt6_fill_node() currently calls ip6mr_get_route() unconditionally and
masks any negative error returned by ip6mr_get_route() with -EMSGSIZE at
nla_put_failure.

Patch 1 checks mc_forwarding and excludes interface-local and link-local
multicast destinations (checking dest when available, otherwise
rt6_dst->addr) before calling ip6mr_get_route(), aligning with IPv4
rt_fill_info() and IPv6 ip6_mc_input() so queries fall back to reporting
RTA_IIF and normal route attributes.

Patch 2 preserves the negative error returned by ip6mr_get_route()
instead of overwriting it with -EMSGSIZE when multicast forwarding is
enabled.

Changes in v3:
- In patch 1, also exclude interface-local (IPV6_ADDR_LOOPBACK) and
  link-local (IPV6_ADDR_LINKLOCAL) multicast by checking
  `dest ? : &rt6_dst->addr`, as pointed out by Sashiko review, and drop
  Hangbin Liu's Reviewed-by tag on patch 1 due to the code change.
- Clarify patch 1 commit message regarding skb->dev in
  inet6_rtm_getroute() and add UML test coverage for ff02::1 and ff01::1
  with MRT6_INIT enabled.
- Carry Hangbin Liu's Reviewed-by on unchanged patch 2.
- Link to v2: https://lore.kernel.org/netdev/20261112094630.197244-1-sunwenbo@cmss.chinamobile.com/

Changes in v2:
- Reword patch 1 commit message for clearer tone.
- Add patch 2 to preserve negative errors returned by ip6mr_get_route()
  instead of returning -EMSGSIZE from nla_put_failure, with
  Suggested-by: Hangbin Liu <liuhangbin@kylinos.cn>.
- Verify both mc_forwarding=0 and mc_forwarding=1 (MRT6_INIT) cases in
  a UML kernel alongside W=1 builds on UML, x86_64 allmodconfig, and
  x86_64 allyesconfig.
- Link to v1: https://lore.kernel.org/netdev/20261111094528.425826-1-sunwenbo@cmss.chinamobile.com/

Wenbo Sun (2):
  ipv6: check mc_forwarding before calling ip6mr_get_route()
  ipv6: preserve ip6mr_get_route() error in rt6_fill_node()

 net/ipv6/route.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

-- 
2.33.0




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH net-next v3 1/2] ipv6: check mc_forwarding before calling ip6mr_get_route()
  2026-11-16  1:47 [PATCH net-next v3 0/2] ipv6: fix rt6_fill_node() multicast route query handling Wenbo Sun
@ 2026-11-16  1:47 ` Wenbo Sun
  2026-11-19 13:49   ` netdev-bot+sashiko
  2026-11-16  1:47 ` [PATCH net-next v3 2/2] ipv6: preserve ip6mr_get_route() error in rt6_fill_node() Wenbo Sun
  1 sibling, 1 reply; 5+ messages in thread
From: Wenbo Sun @ 2026-11-16  1:47 UTC (permalink / raw)
  To: David Ahern, Ido Schimmel, David S . Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: Simon Horman, Hangbin Liu, Hangbin Liu, netdev, linux-kernel,
	sunwenbo, 1342116488

When CONFIG_IPV6_MROUTE is enabled, rt6_fill_node() currently calls
ip6mr_get_route() whenever an input interface (RTA_IIF) is specified and
the route destination is multicast.

However, inet6_rtm_getroute() does not set skb->dev on the newly
allocated reply skb, and the looked-up rt6_info carries the matched FIB6
prefix (such as ff00::/8 from addrconf_add_mroute()) rather than the
queried (S,G) addresses. As a result, when multicast forwarding is
disabled (mc_forwarding is 0), ip6mr_get_route() falls into the
cache-miss check and returns -ENODEV, causing rt6_fill_node() to jump to
nla_put_failure and report -EMSGSIZE ("RTNETLINK answers: Message too
long") to userspace. Similarly, interface-local and link-local multicast
groups are never forwarded by ip6_mc_input(), so querying them with
mc_forwarding enabled also enters ip6mr_get_route() and fails instead of
reporting the local route.

In contrast, the IPv4 counterpart rt_fill_info() guards ipmr_get_route()
with !ipv4_is_local_multicast(dst) and IPV4_DEVCONF_ALL_RO(net,
MC_FORWARDING), falling back to emitting RTA_IIF and normal route
attributes.

To align IPv6 behavior with IPv4 and ip6_mc_input(), check that
mc_forwarding is non-zero and that the destination (dest when available,
otherwise rt6_dst->addr) is neither interface-local (IPV6_ADDR_LOOPBACK)
nor link-local (IPV6_ADDR_LINKLOCAL) multicast before calling
ip6mr_get_route().

This discrepancy was identified with the assistance of an LLM-based code
review comparing IPv4 and IPv6 multicast route get handling, confirmed
on a UML kernel where multicast route queries with an input interface
failed on an unpatched kernel, and verified in UML that routable
multicast queries with mc_forwarding disabled as well as link-local
(ff02::1) and interface-local (ff01::1) queries with mc_forwarding
enabled now 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>
---
 net/ipv6/route.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 1b2dcc066e19..27597d149672 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -5868,7 +5868,12 @@ 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)) {
+		const struct in6_addr *mc_dst = dest ? : &rt6_dst->addr;
+
+		if (ipv6_addr_is_multicast(mc_dst) &&
+		    !(ipv6_addr_type(mc_dst) &
+		      (IPV6_ADDR_LOOPBACK | IPV6_ADDR_LINKLOCAL)) &&
+		    atomic_read(&net->ipv6.devconf_all->mc_forwarding)) {
 			int err = ip6mr_get_route(net, skb, rtm, portid);
 
 			if (err == 0)
-- 
2.33.0




^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net-next v3 2/2] ipv6: preserve ip6mr_get_route() error in rt6_fill_node()
  2026-11-16  1:47 [PATCH net-next v3 0/2] ipv6: fix rt6_fill_node() multicast route query handling Wenbo Sun
  2026-11-16  1:47 ` [PATCH net-next v3 1/2] ipv6: check mc_forwarding before calling ip6mr_get_route() Wenbo Sun
@ 2026-11-16  1:47 ` Wenbo Sun
  2026-11-19 13:49   ` netdev-bot+sashiko
  1 sibling, 1 reply; 5+ messages in thread
From: Wenbo Sun @ 2026-11-16  1:47 UTC (permalink / raw)
  To: David Ahern, Ido Schimmel, David S . Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: Simon Horman, Hangbin Liu, Hangbin Liu, netdev, linux-kernel,
	sunwenbo, 1342116488

In rt6_fill_node(), when ip6mr_get_route() fails with a negative error
(for example -ENODEV, -ENOENT, -ENOMEM, or -ENOBUFS), the error path
currently jumps to nla_put_failure and unconditionally returns -EMSGSIZE
("RTNETLINK answers: Message too long").

Among all callers of rt6_fill_node(), only inet6_rtm_getroute() passes
a non-zero input interface (RTA_IIF) and propagates negative errors back
to userspace. Keeping -EMSGSIZE as the default return value for
attribute put failures while preserving the negative error returned by
ip6mr_get_route() lets userspace see the actual failure reason when
multicast forwarding is enabled.

This issue was pointed out during code review of rt6_fill_node() by
Hangbin Liu, confirmed on a UML kernel with MRT6_INIT enabled (where
querying a routable multicast route with an input interface reported
"Message too long" despite the failure in ip6mr_get_route() being
-ENODEV), and verified after the patch that it returns -ENODEV ("No such
device") instead while other rt6_fill_node() paths behave unchanged.

Built with W=1 on UML, x86_64 allmodconfig, and x86_64 allyesconfig with
zero new warnings or errors.

Suggested-by: Hangbin Liu <liuhangbin@kylinos.cn>
Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
Signed-off-by: Wenbo Sun <sunwenbo@cmss.chinamobile.com>
---
 net/ipv6/route.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 27597d149672..d59aa9272a44 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -5814,6 +5814,7 @@ static int rt6_fill_node(struct net *net, struct sk_buff *skb,
 	struct nlmsghdr *nlh;
 	struct rtmsg *rtm;
 	long expires = 0;
+	int err = -EMSGSIZE;
 
 	nlh = nlmsg_put(skb, portid, seq, type, sizeof(*rtm), flags);
 	if (!nlh)
@@ -5874,12 +5875,14 @@ static int rt6_fill_node(struct net *net, struct sk_buff *skb,
 		    !(ipv6_addr_type(mc_dst) &
 		      (IPV6_ADDR_LOOPBACK | IPV6_ADDR_LINKLOCAL)) &&
 		    atomic_read(&net->ipv6.devconf_all->mc_forwarding)) {
-			int err = ip6mr_get_route(net, skb, rtm, portid);
+			int ret = ip6mr_get_route(net, skb, rtm, portid);
 
-			if (err == 0)
+			if (ret == 0)
 				return 0;
-			if (err < 0)
+			if (ret < 0) {
+				err = ret;
 				goto nla_put_failure;
+			}
 		} else
 #endif
 			if (nla_put_u32(skb, RTA_IIF, iif))
@@ -6002,7 +6005,7 @@ static int rt6_fill_node(struct net *net, struct sk_buff *skb,
 
 nla_put_failure:
 	nlmsg_cancel(skb, nlh);
-	return -EMSGSIZE;
+	return err;
 }
 
 static int fib6_info_nh_uses_dev(struct fib6_nh *nh, void *arg)
-- 
2.33.0




^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next v3 1/2] ipv6: check mc_forwarding before calling ip6mr_get_route()
  2026-11-16  1:47 ` [PATCH net-next v3 1/2] ipv6: check mc_forwarding before calling ip6mr_get_route() Wenbo Sun
@ 2026-11-19 13:49   ` netdev-bot+sashiko
  0 siblings, 0 replies; 5+ messages in thread
From: netdev-bot+sashiko @ 2026-11-19 13:49 UTC (permalink / raw)
  To: sunwenbo
  Cc: dsahern, idosch, davem, edumazet, kuba, pabeni, horms,
	hangbin.liu, liuhangbin, netdev, linux-kernel, 1342116488

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

Critical: 0 · High: 1 · Medium: 2 · 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).

- [High] The fix is incomplete: its own root cause is still there.
- [Medium] This is an undisclosed regression.
- [Medium] The commit says link-local (ff02::1) and interface-local
  (ff01::1) queries now succeed with mc_forwarding enabled.
- [Low] The commit fixes a user-visible failure: RTM_GETROUTE with
  RTA_IIF for multicast destinations returns -EMSGSIZE ("RTNETLINK…

--

ipv6: check mc_forwarding before calling ip6mr_get_route()

This commit adds a guard in rt6_fill_node(). ip6mr_get_route() is now
called only when mc_forwarding is enabled and the destination is not
interface-local or link-local multicast. The goal is to match IPv4
rt_fill_info() and stop RTM_GETROUTE with RTA_IIF failing with -EMSGSIZE.

> Signed-off-by: Wenbo Sun <sunwenbo@cmss.chinamobile.com>

[Severity: Low]
This isn't a bug, but this fixes a user-visible failure, so should it
carry a Fixes: tag? The ip6mr_get_route() call under if (iif), with no
mc_forwarding or scope check, appears to date back to:

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

Later commits 22d0bd82cc7c and fd61c6ba313d only renamed the field to
rt6_dst->addr and removed the nowait argument.

> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index 4a4c5ace63c54..305ae2ac359ea 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
> @@ -5868,7 +5868,12 @@ 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)) {
> +		const struct in6_addr *mc_dst = dest ? : &rt6_dst->addr;

[Severity: Medium]
The multicast test now uses dest instead of the matched prefix. Does that
change the result for multicast queries that match a non-multicast route?

The input device may have no ff00::/8 route:

  - addrconf_add_dev() skips IFF_LOOPBACK devices and l3mdev masters
  - addrconf_sit_config() adds it only for IFF_POINTOPOINT devices
  - an admin can delete it

In that case a query for ff0e::1 with iif X can match a ::/0 route via X.
Before this patch rt6_dst->addr was not multicast, so RTA_IIF was emitted
and the query succeeded. That is also how the data path behaves.
ip6_rt_init_dst() picks ip6_mc_input only when the FIB prefix is
multicast:

net/ipv6/route.c:ip6_rt_init_dst() {
    ...
	} else if (ipv6_addr_type(&f6i->fib6_dst.addr) & IPV6_ADDR_MULTICAST) {
		rt->dst.input = ip6_mc_input;
    ...
}

With mc_forwarding != 0, the guard now passes on dest.
ip6mr_get_route() then looks up (::, ::) from rt6i_src/rt6i_dst, misses,
and returns -ENODEV because skb->dev is NULL.

Is this regression intended? The commit message doesn't mention it.

[Severity: Medium]
What happens with RTM_F_FIB_MATCH queries here? The commit message says
ff02::1 and ff01::1 queries with mc_forwarding enabled now succeed. The
fibmatch branch of inet6_rtm_getroute() passes dest as NULL, though:

net/ipv6/route.c:inet6_rtm_getroute() {
    ...
		if (fibmatch)
			err = rt6_fill_node(net, skb, from, NULL, NULL, NULL,
					    iif, RTM_NEWROUTE,
    ...
}

So mc_dst falls back to rt->fib6_dst.addr. For the default ff00::/8
route from addrconf_add_mroute(), that is ff00::.

The multicast scope of ff00:: is 0. ipv6_addr_type() therefore sets
neither IPV6_ADDR_LOOPBACK nor IPV6_ADDR_LINKLOCAL, and the new exclusion
never fires.

With mc_forwarding enabled, a query like:

  ip -6 route get fibmatch ff02::1 iif eth0

still calls ip6mr_get_route(). That call misses on (::, ff00::) and
returns -ENODEV with skb->dev NULL.

Should the fibmatch path check the queried fl6.daddr instead? Or should
it skip the mroute lookup entirely, as the IPv4 fibmatch path
(fib_dump_info()) does?

> +
> +		if (ipv6_addr_is_multicast(mc_dst) &&
> +		    !(ipv6_addr_type(mc_dst) &
> +		      (IPV6_ADDR_LOOPBACK | IPV6_ADDR_LINKLOCAL)) &&
> +		    atomic_read(&net->ipv6.devconf_all->mc_forwarding)) {
>  			int err = ip6mr_get_route(net, skb, rtm, portid);

[Severity: High]
With mc_forwarding enabled and a routable group, does this still fail for
the reason the commit message gives?

Take a query like:

  ip -6 route get ff0e::1 from <S> iif eth0

The guard passes because it tests dest (ff0e::1). But ip6mr_get_route()
never sees dest or src. It works from the dst attached to the reply skb:

net/ipv6/ip6mr.c:ip6mr_get_route() {
    ...
	struct rt6_info *rt = dst_rt6_info(skb_dst(skb));
    ...
	cache = ip6mr_cache_find(mrt, &rt->rt6i_src.addr, &rt->rt6i_dst.addr);
    ...
		dev = skb->dev;
		if (!dev || (vif = ip6mr_find_vif(mrt, dev)) < 0) {
			rcu_read_unlock();
			return -ENODEV;
		}
    ...
}

ip6_rt_copy_init() copies rt6i_dst from the FIB prefix (ff00::/8 from
addrconf_add_mroute()). The lookup is therefore for (::, ff00::), and it
misses even when an (S,G) MFC entry exists.

The miss path then returns -ENODEV. inet6_rtm_getroute() only calls
skb_dst_set(skb, &rt->dst) on the alloc_skb() reply skb and never sets
skb->dev.

So this query still ends in -EMSGSIZE after this patch. After the
follow-up "ipv6: preserve ip6mr_get_route() error in rt6_fill_node()" it
ends in -ENODEV instead.

On the IPv4 side, inet_rtm_getroute() sets skb->dev = dev, and
rt_fill_info() passes the flow addresses through:

net/ipv4/route.c:rt_fill_info() {
    ...
				int err = ipmr_get_route(net, skb,
							 fl4->saddr, fl4->daddr,
							 r, portid);
    ...
}

Would it make sense to pass the queried (S,G) and the input device into
ip6mr_get_route(), as IPv4 does, so the guard and the lookup use the same
addresses? As it stands, the one case that needs the mroute lookup
(routable group with forwarding on) appears to always fail.

[ ... ]

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next v3 2/2] ipv6: preserve ip6mr_get_route() error in rt6_fill_node()
  2026-11-16  1:47 ` [PATCH net-next v3 2/2] ipv6: preserve ip6mr_get_route() error in rt6_fill_node() Wenbo Sun
@ 2026-11-19 13:49   ` netdev-bot+sashiko
  0 siblings, 0 replies; 5+ messages in thread
From: netdev-bot+sashiko @ 2026-11-19 13:49 UTC (permalink / raw)
  To: sunwenbo
  Cc: dsahern, idosch, davem, edumazet, kuba, pabeni, horms,
	hangbin.liu, liuhangbin, netdev, linux-kernel, 1342116488

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

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

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 commit message says the patch 'lets userspace see the
  actual failure reason' and gives -ENOMEM and -ENOBUFS as examples.
- [Low] The patch fixes the errno masking only for IPv6.
- [Low] The commit describes the -EMSGSIZE masking in rt6_fill_node() as
  an 'issue' but has no Fixes: tag.

--

ipv6: preserve ip6mr_get_route() error in rt6_fill_node()

This patch makes rt6_fill_node() return the negative errno from
ip6mr_get_route(). Before, the nla_put_failure label always returned
-EMSGSIZE. Other attribute put failures still return -EMSGSIZE.

> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index 305ae2ac359ea..81effa72c1893 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c

[ ... ]

> @@ -5874,12 +5875,14 @@ static int rt6_fill_node(struct net *net, struct sk_buff *skb,
>  		    !(ipv6_addr_type(mc_dst) &
>  		      (IPV6_ADDR_LOOPBACK | IPV6_ADDR_LINKLOCAL)) &&
>  		    atomic_read(&net->ipv6.devconf_all->mc_forwarding)) {
> -			int err = ip6mr_get_route(net, skb, rtm, portid);
> +			int ret = ip6mr_get_route(net, skb, rtm, portid);
>  
> -			if (err == 0)
> +			if (ret == 0)
>  				return 0;
> -			if (err < 0)
> +			if (ret < 0) {
> +				err = ret;
>  				goto nla_put_failure;
> +			}

[Severity: Medium]
The commit message says this "lets userspace see the actual failure
reason" and gives -ENOMEM and -ENOBUFS as examples. Can those errors be
reached through inet6_rtm_getroute()? It is the only caller that passes a
non-zero iif.

The reply skb is allocated without a device:

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

So skb->dev is NULL when ip6mr_get_route() runs. Its MFC lookup uses
rt->rt6i_src and rt->rt6i_dst. These hold the matched FIB prefix (for
example ff00::/8), not the (S,G) being queried, so the lookup normally
misses. The skb->dev fallback is skipped, and the function returns early:

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

This return comes before the alloc_skb() (-ENOMEM) and
ip6mr_cache_unresolved() (-ENOBUFS) paths. The UML test in the commit
message also reports -ENODEV.

inet6_rtm_getroute() already returns -ENODEV itself when
dev_get_by_index_rcu(net, iif) fails. After this patch, how can userspace
tell a nonexistent RTA_IIF apart from an mroute lookup that never got the
device or the (S,G)?

The preceding commit in the series, "ipv6: check mc_forwarding before
calling ip6mr_get_route()", already says that skb->dev is not set and
that rt6_info holds the prefix, not the (S,G). With mc_forwarding
enabled, "ip -6 route get <G> iif <dev>" for a routable multicast
group still always fails. The patch changes the errno from one misleading
value to another, and the new value becomes uAPI.

IPv4 sets skb->dev and passes fl4->saddr/daddr, so the same query works
there.

Should the lookup itself be fixed? Or should the commit message at least
say which errors can actually be returned?

>  		} else
>  #endif
>  			if (nla_put_u32(skb, RTA_IIF, iif))
> @@ -6002,7 +6005,7 @@ static int rt6_fill_node(struct net *net, struct sk_buff *skb,
>  
>  nla_put_failure:
>  	nlmsg_cancel(skb, nlh);
> -	return -EMSGSIZE;
> +	return err;

[Severity: Low]
IPv4 still has the same masking. In rt_fill_info(), a negative return
from ipmr_get_route() jumps to nla_put_failure, which always returns
-EMSGSIZE:

net/ipv4/route.c:rt_fill_info() {
    ...
				int err = ipmr_get_route(net, skb,
							 fl4->saddr, fl4->daddr,
							 r, portid);

				if (err <= 0) {
					if (err == 0)
						return 0;
					goto nla_put_failure;
				}
    ...
nla_put_failure:
	nlmsg_cancel(skb, nlh);
	return -EMSGSIZE;
}

inet_rtm_getroute() sets skb->dev = dev before it calls rt_fill_info().
That means -ENODEV (iif is not a VIF), -ENOMEM and the errors from
ipmr_cache_unresolved() can all happen on IPv4.

With mc_forwarding on, after this patch "ip -6 route get <mcast> iif X"
returns the ip6mr_get_route() errno. "ip -4 route get <mcast> iif X"
still returns "Message too long".

The preceding commit in the series, "ipv6: check mc_forwarding before
calling ip6mr_get_route()", aims to make IPv6 behave like IPv4.

Should rt_fill_info() get the same change in this series? Or should the
commit message say that IPv4 is out of scope?

[Severity: Low]
This isn't a bug, but the commit message calls the -EMSGSIZE masking an
"issue" and does not have a Fixes: tag.

The masking goes back to commit 7bc570c8b4f75d ("[IPV6] MROUTE: Support
multicast forwarding."). Its current form comes from commit
fd61c6ba313de6 ("net: ipv6: remove nowait arg to rt6_fill_node").

Is this meant as a net-next improvement? If it is meant as a fix, should
it carry a Fixes: tag?

>  }
>  
>  static int fib6_info_nh_uses_dev(struct fib6_nh *nh, void *arg)

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-11-19 13:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-16  1:47 [PATCH net-next v3 0/2] ipv6: fix rt6_fill_node() multicast route query handling Wenbo Sun
2026-11-16  1:47 ` [PATCH net-next v3 1/2] ipv6: check mc_forwarding before calling ip6mr_get_route() Wenbo Sun
2026-11-19 13:49   ` netdev-bot+sashiko
2026-11-16  1:47 ` [PATCH net-next v3 2/2] ipv6: preserve ip6mr_get_route() error in rt6_fill_node() Wenbo Sun
2026-11-19 13:49   ` netdev-bot+sashiko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox