]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: Add vrf name to debug output
authorDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 14 Feb 2020 13:41:04 +0000 (08:41 -0500)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 14 Feb 2020 13:41:42 +0000 (08:41 -0500)
The vrf id is insufficient of a discriminator in people's head
Give them what they need.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
zebra/interface.c
zebra/redistribute.c
zebra/zapi_msg.c
zebra/zebra_ptm.c
zebra/zebra_rib.c

index 7e7397a3bbc600327a1cb6cb56226684136c82d0..a434ba0d38df08b396822b4cd2286bfb7952388b 100644 (file)
@@ -617,11 +617,14 @@ void if_add_update(struct interface *ifp)
                SET_FLAG(ifp->status, ZEBRA_INTERFACE_ACTIVE);
 
                if (if_data->shutdown == IF_ZEBRA_SHUTDOWN_ON) {
-                       if (IS_ZEBRA_DEBUG_KERNEL)
+                       if (IS_ZEBRA_DEBUG_KERNEL) {
                                zlog_debug(
-                                       "interface %s vrf %u index %d is shutdown. "
+                                       "interface %s vrf %s(%u) index %d is shutdown. "
                                        "Won't wake it up.",
-                                       ifp->name, ifp->vrf_id, ifp->ifindex);
+                                       ifp->name, VRF_LOGNAME(zvrf->vrf),
+                                       ifp->vrf_id, ifp->ifindex);
+                       }
+
                        return;
                }
 
@@ -629,13 +632,15 @@ void if_add_update(struct interface *ifp)
 
                if (IS_ZEBRA_DEBUG_KERNEL)
                        zlog_debug(
-                               "interface %s vrf %u index %d becomes active.",
-                               ifp->name, ifp->vrf_id, ifp->ifindex);
+                               "interface %s vrf %s(%u) index %d becomes active.",
+                               ifp->name, VRF_LOGNAME(zvrf->vrf), ifp->vrf_id,
+                               ifp->ifindex);
 
        } else {
                if (IS_ZEBRA_DEBUG_KERNEL)
-                       zlog_debug("interface %s vrf %u index %d is added.",
-                                  ifp->name, ifp->vrf_id, ifp->ifindex);
+                       zlog_debug("interface %s vrf %s(%u) index %d is added.",
+                                  ifp->name, VRF_LOGNAME(zvrf->vrf),
+                                  ifp->vrf_id, ifp->ifindex);
        }
 }
 
@@ -774,10 +779,12 @@ void if_delete_update(struct interface *ifp)
        struct zebra_if *zif;
 
        if (if_is_up(ifp)) {
+               struct vrf *vrf = vrf_lookup_by_id(ifp->vrf_id);
+
                flog_err(
                        EC_LIB_INTERFACE,
-                       "interface %s vrf %u index %d is still up while being deleted.",
-                       ifp->name, ifp->vrf_id, ifp->ifindex);
+                       "interface %s vrf %s(%u) index %d is still up while being deleted.",
+                       ifp->name, VRF_LOGNAME(vrf), ifp->vrf_id, ifp->ifindex);
                return;
        }
 
@@ -787,9 +794,13 @@ void if_delete_update(struct interface *ifp)
        /* Mark interface as inactive */
        UNSET_FLAG(ifp->status, ZEBRA_INTERFACE_ACTIVE);
 
-       if (IS_ZEBRA_DEBUG_KERNEL)
-               zlog_debug("interface %s vrf %u index %d is now inactive.",
-                          ifp->name, ifp->vrf_id, ifp->ifindex);
+       if (IS_ZEBRA_DEBUG_KERNEL) {
+               struct vrf *vrf = vrf_lookup_by_id(ifp->vrf_id);
+
+               zlog_debug("interface %s vrf %s(%u) index %d is now inactive.",
+                          ifp->name, VRF_LOGNAME(vrf), ifp->vrf_id,
+                          ifp->ifindex);
+       }
 
        /* Delete connected routes from the kernel. */
        if_delete_connected(ifp);
@@ -1863,7 +1874,8 @@ DEFUN (show_interface_desc_vrf_all,
 
        RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
                if (!RB_EMPTY(if_name_head, &vrf->ifaces_by_name)) {
-                       vty_out(vty, "\n\tVRF %u\n\n", vrf->vrf_id);
+                       vty_out(vty, "\n\tVRF %s(%u)\n\n", VRF_LOGNAME(vrf),
+                               vrf->vrf_id);
                        if_show_description(vty, vrf->vrf_id);
                }
 
index b891fb121fe4699f4ae53697da7347150518c53f..03bb19923fccc55cc6fbc13c0f1f0ed48b9f510f 100644 (file)
@@ -339,9 +339,10 @@ void zebra_redistribute_add(ZAPI_HANDLER_ARGS)
 
        if (IS_ZEBRA_DEBUG_EVENT)
                zlog_debug(
-                       "%s: client proto %s afi=%d, wants %s, vrf %u, instance=%d",
+                       "%s: client proto %s afi=%d, wants %s, vrf %s(%u), instance=%d",
                        __func__, zebra_route_string(client->proto), afi,
-                       zebra_route_string(type), zvrf_id(zvrf), instance);
+                       zebra_route_string(type), VRF_LOGNAME(zvrf->vrf),
+                       zvrf_id(zvrf), instance);
 
        if (afi == 0 || afi >= AFI_MAX) {
                flog_warn(EC_ZEBRA_REDISTRIBUTE_UNKNOWN_AF,
@@ -368,8 +369,10 @@ void zebra_redistribute_add(ZAPI_HANDLER_ARGS)
                if (!vrf_bitmap_check(client->redist[afi][type],
                                      zvrf_id(zvrf))) {
                        if (IS_ZEBRA_DEBUG_EVENT)
-                               zlog_debug("%s: setting vrf %u redist bitmap",
-                                          __func__, zvrf_id(zvrf));
+                               zlog_debug(
+                                       "%s: setting vrf %s(%u) redist bitmap",
+                                       __func__, VRF_LOGNAME(zvrf->vrf),
+                                       zvrf_id(zvrf));
                        vrf_bitmap_set(client->redist[afi][type],
                                       zvrf_id(zvrf));
                        zebra_redistribute(client, type, 0, zvrf_id(zvrf), afi);
index 4d0e34561a5a8854abc889fca35eb41cc3071951..02b8cb9723a2dddce810ab14b663813df2719c64 100644 (file)
@@ -1946,6 +1946,7 @@ static void zread_table_manager_connect(struct zserv *client,
        struct stream *s;
        uint8_t proto;
        uint16_t instance;
+       struct vrf *vrf = vrf_lookup_by_id(vrf_id);
 
        s = msg;
 
@@ -1961,8 +1962,9 @@ static void zread_table_manager_connect(struct zserv *client,
                zsend_table_manager_connect_response(client, vrf_id, 1);
                return;
        }
-       zlog_notice("client %d with vrf %u instance %u connected as %s",
-                   client->sock, vrf_id, instance, zebra_route_string(proto));
+       zlog_notice("client %d with vrf %s(%u) instance %u connected as %s",
+                   client->sock, VRF_LOGNAME(vrf), vrf_id, instance,
+                   zebra_route_string(proto));
        client->proto = proto;
        client->instance = instance;
 
index 681b4d1ab8af69c2b7b01b39772b8dd492b83174..b80c9026a7286fffea226897a36ffc1f2e279698 100644 (file)
@@ -441,15 +441,17 @@ static void if_bfd_session_update(struct interface *ifp, struct prefix *dp,
                                dp->prefixlen, ifp->name,
                                bfd_get_status_str(status));
                } else {
+                       struct vrf *vrf = vrf_lookup_by_id(vrf_id);
+
                        zlog_debug(
                                "MESSAGE: ZEBRA_INTERFACE_BFD_DEST_UPDATE %s/%d "
-                               "with src %s/%d and vrf %u %s event",
+                               "with src %s/%d and vrf %s(%u) %s event",
                                inet_ntop(dp->family, &dp->u.prefix, buf[0],
                                          INET6_ADDRSTRLEN),
                                dp->prefixlen,
                                inet_ntop(sp->family, &sp->u.prefix, buf[1],
                                          INET6_ADDRSTRLEN),
-                               sp->prefixlen, vrf_id,
+                               sp->prefixlen, VRF_LOGNAME(vrf), vrf_id,
                                bfd_get_status_str(status));
                }
        }
index 57bd986872e93a942c2eb5ad80713b9f4d0b3d95..7f919e47e1bc996573a23047e4aae2d19a6bf6df 100644 (file)
@@ -2408,13 +2408,14 @@ void _route_entry_dump(const char *func, union prefixconstptr pp,
        char srcaddr[PREFIX_STRLEN];
        char nhname[PREFIX_STRLEN];
        struct nexthop *nexthop;
+       struct vrf *vrf = vrf_lookup_by_id(re->vrf_id);
 
-       zlog_debug("%s: dumping RE entry %p for %s%s%s vrf %u", func,
+       zlog_debug("%s: dumping RE entry %p for %s%s%s vrf %s(%u)", func,
                   (const void *)re, prefix2str(pp, straddr, sizeof(straddr)),
                   is_srcdst ? " from " : "",
                   is_srcdst ? prefix2str(src_pp, srcaddr, sizeof(srcaddr))
                             : "",
-                  re->vrf_id);
+                  VRF_LOGNAME(vrf), re->vrf_id);
        zlog_debug("%s: uptime == %lu, type == %u, instance == %d, table == %d",
                   straddr, (unsigned long)re->uptime, re->type, re->instance,
                   re->table);