]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: fix route-distinguisher in vrf leak json cmd 17997/head
authorChirag Shah <chirag@nvidia.com>
Mon, 3 Feb 2025 20:00:41 +0000 (12:00 -0800)
committerMergify <37929162+mergify[bot]@users.noreply.github.com>
Tue, 4 Feb 2025 12:41:05 +0000 (12:41 +0000)
For auto configured value RD value comes as NULL,
switching back to original change will ensure to cover
for both auto and user configured RD value in JSON.

tor-11# show bgp vrf blue ipv4 unicast route-leak json
{
  "vrf":"blue",
  "afiSafi":"ipv4Unicast",
  "importFromVrfs":[
    "purple"
  ],
  "importRts":"10.10.3.11:6",
  "exportToVrfs":[
    "purple"
  ],
  "routeDistinguisher":"(null)", <<<<<
  "exportRts":"10.10.3.11:10"
}

Signed-off-by: Chirag Shah <chirag@nvidia.com>
(cherry picked from commit 892704d07f5286464728720648ad392b485a9966)

bgpd/bgp_vty.c

index 8d8471cf2e25ce5d77770714f461a3ceafb48181..264b5e2cf5e2fcb4d8b28b1ef9c7011a0b108c7c 100644 (file)
@@ -16629,9 +16629,9 @@ static int bgp_show_route_leak_vty(struct vty *vty, const char *name,
                                                json_object_new_string(vname));
                        json_object_object_add(json, "exportToVrfs",
                                               json_export_vrfs);
-                       json_object_string_addf(
-                               json, "routeDistinguisher", "%s",
-                               bgp->vpn_policy[afi].tovpn_rd_pretty);
+                       json_object_string_addf(json, "routeDistinguisher",
+                                               BGP_RD_AS_FORMAT(bgp->asnotation),
+                                               &bgp->vpn_policy[afi].tovpn_rd);
                        dir = BGP_VPN_POLICY_DIR_TOVPN;
                        if (bgp->vpn_policy[afi].rtlist[dir]) {
                                ecom_str = ecommunity_ecom2str(