Mailing List Archive

[PATCH 48/57] bgpd: use prefix2str in debug logs
From: Julien Courtat <julien.courtat@6wind.com>

In order to simplify display of prefixes in debug logs, use prefix2str
which has been updated to take macip prefixes into account.

Signed-off-by: Julien Courtat <julien.courtat@6wind.com>
---
bgpd/bgp_route.c | 48 ++++++++++++++++++++++++++++--------------------
1 file changed, 28 insertions(+), 20 deletions(-)

diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 4b59710a2a10..571dcbdcf1f3 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -3019,6 +3019,11 @@ bgp_update_main (struct peer *peer, struct prefix *p, struct attr *attr,
/* If the update is implicit withdraw. */
if (ri)
{
+ char pstr[PREFIX_STRLEN];
+
+ if (BGP_DEBUG (update, UPDATE_IN))
+ prefix2str(p, pstr, PREFIX_STRLEN);
+
ri->uptime = bgp_clock ();

/* Same attribute comes in. */
@@ -3033,11 +3038,14 @@ bgp_update_main (struct peer *peer, struct prefix *p, struct attr *attr,
&& peer->sort == BGP_PEER_EBGP
&& CHECK_FLAG (ri->flags, BGP_INFO_HISTORY))
{
- if (BGP_DEBUG (update, UPDATE_IN))
- zlog (peer->log, LOG_DEBUG, "%s rcvd %s/%d",
- peer->host,
- inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN),
- p->prefixlen);
+ if (BGP_DEBUG (update, UPDATE_IN))
+ {
+ zlog (peer->log, LOG_DEBUG, "%s rcvd %s",
+ peer->host,
+ pstr);
+ for (size_t i = 0; i < nlabels; i++)
+ zlog (peer->log, LOG_DEBUG, " : label[%lu]=%x", i, labels[i]);
+ }

if (bgp_damp_update (ri, rn, afi, safi) != BGP_DAMP_SUPPRESSED)
{
@@ -3047,13 +3055,15 @@ bgp_update_main (struct peer *peer, struct prefix *p, struct attr *attr,
}
else /* Duplicate - odd */
{
- if (BGP_DEBUG (update, UPDATE_IN))
- zlog (peer->log, LOG_DEBUG,
- "%s rcvd %s/%d...duplicate ignored",
- peer->host,
- inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN),
- p->prefixlen);
-
+ if (BGP_DEBUG (update, UPDATE_IN))
+ {
+ zlog (peer->log, LOG_DEBUG,
+ "%s rcvd %s...duplicate ignored",
+ peer->host,
+ pstr);
+ for (size_t i = 0; i < nlabels; i++)
+ zlog (peer->log, LOG_DEBUG, " : label[%lu]=%x", i, labels[i]);
+ }
/* graceful restart STALE flag unset. */
if (CHECK_FLAG (ri->flags, BGP_INFO_STALE))
{
@@ -3073,19 +3083,17 @@ bgp_update_main (struct peer *peer, struct prefix *p, struct attr *attr,
if (CHECK_FLAG(ri->flags, BGP_INFO_REMOVED))
{
if (BGP_DEBUG (update, UPDATE_IN))
- zlog (peer->log, LOG_DEBUG, "%s rcvd %s/%d, flapped quicker than processing",
+ zlog (peer->log, LOG_DEBUG, "%s rcvd %s, flapped quicker than processing",
peer->host,
- inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN),
- p->prefixlen);
+ pstr);
bgp_info_restore (rn, ri);
}

/* Received Logging. */
- if (BGP_DEBUG (update, UPDATE_IN))
- zlog (peer->log, LOG_DEBUG, "%s rcvd %s/%d",
- peer->host,
- inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN),
- p->prefixlen);
+ if (BGP_DEBUG (update, UPDATE_IN))
+ zlog (peer->log, LOG_DEBUG, "%s rcvd %s",
+ peer->host,
+ pstr);

/* graceful restart STALE flag unset. */
if (CHECK_FLAG (ri->flags, BGP_INFO_STALE))
--
2.1.4


_______________________________________________
Quagga-dev mailing list
Quagga-dev@lists.quagga.net
https://lists.quagga.net/mailman/listinfo/quagga-dev