Re: [PATCH net-next v3 2/2] ipv6: preserve ip6mr_get_route() error in rt6_fill_node()

From: Wenbo Sun

Date: Thu Nov 19 2026 - 22:23:17 EST


Thank you for the review on v3 2/2. We analyzed and reproduced each point in
UML (`CONFIG_IP_MROUTE=y`, `CONFIG_IPV6_MROUTE=y`):

1. [Medium] Unreachable -ENOMEM / -ENOBUFS examples and misleading -ENODEV:

Agreed. Because `inet6_rtm_getroute()` allocates the reply skb without
assigning `skb->dev` and `ip6mr_get_route()` looks up `rt->rt6i_src/dst`
(`::, ff00::`) rather than the queried `(S,G)`, `ip6mr_get_route()` always
hits the `if (!dev || ...)` check and returns `-ENODEV` (or `-ENOENT` if no
mrt table exists) before ever reaching `alloc_skb()` (`-ENOMEM`) or
`ip6mr_cache_unresolved()` (`-ENOBUFS`).

We confirmed in UML that even after registering `d0` via `MRT6_ADD_MIF` and
installing `(S=2001:db8::3, G=ff0e::1)` via `MRT6_ADD_MFC`, running:
$ ip -6 route get ff0e::1 from 2001:db8::3 iif d0
RTNETLINK answers: No such device
still returns `-ENODEV`, which is indistinguishable from the `-ENODEV`
returned by `dev_get_by_index_rcu(net, iif)` in `inet6_rtm_getroute()` when
`RTA_IIF` refers to a nonexistent interface.

2. [Low] IPv4 `rt_fill_info()` having the same `-EMSGSIZE` masking:

Confirmed in UML as well. When IPv4 multicast routing is enabled via
`setsockopt(fd4, IPPROTO_IP, MRT_INIT, &one, sizeof(one))` on an `AF_INET`
`SOCK_RAW` (`IPPROTO_IGMP`) socket and `d0` is not added as a VIF,
`ipmr_get_route()` returns `-ENODEV` and `rt_fill_info()` maps it to
`-EMSGSIZE` at `nla_put_failure`:
$ ip -4 route get 239.1.1.1 from 10.0.0.3 iif d0
RTNETLINK answers: Message too long

3. [Low] Fixes tag / patch scope:

Given points 1 and 2 above, changing the error return in `rt6_fill_node()`
from `-EMSGSIZE` to `-ENODEV` before `ip6mr_get_route()` is taught to
receive `skb->dev` and the queried `(S,G)` would diverge from IPv4
`rt_fill_info()` and expose a misleading `-ENODEV` to userspace.

Therefore, we are dropping patch 2/2 in v4 and submitting v4 as a focused
single patch ("ipv6: check mc_forwarding before calling ip6mr_get_route()")
that fixes the `rt6_fill_node()` guard for `mc_forwarding == 0`,
interface-local/link-local multicast, `RTM_F_FIB_MATCH`, and non-multicast
matched routes.

Thanks,
Wenbo