summaryrefslogtreecommitdiff
path: root/zebra
diff options
context:
space:
mode:
authorChristian Franke <chris@opensourcerouting.org>2013-07-05 15:35:41 +0000
committerDavid Lamparter <equinox@opensourcerouting.org>2013-09-19 18:04:40 +0200
commitf3a1732eb3bb41c094ec558d2aeee2766878a91d (patch)
tree9cc740a8d4b37bb5e1aa2c00ea1102a26d67809b /zebra
parentc3e6b595160cd3aa601ae7e1887e695710cde15d (diff)
zebra: apply route-maps for interface routes
Signed-off-by: Christian Franke <chris@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'zebra')
-rw-r--r--zebra/zebra_rib.c12
1 files changed, 12 insertions, 0 deletions
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])