]> git.proxmox.com Git - mirror_frr.git/blobdiff - bgpd/bgp_route.c
Merge pull request #2240 from donaldsharp/ubuntu_bull
[mirror_frr.git] / bgpd / bgp_route.c
index fd5648ac3982a159b6bf3515077bfe1d3cfed092..7bfeee9669a00e37fe1dd6dd228c9f1c9eca3c61 100644 (file)
@@ -225,6 +225,11 @@ struct bgp_info *bgp_info_lock(struct bgp_info *binfo)
 
 struct bgp_info *bgp_info_unlock(struct bgp_info *binfo)
 {
+       /* unlink reference to parent, if any. */
+       if (binfo->extra && binfo->extra->parent) {
+               bgp_info_unlock((struct bgp_info *)binfo->extra->parent);
+               binfo->extra->parent = NULL;
+       }
        assert(binfo && binfo->lock > 0);
        binfo->lock--;
 
@@ -6504,7 +6509,7 @@ void route_vty_out(struct vty *vty, struct prefix *p, struct bgp_info *binfo,
                                ? true
                                : false;
        bool nexthop_othervrf = false;
-       vrf_id_t nexthop_vrfid;
+       vrf_id_t nexthop_vrfid = VRF_DEFAULT;
        const char *nexthop_vrfname = "Default";
 
        if (json_paths)
@@ -7409,7 +7414,6 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p,
        json_object *json_cluster_list = NULL;
        json_object *json_cluster_list_list = NULL;
        json_object *json_ext_community = NULL;
-       json_object *json_lcommunity = NULL;
        json_object *json_last_update = NULL;
        json_object *json_pmsi = NULL;
        json_object *json_nexthop_global = NULL;
@@ -8036,13 +8040,12 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p,
                /* Line 6 display Large community */
                if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_LARGE_COMMUNITIES)) {
                        if (json_paths) {
-                               json_lcommunity = json_object_new_object();
-                               json_object_string_add(json_lcommunity,
-                                                      "string",
-                                                      attr->lcommunity->str);
+                               if (!attr->lcommunity->json)
+                                       lcommunity_str(attr->lcommunity, true);
+                               json_object_lock(attr->lcommunity->json);
                                json_object_object_add(json_path,
                                                       "largeCommunity",
-                                                      json_lcommunity);
+                                                      attr->lcommunity->json);
                        } else {
                                vty_out(vty, "      Large Community: %s\n",
                                        attr->lcommunity->str);