summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Zalamena <rzalamena@opensourcerouting.org>2019-01-17 13:12:13 -0200
committerRafael Zalamena <rzalamena@opensourcerouting.org>2019-01-21 10:40:56 -0200
commitb6df4879b71d4a0f16268ef65b17155a34b19765 (patch)
treed83491eb13a8e45823849d65d3a9bec1994540de
parent7a163a7c59bd1a7e94da356ea033040ae17cef29 (diff)
zebra: fix debug messages with prefixes
Debug messages should use `prefix_buf` and `prefix2str` should only be called once in `kernel_rtm`. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
-rw-r--r--zebra/rt_socket.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/zebra/rt_socket.c b/zebra/rt_socket.c
index e1be018869..dd7030a2b6 100644
--- a/zebra/rt_socket.c
+++ b/zebra/rt_socket.c
@@ -83,7 +83,7 @@ static int kernel_rtm(int cmd, const struct prefix *p,
char prefix_buf[PREFIX_STRLEN];
enum blackhole_type bh_type = BLACKHOLE_UNSPEC;
- if (IS_ZEBRA_DEBUG_RIB)
+ if (IS_ZEBRA_DEBUG_RIB || IS_ZEBRA_DEBUG_KERNEL)
prefix2str(p, prefix_buf, sizeof(prefix_buf));
/*
@@ -259,12 +259,11 @@ static int kernel_rtm(int cmd, const struct prefix *p,
/* Note any unexpected status returns */
default:
- flog_err(EC_LIB_SYSTEM_CALL,
- "%s: %s: rtm_write() unexpectedly returned %d for command %s",
- __func__,
- prefix2str(p, prefix_buf,
- sizeof(prefix_buf)),
- error, lookup_msg(rtm_type_str, cmd, NULL));
+ flog_err(
+ EC_LIB_SYSTEM_CALL,
+ "%s: %s: rtm_write() unexpectedly returned %d for command %s",
+ __func__, prefix_buf, error,
+ lookup_msg(rtm_type_str, cmd, NULL));
break;
}
} /* for (ALL_NEXTHOPS(...))*/
@@ -272,9 +271,9 @@ static int kernel_rtm(int cmd, const struct prefix *p,
/* If there was no useful nexthop, then complain. */
if (nexthop_num == 0) {
if (IS_ZEBRA_DEBUG_KERNEL)
- zlog_debug("%s: No useful nexthops were found in RIB prefix %s",
- __func__, prefix2str(p, prefix_buf,
- sizeof(prefix_buf)));
+ zlog_debug(
+ "%s: No useful nexthops were found in RIB prefix %s",
+ __func__, prefix_buf);
return 1;
}