ospfd: Replace prefix2str for JSON to %pFX

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
This commit is contained in:
Donatas Abraitis 2021-11-25 17:29:30 +02:00
parent 60200fdd9b
commit d63f3ff7cc

View File

@ -5966,7 +5966,6 @@ static int show_lsa_summary(struct vty *vty, struct ospf_lsa *lsa, int self,
struct summary_lsa *sl; struct summary_lsa *sl;
struct as_external_lsa *asel; struct as_external_lsa *asel;
struct prefix_ipv4 p; struct prefix_ipv4 p;
char buf[PREFIX2STR_BUFFER];
if (lsa != NULL) if (lsa != NULL)
/* If self option is set, check LSA self flag. */ /* 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) if (!json_lsa)
vty_out(vty, " %pFX", &p); vty_out(vty, " %pFX", &p);
else { else {
prefix2str(&p, buf, sizeof(buf)); json_object_string_addf(
json_object_string_add(json_lsa, json_lsa, "summaryAddress",
"summaryAddress", "%pFX", &p);
buf);
} }
break; break;
case OSPF_AS_EXTERNAL_LSA: 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( (unsigned long)ntohl(
asel->e[0].route_tag)); asel->e[0].route_tag));
else { else {
prefix2str(&p, buf, sizeof(buf));
json_object_string_add( json_object_string_add(
json_lsa, "metricType", json_lsa, "metricType",
IS_EXTERNAL_METRIC( IS_EXTERNAL_METRIC(
asel->e[0].tos) asel->e[0].tos)
? "E2" ? "E2"
: "E1"); : "E1");
json_object_string_add(json_lsa, json_object_string_addf(
"route", buf); json_lsa, "route", "%pFX", &p);
json_object_int_add( json_object_int_add(
json_lsa, "tag", json_lsa, "tag",
(unsigned long)ntohl( (unsigned long)ntohl(