]> git.proxmox.com Git - mirror_frr.git/commitdiff
Merge pull request #3699 from donaldsharp/zebra_rib_debugs
authorDavid Lamparter <equinox@diac24.net>
Thu, 31 Jan 2019 00:51:52 +0000 (01:51 +0100)
committerGitHub <noreply@github.com>
Thu, 31 Jan 2019 00:51:52 +0000 (01:51 +0100)
Zebra Respect my authority

1  2 
zebra/zebra_rib.c

diff --combined zebra/zebra_rib.c
index 3445136d1f209f74d76c6fafe0703e1ec01f9d57,3205f68b6882d9daedd6f0221cde3baf2cf690c5..3a8ec0249ac30215c7853086c496936c9dd7d62c
@@@ -437,6 -437,14 +437,14 @@@ static int nexthop_active(afi_t afi, st
        if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_EVPN_RVTEP))
                return 1;
  
+       /*
+        * If the kernel has sent us a route, then
+        * by golly gee whiz it's a good route.
+        */
+       if (re->type == ZEBRA_ROUTE_KERNEL ||
+           re->type == ZEBRA_ROUTE_SYSTEM)
+               return 1;
        /* Skip nexthops that have been filtered out due to route-map */
        /* The nexthops are specific to this route and so the same */
        /* nexthop for a different route may not have this flag set */
@@@ -1266,8 -1274,9 +1274,9 @@@ static void rib_process_add_fib(struct 
        if (IS_ZEBRA_DEBUG_RIB) {
                char buf[SRCDEST2STR_BUFFER];
                srcdest_rnode2str(rn, buf, sizeof(buf));
-               zlog_debug("%u:%s: Adding route rn %p, re %p (type %d)",
-                          zvrf_id(zvrf), buf, rn, new, new->type);
+               zlog_debug("%u:%s: Adding route rn %p, re %p (%s)",
+                          zvrf_id(zvrf), buf, rn, new,
+                          zebra_route_string(new->type));
        }
  
        /* If labeled-unicast route, install transit LSP. */
@@@ -1292,8 -1301,9 +1301,9 @@@ static void rib_process_del_fib(struct 
        if (IS_ZEBRA_DEBUG_RIB) {
                char buf[SRCDEST2STR_BUFFER];
                srcdest_rnode2str(rn, buf, sizeof(buf));
-               zlog_debug("%u:%s: Deleting route rn %p, re %p (type %d)",
-                          zvrf_id(zvrf), buf, rn, old, old->type);
+               zlog_debug("%u:%s: Deleting route rn %p, re %p (%s)",
+                          zvrf_id(zvrf), buf, rn, old,
+                          zebra_route_string(old->type));
        }
  
        /* If labeled-unicast route, uninstall transit LSP. */
@@@ -1360,15 -1370,16 +1370,16 @@@ static void rib_process_update_fib(stru
                                srcdest_rnode2str(rn, buf, sizeof(buf));
                                if (new != old)
                                        zlog_debug(
-                                               "%u:%s: Updating route rn %p, re %p (type %d) "
-                                               "old %p (type %d)",
+                                               "%u:%s: Updating route rn %p, re %p (%s) old %p (%s)",
                                                zvrf_id(zvrf), buf, rn, new,
-                                               new->type, old, old->type);
+                                               zebra_route_string(new->type),
+                                               old,
+                                               zebra_route_string(old->type));
                                else
                                        zlog_debug(
-                                               "%u:%s: Updating route rn %p, re %p (type %d)",
+                                               "%u:%s: Updating route rn %p, re %p (%s)",
                                                zvrf_id(zvrf), buf, rn, new,
-                                               new->type);
+                                               zebra_route_string(new->type));
                        }
  
                        /* If labeled-unicast route, uninstall transit LSP. */
                                srcdest_rnode2str(rn, buf, sizeof(buf));
                                if (new != old)
                                        zlog_debug(
-                                               "%u:%s: Deleting route rn %p, re %p (type %d) "
-                                               "old %p (type %d) - nexthop inactive",
+                                               "%u:%s: Deleting route rn %p, re %p (%s) old %p (%s) - nexthop inactive",
                                                zvrf_id(zvrf), buf, rn, new,
-                                               new->type, old, old->type);
+                                               zebra_route_string(new->type),
+                                               old,
+                                               zebra_route_string(old->type));
                                else
                                        zlog_debug(
-                                               "%u:%s: Deleting route rn %p, re %p (type %d) - nexthop inactive",
+                                               "%u:%s: Deleting route rn %p, re %p (%s) - nexthop inactive",
                                                zvrf_id(zvrf), buf, rn, new,
-                                               new->type);
+                                               zebra_route_string(new->type));
                        }
  
                        /* If labeled-unicast route, uninstall transit LSP. */
@@@ -1583,10 -1595,10 +1595,10 @@@ static void rib_process(struct route_no
        RNODE_FOREACH_RE_SAFE (rn, re, next) {
                if (IS_ZEBRA_DEBUG_RIB_DETAILED)
                        zlog_debug(
-                               "%u:%s: Examine re %p (type %d) status %x flags %x "
-                               "dist %d metric %d",
-                               vrf_id, buf, re, re->type, re->status,
-                               re->flags, re->distance, re->metric);
+                               "%u:%s: Examine re %p (%s) status %x flags %x dist %d metric %d",
+                               vrf_id, buf, re, zebra_route_string(re->type),
+                               re->status, re->flags, re->distance,
+                               re->metric);
  
                UNSET_FLAG(re->status, ROUTE_ENTRY_NEXTHOPS_CHANGED);
  
@@@ -1933,16 -1945,7 +1945,16 @@@ static void rib_process_result(struct z
                                UNSET_FLAG(re->status, ROUTE_ENTRY_FAILED);
                                SET_FLAG(re->status, ROUTE_ENTRY_INSTALLED);
                        }
 -                      if (old_re) {
 +                      /*
 +                       * On an update operation from the same route type
 +                       * context retrieval currently has no way to know
 +                       * which was the old and which was the new.
 +                       * So don't unset our flags that we just set.
 +                       * We know redistribution is ok because the
 +                       * old_re in this case is used for nothing
 +                       * more than knowing whom to contact if necessary.
 +                       */
 +                      if (old_re && old_re != re) {
                                UNSET_FLAG(old_re->status, ROUTE_ENTRY_FAILED);
                                UNSET_FLAG(old_re->status,
                                           ROUTE_ENTRY_INSTALLED);
@@@ -2484,9 -2487,9 +2496,9 @@@ void rib_delnode(struct route_node *rn
                if (IS_ZEBRA_DEBUG_RIB) {
                        char buf[SRCDEST2STR_BUFFER];
                        srcdest_rnode2str(rn, buf, sizeof(buf));
-                       zlog_debug(
-                               "%u:%s: Freeing route rn %p, re %p (type %d)",
-                               re->vrf_id, buf, rn, re, re->type);
+                       zlog_debug("%u:%s: Freeing route rn %p, re %p (%s)",
+                                  re->vrf_id, buf, rn, re,
+                                  zebra_route_string(re->type));
                }
  
                rib_unlink(rn, re);
@@@ -2746,10 -2749,9 +2758,9 @@@ int rib_add_multipath(afi_t afi, safi_
  
        /* Link new re to node.*/
        if (IS_ZEBRA_DEBUG_RIB) {
-               rnode_debug(
-                       rn, re->vrf_id,
-                       "Inserting route rn %p, re %p (type %d) existing %p",
-                       (void *)rn, (void *)re, re->type, (void *)same);
+               rnode_debug(rn, re->vrf_id,
+                           "Inserting route rn %p, re %p (%s) existing %p",
+                           rn, re, zebra_route_string(re->type), same);
  
                if (IS_ZEBRA_DEBUG_RIB_DETAILED)
                        route_entry_dump(p, src_p, re);
@@@ -2873,10 -2875,10 +2884,10 @@@ void rib_delete(afi_t afi, safi_t safi
                 */
                if (fib && CHECK_FLAG(flags, ZEBRA_FLAG_SELFROUTE)) {
                        if (IS_ZEBRA_DEBUG_RIB) {
-                               rnode_debug(
-                                       rn, vrf_id,
-                                       "rn %p, re %p (type %d) was deleted from kernel, adding",
-                                       rn, fib, fib->type);
+                               rnode_debug(rn, vrf_id,
+                                           "rn %p, re %p (%s) was deleted from kernel, adding",
+                                           rn, fib,
+                                           zebra_route_string(fib->type));
                        }
                        if (allow_delete) {
                                UNSET_FLAG(fib->status, ROUTE_ENTRY_INSTALLED);