]> git.puffer.fish Git - matthieu/frr.git/commitdiff
ospfd: Replace prefix2str for JSON to %pFX
authorDonatas Abraitis <donatas.abraitis@gmail.com>
Thu, 25 Nov 2021 15:29:30 +0000 (17:29 +0200)
committerDonatas Abraitis <donatas.abraitis@gmail.com>
Thu, 25 Nov 2021 15:30:21 +0000 (17:30 +0200)
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
ospfd/ospf_vty.c

index 84469160d3aa7eba45d58e0cb34ea1f0216ad78f..24ea76438574b8981f21bfe75d665c41327878de 100644 (file)
@@ -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(