[PATCH net-next v2 08/10] net/ipv6: leave a note on subtree/nexthop objects
From: David 'equinox' Lamparter <hidden>
Date: 2026-07-23 12:24:15
Also in:
linux-doc, linux-kselftest
Subsystem:
networking [general], networking [ipv4/ipv6], the rest · Maintainers:
"David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, David Ahern, Ido Schimmel, Linus Torvalds
The rule 5.5 code doesn't handle nexthop objects, it doesn't need to since they're currently rejected by the kernel. There's no fundamental reason why nexthop objects can't be supported on subtree / dst-src routes, so leave a note in case somebody wants to do this at a future point in time. (NB: I have no idea what else would need to be addressed for that, hence the "among other things" in the comment.) The error messages on this reject were also just plain worded wrong, source-specific routing and source routing both exist and are very different things, and the source address on a route is yet another distinct thing. Admittedly, "source routing" is sometimes (mis)used to mean source-specific / policy routing, either way let's not add to the confusion. For reference: * source-specific routing: include source address in lookup *after* destination, aka subtree routes, aka dst-src routing, aka SADR (NB: policy routing / ip rule is source *before* destination) * source routing: pre-deciding multiple hops / the path through the network on ingress, e.g. MPLS, segment routing * source attribute on a route: preference to apply when selecting a source address for outbound connections/packets from this system Signed-off-by: David 'equinox' Lamparter <redacted> --- net/ipv4/nexthop.c | 5 ++++- net/ipv6/route.c | 10 +++++++--- 2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/net/ipv4/nexthop.c b/net/ipv4/nexthop.c
index 6205bd57aa85..f26ba66954cc 100644
--- a/net/ipv4/nexthop.c
+++ b/net/ipv4/nexthop.c@@ -1542,8 +1542,11 @@ EXPORT_SYMBOL_GPL(nexthop_for_each_fib6_nh); static int check_src_addr(const struct in6_addr *saddr, struct netlink_ext_ack *extack) { + /* among other things, ipv6_saddr_rule5p5() would need fixing for this + * (it currently doesn't handle nexthop objects / groups) + */ if (!ipv6_addr_any(saddr)) { - NL_SET_ERR_MSG(extack, "IPv6 routes using source address can not use nexthop objects"); + NL_SET_ERR_MSG(extack, "IPv6 dst-src routes (with a source prefix) cannot use nexthop objects"); return -EINVAL; } return 0;
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 704afe2ddea7..3323cda37589 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c@@ -3786,18 +3786,22 @@ static int fib6_config_validate(struct fib6_config *cfg, #ifdef CONFIG_IPV6_SUBTREES if (cfg->fc_src_len > 128) { - NL_SET_ERR_MSG(extack, "Invalid source address length"); + NL_SET_ERR_MSG(extack, "Invalid source prefix length"); goto errout; } + /* among other things, ipv6_saddr_rule5p5() would need fixing for this + * (it currently doesn't handle nexthop objects / groups) + */ if (cfg->fc_nh_id && cfg->fc_src_len) { - NL_SET_ERR_MSG(extack, "Nexthops can not be used with source routing"); + NL_SET_ERR_MSG(extack, + "IPv6 dst-src routes (with a source prefix) cannot use nexthop objects"); goto errout; } #else if (cfg->fc_src_len) { NL_SET_ERR_MSG(extack, - "Specifying source address requires IPV6_SUBTREES to be enabled"); + "Specifying source prefix requires IPV6_SUBTREES to be enabled"); goto errout; } #endif
--
2.53.0