Skip to content

Commit

Permalink
Merge pull request #17815 from FRRouting/mergify/bp/stable/10.2/pr-17807
Browse files Browse the repository at this point in the history
bgpd: fix crash in displaying json orf prefix-list (backport #17807)
  • Loading branch information
Jafaral authored Jan 9, 2025
2 parents 3401b88 + fc34397 commit f3ceae9
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions lib/plist.c
Original file line number Diff line number Diff line change
Expand Up @@ -1536,18 +1536,14 @@ 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);
json_object_string_add(json_prefix, "prefixListName",
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",
Expand All @@ -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",
Expand Down

0 comments on commit f3ceae9

Please sign in to comment.