forked from Mirror/frr
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>
This commit is contained in:
parent
e228ca1247
commit
31be7dbbc5
|
@ -131,7 +131,7 @@ static int kernel_rtm(int cmd, const struct prefix *p,
|
||||||
char prefix_buf[PREFIX_STRLEN];
|
char prefix_buf[PREFIX_STRLEN];
|
||||||
enum blackhole_type bh_type = BLACKHOLE_UNSPEC;
|
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));
|
prefix2str(p, prefix_buf, sizeof(prefix_buf));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -301,12 +301,11 @@ static int kernel_rtm(int cmd, const struct prefix *p,
|
||||||
|
|
||||||
/* Note any unexpected status returns */
|
/* Note any unexpected status returns */
|
||||||
default:
|
default:
|
||||||
flog_err(EC_LIB_SYSTEM_CALL,
|
flog_err(
|
||||||
"%s: %s: rtm_write() unexpectedly returned %d for command %s",
|
EC_LIB_SYSTEM_CALL,
|
||||||
__func__,
|
"%s: %s: rtm_write() unexpectedly returned %d for command %s",
|
||||||
prefix2str(p, prefix_buf,
|
__func__, prefix_buf, error,
|
||||||
sizeof(prefix_buf)),
|
lookup_msg(rtm_type_str, cmd, NULL));
|
||||||
error, lookup_msg(rtm_type_str, cmd, NULL));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} /* for (ALL_NEXTHOPS(...))*/
|
} /* for (ALL_NEXTHOPS(...))*/
|
||||||
|
@ -314,9 +313,9 @@ static int kernel_rtm(int cmd, const struct prefix *p,
|
||||||
/* If there was no useful nexthop, then complain. */
|
/* If there was no useful nexthop, then complain. */
|
||||||
if (nexthop_num == 0) {
|
if (nexthop_num == 0) {
|
||||||
if (IS_ZEBRA_DEBUG_KERNEL)
|
if (IS_ZEBRA_DEBUG_KERNEL)
|
||||||
zlog_debug("%s: No useful nexthops were found in RIB prefix %s",
|
zlog_debug(
|
||||||
__func__, prefix2str(p, prefix_buf,
|
"%s: No useful nexthops were found in RIB prefix %s",
|
||||||
sizeof(prefix_buf)));
|
__func__, prefix_buf);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue