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

From: Wenbo Sun

Date: Sun Nov 15 2026 - 20:48:35 EST


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@xxxxxxxxxxxxxxxxxxxx/

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@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 to v1: https://lore.kernel.org/netdev/20261111094528.425826-1-sunwenbo@xxxxxxxxxxxxxxxxxxxx/

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