From: Donald Sharp Date: Mon, 23 Apr 2018 12:26:33 +0000 (-0400) Subject: zebra: Add some information to redistribute debugs X-Git-Tag: frr-5.0-dev~26^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=refs%2Fpull%2F2108%2Fhead;p=mirror%2Ffrr.git zebra: Add some information to redistribute debugs When we are debugging add a bit of extra information so we can know what we are redistributing to our peers Signed-off-by: Donald Sharp --- diff --git a/zebra/redistribute.c b/zebra/redistribute.c index a51cd6ecc9..1d66653e74 100644 --- a/zebra/redistribute.c +++ b/zebra/redistribute.c @@ -113,18 +113,20 @@ static void zebra_redistribute(struct zserv *client, int type, for (rn = route_top(table); rn; rn = srcdest_route_next(rn)) RNODE_FOREACH_RE (rn, newre) { struct prefix *dst_p, *src_p; + char buf[PREFIX_STRLEN]; + srcdest_rnode_prefixes(rn, &dst_p, &src_p); if (IS_ZEBRA_DEBUG_EVENT) zlog_debug( - "%s: client %s vrf %d checking: selected=%d, type=%d, distance=%d, " - "zebra_check_addr=%d", + "%s: client %s %s(%d) checking: selected=%d, type=%d, distance=%d, metric=%d zebra_check_addr=%d", __func__, zebra_route_string(client->proto), + prefix2str(dst_p, buf, sizeof(buf)), vrf_id, CHECK_FLAG(newre->flags, ZEBRA_FLAG_SELECTED), newre->type, newre->distance, - zebra_check_addr(dst_p)); + newre->metric, zebra_check_addr(dst_p)); if (!CHECK_FLAG(newre->flags, ZEBRA_FLAG_SELECTED)) continue; @@ -151,13 +153,13 @@ void redistribute_update(struct prefix *p, struct prefix *src_p, struct zserv *client; int send_redistribute; int afi; - char buf[INET6_ADDRSTRLEN]; + char buf[PREFIX_STRLEN]; if (IS_ZEBRA_DEBUG_RIB) { - inet_ntop(p->family, &p->u.prefix, buf, INET6_ADDRSTRLEN); zlog_debug( - "%u:%s/%d: Redist update re %p (type %d), old %p (type %d)", - re->vrf_id, buf, p->prefixlen, re, re->type, prev_re, + "%u:%s: Redist update re %p (type %d), old %p (type %d)", + re->vrf_id, prefix2str(p, buf, sizeof(buf)), + re, re->type, prev_re, prev_re ? prev_re->type : -1); } @@ -187,6 +189,15 @@ void redistribute_update(struct prefix *p, struct prefix *src_p, send_redistribute = 1; if (send_redistribute) { + if (IS_ZEBRA_DEBUG_EVENT) { + zlog_debug( + "%s: client %s %s(%d), type=%d, distance=%d, metric=%d", + __func__, + zebra_route_string(client->proto), + prefix2str(p, buf, sizeof(buf)), + re->vrf_id, re->type, + re->distance, re->metric); + } zsend_redistribute_route(ZEBRA_REDISTRIBUTE_ROUTE_ADD, client, p, src_p, re); } else if (prev_re