Skip to content
Permalink
Browse files

bgpd: convert zlog_warns to debugs or errors

Several zlog_warns were being used to tell the end
user that bgp had detected a bug.  These all look like information
added during development that can be noted as debugs or logged
as an error situation.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
  • Loading branch information...
donaldsharp committed Aug 16, 2018
1 parent 9ab2969 commit d8d084d97febb886748be2f77790b0ee9cbe08dd
Showing with 12 additions and 37 deletions.
  1. +12 −26 bgpd/bgp_route.c
  2. +0 −11 bgpd/bgpd.c
@@ -38,6 +38,7 @@
#include "queue.h"
#include "memory.h"
#include "lib/json.h"
#include "lib_errors.h"

#include "bgpd/bgpd.h"
#include "bgpd/bgp_table.h"
@@ -353,12 +354,9 @@ static void bgp_pcount_adjust(struct bgp_node *rn, struct bgp_info *ri)
/* slight hack, but more robust against errors. */
if (ri->peer->pcount[table->afi][table->safi])
ri->peer->pcount[table->afi][table->safi]--;
else {
zlog_warn(
"%s: Asked to decrement 0 prefix count for peer %s",
__func__, ri->peer->host);
zlog_backtrace(LOG_WARNING);
}
else
flog_err(LIB_ERR_DEVELOPMENT,
"Asked to decrement 0 prefix count for peer");
} else if (BGP_INFO_COUNTABLE(ri)
&& !CHECK_FLAG(ri->flags, BGP_INFO_COUNTED)) {
SET_FLAG(ri->flags, BGP_INFO_COUNTED);
@@ -1052,8 +1050,8 @@ static enum filter_type bgp_input_filter(struct peer *peer, struct prefix *p,

#define FILTER_EXIST_WARN(F, f, filter) \
if (BGP_DEBUG(update, UPDATE_IN) && !(F##_IN(filter))) \
zlog_warn("%s: Could not find configured input %s-list %s!", \
peer->host, #f, F##_IN_NAME(filter));
zlog_debug("%s: Could not find configured input %s-list %s!", \
peer->host, #f, F##_IN_NAME(filter));

if (DISTRIBUTE_IN_NAME(filter)) {
FILTER_EXIST_WARN(DISTRIBUTE, distribute, filter);
@@ -1091,8 +1089,8 @@ static enum filter_type bgp_output_filter(struct peer *peer, struct prefix *p,

#define FILTER_EXIST_WARN(F, f, filter) \
if (BGP_DEBUG(update, UPDATE_OUT) && !(F##_OUT(filter))) \
zlog_warn("%s: Could not find configured output %s-list %s!", \
peer->host, #f, F##_OUT_NAME(filter));
zlog_debug("%s: Could not find configured output %s-list %s!", \
peer->host, #f, F##_OUT_NAME(filter));

if (DISTRIBUTE_OUT_NAME(filter)) {
FILTER_EXIST_WARN(DISTRIBUTE, distribute, filter);
@@ -9807,8 +9805,6 @@ static int bgp_peer_count_walker(struct thread *t)
pc->count[PCOUNT_ADJ_IN]++;

for (ri = rn->info; ri; ri = ri->next) {
char buf[SU_ADDRSTRLEN];

if (ri->peer != peer)
continue;

@@ -9830,22 +9826,12 @@ static int bgp_peer_count_walker(struct thread *t)
if (CHECK_FLAG(ri->flags, BGP_INFO_COUNTED)) {
pc->count[PCOUNT_COUNTED]++;
if (CHECK_FLAG(ri->flags, BGP_INFO_UNUSEABLE))
zlog_warn(
"%s [pcount] %s/%d is counted but flags 0x%x",
peer->host,
inet_ntop(rn->p.family,
&rn->p.u.prefix, buf,
SU_ADDRSTRLEN),
rn->p.prefixlen, ri->flags);
flog_err(LIB_ERR_DEVELOPMENT,
"Attempting to count but flags say it is unusable");
} else {
if (!CHECK_FLAG(ri->flags, BGP_INFO_UNUSEABLE))
zlog_warn(
"%s [pcount] %s/%d not counted but flags 0x%x",
peer->host,
inet_ntop(rn->p.family,
&rn->p.u.prefix, buf,
SU_ADDRSTRLEN),
rn->p.prefixlen, ri->flags);
flog_err(LIB_ERR_DEVELOPMENT,
"Not counted but flags say we should");
}
}
}
@@ -6631,17 +6631,6 @@ char *peer_uptime(time_t uptime2, char *buf, size_t len, uint8_t use_json,
time_t uptime1, epoch_tbuf;
struct tm *tm;

/* Check buffer length. */
if (len < BGP_UPTIME_LEN) {
if (!use_json) {
zlog_warn("peer_uptime (): buffer shortage %lu",
(unsigned long)len);
/* XXX: should return status instead of buf... */
snprintf(buf, len, "<error> ");
}
return buf;
}

/* If there is no connection has been done before print `never'. */
if (uptime2 == 0) {
if (use_json) {

0 comments on commit d8d084d

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.