diff options
| author | Donatas Abraitis <donatas@opensourcerouting.org> | 2025-01-10 11:46:01 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-10 11:46:01 +0200 |
| commit | 8aca554935c374e909a44af060f84346942214ef (patch) | |
| tree | f29b8257ec94392db751a1520803bcd8e7711efc | |
| parent | 13d21fd38ec3a9dad2b1a36488ee0539ec854268 (diff) | |
| parent | ac7db8ff709bb2c7e1dd7c26d5f9a97bdf737181 (diff) | |
Merge pull request #17818 from FRRouting/mergify/bp/stable/9.1/pr-17807
bgpd: fix crash in displaying json orf prefix-list (backport #17807)
| -rw-r--r-- | lib/plist.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/plist.c b/lib/plist.c index 5f52e27d18..a5ddc91bae 100644 --- a/lib/plist.c +++ b/lib/plist.c @@ -1536,7 +1536,6 @@ int prefix_bgp_show_prefix_list(struct vty *vty, afi_t afi, char *name, if (use_json) { json = json_object_new_object(); json_prefix = json_object_new_object(); - json_list = json_object_new_object(); json_object_int_add(json_prefix, "prefixListCounter", plist->count); @@ -1544,10 +1543,7 @@ int prefix_bgp_show_prefix_list(struct vty *vty, afi_t afi, char *name, plist->name); for (pentry = plist->head; pentry; pentry = pentry->next) { - struct prefix *p = &pentry->prefix; - char buf_a[BUFSIZ]; - - snprintf(buf_a, sizeof(buf_a), "%pFX", p); + json_list = json_object_new_object(); json_object_int_add(json_list, "seq", pentry->seq); json_object_string_add(json_list, "seqPrefixListType", @@ -1560,7 +1556,7 @@ int prefix_bgp_show_prefix_list(struct vty *vty, afi_t afi, char *name, json_object_int_add(json_list, "le", pentry->le); - json_object_object_add(json_prefix, buf_a, json_list); + json_object_object_addf(json_prefix, json_list, "%pFX", &pentry->prefix); } if (afi == AFI_IP) json_object_object_add(json, "ipPrefixList", |
