zebra: Add vrf name to debug output

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>
This commit is contained in:
Donald Sharp 2020-02-14 08:41:04 -05:00
parent 24c4ee4a1f
commit c479e75665
5 changed files with 43 additions and 23 deletions

View File

@ -617,11 +617,14 @@ void if_add_update(struct interface *ifp)
SET_FLAG(ifp->status, ZEBRA_INTERFACE_ACTIVE); SET_FLAG(ifp->status, ZEBRA_INTERFACE_ACTIVE);
if (if_data->shutdown == IF_ZEBRA_SHUTDOWN_ON) { if (if_data->shutdown == IF_ZEBRA_SHUTDOWN_ON) {
if (IS_ZEBRA_DEBUG_KERNEL) if (IS_ZEBRA_DEBUG_KERNEL) {
zlog_debug( zlog_debug(
"interface %s vrf %u index %d is shutdown. " "interface %s vrf %s(%u) index %d is shutdown. "
"Won't wake it up.", "Won't wake it up.",
ifp->name, ifp->vrf_id, ifp->ifindex); ifp->name, VRF_LOGNAME(zvrf->vrf),
ifp->vrf_id, ifp->ifindex);
}
return; return;
} }
@ -629,13 +632,15 @@ void if_add_update(struct interface *ifp)
if (IS_ZEBRA_DEBUG_KERNEL) if (IS_ZEBRA_DEBUG_KERNEL)
zlog_debug( zlog_debug(
"interface %s vrf %u index %d becomes active.", "interface %s vrf %s(%u) index %d becomes active.",
ifp->name, ifp->vrf_id, ifp->ifindex); ifp->name, VRF_LOGNAME(zvrf->vrf), ifp->vrf_id,
ifp->ifindex);
} else { } else {
if (IS_ZEBRA_DEBUG_KERNEL) if (IS_ZEBRA_DEBUG_KERNEL)
zlog_debug("interface %s vrf %u index %d is added.", zlog_debug("interface %s vrf %s(%u) index %d is added.",
ifp->name, ifp->vrf_id, ifp->ifindex); 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; struct zebra_if *zif;
if (if_is_up(ifp)) { if (if_is_up(ifp)) {
struct vrf *vrf = vrf_lookup_by_id(ifp->vrf_id);
flog_err( flog_err(
EC_LIB_INTERFACE, EC_LIB_INTERFACE,
"interface %s vrf %u index %d is still up while being deleted.", "interface %s vrf %s(%u) index %d is still up while being deleted.",
ifp->name, ifp->vrf_id, ifp->ifindex); ifp->name, VRF_LOGNAME(vrf), ifp->vrf_id, ifp->ifindex);
return; return;
} }
@ -787,9 +794,13 @@ void if_delete_update(struct interface *ifp)
/* Mark interface as inactive */ /* Mark interface as inactive */
UNSET_FLAG(ifp->status, ZEBRA_INTERFACE_ACTIVE); UNSET_FLAG(ifp->status, ZEBRA_INTERFACE_ACTIVE);
if (IS_ZEBRA_DEBUG_KERNEL) if (IS_ZEBRA_DEBUG_KERNEL) {
zlog_debug("interface %s vrf %u index %d is now inactive.", struct vrf *vrf = vrf_lookup_by_id(ifp->vrf_id);
ifp->name, ifp->vrf_id, ifp->ifindex);
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. */ /* Delete connected routes from the kernel. */
if_delete_connected(ifp); if_delete_connected(ifp);
@ -1863,7 +1874,8 @@ DEFUN (show_interface_desc_vrf_all,
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
if (!RB_EMPTY(if_name_head, &vrf->ifaces_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); if_show_description(vty, vrf->vrf_id);
} }

View File

@ -339,9 +339,10 @@ void zebra_redistribute_add(ZAPI_HANDLER_ARGS)
if (IS_ZEBRA_DEBUG_EVENT) if (IS_ZEBRA_DEBUG_EVENT)
zlog_debug( 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, __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) { if (afi == 0 || afi >= AFI_MAX) {
flog_warn(EC_ZEBRA_REDISTRIBUTE_UNKNOWN_AF, 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], if (!vrf_bitmap_check(client->redist[afi][type],
zvrf_id(zvrf))) { zvrf_id(zvrf))) {
if (IS_ZEBRA_DEBUG_EVENT) if (IS_ZEBRA_DEBUG_EVENT)
zlog_debug("%s: setting vrf %u redist bitmap", zlog_debug(
__func__, zvrf_id(zvrf)); "%s: setting vrf %s(%u) redist bitmap",
__func__, VRF_LOGNAME(zvrf->vrf),
zvrf_id(zvrf));
vrf_bitmap_set(client->redist[afi][type], vrf_bitmap_set(client->redist[afi][type],
zvrf_id(zvrf)); zvrf_id(zvrf));
zebra_redistribute(client, type, 0, zvrf_id(zvrf), afi); zebra_redistribute(client, type, 0, zvrf_id(zvrf), afi);

View File

@ -1946,6 +1946,7 @@ static void zread_table_manager_connect(struct zserv *client,
struct stream *s; struct stream *s;
uint8_t proto; uint8_t proto;
uint16_t instance; uint16_t instance;
struct vrf *vrf = vrf_lookup_by_id(vrf_id);
s = msg; s = msg;
@ -1961,8 +1962,9 @@ static void zread_table_manager_connect(struct zserv *client,
zsend_table_manager_connect_response(client, vrf_id, 1); zsend_table_manager_connect_response(client, vrf_id, 1);
return; return;
} }
zlog_notice("client %d with vrf %u instance %u connected as %s", zlog_notice("client %d with vrf %s(%u) instance %u connected as %s",
client->sock, vrf_id, instance, zebra_route_string(proto)); client->sock, VRF_LOGNAME(vrf), vrf_id, instance,
zebra_route_string(proto));
client->proto = proto; client->proto = proto;
client->instance = instance; client->instance = instance;

View File

@ -441,15 +441,17 @@ static void if_bfd_session_update(struct interface *ifp, struct prefix *dp,
dp->prefixlen, ifp->name, dp->prefixlen, ifp->name,
bfd_get_status_str(status)); bfd_get_status_str(status));
} else { } else {
struct vrf *vrf = vrf_lookup_by_id(vrf_id);
zlog_debug( zlog_debug(
"MESSAGE: ZEBRA_INTERFACE_BFD_DEST_UPDATE %s/%d " "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], inet_ntop(dp->family, &dp->u.prefix, buf[0],
INET6_ADDRSTRLEN), INET6_ADDRSTRLEN),
dp->prefixlen, dp->prefixlen,
inet_ntop(sp->family, &sp->u.prefix, buf[1], inet_ntop(sp->family, &sp->u.prefix, buf[1],
INET6_ADDRSTRLEN), INET6_ADDRSTRLEN),
sp->prefixlen, vrf_id, sp->prefixlen, VRF_LOGNAME(vrf), vrf_id,
bfd_get_status_str(status)); bfd_get_status_str(status));
} }
} }

View File

@ -2408,13 +2408,14 @@ void _route_entry_dump(const char *func, union prefixconstptr pp,
char srcaddr[PREFIX_STRLEN]; char srcaddr[PREFIX_STRLEN];
char nhname[PREFIX_STRLEN]; char nhname[PREFIX_STRLEN];
struct nexthop *nexthop; 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)), (const void *)re, prefix2str(pp, straddr, sizeof(straddr)),
is_srcdst ? " from " : "", is_srcdst ? " from " : "",
is_srcdst ? prefix2str(src_pp, srcaddr, sizeof(srcaddr)) 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", zlog_debug("%s: uptime == %lu, type == %u, instance == %d, table == %d",
straddr, (unsigned long)re->uptime, re->type, re->instance, straddr, (unsigned long)re->uptime, re->type, re->instance,
re->table); re->table);