summaryrefslogtreecommitdiff
path: root/zebra/zebra_vty.c
diff options
context:
space:
mode:
Diffstat (limited to 'zebra/zebra_vty.c')
-rw-r--r--zebra/zebra_vty.c46
1 files changed, 11 insertions, 35 deletions
diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c
index 04581be19b..77a2ce4ae7 100644
--- a/zebra/zebra_vty.c
+++ b/zebra/zebra_vty.c
@@ -342,15 +342,8 @@ static void show_nexthop_detail_helper(struct vty *vty,
}
if ((re->vrf_id != nexthop->vrf_id)
- && (nexthop->type != NEXTHOP_TYPE_BLACKHOLE)) {
- struct vrf *vrf =
- vrf_lookup_by_id(nexthop->vrf_id);
-
- if (vrf)
- vty_out(vty, "(vrf %s)", vrf->name);
- else
- vty_out(vty, "(vrf UNKNOWN)");
- }
+ && (nexthop->type != NEXTHOP_TYPE_BLACKHOLE))
+ vty_out(vty, "(vrf %s)", vrf_id_to_name(nexthop->vrf_id));
if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_DUPLICATE))
vty_out(vty, " (duplicate nexthop removed)");
@@ -548,15 +541,9 @@ static void show_route_nexthop_helper(struct vty *vty,
break;
}
- if ((re == NULL || (nexthop->vrf_id != re->vrf_id)) &&
- (nexthop->type != NEXTHOP_TYPE_BLACKHOLE)) {
- struct vrf *vrf = vrf_lookup_by_id(nexthop->vrf_id);
-
- if (vrf)
- vty_out(vty, " (vrf %s)", vrf->name);
- else
- vty_out(vty, " (vrf UNKNOWN)");
- }
+ if ((re == NULL || (nexthop->vrf_id != re->vrf_id))
+ && (nexthop->type != NEXTHOP_TYPE_BLACKHOLE))
+ vty_out(vty, " (vrf %s)", vrf_id_to_name(nexthop->vrf_id));
if (!CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_ACTIVE))
vty_out(vty, " inactive");
@@ -620,7 +607,6 @@ static void show_nexthop_json_helper(json_object *json_nexthop,
const struct route_entry *re)
{
char buf[SRCDEST2STR_BUFFER];
- struct vrf *vrf = NULL;
json_object *json_labels = NULL;
json_object *json_backups = NULL;
int i;
@@ -714,11 +700,10 @@ static void show_nexthop_json_helper(json_object *json_nexthop,
}
if ((nexthop->vrf_id != re->vrf_id)
- && (nexthop->type != NEXTHOP_TYPE_BLACKHOLE)) {
- vrf = vrf_lookup_by_id(nexthop->vrf_id);
+ && (nexthop->type != NEXTHOP_TYPE_BLACKHOLE))
json_object_string_add(json_nexthop, "vrf",
- vrf->name);
- }
+ vrf_id_to_name(nexthop->vrf_id));
+
if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_DUPLICATE))
json_object_boolean_true_add(json_nexthop,
"duplicate");
@@ -813,7 +798,6 @@ static void vty_show_ip_route(struct vty *vty, struct route_node *rn,
json_object *json_nexthop = NULL;
json_object *json_route = NULL;
time_t uptime;
- const struct vrf *vrf = NULL;
const rib_dest_t *dest = rib_dest_from_rnode(rn);
const struct nexthop_group *nhg;
char up_str[MONOTIME_STRLEN];
@@ -848,11 +832,10 @@ static void vty_show_ip_route(struct vty *vty, struct route_node *rn,
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);
-
+ vrf_id_to_name(re->vrf_id));
}
+
if (CHECK_FLAG(re->flags, ZEBRA_FLAG_SELECTED))
json_object_boolean_true_add(json_route, "selected");
@@ -1302,18 +1285,11 @@ static void show_nexthop_group_out(struct vty *vty, struct nhg_hash_entry *nhe)
{
struct nexthop *nexthop = NULL;
struct nhg_connected *rb_node_dep = NULL;
- struct vrf *nhe_vrf = vrf_lookup_by_id(nhe->vrf_id);
struct nexthop_group *backup_nhg;
vty_out(vty, "ID: %u\n", nhe->id);
vty_out(vty, " RefCnt: %d\n", nhe->refcnt);
-
- if (nhe_vrf)
- vty_out(vty, " VRF: %s AFI: %s\n", nhe_vrf->name,
- afi2str(nhe->afi));
- else
- vty_out(vty, " VRF: UNKNOWN AFI: %s\n",
- afi2str(nhe->afi));
+ vty_out(vty, " VRF: %s\n", vrf_id_to_name(nhe->vrf_id));
if (CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_UNHASHABLE))
vty_out(vty, " Duplicate - from kernel not hashable\n");