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 <[email protected]>
Cc: Balaji G <[email protected]>
Signed-off-by: David Lamparter <[email protected]>
---
 zebra/zebra_rib.c | 37 +++++++++++++++++++++++++++++--------
 1 file changed, 29 insertions(+), 8 deletions(-)

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 @@ rib_install_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;
+    }
+
   /*
    * Make sure we update the FPM any time we send new information to
    * the kernel.
@@ -1157,8 +1165,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.
@@ -1187,9 +1203,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))
@@ -1306,9 +1325,6 @@ rib_process (struct route_node *rn)
       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 @@ 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");
 
           redistribute_delete (&rn->p, select);
           if (! RIB_SYSTEM_ROUTE (select))
@@ -1414,7 +1431,8 @@ rib_process (struct route_node *rn)
       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 @@ 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. */
       nexthop_active_update (rn, select, 1);
@@ -3267,6 +3286,7 @@ static void
 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 @@ 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.0.4


_______________________________________________
Quagga-dev mailing list
[email protected]
https://lists.quagga.net/mailman/listinfo/quagga-dev

Reply via email to