[quagga-dev 10578] [PATCH 5/5] zebra: apply route-maps for interface routes

Christian Franke chris at opensourcerouting.org
Fri Jul 5 17:35:41 BST 2013


Signed-off-by: Christian Franke <chris at opensourcerouting.org>
---
 zebra/zebra_rib.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index 3106523..ace69ca 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -950,6 +950,7 @@ static unsigned
 nexthop_active_check (struct route_node *rn, struct rib *rib,
 		      struct nexthop *nexthop, int set)
 {
+  rib_table_info_t *info = rn->table->info;
   struct interface *ifp;
   route_map_result_t ret = RMAP_MATCH;
   extern char *proto_rm[AFI_MAX][ZEBRA_ROUTE_MAX+1];
@@ -1027,11 +1028,22 @@ nexthop_active_check (struct route_node *rn, struct rib *rib,
   if (! CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE))
     return 0;
 
+  /* XXX: What exactly do those checks do? Do we support
+   * e.g. IPv4 routes with IPv6 nexthops or vice versa? */
   if (RIB_SYSTEM_ROUTE(rib) ||
       (family == AFI_IP && rn->p.family != AF_INET) ||
       (family == AFI_IP6 && rn->p.family != AF_INET6))
     return CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE);
 
+  /* The original code didn't determine the family correctly
+   * e.g. for NEXTHOP_TYPE_IFINDEX. Retrieve the correct afi
+   * from the rib_table_info in those cases.
+   * Possibly it may be better to use only the rib_table_info
+   * in every case.
+   */
+  if (!family)
+    family = info->afi;
+
   rmap = 0;
   if (rib->type >= 0 && rib->type < ZEBRA_ROUTE_MAX &&
         	proto_rm[family][rib->type])
-- 
1.7.10.4





More information about the Quagga-dev mailing list