diff options
| author | Donatas Abraitis <donatas@opensourcerouting.org> | 2025-01-09 22:57:51 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-09 22:57:51 +0200 |
| commit | 0b48c8e134c1fd8f54d48f2a75cfb3912ce4b7f6 (patch) | |
| tree | 10a99a85a0168b0fa6edefe9bc9e23661e31c5a5 /lib | |
| parent | 3c3c7fc08d70e6c2af1fa0affc9df3d03ae0ad9c (diff) | |
| parent | 8ccf60921b85893d301186a0f8156fb702da379f (diff) | |
Merge pull request #17807 from louis-6wind/fix-bgp-orf-crash
bgpd: fix crash in displaying json orf prefix-list
Diffstat (limited to 'lib')
| -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 6950ab5761..713eee25ed 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", |
