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 <everton.marques@gmail.com>
Cc: Balaji G <balajig81@gmail.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index a07036e..b4ea242 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -1124,8 +1124,16 @@
{
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;
+ }
+
/*
* Make sure we update the FPM any time we send new information to
* the kernel.
@@ -1157,8 +1165,16 @@
{
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.
@@ -1187,9 +1203,12 @@
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))
@@ -1306,9 +1325,6 @@
if (! nexthop_active_update (rn, rib, 0))
continue;
- if (info->safi == SAFI_MULTICAST)
- continue;
-
/* Infinit distance. */
if (rib->distance == DISTANCE_INFINITY)
continue;
@@ -1371,7 +1387,8 @@
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");
redistribute_delete (&rn->p, select);
if (! RIB_SYSTEM_ROUTE (select))
@@ -1414,7 +1431,8 @@
if (IS_ZEBRA_DEBUG_RIB)
rnode_debug (rn, "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");
redistribute_delete (&rn->p, fib);
if (! RIB_SYSTEM_ROUTE (fib))
@@ -1434,7 +1452,8 @@
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. */
nexthop_active_update (rn, select, 1);
@@ -3267,6 +3286,7 @@
rib_close_table (struct route_table *table)
{
struct route_node *rn;
+ rib_table_info_t *info = table->info;
struct rib *rib;
if (table)
@@ -3276,7 +3296,8 @@
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);