From d63f3ff7cc00761118cc4e89a107968910b4b552 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Thu, 25 Nov 2021 17:29:30 +0200 Subject: [PATCH] ospfd: Replace prefix2str for JSON to %pFX Signed-off-by: Donatas Abraitis --- ospfd/ospf_vty.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 84469160d3..24ea764385 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -5966,7 +5966,6 @@ static int show_lsa_summary(struct vty *vty, struct ospf_lsa *lsa, int self, struct summary_lsa *sl; struct as_external_lsa *asel; struct prefix_ipv4 p; - char buf[PREFIX2STR_BUFFER]; if (lsa != NULL) /* If self option is set, check LSA self flag. */ @@ -6025,10 +6024,9 @@ static int show_lsa_summary(struct vty *vty, struct ospf_lsa *lsa, int self, if (!json_lsa) vty_out(vty, " %pFX", &p); else { - prefix2str(&p, buf, sizeof(buf)); - json_object_string_add(json_lsa, - "summaryAddress", - buf); + json_object_string_addf( + json_lsa, "summaryAddress", + "%pFX", &p); } break; case OSPF_AS_EXTERNAL_LSA: @@ -6050,15 +6048,14 @@ static int show_lsa_summary(struct vty *vty, struct ospf_lsa *lsa, int self, (unsigned long)ntohl( asel->e[0].route_tag)); else { - prefix2str(&p, buf, sizeof(buf)); json_object_string_add( json_lsa, "metricType", IS_EXTERNAL_METRIC( asel->e[0].tos) ? "E2" : "E1"); - json_object_string_add(json_lsa, - "route", buf); + json_object_string_addf( + json_lsa, "route", "%pFX", &p); json_object_int_add( json_lsa, "tag", (unsigned long)ntohl( -- 2.39.5