summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2019-01-29 21:35:07 -0500
committerDonald Sharp <sharpd@cumulusnetworks.com>2019-01-29 21:35:07 -0500
commit2da33d6b3acf63f3386c70c43907f529406e8151 (patch)
tree62e4d54f897e7d0464a283d693a14bf9bae69e0b
parent2b697c3d47161101443ea11492396424eb9a2310 (diff)
zebra: Convert route entry id number to string in debugs
The route entry being displayed in debugs was displaying the originating route type as a number. While numbers are cool, I for one am not terribly interested in memorizing them. Modify the (type %d) to a (%s) to just list the string type of the route. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
-rw-r--r--zebra/redistribute.c11
-rw-r--r--zebra/zebra_rib.c61
2 files changed, 38 insertions, 34 deletions
diff --git a/zebra/redistribute.c b/zebra/redistribute.c
index c5769ae06f..2c5350fceb 100644
--- a/zebra/redistribute.c
+++ b/zebra/redistribute.c
@@ -159,10 +159,10 @@ void redistribute_update(const struct prefix *p, const struct prefix *src_p,
if (IS_ZEBRA_DEBUG_RIB) {
zlog_debug(
- "%u:%s: Redist update re %p (type %d), old %p (type %d)",
+ "%u:%s: Redist update re %p (%s), old %p (%s)",
re->vrf_id, prefix2str(p, buf, sizeof(buf)),
- re, re->type, prev_re,
- prev_re ? prev_re->type : -1);
+ re, zebra_route_string(re->type), prev_re,
+ prev_re ? zebra_route_string(prev_re->type) : "None");
}
afi = family2afi(p->family);
@@ -229,8 +229,9 @@ void redistribute_delete(const struct prefix *p, const struct prefix *src_p,
if (IS_ZEBRA_DEBUG_RIB) {
inet_ntop(p->family, &p->u.prefix, buf, INET6_ADDRSTRLEN);
- zlog_debug("%u:%s/%d: Redist delete re %p (type %d)",
- re->vrf_id, buf, p->prefixlen, re, re->type);
+ zlog_debug("%u:%s/%d: Redist delete re %p (%s)",
+ re->vrf_id, buf, p->prefixlen, re,
+ zebra_route_string(re->type));
}
/* Add DISTANCE_INFINITY check. */
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index 1eda55dca0..0d284b74b0 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -1266,8 +1266,9 @@ static void rib_process_add_fib(struct zebra_vrf *zvrf, struct route_node *rn,
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 +1293,9 @@ static void rib_process_del_fib(struct zebra_vrf *zvrf, struct route_node *rn,
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 +1362,16 @@ static void rib_process_update_fib(struct zebra_vrf *zvrf,
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. */
@@ -1430,15 +1433,16 @@ static void rib_process_update_fib(struct zebra_vrf *zvrf,
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 +1587,10 @@ static void rib_process(struct route_node *rn)
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);
@@ -2475,9 +2479,9 @@ void rib_delnode(struct route_node *rn, struct route_entry *re)
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);
@@ -2737,10 +2741,9 @@ int rib_add_multipath(afi_t afi, safi_t safi, struct prefix *p,
/* 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);
@@ -2864,10 +2867,10 @@ void rib_delete(afi_t afi, safi_t safi, vrf_id_t vrf_id, int type,
*/
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);