From 416ec78d3a8661f04ef724099db07311bb53dff0 Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Mon, 12 Jan 2015 07:05:06 +0100 Subject: [PATCH] zebra: dummy kernel "install" multicast routes This is a followup to 9511633 ("zebra: MBGP routes should not be installed in the kernel"), which was correct in disabling MRIB routes being installed in the kernel, yet broke the MRIB since now routes were never marked as active. Hence, push down the check into the kernel install functions, so that the routes are still marked active. At the same time, the FPM calls get a check each since otherwise we'd bump the FPM interface on MRIB updates. Fixes: 9511633 ("zebra: MBGP routes should not be installed in the kernel") Cc: Everton Marques Cc: Balaji G Signed-off-by: David Lamparter --- zebra/zebra_rib.c | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 3503310ecf..e428471564 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -1160,8 +1160,16 @@ rib_install_kernel (struct route_node *rn, struct rib *rib, int update) { int ret = 0; struct nexthop *nexthop, *tnexthop; + rib_table_info_t *info = rn->table->info; int recursing; + if (info->safi != SAFI_UNICAST) + { + for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing)) + SET_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB); + return ret; + } + /* * Make sure we update the FPM any time we send new information to * the kernel. @@ -1207,8 +1215,16 @@ rib_uninstall_kernel (struct route_node *rn, struct rib *rib) { int ret = 0; struct nexthop *nexthop, *tnexthop; + rib_table_info_t *info = rn->table->info; int recursing; + if (info->safi != SAFI_UNICAST) + { + for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing)) + SET_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB); + return ret; + } + /* * Make sure we update the FPM any time we send new information to * the kernel. @@ -1235,9 +1251,12 @@ rib_uninstall_kernel (struct route_node *rn, struct rib *rib) static void rib_uninstall (struct route_node *rn, struct rib *rib) { + rib_table_info_t *info = rn->table->info; + if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED)) { - zfpm_trigger_update (rn, "rib_uninstall"); + if (info->safi == SAFI_UNICAST) + zfpm_trigger_update (rn, "rib_uninstall"); redistribute_delete (&rn->p, rib); if (! RIB_SYSTEM_ROUTE (rib)) @@ -1710,7 +1729,8 @@ rib_process (struct route_node *rn) select, fib); if (CHECK_FLAG (select->flags, ZEBRA_FLAG_CHANGED)) { - zfpm_trigger_update (rn, "updating existing route"); + if (info->safi == SAFI_UNICAST) + zfpm_trigger_update (rn, "updating existing route"); /* Set real nexthop. */ /* Need to check if any NHs are active to clear the @@ -1781,7 +1801,8 @@ rib_process (struct route_node *rn) if (IS_ZEBRA_DEBUG_RIB) rnode_debug (rn, vrf_id, "Removing existing route, fib %p", fib); - zfpm_trigger_update (rn, "removing existing route"); + if (info->safi == SAFI_UNICAST) + zfpm_trigger_update (rn, "removing existing route"); /* If there's no route to replace this with, withdraw redistribute and * uninstall from kernel. @@ -1813,7 +1834,8 @@ rib_process (struct route_node *rn) if (IS_ZEBRA_DEBUG_RIB) rnode_debug (rn, "Adding route, select %p", select); - zfpm_trigger_update (rn, "new route selected"); + if (info->safi == SAFI_UNICAST) + zfpm_trigger_update (rn, "new route selected"); /* Set real nexthop. */ if (nexthop_active_update (rn, select, 1)) @@ -3931,6 +3953,7 @@ void rib_close_table (struct route_table *table) { struct route_node *rn; + rib_table_info_t *info = table->info; struct rib *rib; if (table) @@ -3940,7 +3963,8 @@ rib_close_table (struct route_table *table) if (!CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED)) continue; - zfpm_trigger_update (rn, NULL); + if (info->safi == SAFI_UNICAST) + zfpm_trigger_update (rn, NULL); if (! RIB_SYSTEM_ROUTE (rib)) rib_uninstall_kernel (rn, rib); -- 2.39.5