summaryrefslogtreecommitdiff
path: root/bgpd
diff options
context:
space:
mode:
authorLouis Scalbert <louis.scalbert@6wind.com>2025-02-12 12:50:42 +0100
committerMergify <37929162+mergify[bot]@users.noreply.github.com>2025-02-12 20:10:58 +0000
commit83b859bf469620f116c973e9f38845ba13843b94 (patch)
treeae547239bcbe1874e181ba230067ad4fd36b17a5 /bgpd
parent45e7fc0bedd01bbe4b784d37a90ef28ac4569f2f (diff)
bgpd: fix incorrect json in bgp_show_table_rd
In bgp_show_table_rd(), the is_last argument is determined using the expression "next == NULL" to check if the RD table is the last one. This helps ensure proper JSON formatting. However, if next is not NULL but is no longer associated with a BGP table, the JSON output becomes malformed. Updates the condition to also verify the existence of the next bgp_dest table. Fixes: 1ae44dfcba ("bgpd: unify 'show bgp' with RD with normal unicast bgp show") Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com> (cherry picked from commit cf0269649cdd09b8d3f2dd8815caf6ecf9cdeef9)
Diffstat (limited to 'bgpd')
-rw-r--r--bgpd/bgp_route.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 84f565b4de..1b30487bc3 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -12403,10 +12403,9 @@ int bgp_show_table_rd(struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi,
memcpy(&prd, dest_p, sizeof(struct prefix_rd));
prefix_rd2str(&prd, rd, sizeof(rd), bgp->asnotation);
- bgp_show_table(vty, bgp, afi, safi, itable, type, output_arg,
- rd, next == NULL, &output_cum,
- &total_cum, &json_header_depth,
- show_flags, RPKI_NOT_BEING_USED);
+ bgp_show_table(vty, bgp, afi, safi, itable, type, output_arg, rd,
+ !bgp_dest_get_bgp_table_info(next), &output_cum, &total_cum,
+ &json_header_depth, show_flags, RPKI_NOT_BEING_USED);
if (next == NULL)
show_msg = false;
}