]> git.proxmox.com Git - mirror_frr.git/commitdiff
zebra: Added vrfname to route prefix dictionary
authorKishore Aramalla <karamalla@vmware.com>
Thu, 19 Sep 2019 21:28:11 +0000 (14:28 -0700)
committerKishore Aramalla <karamalla@vmware.com>
Thu, 19 Sep 2019 21:28:11 +0000 (14:28 -0700)
Route prefix dictionary contains vrf ID only.
Added vrfName to the route prefix dictionary.

Signed-off-by: Kishore Aramalla <karamalla@vmware.com>
zebra/zebra_vty.c

index 7984481093c45e5f01eb34a47304584f42c08ffb..15f0398ca468712071e1c0e545048d1a8c1aca24 100644 (file)
@@ -394,6 +394,7 @@ static void vty_show_ip_route(struct vty *vty, struct route_node *rn,
        json_object *json_labels = NULL;
        time_t uptime;
        struct tm *tm;
+       struct vrf *vrf = NULL;
        rib_dest_t *dest = rib_dest_from_rnode(rn);
        struct nexthop_group *nhg;
 
@@ -422,9 +423,13 @@ static void vty_show_ip_route(struct vty *vty, struct route_node *rn,
                        json_object_int_add(json_route, "instance",
                                            re->instance);
 
-               if (re->vrf_id)
+               if (re->vrf_id) {
                        json_object_int_add(json_route, "vrfId", re->vrf_id);
+                       vrf = vrf_lookup_by_id(re->vrf_id);
+                       json_object_string_add(json_route, "vrfName",
+                                              vrf->name);
 
+               }
                if (CHECK_FLAG(re->flags, ZEBRA_FLAG_SELECTED))
                        json_object_boolean_true_add(json_route, "selected");
 
@@ -565,9 +570,7 @@ static void vty_show_ip_route(struct vty *vty, struct route_node *rn,
 
                        if ((nexthop->vrf_id != re->vrf_id)
                             && (nexthop->type != NEXTHOP_TYPE_BLACKHOLE)) {
-                               struct vrf *vrf =
-                                       vrf_lookup_by_id(nexthop->vrf_id);
-
+                               vrf = vrf_lookup_by_id(nexthop->vrf_id);
                                json_object_string_add(json_nexthop, "vrf",
                                                       vrf->name);
                        }