zebra: rework recursive route resolution
Change the datastructure for recursive routes. This brings the following
benefits:
By using struct nexthop also to store nexthops obtained by recursive
resolution, we can get rid of quite a bit of code duplication in the fib
management. (rt_netlink, rt_socket, ...)
With the new datastructure we can make use of all available paths when
recursive routes are resolved with multipath routes.
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
diff --git a/zebra/zebra_routemap.c b/zebra/zebra_routemap.c
index b3111b8..39c7e1b 100644
--- a/zebra/zebra_routemap.c
+++ b/zebra/zebra_routemap.c
@@ -422,14 +422,10 @@
switch (nexthop->type) {
case NEXTHOP_TYPE_IFINDEX:
case NEXTHOP_TYPE_IFNAME:
+ /* Interface routes can't match ip next-hop */
+ return RMAP_NOMATCH;
case NEXTHOP_TYPE_IPV4_IFINDEX:
case NEXTHOP_TYPE_IPV4_IFNAME:
- if (nexthop->rtype != NEXTHOP_TYPE_IPV4)
- return RMAP_NOMATCH;
- p.family = AF_INET;
- p.prefix = nexthop->rgate.ipv4;
- p.prefixlen = IPV4_MAX_BITLEN;
- break;
case NEXTHOP_TYPE_IPV4:
p.family = AF_INET;
p.prefix = nexthop->gate.ipv4;
@@ -488,14 +484,10 @@
switch (nexthop->type) {
case NEXTHOP_TYPE_IFINDEX:
case NEXTHOP_TYPE_IFNAME:
+ /* Interface routes can't match ip next-hop */
+ return RMAP_NOMATCH;
case NEXTHOP_TYPE_IPV4_IFINDEX:
case NEXTHOP_TYPE_IPV4_IFNAME:
- if (nexthop->rtype != NEXTHOP_TYPE_IPV4)
- return RMAP_NOMATCH;
- p.family = AF_INET;
- p.prefix = nexthop->rgate.ipv4;
- p.prefixlen = IPV4_MAX_BITLEN;
- break;
case NEXTHOP_TYPE_IPV4:
p.family = AF_INET;
p.prefix = nexthop->gate.ipv4;