From 894cb4f68956bb991709d0143795dd95c280b6e8 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Mon, 11 Mar 2024 10:40:22 -0400 Subject: [PATCH] bgpd: When using dev build add pointer information to %pBD When building FRR with `--enable-dev-build`. Add a bit of code to include the pointer value as part of the output. Helps with tracking down issues and let's us see more data when using the dev build option. New output: 2024/03/08 19:48:56 BGP: [V0J1J-W5RHA] 11.0.20.1/32(0x5759ddf8d7c0) for 11.0.20.1/32 Signed-off-by: Donald Sharp --- bgpd/bgp_table.c | 4 ++++ doc/developer/logging.rst | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/bgpd/bgp_table.c b/bgpd/bgp_table.c index 8465ada99671..781909b65dd7 100644 --- a/bgpd/bgp_table.c +++ b/bgpd/bgp_table.c @@ -239,7 +239,11 @@ static ssize_t printfrr_bd(struct fbuf *buf, struct printfrr_eargs *ea, if (!dest) return bputs(buf, "(null)"); +#if !defined(DEV_BUILD) /* need to get the real length even if buffer too small */ prefix2str(p, cbuf, sizeof(cbuf)); return bputs(buf, cbuf); +#else + return bprintfrr(buf, "%s(%p)", prefix2str(p, cbuf, sizeof(cbuf)), dest); +#endif } diff --git a/doc/developer/logging.rst b/doc/developer/logging.rst index 6058b8c0fca4..82cc8b205eab 100644 --- a/doc/developer/logging.rst +++ b/doc/developer/logging.rst @@ -383,7 +383,8 @@ bgpd .. frrfmt:: %pBD (struct bgp_dest *) - Print prefix for a BGP destination. + Print prefix for a BGP destination. When using ``--enable-dev-build`` include + the pointer value for the bgp_dest. :frrfmtout:`fe80::1234/64`