summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_debug.c
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas@opensourcerouting.org>2022-11-29 09:23:20 +0100
committerDonatas Abraitis <donatas@opensourcerouting.org>2022-11-29 16:36:13 +0100
commit073801481b0f298a22fa71ee7bbac74adb5e80b9 (patch)
treeb67c22ef736b22e809f4c71ba5e830f4054c1f60 /bgpd/bgp_debug.c
parentMerge pull request #12375 from chiragshah6/fdev1 (diff)
downloadfrr-073801481b0f298a22fa71ee7bbac74adb5e80b9.tar.xz
frr-073801481b0f298a22fa71ee7bbac74adb5e80b9.zip
bgpd: inet_ntop() adjustments
Use %pI4/%pI6 where possible, otherwise at least atjust stack buffer sizes for inet_ntop() calls. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
Diffstat (limited to 'bgpd/bgp_debug.c')
-rw-r--r--bgpd/bgp_debug.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/bgpd/bgp_debug.c b/bgpd/bgp_debug.c
index 92a22d71b..bfde1c127 100644
--- a/bgpd/bgp_debug.c
+++ b/bgpd/bgp_debug.c
@@ -378,8 +378,6 @@ bool bgp_debug_peer_updout_enabled(char *host)
/* Dump attribute. */
bool bgp_dump_attr(struct attr *attr, char *buf, size_t size)
{
- char addrbuf[BUFSIZ];
-
if (!attr)
return false;
@@ -395,15 +393,12 @@ bool bgp_dump_attr(struct attr *attr, char *buf, size_t size)
/* Add MP case. */
if (attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL
|| attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL)
- snprintf(buf + strlen(buf), size - strlen(buf),
- ", mp_nexthop %s",
- inet_ntop(AF_INET6, &attr->mp_nexthop_global, addrbuf,
- BUFSIZ));
+ snprintfrr(buf + strlen(buf), size - strlen(buf),
+ ", mp_nexthop %pI6", &attr->mp_nexthop_global);
if (attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL)
- snprintf(buf + strlen(buf), size - strlen(buf), "(%s)",
- inet_ntop(AF_INET6, &attr->mp_nexthop_local, addrbuf,
- BUFSIZ));
+ snprintfrr(buf + strlen(buf), size - strlen(buf), "(%pI6)",
+ &attr->mp_nexthop_local);
if (attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV4)
snprintfrr(buf, size, "nexthop %pI4", &attr->nexthop);