The rib entries are normally added and deleted when they are
changed. However, they are modified in placae when the nexthop
reachability changes. This fixes to:
 - properly detect nexthop changes from nexthop_active_update()
   calls from rib_process()
 - rib_update_kernel() to not reset FIB flags when a RIB entry
   is being modifed (old and new RIB are same)
 - improves the "show ip route <prefix>" output to display
   both ACTIVE and FIB flags for each nexthop

Fixes: 325823a5 "zebra: support FIB override routes"
Signed-off-by: Timo Teräs <[email protected]>
---
Igor, can you verify if this fixes now the multihop problem for you?

 zebra/zebra_rib.c | 16 ++++++++++------
 zebra/zebra_vty.c |  3 ++-
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index 1650dab..18eece8 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -1078,7 +1078,6 @@ nexthop_active_update (struct route_node *rn, struct rib 
*rib, int set)
   ifindex_t prev_index;
   
   rib->nexthop_active_num = 0;
-  UNSET_FLAG (rib->status, RIB_ENTRY_CHANGED);
 
   for (nexthop = rib->nexthop; nexthop; nexthop = nexthop->next)
   {
@@ -1124,12 +1123,15 @@ rib_update_kernel (struct route_node *rn, struct rib 
*old, struct rib *new)
 
   /* This condition is never met, if we are using rt_socket.c */
   if (ret < 0 && new)
+    {
       for (ALL_NEXTHOPS_RO(new->nexthop, nexthop, tnexthop, recursing))
         UNSET_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB);
-
-  if (old)
-    for (ALL_NEXTHOPS_RO(old->nexthop, nexthop, tnexthop, recursing))
-      UNSET_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB);
+    }
+  else if (old && old != new)
+    {
+      for (ALL_NEXTHOPS_RO(old->nexthop, nexthop, tnexthop, recursing))
+        UNSET_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB);
+    }
 
   return ret;
 }
@@ -1275,6 +1277,8 @@ rib_process (struct route_node *rn)
 
   RNODE_FOREACH_RIB (rn, rib)
     {
+      UNSET_FLAG (rib->status, RIB_ENTRY_CHANGED);
+
       /* Currently installed rib. */
       if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED))
         {
@@ -1323,7 +1327,7 @@ rib_process (struct route_node *rn)
   if (new_fib)
     nexthop_active_update (rn, new_fib, 1);
   if (new_selected && new_selected != new_fib)
-     nexthop_active_update (rn, new_selected, 1);
+    nexthop_active_update (rn, new_selected, 1);
 
   /* Update kernel if FIB entry has changed */
   if (old_fib != new_fib
diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c
index 21b92ea..028b744 100644
--- a/zebra/zebra_vty.c
+++ b/zebra/zebra_vty.c
@@ -1341,7 +1341,8 @@ vty_show_ip_route_detail (struct vty *vty, struct 
route_node *rn, int mcast)
 
       for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing))
         {
-          vty_out (vty, "  %c%s",
+          vty_out (vty, "  %c%c%s",
+                   CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE) ? '>' : ' 
',
                    CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB) ? '*' : ' ',
                    recursing ? "  " : "");
 
-- 
2.8.0


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

Reply via email to