Re: [PATCH net-next v2 0/2] ipv6: fix rt6_fill_node() multicast route query handling

From: Hangbin Liu

Date: Thu Nov 12 2026 - 21:52:09 EST


On Thu, Nov 12, 2026 at 05:46:28PM +0800, Wenbo Sun wrote:
> When querying an IPv6 multicast route with an input interface via
> "ip -6 route get <mcast_addr> from <src_addr> iif <dev>", 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 before calling ip6mr_get_route(), matching
> IPv4 rt_fill_info() so queries succeed with RTA_IIF when multicast
> routing is disabled. Patch 2 preserves the negative error returned by
> ip6mr_get_route() instead of overwriting it with -EMSGSIZE when
> multicast forwarding is enabled.
>
> Thanks to Hangbin Liu for reviewing v1 and pointing out the error
> masking issue in rt6_fill_node().
>
> Changes in v2:
> - Reword patch 1 commit message for clearer tone and carry
> Reviewed-by: Hangbin Liu <liuhangbin@xxxxxxxxxx>.
> - 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@xxxxxxxxxx>.
> - 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: https://lore.kernel.org/netdev/20261111094528.425826-1-sunwenbo@xxxxxxxxxxxxxxxxxxxx/ [v1]
>
> 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 | 14 +++++++++-----
> 1 file changed, 9 insertions(+), 5 deletions(-)
>
> --
> 2.33.0
>
>
>

Reviewed-by: Hangbin Liu <liuhangbin@xxxxxxxxxx>