diff options
author | David Lamparter <equinox@opensourcerouting.org> | 2015-01-22 19:09:36 +0100 |
---|---|---|
committer | David Lamparter <equinox@opensourcerouting.org> | 2015-01-30 01:12:20 +0100 |
commit | 29ce93ebf6427d1d64eae8b385e36873e3ddcb88 (patch) | |
tree | 35c1db9ecf10ac368fe6d46faa9573c3d9f74a94 /zebra/zebra_rib.c | |
parent | c048dccaf537508019ccda658d75bbb0cfd7ad18 (diff) | |
download | quagga-29ce93ebf6427d1d64eae8b385e36873e3ddcb88.tar.bz2 quagga-29ce93ebf6427d1d64eae8b385e36873e3ddcb88.tar.xz |
zebra: return route_node from rib_match_ipv4_safi
The multicast code needs to know the route_node in addition to the rib
entry in order to perform distance or prefix-length comparisons. Add it
as optional "out" pointer parameter.
Cc: Everton Marques <everton.marques@gmail.com>
Cc: Balaji G <balajig81@gmail.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'zebra/zebra_rib.c')
-rw-r--r-- | zebra/zebra_rib.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index b4ea2424..abef90fb 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -719,7 +719,8 @@ nexthop_active_ipv6 (struct rib *rib, struct nexthop *nexthop, int set, #endif /* HAVE_IPV6 */ struct rib * -rib_match_ipv4_safi (struct in_addr addr, safi_t safi, int skip_bgp) +rib_match_ipv4_safi (struct in_addr addr, safi_t safi, int skip_bgp, + struct route_node **rn_out) { struct route_table *table; struct route_node *rn; @@ -759,16 +760,22 @@ rib_match_ipv4_safi (struct in_addr addr, safi_t safi, int skip_bgp) } else { - if (match->type == ZEBRA_ROUTE_CONNECT) - /* Directly point connected route. */ - return match; - else + if (match->type != ZEBRA_ROUTE_CONNECT) { + int found = 0; for (ALL_NEXTHOPS_RO(match->nexthop, newhop, tnewhop, recursing)) if (CHECK_FLAG (newhop->flags, NEXTHOP_FLAG_FIB)) - return match; - return NULL; + { + found = 1; + break; + } + if (!found) + return NULL; } + + if (rn_out) + *rn_out = rn; + return match; } } return NULL; |