diff options
| author | Igor Ryzhov <iryzhov@nfware.com> | 2021-11-26 17:23:45 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-11-26 17:23:45 +0300 |
| commit | e44c9059e0ac1a6966f14b7fc3ae789554792a46 (patch) | |
| tree | 054f2cc6be827661c8e47814fd05be5bdd88810d /zebra/interface.c | |
| parent | 4f037a39f2f32fb557b8da2bfac7853308782de6 (diff) | |
| parent | 746a6eda2f9d6c774d7c96f4e663148f8579776b (diff) | |
Merge pull request #10125 from ton31337/feature/replace_prefix_to_json_object_string_addf
*: Replace prefix2str for JSON to %pFX
Diffstat (limited to 'zebra/interface.c')
| -rw-r--r-- | zebra/interface.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/zebra/interface.c b/zebra/interface.c index d300397b4e..6ad6e4e3f6 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -1310,7 +1310,6 @@ static void connected_dump_vty(struct vty *vty, json_object *json, { struct prefix *p; json_object *json_addr = NULL; - char buf[PREFIX2STR_BUFFER]; /* Print interface address. */ p = connected->address; @@ -1318,8 +1317,7 @@ static void connected_dump_vty(struct vty *vty, json_object *json, if (json) { json_addr = json_object_new_object(); json_object_array_add(json, json_addr); - json_object_string_add(json_addr, "address", - prefix2str(p, buf, sizeof(buf))); + json_object_string_addf(json_addr, "address", "%pFX", p); } else { vty_out(vty, " %s %pFX", prefix_family_str(p), p); } @@ -1327,10 +1325,8 @@ static void connected_dump_vty(struct vty *vty, json_object *json, /* If there is destination address, print it. */ if (CONNECTED_PEER(connected) && connected->destination) { if (json) { - json_object_string_add( - json_addr, "peer", - prefix2str(connected->destination, buf, - sizeof(buf))); + json_object_string_addf(json_addr, "peer", "%pFX", + connected->destination); } else { vty_out(vty, " peer %pFX", connected->destination); } |
