From f3a1732eb3bb41c094ec558d2aeee2766878a91d Mon Sep 17 00:00:00 2001 From: Christian Franke Date: Fri, 5 Jul 2013 15:35:41 +0000 Subject: zebra: apply route-maps for interface routes Signed-off-by: Christian Franke Signed-off-by: David Lamparter --- zebra/zebra_rib.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 3106523d..ace69cac 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]) -- cgit v1.2.1