This is a hack for Linux kernel, who does not support device-only routes for IPv6 multipath.
Signed-off-by: Soha Jin <s...@jin.sh> --- proto/ospf/rt.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/proto/ospf/rt.c b/proto/ospf/rt.c index efcd4e17..54372070 100644 --- a/proto/ospf/rt.c +++ b/proto/ospf/rt.c @@ -1796,13 +1796,6 @@ calc_next_hop(struct ospf_area *oa, struct top_hash_entry *en, if (ifa->type == OSPF_IT_VLINK) return new_nexthop(p, IPA_NONE, NULL, 0); - /* - * The type of the ospf_iface is PtP and the iface is a physical PtP link, - * so we can simply use the iface, and skip further resolving. - */ - if (ifa->type == OSPF_IT_PTP && !(ifa->iface->flags & IF_MULTIACCESS)) - return new_nexthop(p, IPA_NONE, ifa->iface, ifa->ecmp_weight); - if (ospf_is_v2(p) || ospf_is_ip6(p)) { /* @@ -1819,6 +1812,15 @@ calc_next_hop(struct ospf_area *oa, struct top_hash_entry *en, } else { + /* + * The type of the ospf_iface is PtP and the iface is a physical PtP link, + * so we can simply use the iface, and skip further resolving. + * HACK: Linux kernel doesn't support device-only routes for IPv6 + * multipath, that's why this if-branch is placed here rather than above. + */ + if (ifa->type == OSPF_IT_PTP && !(ifa->iface->flags & IF_MULTIACCESS)) + return new_nexthop(p, IPA_NONE, ifa->iface, ifa->ecmp_weight); + /* * Next-hop is taken from lladdr field of Link-LSA, based on Neighbor * Iface ID (nif) field in our Router-LSA, which is just nbr->iface_id. -- 2.39.2