summaryrefslogtreecommitdiff
path: root/bgpd/bgp_debug.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2017-11-16 20:43:56 -0500
committerDonald Sharp <sharpd@cumulusnetworks.com>2017-11-17 09:04:26 -0500
commita69ea8aeac9d6cc5c27c084d02a0ddcd96231e46 (patch)
tree88399c020efd0d768e90865bf2da3cc9f92c149c /bgpd/bgp_debug.c
parent68e1a55bb151f398104f43aefc66f106f6b26bae (diff)
bgpd: Only build json for community when needed
Building a communities json object every time is both expensive and memory wasteful. Modify code to only build the json object when needed. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'bgpd/bgp_debug.c')
-rw-r--r--bgpd/bgp_debug.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/bgpd/bgp_debug.c b/bgpd/bgp_debug.c
index 6e16d5f45b..45ac8e6859 100644
--- a/bgpd/bgp_debug.c
+++ b/bgpd/bgp_debug.c
@@ -385,7 +385,8 @@ int bgp_dump_attr(struct attr *attr, char *buf, size_t size)
if (CHECK_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_COMMUNITIES)))
snprintf(buf + strlen(buf), size - strlen(buf),
- ", community %s", community_str(attr->community));
+ ", community %s", community_str(attr->community,
+ false));
if (CHECK_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES)))
snprintf(buf + strlen(buf), size - strlen(buf),